diff --git a/ChangeLog b/ChangeLog index e8e509c80f3..799cca598c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,78 @@ +2010-07-12 Andreas Schwab + + * configure.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS) + (PROFILING_LDFLAGS): Substitute, don't add them to CFLAGS/LDFLAGS. + (C_OPTIMIZE_SWITCH): Remove. + (TEMACS_LDFLAGS2): Add ${PROFILING_LDFLAGS}. + +2010-07-11 Andreas Schwab + + * configure.in: Don't check for index and rindex, check for strchr + and strrchr. Define strchr and strrchr as index and rindex, + resp., in src/config.h if not available. + +2010-07-08 Dan Nicolaescu + + * configure.in: Use -Wold-style-definition if available. + This helps with the transition to standard C code, it can be + removed when done. + + * configure.in (PRE_EDIT_LDFLAGS, POST_EDIT_LDFLAGS): Remove. + + * configure.in (UNEXEC_OBJ): Add comment about values for MSDOS + and MSWindows. + +2010-07-07 Andreas Schwab + + * configure.in: Don't check for bcopy, bcmp, bzero. Don't include + and don't define bcopy, bzero, BCMP in config.h. + +2010-07-07 Dan Nicolaescu + + * configure.in (getenv): Remove K&R declaration. + +2010-07-02 Jan Djärv + + * configure.in: Remove define __P. + +2010-07-02 Dan Nicolaescu + + * configure.in (--enable-use-lisp-union-type): New flag. + +2010-06-30 Dan Nicolaescu + + Fix CFLAGS for non-GCC compilers. + * configure.in (CFLAGS): Always use -g like it was done before the + 2010-03-30 change. + (REAL_CFLAGS): Use CFLAGS for non-GCC to get optimization flags. + (Bug#6538) + +2010-06-30 Glenn Morris + + * configure.in (HAVE_SOUND, HAVE_X_I18N, HAVE_X11R6_XIM): + Set with AC_DEFINE rather than AH_BOTTOM. + + * configure.in (C_OPTIMIZE_SWITCH, CANNOT_DUMP, SYSTEM_MALLOC): + (USE_MMAP_FOR_BUFFERS, C_WARNING_SWITCH, CFLAGS, REAL_CFLAGS): + Set with shell, not cpp. + (LIBX): Remove, just use -lX11 in the one place this was used. + (cannot_dump): Replace with CANNOT_DUMP. + +2010-06-28 Jan Djärv + + * configure.in: Add --with-x-toolkit=gtk3. Remove HAVE_GTK_MULTIDISPLAY, + check for gtk_file_chooser_dialog_new, and HAVE_GTK_FILE_BOTH (implied + by minimum required Gtk+ 2.6). Add checks for functions introduced + in Gtk+ 2.14 or newer (bug#6505). + +2010-06-26 Eli Zaretskii + + * config.bat: Remove white space around "+" in COPY commands. + +2010-06-23 Glenn Morris + + * info/dir: Start descriptions in column 32, per Texinfo convention. + 2010-06-16 Chong Yidong * INSTALL: Update font information (Bug#6389). @@ -8,8 +83,7 @@ 2010-06-12 Glenn Morris - * Makefile.in (install-arch-indep): Delete any old info .gz files - first. + * Makefile.in (install-arch-indep): Delete any old info .gz files first. 2010-06-11 Glenn Morris @@ -435,7 +509,7 @@ * configure.in: Remove support for old UNIX System V systems and for Unixware on non-x86 machines. - * configure.in: Remove support for Solaris on PPC and for old versions. + * configure.in: Remove support for Solaris on PPC and for old versions. * configure.in: Remove non-working lynxos port. diff --git a/INSTALL b/INSTALL index 382b794a473..5f4b9e54d05 100644 --- a/INSTALL +++ b/INSTALL @@ -105,8 +105,7 @@ sections if you need to. Note that the install automatically saves space by compressing (provided you have the `gzip' program) those installed Lisp source (.el) - files that have corresponding .elc versions. You may also wish - to compress the installed Info files. + files that have corresponding .elc versions, as well as the Info files. ADDITIONAL DISTRIBUTION FILES diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES index 4425b79edeb..b647370a781 100644 --- a/admin/CPP-DEFINES +++ b/admin/CPP-DEFINES @@ -60,10 +60,8 @@ NARROWPROTO SEPCHAR SIGTYPE SYSTEM_TYPE -USE_MMAP_FOR_BUFFERS ** Machine specific macros, decribed in detail in src/m/template.h -CANNOT_DUMP EXPLICIT_SIGN_EXTEND LOAD_AVE_CVT LOAD_AVE_TYPE @@ -81,8 +79,6 @@ USER_FULL_NAME If defined, overrides the default pw->pw_gecos for getting at t AIX AMPERSAND_FULL_NAME -BCOPY_DOWNWARD_SAFE -BCOPY_UPWARD_SAFE BITS_PER_EMACS_INT BITS_PER_LONG BITS_PER_CHAR @@ -120,7 +116,6 @@ EMACS_UINT FILE_SYSTEM_CASE FLOAT_CHECK_DOMAIN FSCALE -GAP_USE_BCOPY GC_LISP_OBJECT_ALIGNMENT GC_MARK_SECONDARY_STACK GC_MARK_STACK @@ -130,8 +125,6 @@ GNU_LIBRARY_PENDING_OUTPUT_COUNT GNU_LINUX GNU_MALLOC HAVE_AIX_SMT_EXP -HAVE_BCMP -HAVE_BCOPY HAVE_CBRT HAVE_CLOSEDIR HAVE_DUP2 @@ -150,7 +143,6 @@ HAVE_GETPT HAVE_GETTIMEOFDAY HAVE_GETWD HAVE_H_ERRNO -HAVE_INDEX HAVE_INET_SOCKETS HAVE_INVERSE_HYPERBOLIC HAVE_LIBKSTAT @@ -169,7 +161,6 @@ HAVE_PWD_H HAVE_RANDOM HAVE_RENAME HAVE_RES_INIT -HAVE_RINDEX HAVE_RINT HAVE_RMDIR HAVE_SELECT @@ -193,7 +184,6 @@ HAVE_SYS_TIMEB_H HAVE_SYS_TIME_H HAVE_TCATTR HAVE_TERMIOS_H -HAVE_TEXT_START HAVE_TIMEVAL HAVE_TM_ZONE HAVE_TZSET @@ -205,7 +195,6 @@ HAVE_WINDOW_SYSTEM HAVE_WORKING_VFORK HAVE_XRMSETDATABASE HPUX -INHIBIT_X11R6_XIM INTERNAL_TERMINAL IS_ANY_SEP IS_DIRECTORY_SEP @@ -270,7 +259,6 @@ SYSV_SYSTEM_DIR TAB3 TABDLY TERM -TEXT_START THIS_IS_CONFIGURE TIME_WITH_SYS_TIME TIOCSIGSEND @@ -322,10 +310,7 @@ _start abort access alloca -bcmp -bcopy brk -bzero calloc chdir chmod diff --git a/admin/ChangeLog b/admin/ChangeLog index 2b73c72f20e..7a3104c9c40 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,17 @@ +2010-07-11 Andreas Schwab + + * CPP-DEFINES (HAVE_INDEX, HAVE_RINDEX): Remove. + +2010-07-08 Eli Zaretskii + + * MAINTAINERS: Update my responsibilities. + +2010-07-07 Andreas Schwab + + * CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE) + (GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero): + Remove. + 2010-06-12 Eli Zaretskii * unidata/bidimirror.awk: New file. diff --git a/admin/MAINTAINERS b/admin/MAINTAINERS index 0e8c9b32325..ee51e162b3b 100644 --- a/admin/MAINTAINERS +++ b/admin/MAINTAINERS @@ -23,6 +23,11 @@ Jason Rumney W32 Eli Zaretskii + + src/bidi.c + bidirectional editing support in xdisp.c and elsewhere + lisp/term/tty-colors.el + The MS-DOS (a.k.a. DJGPP) port: config.bat msdos/* @@ -35,11 +40,7 @@ Eli Zaretskii lisp/dos-fns.el lisp/dos-w32.el lisp/dos-vars.el - - lisp/term/tty-colors.el - lisp/international/codepage.el - - doc/emacs/msdog.texi + doc/emacs/msdog.texi Kenichi Handa Mule @@ -91,6 +92,7 @@ Eli Zaretskii info/dir src/xfaces.c + src/xdisp.c src/term.c src/frame.c src/dired.c diff --git a/config.bat b/config.bat index a37a7a70085..aac4e108b09 100644 --- a/config.bat +++ b/config.bat @@ -191,7 +191,7 @@ if exist dir.h ren dir.h vmsdir.h rem Create "makefile" from "makefile.in". rm -f Makefile makefile.tmp -copy Makefile.in + deps.mk makefile.tmp +copy Makefile.in+deps.mk makefile.tmp sed -f ../msdos/sed1v2.inp Makefile rm -f makefile.tmp diff --git a/configure b/configure index 3ced885c3f7..693e404bba7 100755 --- a/configure +++ b/configure @@ -1,11 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for emacs 24.0.50. +# Generated by GNU Autoconf 2.66 for emacs 24.0.50. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -316,7 +316,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -356,19 +356,19 @@ else fi # as_fn_arith -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -530,7 +530,7 @@ test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -600,8 +600,6 @@ TOOLTIP_SUPPORT MOUSE_SUPPORT LIB_GCC LINKER -POST_EDIT_LDFLAGS -PRE_EDIT_LDFLAGS LD_SWITCH_SYSTEM_TEMACS POST_ALLOC_OBJ PRE_ALLOC_OBJ @@ -718,7 +716,7 @@ C_SWITCH_SYSTEM UNEXEC_OBJ C_SWITCH_MACHINE LD_SWITCH_SYSTEM -cannot_dump +CANNOT_DUMP MAKEINFO GZIP_PROG INSTALL_INFO @@ -726,6 +724,7 @@ RANLIB INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM +C_WARNINGS_SWITCH EGREP GREP CPP @@ -744,7 +743,10 @@ build_os build_vendor build_cpu build +PROFILING_LDFLAGS +PROFILING_CFLAGS MAINT +GZIP_INFO target_alias host_alias build_alias @@ -815,6 +817,7 @@ with_dbus with_gconf with_selinux with_makeinfo +with_compress_info with_pkg_config_prog with_crt_dir with_gnustep_conf @@ -823,6 +826,7 @@ enable_asserts enable_maintainer_mode enable_locallisppath enable_checking +enable_use_lisp_union_type enable_profiling enable_autodepend enable_largefile @@ -946,7 +950,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -972,7 +976,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1176,7 +1180,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1192,7 +1196,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1222,8 +1226,8 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information." + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) @@ -1231,7 +1235,7 @@ Try \`$0 --help' for more information." # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error "invalid variable name: \`$ac_envvar'" ;; + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1249,13 +1253,13 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error "missing argument to $ac_option" + as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1278,7 +1282,7 @@ do [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1292,8 +1296,8 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1308,9 +1312,9 @@ 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_fn_error "working directory cannot be determined" + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error "pwd does not report name of working directory" + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. @@ -1349,11 +1353,11 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1393,7 +1397,7 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files @@ -1475,6 +1479,10 @@ Optional Features: only specific categories of checks. Categories are: all,yes,no. Flags are: stringbytes, stringoverrun, stringfreelist, xmallocoverrun, conslist + --enable-use-lisp-union-type + use a union for the Lisp_Object data type. This is + only useful for development for catching certain + types of bugs. --enable-profiling build emacs with profiling support. This might not work on all platforms --enable-autodepend automatically generate dependencies to .h-files. @@ -1495,8 +1503,8 @@ Optional Packages: string giving default POP mail host --without-sound don't compile with sound support --without-sync-input process async input synchronously - --with-x-toolkit=KIT use an X toolkit (KIT one of: yes or gtk, lucid or - athena, motif, no) + --with-x-toolkit=KIT use an X toolkit (KIT one of: yes or gtk, gtk3, + lucid or athena, motif, no) --without-xpm don't compile with XPM image support --without-jpeg don't compile with JPEG image support --without-tiff don't compile with TIFF image support @@ -1517,6 +1525,7 @@ Optional Packages: --without-gconf don't compile with GConf support --without-selinux don't compile with SELinux support --without-makeinfo don't require makeinfo for building manuals + --without-compress-info don't compress the installed Info pages --with-pkg-config-prog=PATH path to pkg-config for finding GTK and librsvg --with-crt-dir=DIR directory containing crtn.o etc. The default is @@ -1604,9 +1613,9 @@ 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.65 +generated by GNU Autoconf 2.66 -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1746,10 +1755,10 @@ fi ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1812,7 +1821,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1876,7 +1885,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1898,15 +1907,18 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_header_compile -# ac_fn_c_check_decl LINENO SYMBOL VAR -# ------------------------------------ -# Tests whether SYMBOL is declared, setting cache variable VAR accordingly. +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5 -$as_echo_n "checking whether $2 is declared... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1915,8 +1927,12 @@ $4 int main () { -#ifndef $2 - (void) $2; +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif #endif ; @@ -1945,7 +1961,7 @@ ac_fn_c_check_header_preproc () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1975,7 +1991,7 @@ ac_fn_c_check_member () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } -if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$4+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2031,7 +2047,7 @@ ac_fn_c_check_func () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2099,7 +2115,7 @@ ac_fn_c_check_type () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -2148,7 +2164,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.65. Invocation command line was +generated by GNU Autoconf 2.66. Invocation command line was $ $0 $@ @@ -2258,11 +2274,9 @@ trap 'exit_status=$? { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( @@ -2296,11 +2310,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do @@ -2313,11 +2325,9 @@ _ASBOX echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## -## ------------------- ## -_ASBOX +## ------------------- ##" echo for ac_var in $ac_subst_files do @@ -2331,11 +2341,9 @@ _ASBOX fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo cat confdefs.h echo @@ -2390,7 +2398,12 @@ _ACEOF ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site @@ -2405,7 +2418,11 @@ do { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -2486,7 +2503,7 @@ if $ac_cache_corrupted; then $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$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_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2658,10 +2675,11 @@ if test "${with_x_toolkit+set}" = set; then : a | at | ath | athe | athen | athena ) val=athena ;; m | mo | mot | moti | motif ) val=motif ;; g | gt | gtk ) val=gtk ;; + gtk3 ) val=gtk3 ;; * ) -as_fn_error "\`--with-x-toolkit=$withval' is invalid; -this option's value should be \`yes', \`no', \`lucid', \`athena', \`motif' or \`gtk'. -\`yes' and \`gtk' are synonyms. \`athena' and \`lucid' are synonyms." "$LINENO" 5 +as_fn_error $? "\`--with-x-toolkit=$withval' is invalid; +this option's value should be \`yes', \`no', \`lucid', \`athena', \`motif', \`gtk' or +\`gtk3'. \`yes' and \`gtk' are synonyms. \`athena' and \`lucid' are synonyms." "$LINENO" 5 ;; esac with_x_toolkit=$val @@ -2820,6 +2838,23 @@ else fi +## This is an option because I do not know if all info/man support +## compressed files, nor how to test if they do so. + +# Check whether --with-compress-info was given. +if test "${with_compress_info+set}" = set; then : + withval=$with_compress_info; +else + with_compress_info=yes +fi + +if test $with_compress_info = yes; then + GZIP_INFO=yes +else + GZIP_INFO= +fi + + # Check whether --with-pkg-config-prog was given. if test "${with_pkg_config_prog+set}" = set; then : @@ -2921,7 +2956,7 @@ do stringfreelist) ac_gc_check_string_free_list=1 ;; xmallocoverrun) ac_xmalloc_overrun=1 ;; conslist) ac_gc_check_cons_list=1 ;; - *) as_fn_error "unknown check category $check" "$LINENO" 5 ;; + *) as_fn_error $? "unknown check category $check" "$LINENO" 5 ;; esac done IFS="$ac_save_IFS" @@ -2957,6 +2992,17 @@ $as_echo "#define GC_CHECK_CONS_LIST 1" >>confdefs.h fi +# Check whether --enable-use-lisp-union-type was given. +if test "${enable_use_lisp_union_type+set}" = set; then : + enableval=$enable_use_lisp_union_type; if test "${enableval}" != "no"; then + +$as_echo "#define USE_LISP_UNION_TYPE 1" >>confdefs.h + +fi +fi + + + # Check whether --enable-profiling was given. if test "${enable_profiling+set}" = set; then : enableval=$enable_profiling; ac_enable_profiling="${enableval}" @@ -2970,6 +3016,8 @@ else PROFILING_LDFLAGS= fi + + # Check whether --enable-autodepend was given. if test "${enable_autodepend+set}" = set; then : enableval=$enable_autodepend; ac_enable_autodepend="${enableval}" @@ -3026,16 +3074,22 @@ fi ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - for ac_t in install-sh install.sh shtool; do - if test -f "$ac_dir/$ac_t"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/$ac_t -c" - break 2 - fi - done + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi done if test -z "$ac_aux_dir"; then - as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -3049,7 +3103,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } @@ -3060,16 +3114,16 @@ else test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && - as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -3094,7 +3148,7 @@ else ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi @@ -3102,7 +3156,7 @@ fi $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -3396,7 +3450,7 @@ fi if test $unported = yes; then - as_fn_error "Emacs hasn't been ported to \`${canonical}' systems. + as_fn_error $? "Emacs hasn't been ported to \`${canonical}' systems. Check \`etc/MACHINES' for recognized configuration names." "$LINENO" 5 fi @@ -3710,8 +3764,8 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3825,9 +3879,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3869,8 +3922,8 @@ done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3927,9 +3980,9 @@ $as_echo "$ac_try_echo"; } >&5 else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. +as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi @@ -3980,8 +4033,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -4265,16 +4318,6 @@ then CC="$NON_GNU_CC" fi -if test x$GCC = xyes && test "x$GCC_TEST_OPTIONS" != x -then - CC="$CC $GCC_TEST_OPTIONS" -fi - -if test x$GCC = x && test "x$NON_GCC_TEST_OPTIONS" != x -then - CC="$CC $NON_GCC_TEST_OPTIONS" -fi - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4402,8 +4445,8 @@ if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -4464,7 +4507,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then - as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP @@ -4530,7 +4573,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP @@ -4662,8 +4705,7 @@ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -4797,6 +4839,40 @@ CFLAGS="$SAVE_CFLAGS" unset has_option unset SAVE_CFLAGS +### Use -Wold-style-definition if the compiler supports it +# This can be removed when conversion to standard C is finished. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc understands -Wold-style-definition" >&5 +$as_echo_n "checking whether gcc understands -Wold-style-definition... " >&6; } +SAVE_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -Wold-style-definition" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + has_option=yes +else + has_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +if test $has_option = yes; then + C_WARNINGS_SWITCH="-Wold-style-definition $C_WARNINGS_SWITCH" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_option" >&5 +$as_echo "$has_option" >&6; } +CFLAGS="$SAVE_CFLAGS" +unset has_option +unset SAVE_CFLAGS + + + #### Some other nice autoconf tests. ac_ext=c @@ -4926,8 +5002,8 @@ if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -5364,7 +5440,7 @@ if test "$MAKEINFO" = "no"; then if test "x${with_makeinfo}" = "xno"; then MAKEINFO=off elif test ! -e $srcdir/info/emacs; then - as_fn_error "You do not seem to have makeinfo >= 4.6, and your + as_fn_error $? "You do not seem to have makeinfo >= 4.6, and your source tree does not seem to have pre-built manuals in the \`info' directory. Either install a suitable version of makeinfo, or re-run configure with the \`--without-makeinfo' option to build without the manuals. " "$LINENO" 5 @@ -5407,107 +5483,28 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -#### Extract some information from the operating system and machine files. - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the machine- and system-dependent files to find out - - which libraries the lib-src programs will want, and - - whether the GNU malloc routines are usable..." >&5 -$as_echo "$as_me: checking the machine- and system-dependent files to find out - - which libraries the lib-src programs will want, and - - whether the GNU malloc routines are usable..." >&6;} - -### First figure out CFLAGS (which we use for running the compiler here) -### and REAL_CFLAGS (which we use for real compilation). -### The two are the same except on a few systems, where they are made -### different to work around various lossages. For example, -### GCC 2.5 on GNU/Linux needs them to be different because it treats -g -### as implying static linking. - -### If the CFLAGS env var is specified, we use that value -### instead of the default. - -### It's not important that this name contain the PID; you can't run -### two configures in the same directory and have anything work -### anyway. -tempcname="conftest.c" - -echo ' -#include "'${srcdir}'/src/'${opsysfile}'" -#include "'${srcdir}'/src/'${machfile}'" - -configure___ LIBX=-lX11 - -#ifdef CANNOT_DUMP -configure___ cannot_dump=yes -#else -configure___ cannot_dump=no -#endif - -#ifdef SYSTEM_MALLOC -configure___ system_malloc=yes -#else -configure___ system_malloc=no -#endif - -#ifdef USE_MMAP_FOR_BUFFERS -configure___ use_mmap_for_buffers=yes -#else -configure___ use_mmap_for_buffers=no -#endif - -#ifndef C_OPTIMIZE_SWITCH -#ifdef __GNUC__ -#define C_OPTIMIZE_SWITCH -O2 -#else -#define C_OPTIMIZE_SWITCH -O -#endif -#endif - -#ifndef C_WARNINGS_SWITCH -#define C_WARNINGS_SWITCH ${C_WARNINGS_SWITCH} -#endif - -#ifdef THIS_IS_CONFIGURE - -/* Get the CFLAGS for tests in configure. */ -#ifdef __GNUC__ -configure___ CFLAGS=-g C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}' -#else -configure___ CFLAGS='${SPECIFIED_CFLAGS}' -#endif - -#else /* not THIS_IS_CONFIGURE */ - -/* Get the CFLAGS for real compilation. */ -#ifdef __GNUC__ -configure___ REAL_CFLAGS=-g C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}' -#else -configure___ REAL_CFLAGS='${SPECIFIED_CFLAGS}' -#endif - -#endif /* not THIS_IS_CONFIGURE */ -' > ${tempcname} - -LDFLAGS="${LDFLAGS} ${PROFILING_LDFLAGS}" # The value of CPP is a quoted variable reference, so we need to do this # to get its actual value... CPP=`eval "echo $CPP"` -eval `${CPP} -Isrc ${tempcname} \ - | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'` -if test "x$SPECIFIED_CFLAGS" = x; then - eval `${CPP} -Isrc -DTHIS_IS_CONFIGURE ${tempcname} \ - | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'` -else - REAL_CFLAGS="$CFLAGS" -fi -rm ${tempcname} +CANNOT_DUMP=no +case "$opsys" in + your-opsys-here) + CANNOT_DUMP=yes + +$as_echo "#define CANNOT_DUMP 1" >>confdefs.h + + ;; +esac + UNEXEC_OBJ=unexelf.o case "$opsys" in + # MSDOS uses unexec.o + # MSWindows uses unexw32.o aix4-2) UNEXEC_OBJ=unexaix.o ;; @@ -5597,7 +5594,7 @@ fi if test "x$GCC" = "xyes"; then C_SWITCH_MACHINE="-fno-common" else - as_fn_error "What gives? Fix me if DEC Unix supports ELF now." "$LINENO" 5 + as_fn_error $? "What gives? Fix me if DEC Unix supports ELF now." "$LINENO" 5 fi else UNEXEC_OBJ=unexalpha.o @@ -5875,7 +5872,7 @@ else ## Some platforms don't use any of these files, so it is not ## appropriate to put this test outside the if block. test -e $CRT_DIR/crtn.o || test -e $CRT_DIR/crt0.o || \ - as_fn_error "crt*.o not found in specified location." "$LINENO" 5 + as_fn_error $? "crt*.o not found in specified location." "$LINENO" 5 fi @@ -5930,12 +5927,11 @@ if test "${with_sound}" != "no"; then do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - + have_sound_header=yes fi done @@ -6122,7 +6118,7 @@ else fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "$emacs_alsa_subdir" != yes; then - as_fn_error "pkg-config found alsa, but it does not compile. See config.log for error messages." "$LINENO" 5 + as_fn_error $? "pkg-config found alsa, but it does not compile. See config.log for error messages." "$LINENO" 5 fi ALSA_CFLAGS="$ALSA_CFLAGS -DALSA_SUBDIR_INCLUDE" fi @@ -6136,6 +6132,17 @@ $as_echo "#define HAVE_ALSA 1" >>confdefs.h fi + if test x$have_sound_header = xyes || test $HAVE_ALSA = yes; then + case "$opsys" in + gnu-linux|freebsd|netbsd) + +$as_echo "#define HAVE_SOUND 1" >>confdefs.h + + ;; + esac + fi + + fi for ac_header in sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \ @@ -6146,8 +6153,7 @@ for ac_header in sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -6989,7 +6995,7 @@ fi $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -6997,7 +7003,7 @@ SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; @@ -7133,7 +7139,7 @@ if test "x$with_x" = xno; then have_x=disabled else case $x_includes,$x_libraries in #( - *\'*) as_fn_error "cannot use X directory names containing '" "$LINENO" 5;; #( + *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -7151,7 +7157,7 @@ libdir: @echo libdir='${LIBDIR}' _ACEOF if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then - # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. for ac_var in incroot usrlibdir libdir; do eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" done @@ -7387,7 +7393,7 @@ tmp_CPPFLAGS="$CPPFLAGS" tmp_CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS -x objective-c" CFLAGS="$CFLAGS -x objective-c" -TEMACS_LDFLAGS2="\${LDFLAGS}" +TEMACS_LDFLAGS2="\${LDFLAGS} \${PROFILING_LDFLAGS}" if test "${with_ns}" != no; then if test "${opsys}" = darwin; then NS_IMPL_COCOA=yes @@ -7411,7 +7417,6 @@ if test "${with_ns}" != no; then GNUSTEP_LOCAL_LIBRARIES="-L${GNUSTEP_LOCAL_LIBRARIES}" CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}" CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}" - REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}" LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}" LIB_STANDARD= START_FILES= @@ -7421,7 +7426,7 @@ if test "${with_ns}" != no; then if test "x$ac_cv_header_AppKit_AppKit_h" = x""yes; then : HAVE_NS=yes else - as_fn_error "\`--with-ns' was specified, but the include + as_fn_error $? "\`--with-ns' was specified, but the include files are missing or cannot be compiled." "$LINENO" 5 fi @@ -7482,6 +7487,8 @@ case "${window_system}" in motif ) USE_X_TOOLKIT=MOTIF ;; gtk ) with_gtk=yes USE_X_TOOLKIT=none ;; + gtk3 ) with_gtk3=yes + USE_X_TOOLKIT=none ;; no ) USE_X_TOOLKIT=none ;; * ) USE_X_TOOLKIT=maybe ;; esac @@ -7535,7 +7542,7 @@ fi if test "$HAVE_XSERVER" = true || test -n "$DISPLAY" || test "`echo /usr/lib/libX11.*`" != "/usr/lib/libX11.*"; then - as_fn_error "You seem to be running X, but no X development libraries + as_fn_error $? "You seem to be running X, but no X development libraries were found. You should install the relevant development files for X and for the toolkit you want, such as Gtk+, Lesstif or Motif. Also make sure you have development files for image handling, i.e. @@ -7600,7 +7607,17 @@ if test $emacs_cv_var___after_morecore_hook = no; then doug_lea_malloc=no fi + +system_malloc=no +case "$opsys" in + ## darwin ld insists on the use of malloc routines in the System framework. + darwin|sol2-10) system_malloc=yes ;; +esac + if test "${system_malloc}" = "yes"; then + +$as_echo "#define SYSTEM_MALLOC 1" >>confdefs.h + GNU_MALLOC=no GNU_MALLOC_reason=" (The GNU allocators don't work with this system configuration.)" @@ -7635,6 +7652,10 @@ if test x"${REL_ALLOC}" = x; then REL_ALLOC=${GNU_MALLOC} fi +use_mmap_for_buffers=no +case "$opsys" in + freebsd|irix6-5) use_mmap_for_buffers=yes ;; +esac @@ -7644,8 +7665,7 @@ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -7751,6 +7771,7 @@ int main () { char *data, *data2, *data3; + const char *cdata2; int i, pagesize; int fd, fd2; @@ -7775,10 +7796,10 @@ main () fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); if (fd2 < 0) return 4; - data2 = ""; - if (write (fd2, data2, 1) != 1) + cdata2 = ""; + if (write (fd2, cdata2, 1) != 1) return 5; - data2 = mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); + data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); if (data2 == MAP_FAILED) return 6; for (i = 0; i < pagesize; ++i) @@ -7838,6 +7859,9 @@ fi rm -f conftest.mmap conftest.txt if test $use_mmap_for_buffers = yes; then + +$as_echo "#define USE_MMAP_FOR_BUFFERS 1" >>confdefs.h + REL_ALLOC=no fi @@ -8026,12 +8050,13 @@ esac # used for the tests that follow. We set them back to REAL_CFLAGS and # REAL_CPPFLAGS later on. +REAL_CFLAGS="$CFLAGS" REAL_CPPFLAGS="$CPPFLAGS" if test "${HAVE_X11}" = "yes"; then DEFS="$C_SWITCH_X_SITE $DEFS" LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE" - LIBS="$LIBX $LIBS" + LIBS="-lX11 $LIBS" CFLAGS="$C_SWITCH_X_SITE $CFLAGS" CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS" @@ -8147,8 +8172,7 @@ XScreenNumberOfScreen XSetWMProtocols 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 : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -8193,6 +8217,18 @@ $as_echo "6 or newer" >&6; } $as_echo "#define HAVE_X11R6 1" >>confdefs.h + +$as_echo "#define HAVE_X_I18N 1" >>confdefs.h + + ## inoue@ainet.or.jp says Solaris has a bug related to X11R6-style + ## XIM support. + case "$opsys" in + sol2-*) : ;; + *) +$as_echo "#define HAVE_X11R6_XIM 1" >>confdefs.h + + ;; + esac else { $as_echo "$as_me:${as_lineno-$LINENO}: result: before 6" >&5 $as_echo "before 6" >&6; } @@ -8317,6 +8353,112 @@ fi HAVE_GTK=no +if test "${with_gtk3}" = "yes"; then + GLIB_REQUIRED=2.6 + GTK_REQUIRED=2.90 + GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_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:${as_lineno-$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:${as_lineno-$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:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + if test "$PKG_CONFIG" = "no" ; then + pkg_check_gtk=no + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $GTK_MODULES" >&5 +$as_echo_n "checking for $GTK_MODULES... " >&6; } + + if $PKG_CONFIG --exists "$GTK_MODULES" 2>&5; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + succeeded=yes + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking GTK_CFLAGS" >&5 +$as_echo_n "checking GTK_CFLAGS... " >&6; } + GTK_CFLAGS=`$PKG_CONFIG --cflags "$GTK_MODULES"|sed -e 's,///*,/,g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTK_CFLAGS" >&5 +$as_echo "$GTK_CFLAGS" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking GTK_LIBS" >&5 +$as_echo_n "checking GTK_LIBS... " >&6; } + GTK_LIBS=`$PKG_CONFIG --libs "$GTK_MODULES"|sed -e 's,///*,/,g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTK_LIBS" >&5 +$as_echo "$GTK_LIBS" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + GTK_CFLAGS="" + GTK_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + GTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$GTK_MODULES"` + + 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 + pkg_check_gtk=yes + else + pkg_check_gtk=no + fi + + if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then + as_fn_error $? "$GTK_PKG_ERRORS" "$LINENO" 5 + fi +fi + +if test "$pkg_check_gtk" != "yes"; then + HAVE_GTK=no if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then GLIB_REQUIRED=2.6 GTK_REQUIRED=2.6 @@ -8417,10 +8559,10 @@ $as_echo "no" >&6; } fi if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then - as_fn_error "$GTK_PKG_ERRORS" "$LINENO" 5 + as_fn_error $? "$GTK_PKG_ERRORS" "$LINENO" 5 fi fi - +fi GTK_OBJ= if test x"$pkg_check_gtk" = xyes; then @@ -8444,7 +8586,7 @@ done if test "${GTK_COMPILES}" != "yes"; then if test "$USE_X_TOOLKIT" != "maybe"; then - as_fn_error "Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?" "$LINENO" 5; + as_fn_error $? "Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?" "$LINENO" 5; fi else HAVE_GTK=yes @@ -8476,24 +8618,6 @@ if test "${HAVE_GTK}" = "yes"; then if test "$with_toolkit_scroll_bars" != no; then with_toolkit_scroll_bars=yes - fi - - HAVE_GTK_MULTIDISPLAY=no - for ac_func in gdk_display_open -do : - ac_fn_c_check_func "$LINENO" "gdk_display_open" "ac_cv_func_gdk_display_open" -if test "x$ac_cv_func_gdk_display_open" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GDK_DISPLAY_OPEN 1 -_ACEOF - HAVE_GTK_MULTIDISPLAY=yes -fi -done - - if test "${HAVE_GTK_MULTIDISPLAY}" = "yes"; then - -$as_echo "#define HAVE_GTK_MULTIDISPLAY 1" >>confdefs.h - fi HAVE_GTK_FILE_SELECTION=no @@ -8514,49 +8638,13 @@ if test "x$ac_cv_func_gtk_file_selection_new" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GTK_FILE_SELECTION_NEW 1 _ACEOF - HAVE_GTK_FILE_SELECTION=yes -else - HAVE_GTK_FILE_SELECTION=no + fi done fi - HAVE_GTK_FILE_CHOOSER=no - ac_fn_c_check_decl "$LINENO" "GTK_TYPE_FILE_CHOOSER" "ac_cv_have_decl_GTK_TYPE_FILE_CHOOSER" "$ac_includes_default -#include -" -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 -fi - - if test "$HAVE_GTK_FILE_CHOOSER" = yes; then - for ac_func in gtk_file_chooser_dialog_new -do : - ac_fn_c_check_func "$LINENO" "gtk_file_chooser_dialog_new" "ac_cv_func_gtk_file_chooser_dialog_new" -if test "x$ac_cv_func_gtk_file_chooser_dialog_new" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GTK_FILE_CHOOSER_DIALOG_NEW 1 -_ACEOF - HAVE_GTK_FILE_CHOOSER=yes -else - HAVE_GTK_FILE_CHOOSER=no -fi -done - - fi - - if test "$HAVE_GTK_FILE_SELECTION" = yes \ - && test "$HAVE_GTK_FILE_CHOOSER" = yes; then - -$as_echo "#define HAVE_GTK_FILE_BOTH 1" >>confdefs.h - - fi - - if test "$HAVE_GTK_FILE_CHOOSER" = yes; then - HAVE_GTK_AND_PTHREAD=no + HAVE_GTK_AND_PTHREAD=no for ac_header in pthread.h do : ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" @@ -8620,7 +8708,23 @@ fi $as_echo "#define HAVE_GTK_AND_PTHREAD 1" >>confdefs.h fi - fi + + for ac_func in gtk_widget_get_window gtk_widget_set_has_window \ + gtk_dialog_get_action_area gtk_widget_get_sensitive \ + gtk_widget_get_mapped gtk_adjustment_get_page_size \ + gtk_orientable_set_orientation +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" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + fi HAVE_DBUS=no @@ -8977,7 +9081,7 @@ $as_echo "yes; using Lucid toolkit" >&6; } USE_X_TOOLKIT=LUCID LUCID_LIBW=-lXaw elif test x"${USE_X_TOOLKIT}" = xLUCID; then - as_fn_error "Lucid toolkit requires X11/Xaw include files" "$LINENO" 5 + as_fn_error $? "Lucid toolkit requires X11/Xaw include files" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no; do not use toolkit by default" >&5 $as_echo "no; do not use toolkit by default" >&6; } @@ -10154,8 +10258,7 @@ if test "${HAVE_X11}" = "yes"; then do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -10407,7 +10510,7 @@ if test "${HAVE_X11}" = "yes"; then MISSING="$MISSING libtiff" && WITH_NO="$WITH_NO --with-tiff=no" if test "X${MISSING}" != X; then - as_fn_error "The following required libraries were not found: + as_fn_error $? "The following required libraries were not found: $MISSING Maybe some development libraries/packages are missing? If you don't want to link with them give @@ -10742,8 +10845,7 @@ if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; 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 : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func @@ -10807,7 +10909,7 @@ fi if test x"$ac_cv_func_alloca_works" != xyes; then - as_fn_error "a system implementation of alloca is required " "$LINENO" 5 + as_fn_error $? "a system implementation of alloca is required " "$LINENO" 5 fi # fmod, logb, and frexp are found in -lm on most systems. @@ -11003,7 +11105,7 @@ fi if test $ac_cv_prog_liblockfile = yes; then - as_fn_error "Shared liblockfile found but can't link against it. + as_fn_error $? "Shared liblockfile found but can't link against it. This probably means that movemail could lose mail. There may be a \`development' package to install containing liblockfile." "$LINENO" 5 fi @@ -11081,19 +11183,18 @@ esac for ac_func in gethostname getdomainname dup2 \ rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \ -random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \ +random lrand48 logb frexp fmod rint cbrt ftime setsid \ strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \ utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \ -__fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \ +__fpending mblen mbrlen mbsinit strsignal setitimer ualarm strchr strrchr \ sendto recvfrom getsockopt setsockopt getsockname getpeername \ -gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \ +gai_strerror mkstemp getline getdelim mremap memmove fsync sync \ memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \ cfmakeraw cfsetspeed isnan copysign 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 : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -11124,8 +11225,7 @@ done 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 : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -11177,8 +11277,8 @@ static time_t time_t_max; static time_t time_t_min; /* Values we'll use to set the TZ environment variable. */ -static char *tz_strings[] = { - (char *) 0, "TZ=GMT0", "TZ=JST-9", +static const char *tz_strings[] = { + (const char *) 0, "TZ=GMT0", "TZ=JST-9", "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00" }; #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) @@ -11195,7 +11295,7 @@ spring_forward_gap () instead of "TZ=America/Vancouver" in order to detect the bug even on systems that don't support the Olson extension, or don't have the full zoneinfo tables installed. */ - putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); + putenv ((char*) "TZ=PST8PDT,M4.1.0,M10.5.0"); tm.tm_year = 98; tm.tm_mon = 3; @@ -11208,16 +11308,14 @@ spring_forward_gap () } static int -mktime_test1 (now) - time_t now; +mktime_test1 (time_t now) { struct tm *lt; return ! (lt = localtime (&now)) || mktime (lt) == now; } static int -mktime_test (now) - time_t now; +mktime_test (time_t now) { return (mktime_test1 (now) && mktime_test1 ((time_t) (time_t_max - now)) @@ -11241,8 +11339,7 @@ irix_6_4_bug () } static int -bigtime_test (j) - int j; +bigtime_test (int j) { struct tm tm; time_t now; @@ -11286,7 +11383,7 @@ year_2050_test () instead of "TZ=America/Vancouver" in order to detect the bug even on systems that don't support the Olson extension, or don't have the full zoneinfo tables installed. */ - putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); + putenv ((char*) "TZ=PST8PDT,M4.1.0,M10.5.0"); t = mktime (&tm); @@ -11321,7 +11418,7 @@ main () for (i = 0; i < N_STRINGS; i++) { if (tz_strings[i]) - putenv (tz_strings[i]); + putenv ((char*) tz_strings[i]); for (t = 0; t <= time_t_max - delta; t += delta) if (! mktime_test (t)) @@ -11373,7 +11470,7 @@ ac_have_func=no # yes means we've found a way to get the load average. # Make sure getloadavg.c is where it belongs, at configure-time. test -f "$srcdir/$ac_config_libobj_dir/getloadavg.c" || - as_fn_error "$srcdir/$ac_config_libobj_dir/getloadavg.c is missing" "$LINENO" 5 + as_fn_error $? "$srcdir/$ac_config_libobj_dir/getloadavg.c is missing" "$LINENO" 5 ac_save_LIBS=$LIBS @@ -12242,7 +12339,7 @@ else fi if test "$have_tputs_et_al" != true; then - as_fn_error "I couldn't find termcap functions (tputs and friends). + as_fn_error $? "I couldn't find termcap functions (tputs and friends). Maybe some development libraries/packages are missing? Try installing libncurses-dev(el), libterminfo-dev(el) or similar." "$LINENO" 5 fi @@ -13389,8 +13486,7 @@ for ac_func in fork vfork 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 : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -13764,14 +13860,14 @@ if test "x$GCC" = xyes \ && test x"`$CC --version 2> /dev/null | grep 'gcc.* 4.5.0'`" != x \ && test x"`echo $CFLAGS | grep '\-O[23]'`" != x \ && test x"`echo $CFLAGS | grep '\-fno-optimize-sibling-calls'`" = x; then - as_fn_error "GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'." "$LINENO" 5 + as_fn_error $? "GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'." "$LINENO" 5 fi #### Find out which version of Emacs this is. version=`grep 'const char emacs_version' ${srcdir}/src/emacs.c \ | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'` if test x"${version}" = x; then - as_fn_error "can't find current emacs version in \`${srcdir}/src/emacs.c'." "$LINENO" 5 + as_fn_error $? "can't find current emacs version in \`${srcdir}/src/emacs.c'." "$LINENO" 5 fi if test x"${version}" != x"$PACKAGE_VERSION"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: version mismatch between \`${srcdir}/configure.in' and \`${srcdir}/src/emacs.c'." >&5 @@ -14074,8 +14170,6 @@ case "$opsys" in esac -PRE_EDIT_LDFLAGS= -POST_EDIT_LDFLAGS= if test "x$ORDINARY_LINK" = "xyes"; then LINKER="\$(CC)" @@ -14096,18 +14190,8 @@ elif test "x$GCC" = "xyes" && test "x$LINKER" = "x"; then ## searching for libraries in its internal directories, so we have to ## ask GCC explicitly where to find libgcc.a (LIB_GCC below). LINKER="\$(CC) -nostdlib" - ## GCC passes any argument prefixed with -Xlinker directly to the linker. - ## See prefix-args.c for an explanation of why we do not do this with the - ## shell''s ``for'' construct. Note that sane people do not have '.' in - ## their paths, so we must use ./prefix-args. - ## TODO either make prefix-args check ORDINARY_LINK internally, - ## or remove it altogether (bug#6184), removing the need for this hack. - PRE_EDIT_LDFLAGS='`./prefix-args -Xlinker' - POST_EDIT_LDFLAGS='`' fi - - test "x$LINKER" = "x" && LINKER=ld ## FIXME? What setting of EDIT_LDFLAGS should this have? test "$NS_IMPL_GNUSTEP" = "yes" && LINKER="\$(CC) -rdynamic" @@ -14344,6 +14428,7 @@ DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' @@ -14505,19 +14590,19 @@ export LANGUAGE (unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -14713,7 +14798,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -14767,7 +14852,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=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.65. Invocation command line was +generated by GNU Autoconf 2.66. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -14833,10 +14918,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ emacs config.status 24.0.50 -configured by $0, generated by GNU Autoconf 2.65, +configured by $0, generated by GNU Autoconf 2.66, with options \\"\$ac_cs_config\\" -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -14890,7 +14975,7 @@ do ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - as_fn_error "ambiguous option: \`$1' + as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; @@ -14899,7 +14984,7 @@ Try \`$0 --help' for more information.";; ac_cs_silent=: ;; # This is an error. - -*) as_fn_error "unrecognized option: \`$1' + -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" @@ -14967,7 +15052,7 @@ do "leim/Makefile") CONFIG_FILES="$CONFIG_FILES leim/Makefile" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; - *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -15005,7 +15090,7 @@ $debug || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -15039,7 +15124,7 @@ if test "x$ac_cr" = x; then fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' + ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi @@ -15056,7 +15141,7 @@ _ACEOF echo "_ACEOF" } >conf$$files.sh && . ./conf$$files.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 rm -f conf$$files.sh { @@ -15064,18 +15149,18 @@ rm -f conf$$files.sh echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 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_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -15170,20 +15255,28 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error "could not setup config files machinery" "$LINENO" 5 + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// s/^[^=]*=[ ]*$// }' fi @@ -15211,7 +15304,7 @@ for ac_last_try in false false :; do if test -z "$ac_t"; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -15296,7 +15389,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error "could not setup config headers machinery" "$LINENO" 5 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" @@ -15309,7 +15402,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -15337,7 +15430,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -15364,7 +15457,7 @@ $as_echo "$as_me: creating $ac_file" >&6;} case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -15500,22 +15593,22 @@ if $ac_cs_awk_getline; then else $AWK -f "$tmp/subs.awk" | $SHELL fi >$tmp/out \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 +which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} +which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # @@ -15526,19 +15619,19 @@ which seems to be undefined. Please make sure it is defined." >&2;} $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error "could not create -" "$LINENO" 5 + || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; @@ -15575,7 +15668,7 @@ _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. @@ -15596,7 +15689,7 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit $? + $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 diff --git a/configure.in b/configure.in index eeb94c6ee2d..ed229916eb8 100644 --- a/configure.in +++ b/configure.in @@ -129,7 +129,7 @@ dnl This should be the last --with option, because --with-x is dnl added later on when we find the path of X, and it's best to dnl keep them together visually. AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT], - [use an X toolkit (KIT one of: yes or gtk, lucid or athena, motif, no)])], + [use an X toolkit (KIT one of: yes or gtk, gtk3, lucid or athena, motif, no)])], [ case "${withval}" in y | ye | yes ) val=gtk ;; n | no ) val=no ;; @@ -137,10 +137,11 @@ AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT], a | at | ath | athe | athen | athena ) val=athena ;; m | mo | mot | moti | motif ) val=motif ;; g | gt | gtk ) val=gtk ;; + gtk3 ) val=gtk3 ;; * ) AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid; -this option's value should be `yes', `no', `lucid', `athena', `motif' or `gtk'. -`yes' and `gtk' are synonyms. `athena' and `lucid' are synonyms.]) +this option's value should be `yes', `no', `lucid', `athena', `motif', `gtk' or +`gtk3'. `yes' and `gtk' are synonyms. `athena' and `lucid' are synonyms.]) ;; esac with_x_toolkit=$val @@ -304,6 +305,16 @@ if test x$ac_gc_check_cons_list != x ; then [Define this to check for errors in cons list.]) fi +AC_ARG_ENABLE(use-lisp-union-type, +[AS_HELP_STRING([--enable-use-lisp-union-type], + [use a union for the Lisp_Object data type. + This is only useful for development for catching certain types of bugs.])], +if test "${enableval}" != "no"; then + AC_DEFINE(USE_LISP_UNION_TYPE, 1, + [Define this to use a lisp union for the Lisp_Object data type.]) +fi) + + AC_ARG_ENABLE(profiling, [AS_HELP_STRING([--enable-profiling], [build emacs with profiling support. @@ -316,6 +327,8 @@ else PROFILING_CFLAGS= PROFILING_LDFLAGS= fi +AC_SUBST(PROFILING_CFLAGS) +AC_SUBST(PROFILING_LDFLAGS) AC_ARG_ENABLE(autodepend, [AS_HELP_STRING([--enable-autodepend], @@ -709,16 +722,6 @@ then CC="$NON_GNU_CC" fi -if test x$GCC = xyes && test "x$GCC_TEST_OPTIONS" != x -then - CC="$CC $GCC_TEST_OPTIONS" -fi - -if test x$GCC = x && test "x$NON_GCC_TEST_OPTIONS" != x -then - CC="$CC $NON_GCC_TEST_OPTIONS" -fi - dnl checks for Unix variants AC_USE_SYSTEM_EXTENSIONS @@ -748,6 +751,22 @@ CFLAGS="$SAVE_CFLAGS" unset has_option unset SAVE_CFLAGS +### Use -Wold-style-definition if the compiler supports it +# This can be removed when conversion to standard C is finished. +AC_MSG_CHECKING([whether gcc understands -Wold-style-definition]) +SAVE_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -Wold-style-definition" +AC_TRY_COMPILE([], [], has_option=yes, has_option=no,) +if test $has_option = yes; then + C_WARNINGS_SWITCH="-Wold-style-definition $C_WARNINGS_SWITCH" +fi +AC_MSG_RESULT($has_option) +CFLAGS="$SAVE_CFLAGS" +unset has_option +unset SAVE_CFLAGS +AC_SUBST(C_WARNINGS_SWITCH) + + #### Some other nice autoconf tests. dnl checks for programs @@ -837,104 +856,29 @@ AC_LINK_IFELSE([main(){return 0;}], LDFLAGS=$late_LDFLAGS [AC_MSG_RESULT(no)]) -#### Extract some information from the operating system and machine files. - -AC_CHECKING([the machine- and system-dependent files to find out - - which libraries the lib-src programs will want, and - - whether the GNU malloc routines are usable]) - -### First figure out CFLAGS (which we use for running the compiler here) -### and REAL_CFLAGS (which we use for real compilation). -### The two are the same except on a few systems, where they are made -### different to work around various lossages. For example, -### GCC 2.5 on GNU/Linux needs them to be different because it treats -g -### as implying static linking. - -### If the CFLAGS env var is specified, we use that value -### instead of the default. - -### It's not important that this name contain the PID; you can't run -### two configures in the same directory and have anything work -### anyway. -tempcname="conftest.c" - -echo ' -#include "'${srcdir}'/src/'${opsysfile}'" -#include "'${srcdir}'/src/'${machfile}'" - -configure___ LIBX=-lX11 - -#ifdef CANNOT_DUMP -configure___ cannot_dump=yes -#else -configure___ cannot_dump=no -#endif - -#ifdef SYSTEM_MALLOC -configure___ system_malloc=yes -#else -configure___ system_malloc=no -#endif - -#ifdef USE_MMAP_FOR_BUFFERS -configure___ use_mmap_for_buffers=yes -#else -configure___ use_mmap_for_buffers=no -#endif - -#ifndef C_OPTIMIZE_SWITCH -#ifdef __GNUC__ -#define C_OPTIMIZE_SWITCH -O2 -#else -#define C_OPTIMIZE_SWITCH -O -#endif -#endif - -#ifndef C_WARNINGS_SWITCH -#define C_WARNINGS_SWITCH ${C_WARNINGS_SWITCH} -#endif - -#ifdef THIS_IS_CONFIGURE - -/* Get the CFLAGS for tests in configure. */ -#ifdef __GNUC__ -configure___ CFLAGS=-g C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}' -#else -configure___ CFLAGS='${SPECIFIED_CFLAGS}' -#endif - -#else /* not THIS_IS_CONFIGURE */ - -/* Get the CFLAGS for real compilation. */ -#ifdef __GNUC__ -configure___ REAL_CFLAGS=-g C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}' -#else -configure___ REAL_CFLAGS='${SPECIFIED_CFLAGS}' -#endif - -#endif /* not THIS_IS_CONFIGURE */ -' > ${tempcname} - -LDFLAGS="${LDFLAGS} ${PROFILING_LDFLAGS}" # The value of CPP is a quoted variable reference, so we need to do this # to get its actual value... CPP=`eval "echo $CPP"` -[eval `${CPP} -Isrc ${tempcname} \ - | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'` -if test "x$SPECIFIED_CFLAGS" = x; then - eval `${CPP} -Isrc -DTHIS_IS_CONFIGURE ${tempcname} \ - | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'` -else - REAL_CFLAGS="$CFLAGS" -fi] -rm ${tempcname} -AC_SUBST(cannot_dump) +dnl Not used by any currently supported platform. +dnl The function dump-emacs will not be defined and temacs will do +dnl (load "loadup") automatically unless told otherwise. +CANNOT_DUMP=no +case "$opsys" in + your-opsys-here) + CANNOT_DUMP=yes + AC_DEFINE(CANNOT_DUMP, 1, [Define if Emacs cannot be dumped on your system.]) + ;; +esac +AC_SUBST(CANNOT_DUMP) + UNEXEC_OBJ=unexelf.o case "$opsys" in + # MSDOS uses unexec.o + # MSWindows uses unexw32.o aix4-2) UNEXEC_OBJ=unexaix.o ;; @@ -1205,7 +1149,8 @@ AC_DEFUN([PKG_CHECK_MODULES], [ if test "${with_sound}" != "no"; then # Sound support for GNU/Linux and the free BSDs. - AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h soundcard.h) + AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h soundcard.h, + have_sound_header=yes) # Emulation library used on NetBSD. AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBSOUND=-lossaudio, LIBSOUND=) AC_SUBST(LIBSOUND) @@ -1238,6 +1183,19 @@ if test "${with_sound}" != "no"; then CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS" AC_DEFINE(HAVE_ALSA, 1, [Define to 1 if ALSA is available.]) fi + + dnl Define HAVE_SOUND if we have sound support. We know it works and + dnl compiles only on the specified platforms. For others, it + dnl probably doesn't make sense to try. + if test x$have_sound_header = xyes || test $HAVE_ALSA = yes; then + case "$opsys" in + dnl defined __FreeBSD__ || defined __NetBSD__ || defined __linux__ + gnu-linux|freebsd|netbsd) + AC_DEFINE(HAVE_SOUND, 1, [Define to 1 if you have sound support.]) + ;; + esac + fi + AC_SUBST(CFLAGS_SOUND) fi @@ -1511,7 +1469,7 @@ tmp_CPPFLAGS="$CPPFLAGS" tmp_CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS -x objective-c" CFLAGS="$CFLAGS -x objective-c" -TEMACS_LDFLAGS2="\${LDFLAGS}" +TEMACS_LDFLAGS2="\${LDFLAGS} \${PROFILING_LDFLAGS}" dnl I don't think it's especially important, but src/Makefile.in dnl (now the only user of ns_appdir) used to go to the trouble of adding a dnl trailing "/" to it, so now we do it here. @@ -1540,7 +1498,6 @@ if test "${with_ns}" != no; then GNUSTEP_LOCAL_LIBRARIES="-L${GNUSTEP_LOCAL_LIBRARIES}" CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}" CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}" - REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}" LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}" LIB_STANDARD= START_FILES= @@ -1594,6 +1551,8 @@ case "${window_system}" in dnl Dont set this for GTK. A lot of tests below assumes Xt when dnl USE_X_TOOLKIT is set. USE_X_TOOLKIT=none ;; + gtk3 ) with_gtk3=yes + USE_X_TOOLKIT=none ;; no ) USE_X_TOOLKIT=none ;; dnl If user did not say whether to use a toolkit, make this decision later: dnl use the toolkit if we have gtk, or X11R5 or newer. @@ -1644,7 +1603,16 @@ if test $emacs_cv_var___after_morecore_hook = no; then doug_lea_malloc=no fi + +dnl See comments in aix4-2.h about maybe using system malloc there. +system_malloc=no +case "$opsys" in + ## darwin ld insists on the use of malloc routines in the System framework. + darwin|sol2-10) system_malloc=yes ;; +esac + if test "${system_malloc}" = "yes"; then + AC_DEFINE(SYSTEM_MALLOC, 1, [Define to use system malloc.]) GNU_MALLOC=no GNU_MALLOC_reason=" (The GNU allocators don't work with this system configuration.)" @@ -1678,12 +1646,14 @@ if test x"${REL_ALLOC}" = x; then REL_ALLOC=${GNU_MALLOC} fi -dnl For now, need to use an explicit `#define USE_MMAP_FOR_BUFFERS 1' -dnl the system configuration file (s/*.h) to turn the use of mmap -dnl in the relocating allocator on. +use_mmap_for_buffers=no +case "$opsys" in + freebsd|irix6-5) use_mmap_for_buffers=yes ;; +esac AC_FUNC_MMAP if test $use_mmap_for_buffers = yes; then + AC_DEFINE(USE_MMAP_FOR_BUFFERS, 1, [Define to use mmap to allocate buffer text.]) REL_ALLOC=no fi @@ -1733,12 +1703,13 @@ esac # used for the tests that follow. We set them back to REAL_CFLAGS and # REAL_CPPFLAGS later on. +REAL_CFLAGS="$CFLAGS" REAL_CPPFLAGS="$CPPFLAGS" if test "${HAVE_X11}" = "yes"; then DEFS="$C_SWITCH_X_SITE $DEFS" LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE" - LIBS="$LIBX $LIBS" + LIBS="-lX11 $LIBS" CFLAGS="$C_SWITCH_X_SITE $CFLAGS" CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS" @@ -1814,6 +1785,15 @@ fail; AC_MSG_RESULT(6 or newer) AC_DEFINE(HAVE_X11R6, 1, [Define to 1 if you have the X11R6 or newer version of Xlib.]) + AC_DEFINE(HAVE_X_I18N, 1, [Define if you have usable i18n support.]) + ## inoue@ainet.or.jp says Solaris has a bug related to X11R6-style + ## XIM support. + case "$opsys" in + sol2-*) : ;; + *) AC_DEFINE(HAVE_X11R6_XIM, 1, + [Define if you have usable X11R6-style XIM support.]) + ;; + esac else AC_MSG_RESULT(before 6) fi @@ -1842,6 +1822,20 @@ fi HAVE_GTK=no +if test "${with_gtk3}" = "yes"; then + GLIB_REQUIRED=2.6 + GTK_REQUIRED=2.90 + GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED" + + dnl Checks for libraries. + PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no) + if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then + AC_MSG_ERROR($GTK_PKG_ERRORS) + fi +fi + +if test "$pkg_check_gtk" != "yes"; then + HAVE_GTK=no if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then GLIB_REQUIRED=2.6 GTK_REQUIRED=2.6 @@ -1853,7 +1847,7 @@ if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then AC_MSG_ERROR($GTK_PKG_ERRORS) fi fi - +fi GTK_OBJ= if test x"$pkg_check_gtk" = xyes; then @@ -1898,15 +1892,6 @@ if test "${HAVE_GTK}" = "yes"; then with_toolkit_scroll_bars=yes fi - dnl Check if we can use multiple displays with this GTK version. - dnl If gdk_display_open exists, assume all others are there also. - HAVE_GTK_MULTIDISPLAY=no - AC_CHECK_FUNCS(gdk_display_open, HAVE_GTK_MULTIDISPLAY=yes) - if test "${HAVE_GTK_MULTIDISPLAY}" = "yes"; then - AC_DEFINE(HAVE_GTK_MULTIDISPLAY, 1, - [Define to 1 if GTK can handle more than one display.]) - fi - dnl Check if we have the old file selection dialog declared and dnl in the link library. In 2.x it may be in the library, dnl but not declared if deprecated featured has been selected out. @@ -1916,29 +1901,11 @@ if test "${HAVE_GTK}" = "yes"; then HAVE_GTK_FILE_SELECTION=no, [AC_INCLUDES_DEFAULT #include ]) if test "$HAVE_GTK_FILE_SELECTION" = yes; then - AC_CHECK_FUNCS(gtk_file_selection_new, HAVE_GTK_FILE_SELECTION=yes, - HAVE_GTK_FILE_SELECTION=no) - fi - - dnl Check if we have the new file chooser dialog - HAVE_GTK_FILE_CHOOSER=no - AC_CHECK_DECL(GTK_TYPE_FILE_CHOOSER, HAVE_GTK_FILE_CHOOSER=yes, - HAVE_GTK_FILE_CHOOSER=no, [AC_INCLUDES_DEFAULT -#include ]) - if test "$HAVE_GTK_FILE_CHOOSER" = yes; then - AC_CHECK_FUNCS(gtk_file_chooser_dialog_new, HAVE_GTK_FILE_CHOOSER=yes, - HAVE_GTK_FILE_CHOOSER=no) - fi - - if test "$HAVE_GTK_FILE_SELECTION" = yes \ - && test "$HAVE_GTK_FILE_CHOOSER" = yes; then - AC_DEFINE(HAVE_GTK_FILE_BOTH, 1, - [Define to 1 if GTK has both file selection and chooser dialog.]) + AC_CHECK_FUNCS(gtk_file_selection_new) fi dnl Check if pthreads are available. Emacs only needs this when using dnl gtk_file_chooser under Gnome. - if test "$HAVE_GTK_FILE_CHOOSER" = yes; then HAVE_GTK_AND_PTHREAD=no AC_CHECK_HEADERS(pthread.h) if test "$ac_cv_header_pthread_h"; then @@ -1952,7 +1919,13 @@ if test "${HAVE_GTK}" = "yes"; then AC_DEFINE(HAVE_GTK_AND_PTHREAD, 1, [Define to 1 if you have GTK and pthread (-lpthread).]) fi - fi + + dnl Check for functions introduced in 2.14 and later. + AC_CHECK_FUNCS(gtk_widget_get_window gtk_widget_set_has_window \ + gtk_dialog_get_action_area gtk_widget_get_sensitive \ + gtk_widget_get_mapped gtk_adjustment_get_page_size \ + gtk_orientable_set_orientation) + fi dnl D-Bus has been tested under GNU/Linux only. Must be adapted for @@ -2631,12 +2604,12 @@ AC_SUBST(BLESSMAIL_TARGET) AC_CHECK_FUNCS(gethostname getdomainname dup2 \ rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \ -random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \ +random lrand48 logb frexp fmod rint cbrt ftime setsid \ strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \ utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \ -__fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \ +__fpending mblen mbrlen mbsinit strsignal setitimer ualarm strchr strrchr \ sendto recvfrom getsockopt setsockopt getsockname getpeername \ -gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \ +gai_strerror mkstemp getline getdelim mremap memmove fsync sync \ memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \ cfmakeraw cfsetspeed isnan copysign) @@ -3374,8 +3347,6 @@ case "$opsys" in esac -PRE_EDIT_LDFLAGS= -POST_EDIT_LDFLAGS= if test "x$ORDINARY_LINK" = "xyes"; then LINKER="\$(CC)" @@ -3394,17 +3365,7 @@ elif test "x$GCC" = "xyes" && test "x$LINKER" = "x"; then ## searching for libraries in its internal directories, so we have to ## ask GCC explicitly where to find libgcc.a (LIB_GCC below). LINKER="\$(CC) -nostdlib" - ## GCC passes any argument prefixed with -Xlinker directly to the linker. - ## See prefix-args.c for an explanation of why we do not do this with the - ## shell''s ``for'' construct. Note that sane people do not have '.' in - ## their paths, so we must use ./prefix-args. - ## TODO either make prefix-args check ORDINARY_LINK internally, - ## or remove it altogether (bug#6184), removing the need for this hack. - PRE_EDIT_LDFLAGS='`./prefix-args -Xlinker' - POST_EDIT_LDFLAGS='`' fi -AC_SUBST(PRE_EDIT_LDFLAGS) -AC_SUBST(POST_EDIT_LDFLAGS) test "x$LINKER" = "x" && LINKER=ld ## FIXME? What setting of EDIT_LDFLAGS should this have? @@ -3497,25 +3458,6 @@ AH_BOTTOM([ /* Turned on June 1996 supposing nobody will mind it. */ #define AMPERSAND_FULL_NAME -/* Define HAVE_SOUND if we have sound support. We know it works - and compiles only on the specified platforms. For others, - it probably doesn't make sense to try. */ - -#if defined __FreeBSD__ || defined __NetBSD__ || defined __linux__ -#ifdef HAVE_MACHINE_SOUNDCARD_H -#define HAVE_SOUND 1 -#endif -#ifdef HAVE_SYS_SOUNDCARD_H -#define HAVE_SOUND 1 -#endif -#ifdef HAVE_SOUNDCARD_H -#define HAVE_SOUND 1 -#endif -#ifdef HAVE_ALSA -#define HAVE_SOUND 1 -#endif -#endif /* __FreeBSD__ || __NetBSD__ || __linux__ */ - /* If using GNU, then support inline function declarations. */ /* Don't try to switch on inline handling as detected by AC_C_INLINE generally, because even if non-gcc compilers accept `inline', they @@ -3575,11 +3517,6 @@ SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */ #define my_strftime nstrftime /* for strftime.c */ -/* Some of the files of Emacs which are intended for use with other - programs assume that if you have a config.h file, you must declare - the type of getenv. */ -extern char *getenv (); - /* These default definitions are good for almost all machines. The exceptions override them in m/MACHINE.h. */ @@ -3606,27 +3543,14 @@ extern char *getenv (); #endif #endif -/* Define if the compiler supports function prototypes. It may do so - but not define __STDC__ (e.g. DEC C by default) or may define it as - zero. */ +/* Define if the compiler supports function prototypes. It may do so but + not define __STDC__ (e.g. DEC C by default) or may define it as zero. */ #undef PROTOTYPES -/* For mktime.c: */ -#ifndef __P -# if defined PROTOTYPES -# define __P(args) args -# else -# define __P(args) () -# endif /* GCC. */ -#endif /* __P */ #ifdef HAVE_STRING_H #include #endif -#ifdef HAVE_STRINGS_H -#include /* May be needed for bcopy & al. */ -#endif - #ifdef HAVE_STDLIB_H #include #endif @@ -3649,16 +3573,12 @@ void *alloca (size_t); typedef unsigned size_t; #endif -/* Define HAVE_X_I18N if we have usable i18n support. */ - -#ifdef HAVE_X11R6 -#define HAVE_X_I18N +#ifndef HAVE_STRCHR +#define strchr(a, b) index (a, b) #endif -/* Define HAVE_X11R6_XIM if we have usable X11R6-style XIM support. */ - -#if defined HAVE_X11R6 && !defined INHIBIT_X11R6_XIM -#define HAVE_X11R6_XIM +#ifndef HAVE_STRRCHR +#define strrchr(a, b) rindex (a, b) #endif #if defined __GNUC__ && (__GNUC__ > 2 \ @@ -3680,16 +3600,6 @@ typedef unsigned size_t; # endif #endif -#ifndef HAVE_BCOPY -#define bcopy(a,b,s) memcpy (b,a,s) -#endif -#ifndef HAVE_BZERO -#define bzero(a,s) memset (a,0,s) -#endif -#ifndef HAVE_BCMP -#define BCMP memcmp -#endif - #endif /* EMACS_CONFIG_H */ /* diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index e954fe496c4..487663109bd 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,13 @@ +2010-06-23 Glenn Morris + + * abbrevs.texi, basic.texi, buffers.texi, building.texi, calendar.texi: + * custom.texi, dired.texi, display.texi, emacs.texi, emerge-xtra.texi: + * files.texi, fortran-xtra.texi, frames.texi, help.texi, killing.texi: + * maintaining.texi, mark.texi, mini.texi, misc.texi, msdog.texi: + * mule.texi, programs.texi, rmail.texi, screen.texi, search.texi: + * sending.texi, text.texi, trouble.texi, vc1-xtra.texi, xresources.texi: + Untabify Texinfo files. + 2010-06-10 Glenn Morris * basic.texi (Inserting Text): Minor clarification. (Bug#6374) diff --git a/doc/emacs/abbrevs.texi b/doc/emacs/abbrevs.texi index 7a291742386..9039ca662a0 100644 --- a/doc/emacs/abbrevs.texi +++ b/doc/emacs/abbrevs.texi @@ -235,9 +235,9 @@ Edit a list of abbrevs; you can add, alter or remove definitions. @example @var{various other tables@dots{}} (lisp-mode-abbrev-table) -"dk" 0 "define-key" +"dk" 0 "define-key" (global-abbrev-table) -"dfn" 0 "definition" +"dfn" 0 "definition" @end example @noindent diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi index b5a194f1ccf..a4751e7f99d 100644 --- a/doc/emacs/basic.texi +++ b/doc/emacs/basic.texi @@ -17,15 +17,15 @@ suggest you first run the Emacs learn-by-doing tutorial, by typing * Inserting Text:: Inserting text by simply typing it. * Moving Point:: Moving the cursor to the place where you want to - change something. -* Erasing:: Deleting and killing text. -* Basic Undo:: Undoing recent changes in the text. + change something. +* Erasing:: Deleting and killing text. +* Basic Undo:: Undoing recent changes in the text. * Files: Basic Files. Visiting, creating, and saving files. * Help: Basic Help. Asking what a character does. -* Blank Lines:: Making and deleting blank lines. +* Blank Lines:: Making and deleting blank lines. * Continuation Lines:: How Emacs displays lines too wide for the screen. * Position Info:: What page, line, row, or column is point on? -* Arguments:: Numeric arguments for repeating a command N times. +* Arguments:: Numeric arguments for repeating a command N times. * Repeating:: Repeating the previous command quickly. @end menu diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi index 499556401fc..ca9279a9df4 100644 --- a/doc/emacs/buffers.texi +++ b/doc/emacs/buffers.texi @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Buffers, Windows, Files, Top @chapter Using Multiple Buffers @@ -49,10 +50,10 @@ using that data type. For 32-bit machines, the largest buffer size is @menu * Select Buffer:: Creating a new buffer or reselecting an old one. * List Buffers:: Getting a list of buffers that exist. -* Misc Buffer:: Renaming; changing read-onlyness; copying text. -* Kill Buffer:: Killing buffers you no longer need. +* Misc Buffer:: Renaming; changing read-onlyness; copying text. +* Kill Buffer:: Killing buffers you no longer need. * Several Buffers:: How to go through the list of all buffers - and operate variously on several of them. + and operate variously on several of them. * Indirect Buffers:: An indirect buffer shares the text of another buffer. * Buffer Convenience:: Convenience and customization features for buffer handling. diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 9a1ec894815..dca76407e23 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Building, Maintaining, Programs, Top @chapter Compiling and Testing Programs @@ -20,14 +21,14 @@ in the larger process of compiling and testing programs. for use in the compilation buffer. * Grep Searching:: Searching with grep. * Flymake:: Finding syntax errors on the fly. -* Debuggers:: Running symbolic debuggers for non-Lisp programs. +* Debuggers:: Running symbolic debuggers for non-Lisp programs. * Executing Lisp:: Various modes for editing Lisp programs, with different facilities for running the Lisp programs. * Libraries: Lisp Libraries. Creating Lisp programs to run in Emacs. * Eval: Lisp Eval. Executing a single Lisp expression in Emacs. * Interaction: Lisp Interaction. Executing Lisp in an Emacs buffer. -* External Lisp:: Communicating through Emacs with a separate Lisp. +* External Lisp:: Communicating through Emacs with a separate Lisp. @end menu @node Compilation @@ -471,10 +472,10 @@ Lisp programs. @xref{Debugging,, The Lisp Debugger, elisp, the Emacs Lisp Reference Manual}, for information on the Emacs Lisp debugger. @menu -* Starting GUD:: How to start a debugger subprocess. -* Debugger Operation:: Connection between the debugger and source buffers. -* Commands of GUD:: Key bindings for common commands. -* GUD Customization:: Defining your own commands for GUD. +* Starting GUD:: How to start a debugger subprocess. +* Debugger Operation:: Connection between the debugger and source buffers. +* Commands of GUD:: Key bindings for common commands. +* GUD Customization:: Defining your own commands for GUD. * GDB Graphical Interface:: An enhanced mode that uses GDB features to implement a graphical debugging environment through Emacs. diff --git a/doc/emacs/calendar.texi b/doc/emacs/calendar.texi index ae4333cefbb..5698fd5ff58 100644 --- a/doc/emacs/calendar.texi +++ b/doc/emacs/calendar.texi @@ -42,7 +42,7 @@ about more specialized features. * Lunar Phases:: Displaying phases of the moon. * Other Calendars:: Converting dates to other calendar systems. * Diary:: Displaying events from your diary. -* Appointments:: Reminders when it's time to do something. +* Appointments:: Reminders when it's time to do something. * Importing Diary:: Converting diary events to/from other formats. * Daylight Saving:: How to specify when daylight saving time is active. * Time Intervals:: Keeping track of time intervals. @@ -674,11 +674,11 @@ Gregorian calendar did not exist. and from several other calendars. @menu -* Calendar Systems:: The calendars Emacs understands - (aside from Gregorian). -* To Other Calendar:: Converting the selected date to various calendars. -* From Other Calendar:: Moving to a date specified in another calendar. -* Mayan Calendar:: Moving to a date specified in a Mayan calendar. +* Calendar Systems:: The calendars Emacs understands + (aside from Gregorian). +* To Other Calendar:: Converting the selected date to various calendars. +* From Other Calendar:: Moving to a date specified in another calendar. +* Mayan Calendar:: Moving to a date specified in a Mayan calendar. @end menu @node Calendar Systems @@ -1040,8 +1040,8 @@ entries. @menu * Displaying the Diary:: Viewing diary entries and associated calendar dates. * Format of Diary File:: Entering events in your diary. -* Date Formats:: Various ways you can specify dates. -* Adding to Diary:: Commands to create diary entries. +* Date Formats:: Various ways you can specify dates. +* Adding to Diary:: Commands to create diary entries. * Special Diary Entries:: Anniversaries, blocks of dates, cyclic entries, etc. @end menu diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index a8bba419c25..18fdb581210 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -24,18 +24,18 @@ Reference Manual}. @end ifnottex @menu -* Minor Modes:: Each minor mode is a feature you can turn on - independently of any others. +* Minor Modes:: Each minor mode is a feature you can turn on + independently of any others. * Easy Customization:: Convenient way to browse and change settings. -* Variables:: Many Emacs commands examine Emacs variables - to decide what to do; by setting variables, - you can control their functioning. -* Key Bindings:: The keymaps say what command each key runs. - By changing them, you can "redefine keys". -* Syntax:: The syntax table controls how words and - expressions are parsed. -* Init File:: How to write common customizations in the - @file{.emacs} file. +* Variables:: Many Emacs commands examine Emacs variables + to decide what to do; by setting variables, + you can control their functioning. +* Key Bindings:: The keymaps say what command each key runs. + By changing them, you can "redefine keys". +* Syntax:: The syntax table controls how words and + expressions are parsed. +* Init File:: How to write common customizations in the + @file{.emacs} file. @end menu @node Minor Modes @@ -794,10 +794,10 @@ check the variable's documentation string to see kind of value it expects (@pxref{Examining}). @menu -* Examining:: Examining or setting one variable's value. -* Hooks:: Hook variables let you specify programs for parts - of Emacs to run on particular occasions. -* Locals:: Per-buffer values of variables. +* Examining:: Examining or setting one variable's value. +* Hooks:: Hook variables let you specify programs for parts + of Emacs to run on particular occasions. +* Locals:: Per-buffer values of variables. * File Variables:: How files can specify variable values. * Directory Variables:: How variable values can be specified by directory. @end menu @@ -943,12 +943,12 @@ lambda expression. @end group @group (c-cleanup-list . (scope-operator - empty-defun-braces - defun-close-semi)) + empty-defun-braces + defun-close-semi)) @end group @group (c-offsets-alist . ((arglist-close . c-lineup-arglist) - (substatement-open . 0))))) + (substatement-open . 0))))) @end group @group @@ -2175,10 +2175,10 @@ Manual}. @end ifnottex @menu -* Init Syntax:: Syntax of constants in Emacs Lisp. +* Init Syntax:: Syntax of constants in Emacs Lisp. * Init Examples:: How to do some things with an init file. * Terminal Init:: Each terminal type can have an init file. -* Find Init:: How Emacs finds the init file. +* Find Init:: How Emacs finds the init file. * Init Non-ASCII:: Using non-@acronym{ASCII} characters in an init file. @end menu diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi index 4a1299c66a6..c8b4264d486 100644 --- a/doc/emacs/dired.texi +++ b/doc/emacs/dired.texi @@ -36,20 +36,20 @@ you to operate on the listed files. @xref{Directories}. * Deletion: Dired Deletion. Deleting files with Dired. * Flagging Many Files:: Flagging files based on their names. * Visit: Dired Visiting. Other file operations through Dired. -* Marks vs Flags:: Flagging for deletion vs marking. -* Operating on Files:: How to copy, rename, print, compress, etc. - either one file or several files. +* Marks vs Flags:: Flagging for deletion vs marking. +* Operating on Files:: How to copy, rename, print, compress, etc. + either one file or several files. * Shell Commands in Dired:: Running a shell command on the marked files. * Transforming File Names:: Using patterns to rename multiple files. -* Comparison in Dired:: Running `diff' by way of Dired. +* Comparison in Dired:: Running `diff' by way of Dired. * Subdirectories in Dired:: Adding subdirectories to the Dired buffer. @ifnottex * Subdir Switches:: Subdirectory switches in Dired. @end ifnottex -* Subdirectory Motion:: Moving across subdirectories, and up and down. +* Subdirectory Motion:: Moving across subdirectories, and up and down. * Hiding Subdirectories:: Making subdirectories visible or invisible. * Updating: Dired Updating. Discarding lines for files of no interest. -* Find: Dired and Find. Using `find' to choose the files for Dired. +* Find: Dired and Find. Using `find' to choose the files for Dired. * Wdired:: Operating on files by editing the Dired buffer. * Image-Dired:: Viewing image thumbnails in Dired. * Misc: Misc Dired Features. Various other features. diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index 3d3a1e03e46..3b5e7b0b955 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -13,11 +13,11 @@ commands and variables allow you to specify which part of the text you want to see, and how to display it. @menu -* Scrolling:: Commands to move text up and down in a window. +* Scrolling:: Commands to move text up and down in a window. * Auto Scrolling:: Redisplay scrolls text automatically when needed. * Horizontal Scrolling:: Moving text left and right in a window. * Follow Mode:: Follow mode lets two windows scroll as one. -* Faces:: How to change the display style using faces. +* Faces:: How to change the display style using faces. * Standard Faces:: Emacs' predefined faces. * Temporary Face Changes:: Commands to temporarily modify the default text face * Font Lock:: Minor mode for syntactic highlighting using faces. diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 6eaee237510..4de9ee4a57a 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -33,7 +33,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Emacs: (emacs). The extensible self-documenting text editor. +* Emacs: (emacs). The extensible self-documenting text editor. @end direntry @c in general, keep the following line commented out, unless doing a @@ -134,13 +134,13 @@ and Sending Mail and Registers and Minibuffer. @end ignore @menu -* Distrib:: How to get the latest Emacs distribution. -* Intro:: An introduction to Emacs concepts. +* Distrib:: How to get the latest Emacs distribution. +* Intro:: An introduction to Emacs concepts. @c Note that in the printed manual, the glossary and indices come last. -* Glossary:: Terms used in this manual. +* Glossary:: Terms used in this manual. Indexes (each index contains a large menu) -* Key Index:: An item for each standard Emacs key sequence. +* Key Index:: An item for each standard Emacs key sequence. * Option Index:: An item for every command-line option. * Command Index:: An item for each command name. * Variable Index:: An item for each documented variable. @@ -149,100 +149,100 @@ Indexes (each index contains a large menu) * Acknowledgments:: Major contributors to GNU Emacs. Important General Concepts -* Screen:: How to interpret what you see on the screen. -* User Input:: Kinds of input events (characters, buttons, +* Screen:: How to interpret what you see on the screen. +* User Input:: Kinds of input events (characters, buttons, function keys). -* Keys:: Key sequences: what you type to request one +* Keys:: Key sequences: what you type to request one editing action. -* Commands:: Named functions run by key sequences to do editing. +* Commands:: Named functions run by key sequences to do editing. * Entering Emacs:: Starting Emacs from the shell. -* Exiting:: Stopping or killing Emacs. +* Exiting:: Stopping or killing Emacs. Fundamental Editing Commands -* Basic:: The most basic editing commands. -* Minibuffer:: Entering arguments that are prompted for. -* M-x:: Invoking commands by their names. -* Help:: Commands for asking Emacs about its commands. +* Basic:: The most basic editing commands. +* Minibuffer:: Entering arguments that are prompted for. +* M-x:: Invoking commands by their names. +* Help:: Commands for asking Emacs about its commands. Important Text-Changing Commands -* Mark:: The mark: how to delimit a ``region'' of text. -* Killing:: Killing (cutting) text. -* Yanking:: Recovering killed text. Moving text. (Pasting.) +* Mark:: The mark: how to delimit a ``region'' of text. +* Killing:: Killing (cutting) text. +* Yanking:: Recovering killed text. Moving text. (Pasting.) * Accumulating Text:: Other ways of copying text. -* Rectangles:: Operating on the text inside a rectangle on the screen. +* Rectangles:: Operating on the text inside a rectangle on the screen. * CUA Bindings:: Using @kbd{C-x}, @kbd{C-c}, @kbd{C-v} for copy and paste, with enhanced rectangle support. -* Registers:: Saving a text string or a location in the buffer. -* Display:: Controlling what text is displayed. -* Search:: Finding or replacing occurrences of a string. -* Fixit:: Commands especially useful for fixing typos. -* Keyboard Macros:: A keyboard macro records a sequence of - keystrokes to be replayed with a single command. +* Registers:: Saving a text string or a location in the buffer. +* Display:: Controlling what text is displayed. +* Search:: Finding or replacing occurrences of a string. +* Fixit:: Commands especially useful for fixing typos. +* Keyboard Macros:: A keyboard macro records a sequence of + keystrokes to be replayed with a single command. Major Structures of Emacs -* Files:: All about handling files. -* Buffers:: Multiple buffers; editing several files at once. -* Windows:: Viewing two pieces of text at once. -* Frames:: Running the same Emacs session in multiple X windows. +* Files:: All about handling files. +* Buffers:: Multiple buffers; editing several files at once. +* Windows:: Viewing two pieces of text at once. +* Frames:: Running the same Emacs session in multiple X windows. * International:: Using non-@acronym{ASCII} character sets. Advanced Features -* Major Modes:: Text mode vs. Lisp mode vs. C mode... -* Indentation:: Editing the white space at the beginnings of lines. -* Text:: Commands and modes for editing English. -* Programs:: Commands and modes for editing programs. -* Building:: Compiling, running and debugging programs. +* Major Modes:: Text mode vs. Lisp mode vs. C mode... +* Indentation:: Editing the white space at the beginnings of lines. +* Text:: Commands and modes for editing English. +* Programs:: Commands and modes for editing programs. +* Building:: Compiling, running and debugging programs. * Maintaining:: Features for maintaining large programs. -* Abbrevs:: How to define text abbreviations to reduce - the number of characters you must type. +* Abbrevs:: How to define text abbreviations to reduce + the number of characters you must type. @c AFAICS, the tex stuff generates its own index and does not use this one. @ifnottex * Picture Mode:: Editing pictures made up of characters using the quarter-plane screen model. @end ifnottex * Sending Mail:: Sending mail in Emacs. -* Rmail:: Reading mail in Emacs. -* Dired:: You can ``edit'' a directory to manage files in it. +* Rmail:: Reading mail in Emacs. +* Dired:: You can ``edit'' a directory to manage files in it. * Calendar/Diary:: The calendar and diary facilities. * Document View:: Viewing PDF, PS and DVI files. -* Gnus:: How to read netnews with Emacs. -* Shell:: Executing shell commands from Emacs. +* Gnus:: How to read netnews with Emacs. +* Shell:: Executing shell commands from Emacs. * Emacs Server:: Using Emacs as an editing server for @code{mail}, etc. -* Printing:: Printing hardcopies of buffers or regions. -* Sorting:: Sorting lines, paragraphs or pages within Emacs. -* Narrowing:: Restricting display and editing to a portion - of the buffer. -* Two-Column:: Splitting apart columns to edit them - in side-by-side windows. +* Printing:: Printing hardcopies of buffers or regions. +* Sorting:: Sorting lines, paragraphs or pages within Emacs. +* Narrowing:: Restricting display and editing to a portion + of the buffer. +* Two-Column:: Splitting apart columns to edit them + in side-by-side windows. * Editing Binary Files::Using Hexl mode to edit binary files. * Saving Emacs Sessions:: Saving Emacs state from one session to the next. * Recursive Edit:: A command can allow you to do editing - "within the command". This is called a - "recursive editing level". -* Emulation:: Emulating some other editors with Emacs. + "within the command". This is called a + "recursive editing level". +* Emulation:: Emulating some other editors with Emacs. * Hyperlinking:: Following links in buffers. * Dissociated Press:: Dissociating text for fun. -* Amusements:: Various games and hacks. +* Amusements:: Various games and hacks. * Customization:: Modifying the behavior of Emacs. Recovery from Problems -* Quitting:: Quitting and aborting. -* Lossage:: What to do if Emacs is hung or malfunctioning. -* Bugs:: How and when to report a bug. +* Quitting:: Quitting and aborting. +* Lossage:: What to do if Emacs is hung or malfunctioning. +* Bugs:: How and when to report a bug. * Contributing:: How to contribute improvements to Emacs. -* Service:: How to get help for your own Emacs needs. +* Service:: How to get help for your own Emacs needs. Appendices -* Copying:: The GNU General Public License gives you permission - to redistribute GNU Emacs on certain terms; - it also explains that there is no warranty. +* Copying:: The GNU General Public License gives you permission + to redistribute GNU Emacs on certain terms; + it also explains that there is no warranty. * GNU Free Documentation License:: The license for this documentation. * Emacs Invocation:: Hairy startup options. * X Resources:: X resources for customizing Emacs. -* Antinews:: Information about Emacs version 22. +* Antinews:: Information about Emacs version 22. * Mac OS / GNUstep:: Using Emacs under Mac OS and GNUstep. * Microsoft Windows:: Using Emacs on Microsoft Windows and MS-DOS. -* Manifesto:: What's GNU? Gnu's Not Unix! +* Manifesto:: What's GNU? Gnu's Not Unix! @c Do NOT modify the following 3 lines! They must have this form to @c be correctly identified by `texinfo-multiple-files-update'. In @@ -258,9 +258,9 @@ already listed, mentioned here so you can get to them in one step: The Organization of the Screen -* Point:: The place in the text where editing commands operate. +* Point:: The place in the text where editing commands operate. * Echo Area:: Short messages appear at the bottom of the screen. -* Mode Line:: Interpreting the mode line. +* Mode Line:: Interpreting the mode line. * Menu Bar:: How to use the menu bar. Basic Editing Commands @@ -268,23 +268,23 @@ Basic Editing Commands * Inserting Text:: Inserting text by simply typing it. * Moving Point:: Moving the cursor to the place where you want to change something. -* Erasing:: Deleting and killing text. -* Basic Undo:: Undoing recent changes in the text. +* Erasing:: Deleting and killing text. +* Basic Undo:: Undoing recent changes in the text. * Basic Files:: Visiting, creating, and saving files. * Basic Help:: Asking what a character does. -* Blank Lines:: Making and deleting blank lines. +* Blank Lines:: Making and deleting blank lines. * Continuation Lines:: How Emacs displays lines too wide for the screen. * Position Info:: What page, line, row, or column is point on? -* Arguments:: Numeric arguments for repeating a command N times. +* Arguments:: Numeric arguments for repeating a command N times. * Repeating:: Repeating the previous command quickly. The Minibuffer * Minibuffer File:: Entering file names with the minibuffer. * Minibuffer Edit:: How to edit in the minibuffer. -* Completion:: An abbreviation facility for minibuffer input. -* Minibuffer History:: Reusing recent minibuffer arguments. -* Repetition:: Re-executing commands that used the minibuffer. +* Completion:: An abbreviation facility for minibuffer input. +* Minibuffer History:: Reusing recent minibuffer arguments. +* Repetition:: Re-executing commands that used the minibuffer. * Passwords:: Entering passwords in the echo area. Completion @@ -296,59 +296,59 @@ Completion Help -* Help Summary:: Brief list of all Help commands. -* Key Help:: Asking what a key does in Emacs. -* Name Help:: Asking about a command, variable or function name. -* Apropos:: Asking what pertains to a given topic. +* Help Summary:: Brief list of all Help commands. +* Key Help:: Asking what a key does in Emacs. +* Name Help:: Asking about a command, variable or function name. +* Apropos:: Asking what pertains to a given topic. * Help Mode:: Special features of Help mode and Help buffers. -* Library Keywords:: Finding Lisp libraries by keywords (topics). +* Library Keywords:: Finding Lisp libraries by keywords (topics). * Language Help:: Help relating to international language support. -* Misc Help:: Other help commands. +* Misc Help:: Other help commands. * Help Files:: Commands to display pre-written help files. * Help Echo:: Help on active text and tooltips (`balloon help'). The Mark and the Region -* Setting Mark:: Commands to set the mark. -* Marking Objects:: Commands to put region around textual units. -* Using Region:: Summary of ways to operate on contents of the region. -* Mark Ring:: Previous mark positions saved so you can go back there. +* Setting Mark:: Commands to set the mark. +* Marking Objects:: Commands to put region around textual units. +* Using Region:: Summary of ways to operate on contents of the region. +* Mark Ring:: Previous mark positions saved so you can go back there. * Global Mark Ring:: Previous mark positions in various buffers. * Shift Selection:: Using shifted cursor motion keys. -* Persistent Mark:: Keeping the mark active all the time. +* Persistent Mark:: Keeping the mark active all the time. Killing and Moving Text -* Deletion:: Commands for deleting small amounts of text and - blank areas. -* Killing by Lines:: How to kill entire lines of text at one time. +* Deletion:: Commands for deleting small amounts of text and + blank areas. +* Killing by Lines:: How to kill entire lines of text at one time. * Other Kill Commands:: Commands to kill large regions of text and - syntactic units such as words and sentences. + syntactic units such as words and sentences. * Kill Options:: Options that affect killing. Yanking -* Kill Ring:: Where killed text is stored. Basic yanking. -* Appending Kills:: Several kills in a row all yank together. -* Earlier Kills:: Yanking something killed some time ago. +* Kill Ring:: Where killed text is stored. Basic yanking. +* Appending Kills:: Several kills in a row all yank together. +* Earlier Kills:: Yanking something killed some time ago. Registers -* RegPos:: Saving positions in registers. -* RegText:: Saving text in registers. -* RegRect:: Saving rectangles in registers. +* RegPos:: Saving positions in registers. +* RegText:: Saving text in registers. +* RegRect:: Saving rectangles in registers. * RegConfig:: Saving window configurations in registers. * RegNumbers:: Numbers in registers. -* RegFiles:: File names in registers. +* RegFiles:: File names in registers. * Bookmarks:: Bookmarks are like registers, but persistent. Controlling the Display -* Scrolling:: Commands to move text up and down in a window. +* Scrolling:: Commands to move text up and down in a window. * Auto Scrolling:: Redisplay scrolls text automatically when needed. * Horizontal Scrolling:: Moving text left and right in a window. * Follow Mode:: Follow mode lets two windows scroll as one. -* Faces:: How to change the display style using faces. +* Faces:: How to change the display style using faces. * Standard Faces:: Emacs' predefined faces. * Temporary Face Changes:: Commands to temporarily modify the default text face * Font Lock:: Minor mode for syntactic highlighting using faces. @@ -367,15 +367,15 @@ Controlling the Display Searching and Replacement -* Incremental Search:: Search happens as you type the string. +* Incremental Search:: Search happens as you type the string. * Nonincremental Search:: Specify entire string and then search. -* Word Search:: Search for sequence of words. -* Regexp Search:: Search for match for a regexp. -* Regexps:: Syntax of regular expressions. +* Word Search:: Search for sequence of words. +* Regexp Search:: Search for match for a regexp. +* Regexps:: Syntax of regular expressions. * Regexp Backslash:: Regular expression constructs starting with `\'. * Regexp Example:: A complex regular expression explained. -* Search Case:: To ignore case while searching, or not. -* Replace:: Search, and replace some or all matches. +* Search Case:: To ignore case while searching, or not. +* Replace:: Search, and replace some or all matches. * Other Repeating Search:: Operating on all matches for some regexp. Incremental Search @@ -393,16 +393,16 @@ Incremental Search Replacement Commands * Unconditional Replace:: Replacing all matches for a string. -* Regexp Replace:: Replacing all matches for a regexp. +* Regexp Replace:: Replacing all matches for a regexp. * Replacement and Case:: How replacements preserve case of letters. -* Query Replace:: How to use querying. +* Query Replace:: How to use querying. Commands for Fixing Typos * Undo:: The Undo commands. -* Transpose:: Exchanging two characters, words, lines, lists... +* Transpose:: Exchanging two characters, words, lines, lists... * Fixing Case:: Correcting case of last word entered. -* Spelling:: Apply spelling checker to a word, or a whole file. +* Spelling:: Apply spelling checker to a word, or a whole file. Keyboard Macros @@ -448,9 +448,9 @@ Saving Files Backup Files -* Backup Names:: How backup files are named. -* Backup Deletion:: Emacs deletes excess numbered backups. -* Backup Copying:: Backups can be made by copying or renaming. +* Backup Names:: How backup files are named. +* Backup Deletion:: Emacs deletes excess numbered backups. +* Backup Copying:: Backups can be made by copying or renaming. Auto Reverting Non-File Buffers @@ -463,16 +463,16 @@ Auto-Saving: Protection Against Disasters * Auto Save Files:: The file where auto-saved changes are actually made until you save the file. * Auto Save Control:: Controlling when and how often to auto-save. -* Recover:: Recovering text from auto-save files. +* Recover:: Recovering text from auto-save files. Using Multiple Buffers * Select Buffer:: Creating a new buffer or reselecting an old one. * List Buffers:: Getting a list of buffers that exist. -* Misc Buffer:: Renaming; changing read-onlyness; copying text. -* Kill Buffer:: Killing buffers you no longer need. +* Misc Buffer:: Renaming; changing read-onlyness; copying text. +* Kill Buffer:: Killing buffers you no longer need. * Several Buffers:: How to go through the list of all buffers - and operate variously on several of them. + and operate variously on several of them. * Indirect Buffers:: An indirect buffer shares the text of another buffer. * Buffer Convenience:: Convenience and customization features for buffer handling. @@ -507,10 +507,10 @@ Frames and Graphical Displays * Multiple Displays:: How one Emacs job can talk to several displays. * Special Buffer Frames:: You can make certain buffers have their own frames. * Frame Parameters:: Changing the colors and other modes of frames. -* Scroll Bars:: How to enable and disable scroll bars; how to use them. +* Scroll Bars:: How to enable and disable scroll bars; how to use them. * Wheeled Mice:: Using mouse wheels for scrolling. * Drag and Drop:: Using drag and drop to open files and insert text. -* Menu Bars:: Enabling and disabling the menu bar. +* Menu Bars:: Enabling and disabling the menu bar. * Tool Bars:: Enabling and disabling the tool bar. * Dialog Boxes:: Controlling use of dialog boxes. * Tooltips:: Displaying information at the current mouse position. @@ -559,31 +559,31 @@ Major Modes Indentation * Indentation Commands:: Various commands and techniques for indentation. -* Tab Stops:: You can set arbitrary "tab stops" and then - indent to the next tab stop when you want to. -* Just Spaces:: You can request indentation using just spaces. +* Tab Stops:: You can set arbitrary "tab stops" and then + indent to the next tab stop when you want to. +* Just Spaces:: You can request indentation using just spaces. Commands for Human Languages -* Words:: Moving over and killing words. -* Sentences:: Moving over and killing sentences. -* Paragraphs:: Moving over paragraphs. -* Pages:: Moving over pages. -* Filling:: Filling or justifying text. -* Case:: Changing the case of text. -* Text Mode:: The major modes for editing text files. +* Words:: Moving over and killing words. +* Sentences:: Moving over and killing sentences. +* Paragraphs:: Moving over paragraphs. +* Pages:: Moving over pages. +* Filling:: Filling or justifying text. +* Case:: Changing the case of text. +* Text Mode:: The major modes for editing text files. * Outline Mode:: Editing outlines. -* TeX Mode:: Editing input to the formatter TeX. +* TeX Mode:: Editing input to the formatter TeX. * HTML Mode:: Editing HTML and SGML files. -* Nroff Mode:: Editing input to the formatter nroff. +* Nroff Mode:: Editing input to the formatter nroff. * Formatted Text:: Editing formatted text directly in WYSIWYG fashion. * Text Based Tables:: Editing text-based tables in WYSIWYG fashion. Filling Text -* Auto Fill:: Auto Fill mode breaks long lines automatically. +* Auto Fill:: Auto Fill mode breaks long lines automatically. * Fill Commands:: Commands to refill paragraphs and center lines. -* Fill Prefix:: Filling paragraphs that are indented +* Fill Prefix:: Filling paragraphs that are indented or in a comment, etc. * Adaptive Fill:: How Emacs can determine the fill prefix automatically. * Refill:: Keeping paragraphs filled. @@ -592,7 +592,7 @@ Filling Text Outline Mode * Outline Format:: What the text of an outline looks like. -* Outline Motion:: Special commands for moving through +* Outline Motion:: Special commands for moving through outlines. * Outline Visibility:: Commands to control what is visible. * Outline Views:: Outlines and multiple views. @@ -644,7 +644,7 @@ Editing Programs of a program. * Program Indent:: Adjusting indentation to show the nesting. * Parentheses:: Commands that operate on parentheses. -* Comments:: Inserting, killing, and aligning comments. +* Comments:: Inserting, killing, and aligning comments. * Documentation:: Getting documentation of functions you plan to call. * Hideshow:: Displaying blocks selectively. * Symbol Completion:: Completion on symbol names of your program or language. @@ -666,18 +666,18 @@ Top-Level Definitions, or Defuns Indentation for Programs -* Basic Indent:: Indenting a single line. +* Basic Indent:: Indenting a single line. * Multi-line Indent:: Commands to reindent many lines at once. -* Lisp Indent:: Specifying how each Lisp function should be indented. -* C Indent:: Extra features for indenting C and related modes. -* Custom C Indent:: Controlling indentation style for C and related modes. +* Lisp Indent:: Specifying how each Lisp function should be indented. +* C Indent:: Extra features for indenting C and related modes. +* Custom C Indent:: Controlling indentation style for C and related modes. Commands for Editing with Parentheses * Expressions:: Expressions with balanced parentheses. * Moving by Parens:: Commands for moving up, down and across in the structure of parentheses. -* Matching:: Insertion of a close-delimiter flashes matching open. +* Matching:: Insertion of a close-delimiter flashes matching open. Manipulating Comments @@ -702,12 +702,12 @@ C and Related Modes Fortran Mode -* Fortran Motion:: Moving point by statements or subprograms. -* Fortran Indent:: Indentation commands for Fortran. -* Fortran Comments:: Inserting and aligning comments. -* Fortran Autofill:: Auto fill support for Fortran. -* Fortran Columns:: Measuring columns for valid Fortran. -* Fortran Abbrev:: Built-in abbrevs for Fortran keywords. +* Fortran Motion:: Moving point by statements or subprograms. +* Fortran Indent:: Indentation commands for Fortran. +* Fortran Comments:: Inserting and aligning comments. +* Fortran Autofill:: Auto fill support for Fortran. +* Fortran Columns:: Measuring columns for valid Fortran. +* Fortran Abbrev:: Built-in abbrevs for Fortran keywords. Fortran Indentation @@ -719,28 +719,28 @@ Fortran Indentation Compiling and Testing Programs -* Compilation:: Compiling programs in languages other - than Lisp (C, Pascal, etc.). +* Compilation:: Compiling programs in languages other + than Lisp (C, Pascal, etc.). * Compilation Mode:: The mode for visiting compiler errors. * Compilation Shell:: Customizing your shell properly for use in the compilation buffer. * Grep Searching:: Searching with grep. * Flymake:: Finding syntax errors on the fly. -* Debuggers:: Running symbolic debuggers for non-Lisp programs. -* Executing Lisp:: Various modes for editing Lisp programs, - with different facilities for running - the Lisp programs. +* Debuggers:: Running symbolic debuggers for non-Lisp programs. +* Executing Lisp:: Various modes for editing Lisp programs, + with different facilities for running + the Lisp programs. * Lisp Libraries:: Creating Lisp programs to run in Emacs. -* Lisp Eval:: Executing a single Lisp expression in Emacs. +* Lisp Eval:: Executing a single Lisp expression in Emacs. * Lisp Interaction:: Executing Lisp in an Emacs buffer. -* External Lisp:: Communicating through Emacs with a separate Lisp. +* External Lisp:: Communicating through Emacs with a separate Lisp. Running Debuggers Under Emacs -* Starting GUD:: How to start a debugger subprocess. -* Debugger Operation:: Connection between the debugger and source buffers. -* Commands of GUD:: Key bindings for common commands. -* GUD Customization:: Defining your own commands for GUD. +* Starting GUD:: How to start a debugger subprocess. +* Debugger Operation:: Connection between the debugger and source buffers. +* Commands of GUD:: Key bindings for common commands. +* GUD Customization:: Defining your own commands for GUD. * GDB Graphical Interface:: An enhanced mode that uses GDB features to implement a graphical debugging environment through Emacs. @@ -761,9 +761,9 @@ GDB Graphical Interface Maintaining Large Programs * Version Control:: Using version control systems. -* Change Log:: Maintaining a change history for your program. -* Tags:: Go directly to any function in your program in one - command. Tags remembers which file it is in. +* Change Log:: Maintaining a change history for your program. +* Tags:: Go directly to any function in your program in one + command. Tags remembers which file it is in. * EDE:: An integrated development environment for Emacs. * Emerge:: A convenient way of merging two versions of a program. @@ -844,25 +844,25 @@ Change Logs Tags Tables -* Tag Syntax:: Tag syntax for various types of code and text files. -* Create Tags Table:: Creating a tags table with @code{etags}. +* Tag Syntax:: Tag syntax for various types of code and text files. +* Create Tags Table:: Creating a tags table with @code{etags}. * Etags Regexps:: Create arbitrary tags using regular expressions. -* Select Tags Table:: How to visit a tags table. -* Find Tag:: Commands to find the definition of a specific tag. -* Tags Search:: Using a tags table for searching and replacing. -* List Tags:: Listing and finding tags defined in a file. +* Select Tags Table:: How to visit a tags table. +* Find Tag:: Commands to find the definition of a specific tag. +* Tags Search:: Using a tags table for searching and replacing. +* List Tags:: Listing and finding tags defined in a file. Merging Files with Emerge -* Overview of Emerge:: How to start Emerge. Basic concepts. -* Submodes of Emerge:: Fast mode vs. Edit mode. - Skip Prefers mode and Auto Advance mode. -* State of Difference:: You do the merge by specifying state A or B - for each difference. -* Merge Commands:: Commands for selecting a difference, - changing states of differences, etc. -* Exiting Emerge:: What to do when you've finished the merge. -* Combining in Emerge:: How to keep both alternatives for a difference. +* Overview of Emerge:: How to start Emerge. Basic concepts. +* Submodes of Emerge:: Fast mode vs. Edit mode. + Skip Prefers mode and Auto Advance mode. +* State of Difference:: You do the merge by specifying state A or B + for each difference. +* Merge Commands:: Commands for selecting a difference, + changing states of differences, etc. +* Exiting Emerge:: What to do when you've finished the merge. +* Combining in Emerge:: How to keep both alternatives for a difference. * Fine Points of Emerge:: Miscellaneous issues. Abbrevs @@ -887,10 +887,10 @@ Editing Pictures Sending Mail -* Mail Format:: Format of the mail being composed. +* Mail Format:: Format of the mail being composed. * Mail Headers:: Details of some standard mail header fields. * Mail Aliases:: Abbreviating and grouping mail addresses. -* Mail Commands:: Special commands for editing mail being composed. +* Mail Commands:: Special commands for editing mail being composed. * Mail Signature:: Adding a signature to every message. * Mail Amusements:: Distracting the NSA; adding fortune messages. * Mail Methods:: Using alternative mail-composition methods. @@ -928,28 +928,28 @@ Reading Mail with Rmail Summaries -* Rmail Make Summary:: Making various sorts of summaries. -* Rmail Summary Edit:: Manipulating messages from the summary. +* Rmail Make Summary:: Making various sorts of summaries. +* Rmail Summary Edit:: Manipulating messages from the summary. Dired, the Directory Editor -* Dired Enter:: How to invoke Dired. +* Dired Enter:: How to invoke Dired. * Dired Navigation:: Special motion commands in the Dired buffer. * Dired Deletion:: Deleting files with Dired. * Flagging Many Files:: Flagging files based on their names. * Dired Visiting:: Other file operations through Dired. -* Marks vs Flags:: Flagging for deletion vs marking. -* Operating on Files:: How to copy, rename, print, compress, etc. - either one file or several files. +* Marks vs Flags:: Flagging for deletion vs marking. +* Operating on Files:: How to copy, rename, print, compress, etc. + either one file or several files. * Shell Commands in Dired:: Running a shell command on the marked files. * Transforming File Names:: Using patterns to rename multiple files. -* Comparison in Dired:: Running `diff' by way of Dired. +* Comparison in Dired:: Running `diff' by way of Dired. * Subdirectories in Dired:: Adding subdirectories to the Dired buffer. * Subdir Switches:: Subdirectory switches in Dired. -* Subdirectory Motion:: Moving across subdirectories, and up and down. +* Subdirectory Motion:: Moving across subdirectories, and up and down. * Hiding Subdirectories:: Making subdirectories visible or invisible. * Dired Updating:: Discarding lines for files of no interest. -* Dired and Find:: Using `find' to choose the files for Dired. +* Dired and Find:: Using `find' to choose the files for Dired. * Wdired:: Operating on files by editing the Dired buffer. * Image-Dired:: Viewing image thumbnails in Dired. * Misc Dired Features:: Various other features. @@ -966,7 +966,7 @@ The Calendar and the Diary * Lunar Phases:: Displaying phases of the moon. * Other Calendars:: Converting dates to other calendar systems. * Diary:: Displaying events from your diary. -* Appointments:: Reminders when it's time to do something. +* Appointments:: Reminders when it's time to do something. * Importing Diary:: Converting diary events to/from other formats. * Daylight Saving:: How to specify when daylight saving time is active. * Time Intervals:: Keeping track of time intervals. @@ -976,23 +976,23 @@ Movement in the Calendar * Calendar Unit Motion:: Moving by days, weeks, months, and years. * Move to Beginning or End:: Moving to start/end of weeks, months, and years. -* Specified Dates:: Moving to the current date or another - specific date. +* Specified Dates:: Moving to the current date or another + specific date. Conversion To and From Other Calendars -* Calendar Systems:: The calendars Emacs understands - (aside from Gregorian). -* To Other Calendar:: Converting the selected date to various calendars. -* From Other Calendar:: Moving to a date specified in another calendar. -* Mayan Calendar:: Moving to a date specified in a Mayan calendar. +* Calendar Systems:: The calendars Emacs understands + (aside from Gregorian). +* To Other Calendar:: Converting the selected date to various calendars. +* From Other Calendar:: Moving to a date specified in another calendar. +* Mayan Calendar:: Moving to a date specified in a Mayan calendar. The Diary * Displaying the Diary:: Viewing diary entries and associated calendar dates. * Format of Diary File:: Entering events in your diary. -* Date Formats:: Various ways you can specify dates. -* Adding to Diary:: Commands to create diary entries. +* Date Formats:: Various ways you can specify dates. +* Adding to Diary:: Commands to create diary entries. * Special Diary Entries:: Anniversaries, blocks of dates, cyclic entries, etc. Customizing the Calendar and Diary @@ -1009,22 +1009,22 @@ Customizing the Calendar and Diary Document Viewing -* Navigation:: Navigation inside DocView buffers. -* Searching:: Searching inside documents. -* Slicing:: Specifying which part of pages should be displayed. -* Conversion:: Influencing and triggering conversion. +* Navigation:: Navigation inside DocView buffers. +* Searching:: Searching inside documents. +* Slicing:: Specifying which part of pages should be displayed. +* Conversion:: Influencing and triggering conversion. Gnus -* Buffers of Gnus:: The group, summary, and article buffers. -* Gnus Startup:: What you should know about starting Gnus. -* Summary of Gnus:: A short description of the basic Gnus commands. +* Buffers of Gnus:: The group, summary, and article buffers. +* Gnus Startup:: What you should know about starting Gnus. +* Summary of Gnus:: A short description of the basic Gnus commands. Running Shell Commands from Emacs -* Single Shell:: How to run one shell command and return. -* Interactive Shell:: Permanent shell taking input via Emacs. -* Shell Mode:: Special Emacs commands used with permanent shell. +* Single Shell:: How to run one shell command and return. +* Interactive Shell:: Permanent shell taking input via Emacs. +* Shell Mode:: Special Emacs commands used with permanent shell. * Shell Prompts:: Two ways to recognize shell prompts. * Shell History:: Repeating previous commands in a shell buffer. * Directory Tracking:: Keeping track when the subshell changes directory. @@ -1032,7 +1032,7 @@ Running Shell Commands from Emacs * Terminal emulator:: An Emacs window as a terminal emulator. * Term Mode:: Special Emacs commands used in Term mode. * Paging in Term:: Paging in the terminal emulator. -* Remote Host:: Connecting to another computer. +* Remote Host:: Connecting to another computer. * Serial Terminal:: Connecting to a serial port. Shell Command History @@ -1048,7 +1048,7 @@ Using Emacs as a Server Printing Hard Copies -* PostScript:: Printing buffers or regions as PostScript. +* PostScript:: Printing buffers or regions as PostScript. * PostScript Variables:: Customizing the PostScript printing commands. * Printing Package:: An optional advanced printing interface. @@ -1060,18 +1060,18 @@ Hyperlinking and Navigation Features Customization -* Minor Modes:: Each minor mode is a feature you can turn on - independently of any others. +* Minor Modes:: Each minor mode is a feature you can turn on + independently of any others. * Easy Customization:: Convenient way to browse and change settings. -* Variables:: Many Emacs commands examine Emacs variables - to decide what to do; by setting variables, - you can control their functioning. -* Key Bindings:: The keymaps say what command each key runs. - By changing them, you can "redefine keys". -* Syntax:: The syntax table controls how words and - expressions are parsed. -* Init File:: How to write common customizations in the - @file{.emacs} file. +* Variables:: Many Emacs commands examine Emacs variables + to decide what to do; by setting variables, + you can control their functioning. +* Key Bindings:: The keymaps say what command each key runs. + By changing them, you can "redefine keys". +* Syntax:: The syntax table controls how words and + expressions are parsed. +* Init File:: How to write common customizations in the + @file{.emacs} file. Easy Customization Interface @@ -1087,10 +1087,10 @@ Easy Customization Interface Variables -* Examining:: Examining or setting one variable's value. -* Hooks:: Hook variables let you specify programs for parts - of Emacs to run on particular occasions. -* Locals:: Per-buffer values of variables. +* Examining:: Examining or setting one variable's value. +* Hooks:: Hook variables let you specify programs for parts + of Emacs to run on particular occasions. +* Locals:: Per-buffer values of variables. * File Variables:: How files can specify variable values. * Directory Variables:: How variable values can be specified by directory. @@ -1117,10 +1117,10 @@ Customizing Key Bindings The Init File, @file{~/.emacs} -* Init Syntax:: Syntax of constants in Emacs Lisp. +* Init Syntax:: Syntax of constants in Emacs Lisp. * Init Examples:: How to do some things with an init file. * Terminal Init:: Each terminal type can have an init file. -* Find Init:: How Emacs finds the init file. +* Find Init:: How Emacs finds the init file. * Init Non-ASCII:: Using non-@acronym{ASCII} characters in an init file. Dealing with Emacs Trouble @@ -1138,31 +1138,31 @@ Dealing with Emacs Trouble Reporting Bugs * Bug Criteria:: Have you really found a bug? -* Understanding Bug Reporting:: How to report a bug effectively. -* Checklist:: Steps to follow for a good bug report. -* Sending Patches:: How to send a patch for GNU Emacs. +* Understanding Bug Reporting:: How to report a bug effectively. +* Checklist:: Steps to follow for a good bug report. +* Sending Patches:: How to send a patch for GNU Emacs. Command Line Arguments for Emacs Invocation -* Action Arguments:: Arguments to visit files, load libraries, - and call functions. +* Action Arguments:: Arguments to visit files, load libraries, + and call functions. * Initial Options:: Arguments that take effect while starting Emacs. * Command Example:: Examples of using command line arguments. -* Resume Arguments:: Specifying arguments when you resume a running Emacs. +* Resume Arguments:: Specifying arguments when you resume a running Emacs. * Environment:: Environment variables that Emacs uses. * Display X:: Changing the default display and using remote login. -* Font X:: Choosing a font for text, under X. -* Colors:: Choosing display colors. +* Font X:: Choosing a font for text, under X. +* Colors:: Choosing display colors. * Window Size X:: Start-up window size, under X. -* Borders X:: Internal and external borders, under X. +* Borders X:: Internal and external borders, under X. * Title X:: Specifying the initial frame's title. * Icons X:: Choosing what sort of icon to use, under X. * Misc X:: Other display options. Environment Variables -* General Variables:: Environment variables that all versions of Emacs use. -* Misc Variables:: Certain system-specific variables. +* General Variables:: Environment variables that all versions of Emacs use. +* Misc Variables:: Certain system-specific variables. * MS-Windows Registry:: An alternative to the environment on MS-Windows. X Options and Resources diff --git a/doc/emacs/emerge-xtra.texi b/doc/emacs/emerge-xtra.texi index 762e2fc8727..f502d3f4728 100644 --- a/doc/emacs/emerge-xtra.texi +++ b/doc/emacs/emerge-xtra.texi @@ -1,5 +1,6 @@ @c This is part of the Emacs manual. -@c Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @c @c This file is included either in emacs-xtra.texi (when producing the @@ -22,16 +23,16 @@ easier. For other ways to compare files, see and @ref{Top, Ediff,, ediff, The Ediff Manual}. @menu -* Overview of Emerge:: How to start Emerge. Basic concepts. -* Submodes of Emerge:: Fast mode vs. Edit mode. - Skip Prefers mode and Auto Advance mode. -* State of Difference:: You do the merge by specifying state A or B - for each difference. -* Merge Commands:: Commands for selecting a difference, - changing states of differences, etc. -* Exiting Emerge:: What to do when you've finished the merge. -* Combining in Emerge:: How to keep both alternatives for a difference. -* Fine Points of Emerge:: Miscellaneous issues. +* Overview of Emerge:: How to start Emerge. Basic concepts. +* Submodes of Emerge:: Fast mode vs. Edit mode. + Skip Prefers mode and Auto Advance mode. +* State of Difference:: You do the merge by specifying state A or B + for each difference. +* Merge Commands:: Commands for selecting a difference, + changing states of differences, etc. +* Exiting Emerge:: What to do when you've finished the merge. +* Combining in Emerge:: How to keep both alternatives for a difference. +* Fine Points of Emerge:: Miscellaneous issues. @end menu @node Overview of Emerge diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index d6a7692d3ab..4701c1a7a89 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1999, 2000, -@c 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Files, Buffers, Keyboard Macros, Top @chapter File Handling @@ -553,9 +554,9 @@ makes a backup from the previous contents, and arranges to make another from the newly saved contents if you save again. @menu -* Names: Backup Names. How backup files are named. -* Deletion: Backup Deletion. Emacs deletes excess numbered backups. -* Copying: Backup Copying. Backups can be made by copying or renaming. +* Names: Backup Names. How backup files are named. +* Deletion: Backup Deletion. Emacs deletes excess numbered backups. +* Copying: Backup Copying. Backups can be made by copying or renaming. @end menu @node Backup Names @@ -994,7 +995,7 @@ execution of commands you have been typing. * Files: Auto Save Files. The file where auto-saved changes are actually made until you save the file. * Control: Auto Save Control. Controlling when and how often to auto-save. -* Recover:: Recovering text from auto-save files. +* Recover:: Recovering text from auto-save files. @end menu @node Auto Save Files diff --git a/doc/emacs/fortran-xtra.texi b/doc/emacs/fortran-xtra.texi index f91297d4dd8..d875ed46812 100644 --- a/doc/emacs/fortran-xtra.texi +++ b/doc/emacs/fortran-xtra.texi @@ -1,5 +1,6 @@ @c This is part of the Emacs manual. -@c Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @c @c This file is included either in emacs-xtra.texi (when producing the @@ -57,12 +58,12 @@ command runs the hook @code{fortran-mode-hook}. @end ifnottex @menu -* Motion: Fortran Motion. Moving point by statements or subprograms. -* Indent: Fortran Indent. Indentation commands for Fortran. -* Comments: Fortran Comments. Inserting and aligning comments. -* Autofill: Fortran Autofill. Auto fill support for Fortran. -* Columns: Fortran Columns. Measuring columns for valid Fortran. -* Abbrev: Fortran Abbrev. Built-in abbrevs for Fortran keywords. +* Motion: Fortran Motion. Moving point by statements or subprograms. +* Indent: Fortran Indent. Indentation commands for Fortran. +* Comments: Fortran Comments. Inserting and aligning comments. +* Autofill: Fortran Autofill. Auto fill support for Fortran. +* Columns: Fortran Columns. Measuring columns for valid Fortran. +* Abbrev: Fortran Abbrev. Built-in abbrevs for Fortran keywords. @end menu @node Fortran Motion diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index cde901acf75..fbc21f17884 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1999, 2000, -@c 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Frames, International, Windows, Top @chapter Frames and Graphical Displays @@ -44,10 +45,10 @@ so that you can use many of the features described in this chapter. * Multiple Displays:: How one Emacs job can talk to several displays. * Special Buffer Frames:: You can make certain buffers have their own frames. * Frame Parameters:: Changing the colors and other modes of frames. -* Scroll Bars:: How to enable and disable scroll bars; how to use them. +* Scroll Bars:: How to enable and disable scroll bars; how to use them. * Wheeled Mice:: Using mouse wheels for scrolling. * Drag and Drop:: Using drag and drop to open files and insert text. -* Menu Bars:: Enabling and disabling the menu bar. +* Menu Bars:: Enabling and disabling the menu bar. * Tool Bars:: Enabling and disabling the tool bar. * Dialog Boxes:: Controlling use of dialog boxes. * Tooltips:: Displaying information at the current mouse position. diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi index ac3539881d8..3e298bb0f96 100644 --- a/doc/emacs/help.texi +++ b/doc/emacs/help.texi @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Help, Mark, M-x, Top @chapter Help @@ -69,14 +70,14 @@ This displays the available Emacs packages based on keywords. @end table @menu -* Help Summary:: Brief list of all Help commands. -* Key Help:: Asking what a key does in Emacs. -* Name Help:: Asking about a command, variable or function name. -* Apropos:: Asking what pertains to a given topic. +* Help Summary:: Brief list of all Help commands. +* Key Help:: Asking what a key does in Emacs. +* Name Help:: Asking about a command, variable or function name. +* Apropos:: Asking what pertains to a given topic. * Help Mode:: Special features of Help mode and Help buffers. -* Library Keywords:: Finding Lisp libraries by keywords (topics). +* Library Keywords:: Finding Lisp libraries by keywords (topics). * Language Help:: Help relating to international language support. -* Misc Help:: Other help commands. +* Misc Help:: Other help commands. * Help Files:: Commands to display pre-written help files. * Help Echo:: Help on active text and tooltips (`balloon help'). @end menu diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi index 07533a15a84..150f05b5994 100644 --- a/doc/emacs/killing.texi +++ b/doc/emacs/killing.texi @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Killing, Yanking, Mark, Top @@ -260,9 +261,9 @@ than you killed any text in Emacs, @kbd{C-y} copies the selection instead of text killed within Emacs. @menu -* Kill Ring:: Where killed text is stored. Basic yanking. -* Appending Kills:: Several kills in a row all yank together. -* Earlier Kills:: Yanking something killed some time ago. +* Kill Ring:: Where killed text is stored. Basic yanking. +* Appending Kills:: Several kills in a row all yank together. +* Earlier Kills:: Yanking something killed some time ago. @end menu @node Kill Ring diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 8c417bc12ac..f5a93ec60e7 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -11,9 +11,9 @@ programs. @menu * Version Control:: Using version control systems. -* Change Log:: Maintaining a change history for your program. -* Tags:: Go directly to any function in your program in one - command. Tags remembers which file it is in. +* Change Log:: Maintaining a change history for your program. +* Tags:: Go directly to any function in your program in one + command. Tags remembers which file it is in. * EDE:: An integrated development environment for Emacs. @ifnottex * Emerge:: A convenient way of merging two versions of a program. @@ -1570,13 +1570,13 @@ within that file where the function is defined. @xref{Top,, Ebrowse, ebrowse, Ebrowse User's Manual}. @menu -* Tag Syntax:: Tag syntax for various types of code and text files. -* Create Tags Table:: Creating a tags table with @code{etags}. +* Tag Syntax:: Tag syntax for various types of code and text files. +* Create Tags Table:: Creating a tags table with @code{etags}. * Etags Regexps:: Create arbitrary tags using regular expressions. -* Select Tags Table:: How to visit a tags table. -* Find Tag:: Commands to find the definition of a specific tag. -* Tags Search:: Using a tags table for searching and replacing. -* List Tags:: Listing and finding tags defined in a file. +* Select Tags Table:: How to visit a tags table. +* Find Tag:: Commands to find the definition of a specific tag. +* Tags Search:: Using a tags table for searching and replacing. +* List Tags:: Listing and finding tags defined in a file. @end menu @node Tag Syntax diff --git a/doc/emacs/mark.texi b/doc/emacs/mark.texi index 4d6b38ad713..2ebab1daaeb 100644 --- a/doc/emacs/mark.texi +++ b/doc/emacs/mark.texi @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2001, 2002, -@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Mark, Killing, Help, Top @chapter The Mark and the Region @@ -41,13 +42,13 @@ if the variable @code{highlight-nonselected-windows} is non-@code{nil}, each window highlights its own region. @menu -* Setting Mark:: Commands to set the mark. -* Marking Objects:: Commands to put region around textual units. -* Using Region:: Summary of ways to operate on contents of the region. -* Mark Ring:: Previous mark positions saved so you can go back there. +* Setting Mark:: Commands to set the mark. +* Marking Objects:: Commands to put region around textual units. +* Using Region:: Summary of ways to operate on contents of the region. +* Mark Ring:: Previous mark positions saved so you can go back there. * Global Mark Ring:: Previous mark positions in various buffers. * Shift Selection:: Using shifted cursor motion keys. -* Persistent Mark:: Keeping the mark active all the time. +* Persistent Mark:: Keeping the mark active all the time. @end menu @node Setting Mark diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi index 1726a6780d5..3750e1d49e2 100644 --- a/doc/emacs/mini.texi +++ b/doc/emacs/mini.texi @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Minibuffer, M-x, Basic, Top @chapter The Minibuffer @@ -43,9 +44,9 @@ is in use, keystrokes do not echo. @menu * Minibuffer File:: Entering file names with the minibuffer. * Minibuffer Edit:: How to edit in the minibuffer. -* Completion:: An abbreviation facility for minibuffer input. +* Completion:: An abbreviation facility for minibuffer input. * Minibuffer History:: Reusing recent minibuffer arguments. -* Repetition:: Re-executing commands that used the minibuffer. +* Repetition:: Re-executing commands that used the minibuffer. * Passwords:: Entering passwords in the echo area. @end menu diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 8c89c7b7a27..387e1be715a 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -71,10 +71,10 @@ set or customize the variable @code{doc-view-resolution}. (@code{quit-window}). @menu -* Navigation:: Navigation inside DocView buffers. -* Searching:: Searching inside documents. -* Slicing:: Specifying which part of pages should be displayed. -* Conversion:: Influencing and triggering conversion. +* Navigation:: Navigation inside DocView buffers. +* Searching:: Searching inside documents. +* Slicing:: Specifying which part of pages should be displayed. +* Conversion:: Influencing and triggering conversion. @end menu @node Navigation @@ -211,9 +211,9 @@ manual. To start Gnus, type @kbd{M-x gnus @key{RET}}. @menu -* Buffers of Gnus:: The group, summary, and article buffers. -* Gnus Startup:: What you should know about starting Gnus. -* Summary of Gnus:: A short description of the basic Gnus commands. +* Buffers of Gnus:: The group, summary, and article buffers. +* Gnus Startup:: What you should know about starting Gnus. +* Summary of Gnus:: A short description of the basic Gnus commands. @end menu @node Buffers of Gnus @@ -1757,7 +1757,7 @@ whether to supply @samp{-T} and @samp{-J} options (suitable for not compatible with @code{lpr}. @menu -* PostScript:: Printing buffers or regions as PostScript. +* PostScript:: Printing buffers or regions as PostScript. * PostScript Variables:: Customizing the PostScript printing commands. * Printing Package:: An optional advanced printing interface. @end menu diff --git a/doc/emacs/msdog.texi b/doc/emacs/msdog.texi index 5229d1effa2..a44438bf81f 100644 --- a/doc/emacs/msdog.texi +++ b/doc/emacs/msdog.texi @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Microsoft Windows, Manifesto, Mac OS / GNUstep, Top @appendix Emacs and Microsoft Windows/MS-DOS @@ -761,8 +762,8 @@ printer, put this in your @file{.emacs} file: (setq ps-printer-name t) (setq ps-lpr-command "D:/gs6.01/bin/gswin32c.exe") (setq ps-lpr-switches '("-q" "-dNOPAUSE" "-dBATCH" - "-sDEVICE=mswinpr2" - "-sPAPERSIZE=a4")) + "-sDEVICE=mswinpr2" + "-sPAPERSIZE=a4")) @end example @noindent diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi index be639f45b0a..9fdef175826 100644 --- a/doc/emacs/mule.texi +++ b/doc/emacs/mule.texi @@ -228,7 +228,7 @@ in a buffer whose coding system is @code{utf-8-unix}: character: @`A (192, #o300, #xc0) preferred charset: unicode (Unicode (ISO10646)) code point: 0xC0 - syntax: w which means: word + syntax: w which means: word category: j:Japanese l:Latin v:Vietnamese buffer code: #xC3 #x80 file code: not encodable by coding system undecided-unix diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index 72541eccc6f..b729df105e7 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -34,7 +34,7 @@ Highlight program syntax (@pxref{Font Lock}). of a program. * Program Indent:: Adjusting indentation to show the nesting. * Parentheses:: Commands that operate on parentheses. -* Comments:: Inserting, killing, and aligning comments. +* Comments:: Inserting, killing, and aligning comments. * Documentation:: Getting documentation of functions you plan to call. * Hideshow:: Displaying blocks selectively. * Symbol Completion:: Completion on symbol names of your program or language. @@ -354,11 +354,11 @@ single line, a specified number of lines, or all of the lines inside a single parenthetical grouping. @menu -* Basic Indent:: Indenting a single line. +* Basic Indent:: Indenting a single line. * Multi-line Indent:: Commands to reindent many lines at once. -* Lisp Indent:: Specifying how each Lisp function should be indented. -* C Indent:: Extra features for indenting C and related modes. -* Custom C Indent:: Controlling indentation style for C and related modes. +* Lisp Indent:: Specifying how each Lisp function should be indented. +* C Indent:: Extra features for indenting C and related modes. +* Custom C Indent:: Controlling indentation style for C and related modes. @end menu @cindex pretty-printer @@ -652,7 +652,7 @@ parentheses and unbalanced string quotes in the buffer. * Expressions:: Expressions with balanced parentheses. * Moving by Parens:: Commands for moving up, down and across in the structure of parentheses. -* Matching:: Insertion of a close-delimiter flashes matching open. +* Matching:: Insertion of a close-delimiter flashes matching open. @end menu @node Expressions diff --git a/doc/emacs/rmail.texi b/doc/emacs/rmail.texi index 8a4ce492ee1..d477ca73c46 100644 --- a/doc/emacs/rmail.texi +++ b/doc/emacs/rmail.texi @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2001, 2002, -@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Rmail, Dired, Sending Mail, Top @chapter Reading Mail with Rmail @@ -21,7 +22,7 @@ Rmail mode, which redefines most letters to run commands for managing mail. * Deletion: Rmail Deletion. Deleting and expunging messages. * Inbox: Rmail Inbox. How mail gets into the Rmail file. * Files: Rmail Files. Using multiple Rmail files. -* Output: Rmail Output. Copying messages out to files. +* Output: Rmail Output. Copying messages out to files. * Labels: Rmail Labels. Classifying messages by labeling them. * Attrs: Rmail Attributes. Certain standard labels, called attributes. * Reply: Rmail Reply. Sending replies to messages you are viewing. @@ -31,7 +32,7 @@ Rmail mode, which redefines most letters to run commands for managing mail. * Coding: Rmail Coding. How Rmail handles decoding character sets. * Editing: Rmail Editing. Editing message text and headers in Rmail. * Digest: Rmail Digest. Extracting the messages from a digest message. -* Rot13: Rmail Rot13. Reading messages encoded in the rot13 code. +* Rot13: Rmail Rot13. Reading messages encoded in the rot13 code. * Movemail:: More details of fetching new mail. * Remote Mailboxes:: Retrieving mail from remote mailboxes. * Other Mailbox Formats:: Retrieving mail from local mailboxes in @@ -834,8 +835,8 @@ Rmail buffer's name. Normally only one summary buffer is displayed at a time. @menu -* Rmail Make Summary:: Making various sorts of summaries. -* Rmail Summary Edit:: Manipulating messages from the summary. +* Rmail Make Summary:: Making various sorts of summaries. +* Rmail Summary Edit:: Manipulating messages from the summary. @end menu @node Rmail Make Summary diff --git a/doc/emacs/screen.texi b/doc/emacs/screen.texi index 43a32d8680e..88d248a93bf 100644 --- a/doc/emacs/screen.texi +++ b/doc/emacs/screen.texi @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2001, 2002, -@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Screen, User Input, Acknowledgments, Top @chapter The Organization of the Screen @@ -53,10 +54,10 @@ reference. If you use multiple frames on a graphical display, selecting a particular frame selects a window in that frame. @menu -* Point:: The place in the text where editing commands operate. -* Echo Area:: Short messages appear at the bottom of the screen. -* Mode Line:: Interpreting the mode line. -* Menu Bar:: How to use the menu bar. +* Point:: The place in the text where editing commands operate. +* Echo Area:: Short messages appear at the bottom of the screen. +* Mode Line:: Interpreting the mode line. +* Menu Bar:: How to use the menu bar. @end menu @node Point diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 890dd48df9f..69532e6083d 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, 2002, -@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Search, Fixit, Display, Top @chapter Searching and Replacement @@ -19,16 +20,16 @@ thing, but search for patterns instead of fixed strings. @menu -* Incremental Search:: Search happens as you type the string. -* Nonincremental Search:: Specify entire string and then search. -* Word Search:: Search for sequence of words. -* Regexp Search:: Search for match for a regexp. -* Regexps:: Syntax of regular expressions. -* Regexp Backslash:: Regular expression constructs starting with `\'. -* Regexp Example:: A complex regular expression explained. -* Search Case:: To ignore case while searching, or not. -* Replace:: Search, and replace some or all matches. -* Other Repeating Search:: Operating on all matches for some regexp. +* Incremental Search:: Search happens as you type the string. +* Nonincremental Search:: Specify entire string and then search. +* Word Search:: Search for sequence of words. +* Regexp Search:: Search for match for a regexp. +* Regexps:: Syntax of regular expressions. +* Regexp Backslash:: Regular expression constructs starting with `\'. +* Regexp Example:: A complex regular expression explained. +* Search Case:: To ignore case while searching, or not. +* Replace:: Search, and replace some or all matches. +* Other Repeating Search:: Operating on all matches for some regexp. @end menu @node Incremental Search @@ -983,10 +984,10 @@ is possible to perform several replacements in parallel, using the command @code{expand-region-abbrevs} (@pxref{Expanding Abbrevs}). @menu -* Unconditional Replace:: Replacing all matches for a string. -* Regexp Replace:: Replacing all matches for a regexp. -* Replacement and Case:: How replacements preserve case of letters. -* Query Replace:: How to use querying. +* Unconditional Replace:: Replacing all matches for a string. +* Regexp Replace:: Replacing all matches for a regexp. +* Replacement and Case:: How replacements preserve case of letters. +* Query Replace:: How to use querying. @end menu @node Unconditional Replace, Regexp Replace, Replace, Replace diff --git a/doc/emacs/sending.texi b/doc/emacs/sending.texi index 59f140e5f8a..95bf5873eb0 100644 --- a/doc/emacs/sending.texi +++ b/doc/emacs/sending.texi @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, 2002, -@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Sending Mail @chapter Sending Mail @@ -63,7 +64,7 @@ you may need to customize @code{user-mail-address} if the system cannot receive mail via SMTP (@pxref{Mail Headers}). @menu -* Format: Mail Format. Format of a mail message. +* Format: Mail Format. Format of a mail message. * Headers: Mail Headers. Details of some standard mail header fields. * Aliases: Mail Aliases. Abbreviating and grouping mail addresses. * Commands: Mail Commands. Special commands for editing mail being composed. diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi index c00410e047a..a9faa420967 100644 --- a/doc/emacs/text.texi +++ b/doc/emacs/text.texi @@ -1,6 +1,7 @@ @c This is part of the Emacs manual. @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Text, Programs, Indentation, Top @chapter Commands for Human Languages @@ -57,17 +58,17 @@ for editing such pictures. @inforef{Top,, autotype}. @menu -* Words:: Moving over and killing words. -* Sentences:: Moving over and killing sentences. -* Paragraphs:: Moving over paragraphs. -* Pages:: Moving over pages. -* Filling:: Filling or justifying text. -* Case:: Changing the case of text. -* Text Mode:: The major modes for editing text files. +* Words:: Moving over and killing words. +* Sentences:: Moving over and killing sentences. +* Paragraphs:: Moving over paragraphs. +* Pages:: Moving over pages. +* Filling:: Filling or justifying text. +* Case:: Changing the case of text. +* Text Mode:: The major modes for editing text files. * Outline Mode:: Editing outlines. -* TeX Mode:: Editing input to the formatter TeX. +* TeX Mode:: Editing input to the formatter TeX. * HTML Mode:: Editing HTML and SGML files. -* Nroff Mode:: Editing input to the formatter nroff. +* Nroff Mode:: Editing input to the formatter nroff. * Formatted Text:: Editing formatted text directly in WYSIWYG fashion. * Text Based Tables:: Editing text-based tables in WYSIWYG fashion. @end menu @@ -402,13 +403,12 @@ a style of filling for each portion of the text (@pxref{Formatted Text}). @menu -* Auto Fill:: Auto Fill mode breaks long lines automatically. -* Fill Commands:: Commands to refill paragraphs and center lines. -* Fill Prefix:: Filling paragraphs that are indented - or in a comment, etc. -* Adaptive Fill:: How Emacs can determine the fill prefix automatically. -* Refill:: Keeping paragraphs filled. -* Longlines:: Editing text with very long lines. +* Auto Fill:: Auto Fill mode breaks long lines automatically. +* Fill Commands:: Commands to refill paragraphs and center lines. +* Fill Prefix:: Filling paragraphs that are indented or in a comment, etc. +* Adaptive Fill:: How Emacs can determine the fill prefix automatically. +* Refill:: Keeping paragraphs filled. +* Longlines:: Editing text with very long lines. @end menu @node Auto Fill @@ -978,8 +978,8 @@ major mode's special commands. (The variable the hook @code{outline-mode-hook} (@pxref{Hooks}). @menu -* Format: Outline Format. What the text of an outline looks like. -* Motion: Outline Motion. Special commands for moving through +* Format: Outline Format. What the text of an outline looks like. +* Motion: Outline Motion. Special commands for moving through outlines. * Visibility: Outline Visibility. Commands to control what is visible. * Views: Outline Views. Outlines and multiple views. diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index 69b5b82a056..0390b7da910 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -426,10 +426,10 @@ problem in these two documents might provide you with a solution or a work-around, or give you additional information about related issues. @menu -* Criteria: Bug Criteria. Have you really found a bug? -* Understanding Bug Reporting:: How to report a bug effectively. -* Checklist:: Steps to follow for a good bug report. -* Sending Patches:: How to send a patch for GNU Emacs. +* Criteria: Bug Criteria. Have you really found a bug? +* Understanding Bug Reporting:: How to report a bug effectively. +* Checklist:: Steps to follow for a good bug report. +* Sending Patches:: How to send a patch for GNU Emacs. @end menu @node Bug Criteria diff --git a/doc/emacs/vc1-xtra.texi b/doc/emacs/vc1-xtra.texi index d93286befda..5095c3f4764 100644 --- a/doc/emacs/vc1-xtra.texi +++ b/doc/emacs/vc1-xtra.texi @@ -220,8 +220,8 @@ a symbolic name for a revision. stable version of the system that is ready for distribution to users. @menu -* Making Revision Tags:: The tag facilities. -* Revision Tag Caveats:: Things to be careful of when using tags. +* Making Revision Tags:: The tag facilities. +* Revision Tag Caveats:: Things to be careful of when using tags. @end menu @node Making Revision Tags diff --git a/doc/emacs/xresources.texi b/doc/emacs/xresources.texi index bc60ff946af..2a543eeee08 100644 --- a/doc/emacs/xresources.texi +++ b/doc/emacs/xresources.texi @@ -435,13 +435,14 @@ Emacs.pane.menubar.faceName: Courier-12 To specify a font, use fontconfig font names as values to the @code{faceName} resource. -If Emacs is not built with the Xft library, Lucid menus and dialogs can only -display old style fonts. If Emacs is built with Xft and you prefer the old -fonts, you have to specify @samp{none} to @code{faceName}: +If Emacs is not built with the Xft library, Lucid menus and dialogs +can only display old style fonts. If Emacs is built with Xft and you +prefer the old fonts, you have to specify @samp{none} to +@code{faceName}: @example -Emacs.pane.menubar.faceName: none -Emacs.pane.dialog.faceName: none +Emacs.pane.menubar.faceName: none +Emacs.pane.dialog.faceName: none @end example @noindent @@ -472,7 +473,7 @@ Resources for @emph{non-menubar} toolkit pop-up menus have the font @samp{8x16} for the pop-up menu items, write this: @example -Emacs.menu*.font: 8x16 +Emacs.menu*.font: 8x16 @end example @noindent diff --git a/doc/lispintro/ChangeLog b/doc/lispintro/ChangeLog index f52240fbdfd..093a7018ca3 100644 --- a/doc/lispintro/ChangeLog +++ b/doc/lispintro/ChangeLog @@ -1,3 +1,7 @@ +2010-06-23 Glenn Morris + + * emacs-lisp-intro.texi: Untabify. + 2010-05-07 Chong Yidong * Version 23.2 released. diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 0f3a3bc1993..dfba68cc911 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -17789,7 +17789,7 @@ Incidentally, @code{load-library} is an interactive interface to the This is an interface to the function `load'." (interactive (list (completing-read "Load library: " - (apply-partially 'locate-file-completion-table + (apply-partially 'locate-file-completion-table load-path (get-load-suffixes))))) (load library)) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index cecb6f0c661..20e8150599b 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,32 @@ +2010-07-09 Eli Zaretskii + + * internals.texi (Writing Emacs Primitives): Adapt to ANSI C + calling sequences, which are now the standard. + +2010-06-24 Chong Yidong + + * text.texi (Undo): Clarify command loop behavior (Bug#2433). + + * commands.texi (Command Overview): Mention undo-boundary call. + +2010-06-23 Glenn Morris + + * abbrevs.texi, commands.texi, compile.texi, debugging.texi: + * display.texi, edebug.texi, elisp.texi, eval.texi, files.texi: + * frames.texi, functions.texi, internals.texi, keymaps.texi: + * loading.texi, minibuf.texi, numbers.texi, os.texi, processes.texi: + * searching.texi, sequences.texi, strings.texi, syntax.texi: + * text.texi, tips.texi, vol1.texi, vol2.texi, windows.texi: + Untabify Texinfo files. + +2010-06-20 Chong Yidong + + * modes.texi (Minor Mode Conventions): Fix typo (Bug#6477). + +2010-06-19 Chong Yidong + + * errors.texi (Standard Errors): Remove unnecessary markup (Bug#6461). + 2010-06-02 Chong Yidong * searching.texi (Regexp Special): Remove obsolete information @@ -15,8 +44,7 @@ 2010-05-22 Chong Yidong - * display.texi (Image Cache): Update documentation about image - caching. + * display.texi (Image Cache): Update documentation about image caching. 2010-05-08 Štěpán Němec (tiny change) diff --git a/doc/lispref/abbrevs.texi b/doc/lispref/abbrevs.texi index 1bb33475240..90da5aaa488 100644 --- a/doc/lispref/abbrevs.texi +++ b/doc/lispref/abbrevs.texi @@ -376,10 +376,10 @@ definitions of @code{local-abbrev-table} and @code{text-mode-abbrev-table}. (funcall expand)))) (add-hook 'foo-mode-hook - #'(lambda () - (add-hook 'abbrev-expand-functions - 'foo-mode-abbrev-expand-function - nil t))) + #'(lambda () + (add-hook 'abbrev-expand-functions + 'foo-mode-abbrev-expand-function + nil t))) @end smallexample @node Standard Abbrev Tables, Abbrev Properties, Abbrev Expansion, Abbrevs diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index 463443f8e10..d22cfd955cb 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -1,7 +1,8 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, 2002, -@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../../info/commands @node Command Loop, Keymaps, Minibuffers, Top @@ -21,7 +22,7 @@ are done, and the subroutines that allow Lisp programs to do them. * Distinguish Interactive:: Making a command distinguish interactive calls. * Command Loop Info:: Variables set by the command loop for you to examine. * Adjusting Point:: Adjustment of point after a command. -* Input Events:: What input looks like when you read it. +* Input Events:: What input looks like when you read it. * Reading Input:: How to read input events from the keyboard or mouse. * Special Events:: Events processed immediately and individually. * Waiting:: Waiting for user input or elapsed time. @@ -52,16 +53,19 @@ function. If the key is @kbd{M-x}, then it reads the name of another command, which it then calls. This is done by the command @code{execute-extended-command} (@pxref{Interactive Call}). - To execute a command requires first reading the arguments for it. -This is done by calling @code{command-execute} (@pxref{Interactive -Call}). For commands written in Lisp, the @code{interactive} -specification says how to read the arguments. This may use the prefix -argument (@pxref{Prefix Command Arguments}) or may read with prompting -in the minibuffer (@pxref{Minibuffers}). For example, the command -@code{find-file} has an @code{interactive} specification which says to -read a file name using the minibuffer. The command's function body does -not use the minibuffer; if you call this command from Lisp code as a -function, you must supply the file name string as an ordinary Lisp + Prior to executing the command, Emacs runs @code{undo-boundary} to +create an undo boundary. @xref{Maintaining Undo}. + + To execute a command, Emacs first reads its arguments by calling +@code{command-execute} (@pxref{Interactive Call}). For commands +written in Lisp, the @code{interactive} specification says how to read +the arguments. This may use the prefix argument (@pxref{Prefix +Command Arguments}) or may read with prompting in the minibuffer +(@pxref{Minibuffers}). For example, the command @code{find-file} has +an @code{interactive} specification which says to read a file name +using the minibuffer. The function body of @code{find-file} does not +use the minibuffer, so if you call @code{find-file} as a function from +Lisp code, you must supply the file name string as an ordinary Lisp function argument. If the command is a string or vector (i.e., a keyboard macro) then @@ -968,23 +972,23 @@ the current Emacs session. If a symbol has not yet been so used, @end defun @menu -* Keyboard Events:: Ordinary characters--keys with symbols on them. -* Function Keys:: Function keys--keys with names, not symbols. +* Keyboard Events:: Ordinary characters--keys with symbols on them. +* Function Keys:: Function keys--keys with names, not symbols. * Mouse Events:: Overview of mouse events. -* Click Events:: Pushing and releasing a mouse button. -* Drag Events:: Moving the mouse before releasing the button. -* Button-Down Events:: A button was pushed and not yet released. +* Click Events:: Pushing and releasing a mouse button. +* Drag Events:: Moving the mouse before releasing the button. +* Button-Down Events:: A button was pushed and not yet released. * Repeat Events:: Double and triple click (or drag, or down). -* Motion Events:: Just moving the mouse, not pushing a button. -* Focus Events:: Moving the mouse between frames. +* Motion Events:: Just moving the mouse, not pushing a button. +* Focus Events:: Moving the mouse between frames. * Misc Events:: Other events the system can generate. -* Event Examples:: Examples of the lists for mouse events. -* Classifying Events:: Finding the modifier keys in an event symbol. - Event types. -* Accessing Mouse:: Functions to extract info from mouse events. -* Accessing Scroll:: Functions to get info from scroll bar events. +* Event Examples:: Examples of the lists for mouse events. +* Classifying Events:: Finding the modifier keys in an event symbol. + Event types. +* Accessing Mouse:: Functions to extract info from mouse events. +* Accessing Scroll:: Functions to get info from scroll bar events. * Strings of Events:: Special considerations for putting - keyboard character events in a string. + keyboard character events in a string. @end menu @node Keyboard Events @@ -2158,12 +2162,12 @@ debugging terminal input. For higher-level input facilities, see @ref{Minibuffers}. @menu -* Key Sequence Input:: How to read one key sequence. -* Reading One Event:: How to read just one event. +* Key Sequence Input:: How to read one key sequence. +* Reading One Event:: How to read just one event. * Event Mod:: How Emacs modifies events as they are read. * Invoking the Input Method:: How reading an event uses the input method. -* Quoted Character Input:: Asking the user to specify a character. -* Event Input Misc:: How to reread or throw away input events. +* Quoted Character Input:: Asking the user to specify a character. +* Event Input Misc:: How to reread or throw away input events. @end menu @node Key Sequence Input @@ -2889,9 +2893,9 @@ normal quitting is permitted after the first character of input. (while (not done) (let ((inhibit-quit first) @dots{}) - (and prompt (message "%s-" prompt)) - (setq char (read-event)) - (if inhibit-quit (setq quit-flag nil))) + (and prompt (message "%s-" prompt)) + (setq char (read-event)) + (if inhibit-quit (setq quit-flag nil))) @r{@dots{}set the variable @code{code}@dots{}}) code)) @end example diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi index b2ab9d67e59..1c28664e7c3 100644 --- a/doc/lispref/compile.texi +++ b/doc/lispref/compile.texi @@ -47,9 +47,9 @@ byte compilation. * Compilation Functions:: Byte compilation functions. * Docs and Compilation:: Dynamic loading of documentation strings. * Dynamic Loading:: Dynamic loading of individual functions. -* Eval During Compile:: Code to be evaluated when you compile. +* Eval During Compile:: Code to be evaluated when you compile. * Compiler Errors:: Handling compiler error messages. -* Byte-Code Objects:: The data type used for byte-compiled functions. +* Byte-Code Objects:: The data type used for byte-compiled functions. * Disassembly:: Disassembling byte-code; how to read byte-code. @end menu diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index 669c07d5a0e..3d77a5fe0d5 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi @@ -28,7 +28,7 @@ compiler, you need to know how to examine the compiler's input buffer. @menu * Debugger:: How the Emacs Lisp debugger is implemented. -* Edebug:: A source-level Emacs Lisp debugger. +* Edebug:: A source-level Emacs Lisp debugger. * Syntax Errors:: How to find syntax errors. * Test Coverage:: Ensuring you have tested all branches in your code. * Compilation Errors:: How to find errors that show up in byte compilation. @@ -58,7 +58,7 @@ debugger recursively. @xref{Recursive Editing}. @menu * Error Debugging:: Entering the debugger when an error happens. -* Infinite Loops:: Stopping and debugging a program that doesn't exit. +* Infinite Loops:: Stopping and debugging a program that doesn't exit. * Function Debugging:: Entering it when a certain function is called. * Explicit Debug:: Entering it at a certain point in the program. * Using Debugger:: What the debugger does; what you see while in it. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 622de2cd3cf..9f07fb42ef4 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -1181,7 +1181,7 @@ inside the overlay or outside, and likewise for the end of the overlay. @menu * Managing Overlays:: Creating and moving overlays. * Overlay Properties:: How to read and set properties. - What properties do to the screen display. + What properties do to the screen display. * Finding Overlays:: Searching for overlays. @end menu diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi index fba83980cd1..3733a8fb105 100644 --- a/doc/lispref/edebug.texi +++ b/doc/lispref/edebug.texi @@ -59,24 +59,24 @@ The first three sections below should tell you enough about Edebug to start using it. @menu -* Using Edebug:: Introduction to use of Edebug. -* Instrumenting:: You must instrument your code - in order to debug it with Edebug. +* Using Edebug:: Introduction to use of Edebug. +* Instrumenting:: You must instrument your code + in order to debug it with Edebug. * Modes: Edebug Execution Modes. Execution modes, stopping more or less often. -* Jumping:: Commands to jump to a specified place. -* Misc: Edebug Misc. Miscellaneous commands. +* Jumping:: Commands to jump to a specified place. +* Misc: Edebug Misc. Miscellaneous commands. * Breaks:: Setting breakpoints to make the program stop. -* Trapping Errors:: Trapping errors with Edebug. -* Views: Edebug Views. Views inside and outside of Edebug. -* Eval: Edebug Eval. Evaluating expressions within Edebug. -* Eval List:: Expressions whose values are displayed - each time you enter Edebug. -* Printing in Edebug:: Customization of printing. -* Trace Buffer:: How to produce trace output in a buffer. -* Coverage Testing:: How to test evaluation coverage. -* The Outside Context:: Data that Edebug saves and restores. -* Edebug and Macros:: Specifying how to handle macro calls. -* Options: Edebug Options. Option variables for customizing Edebug. +* Trapping Errors:: Trapping errors with Edebug. +* Views: Edebug Views. Views inside and outside of Edebug. +* Eval: Edebug Eval. Evaluating expressions within Edebug. +* Eval List:: Expressions whose values are displayed + each time you enter Edebug. +* Printing in Edebug:: Customization of printing. +* Trace Buffer:: How to produce trace output in a buffer. +* Coverage Testing:: How to test evaluation coverage. +* The Outside Context:: Data that Edebug saves and restores. +* Edebug and Macros:: Specifying how to handle macro calls. +* Options: Edebug Options. Option variables for customizing Edebug. @end menu @node Using Edebug @@ -429,8 +429,8 @@ breakpoints, the global break condition, and source breakpoints. @menu * Breakpoints:: Breakpoints at stop points. -* Global Break Condition:: Breaking on an event. -* Source Breakpoints:: Embedding breakpoints in source code. +* Global Break Condition:: Breaking on an event. +* Source Breakpoints:: Embedding breakpoints in source code. @end menu @node Breakpoints @@ -940,9 +940,9 @@ explains precisely what context Edebug restores, and how Edebug fails to be completely transparent. @menu -* Checking Whether to Stop:: When Edebug decides what to do. -* Edebug Display Update:: When Edebug updates the display. -* Edebug Recursive Edit:: When Edebug stops execution. +* Checking Whether to Stop:: When Edebug decides what to do. +* Edebug Display Update:: When Edebug updates the display. +* Edebug Recursive Edit:: When Edebug stops execution. @end menu @node Checking Whether to Stop @@ -1074,9 +1074,9 @@ extra care is needed. This subsection explains the details. @menu * Instrumenting Macro Calls:: The basic problem. -* Specification List:: How to specify complex patterns of evaluation. -* Backtracking:: What Edebug does when matching fails. -* Specification Examples:: To help understand specifications. +* Specification List:: How to specify complex patterns of evaluation. +* Backtracking:: What Edebug does when matching fails. +* Specification Examples:: To help understand specifications. @end menu @node Instrumenting Macro Calls diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index 46d242fcfba..30f085f69de 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -143,7 +143,7 @@ Cover art by Etienne Suvasa. files are made. * Buffers:: Creating and using buffer objects. * Windows:: Manipulating windows and displaying buffers. -* Frames:: Making multiple system-level windows. +* Frames:: Making multiple system-level windows. * Positions:: Buffer positions and motion functions. * Markers:: Markers represent positions and update automatically when the text is changed. @@ -155,7 +155,7 @@ Cover art by Etienne Suvasa. * Abbrevs:: How Abbrev mode works, and its data structures. * Processes:: Running and communicating with subprocesses. -* Display:: Features for controlling the screen display. +* Display:: Features for controlling the screen display. * System Interface:: Getting the user id, system type, environment variables, and other such things. @@ -291,10 +291,10 @@ Editing Types Numbers * Integer Basics:: Representation and range of integers. -* Float Basics:: Representation and range of floating point. +* Float Basics:: Representation and range of floating point. * Predicates on Numbers:: Testing for numbers. * Comparison of Numbers:: Equality and inequality predicates. -* Numeric Conversions:: Converting float to integer and vice versa. +* Numeric Conversions:: Converting float to integer and vice versa. * Arithmetic Operations:: How to add, subtract, multiply and divide. * Rounding Operations:: Explicitly rounding floating point numbers. * Bitwise Operations:: Logical and, or, not, shifting. @@ -311,7 +311,7 @@ Strings and Characters * String Conversion:: Converting to and from characters and strings. * Formatting Strings:: @code{format}: Emacs's analogue of @code{printf}. * Case Conversion:: Case conversion functions. -* Case Tables:: Customizing case conversion. +* Case Tables:: Customizing case conversion. Lists @@ -379,7 +379,7 @@ Kinds of Forms * Symbol Forms:: Symbols evaluate as variables. * Classifying Lists:: How to distinguish various sorts of list forms. * Function Indirection:: When a symbol appears as the car of a list, - we find the real function via the symbol. + we find the real function via the symbol. * Function Forms:: Forms that call functions. * Macro Forms:: Forms that call macros. * Special Forms:: "Special forms" are idiosyncratic primitives, @@ -460,9 +460,9 @@ Functions * Function Cells:: Accessing or setting the function definition of a symbol. * Obsolete Functions:: Declaring functions obsolete. -* Inline Functions:: Defining functions that the compiler +* Inline Functions:: Defining functions that the compiler will open code. -* Declaring Functions:: Telling the compiler that a function is defined. +* Declaring Functions:: Telling the compiler that a function is defined. * Function Currying:: Making wrapper functions that pre-specify some arguments. * Function Safety:: Determining whether a function is safe to call. @@ -523,9 +523,9 @@ Loading * Repeated Loading:: Precautions about loading a file twice. * Named Features:: Loading a library if it isn't already loaded. * Where Defined:: Finding which file defined a certain symbol. -* Unloading:: How to "unload" a library that was loaded. -* Hooks for Loading:: Providing code to be run when - particular libraries are loaded. +* Unloading:: How to "unload" a library that was loaded. +* Hooks for Loading:: Providing code to be run when + particular libraries are loaded. Byte Compilation @@ -535,7 +535,7 @@ Byte Compilation * Dynamic Loading:: Dynamic loading of individual functions. * Eval During Compile:: Code to be evaluated when you compile. * Compiler Errors:: Handling compiler error messages. -* Byte-Code Objects:: The data type used for byte-compiled functions. +* Byte-Code Objects:: The data type used for byte-compiled functions. * Disassembly:: Disassembling byte-code; how to read byte-code. Advising Emacs Lisp Functions @@ -564,7 +564,7 @@ Debugging Lisp Programs The Lisp Debugger * Error Debugging:: Entering the debugger when an error happens. -* Infinite Loops:: Stopping and debugging a program that doesn't exit. +* Infinite Loops:: Stopping and debugging a program that doesn't exit. * Function Debugging:: Entering it when a certain function is called. * Explicit Debug:: Entering it at a certain point in the program. * Using Debugger:: What the debugger does; what you see while in it. @@ -574,24 +574,24 @@ The Lisp Debugger Edebug -* Using Edebug:: Introduction to use of Edebug. -* Instrumenting:: You must instrument your code - in order to debug it with Edebug. +* Using Edebug:: Introduction to use of Edebug. +* Instrumenting:: You must instrument your code + in order to debug it with Edebug. * Edebug Execution Modes:: Execution modes, stopping more or less often. -* Jumping:: Commands to jump to a specified place. -* Edebug Misc:: Miscellaneous commands. -* Breaks:: Setting breakpoints to make the program stop. -* Trapping Errors:: Trapping errors with Edebug. -* Edebug Views:: Views inside and outside of Edebug. -* Edebug Eval:: Evaluating expressions within Edebug. -* Eval List:: Expressions whose values are displayed - each time you enter Edebug. -* Printing in Edebug:: Customization of printing. -* Trace Buffer:: How to produce trace output in a buffer. -* Coverage Testing:: How to test evaluation coverage. -* The Outside Context:: Data that Edebug saves and restores. +* Jumping:: Commands to jump to a specified place. +* Edebug Misc:: Miscellaneous commands. +* Breaks:: Setting breakpoints to make the program stop. +* Trapping Errors:: Trapping errors with Edebug. +* Edebug Views:: Views inside and outside of Edebug. +* Edebug Eval:: Evaluating expressions within Edebug. +* Eval List:: Expressions whose values are displayed + each time you enter Edebug. +* Printing in Edebug:: Customization of printing. +* Trace Buffer:: How to produce trace output in a buffer. +* Coverage Testing:: How to test evaluation coverage. +* The Outside Context:: Data that Edebug saves and restores. * Edebug and Macros:: Specifying how to handle macro calls. -* Edebug Options:: Option variables for customizing Edebug. +* Edebug Options:: Option variables for customizing Edebug. Breaks @@ -608,8 +608,8 @@ The Outside Context Edebug and Macros * Instrumenting Macro Calls::The basic problem. -* Specification List:: How to specify complex patterns of evaluation. -* Backtracking:: What Edebug does when matching fails. +* Specification List:: How to specify complex patterns of evaluation. +* Backtracking:: What Edebug does when matching fails. * Specification Examples:: To help understand specifications. Debugging Invalid Lisp Syntax @@ -634,13 +634,13 @@ Minibuffers * Intro to Minibuffers:: Basic information about minibuffers. * Text from Minibuffer:: How to read a straight text string. * Object from Minibuffer:: How to read a Lisp object or expression. -* Minibuffer History:: Recording previous minibuffer inputs - so the user can reuse them. +* Minibuffer History:: Recording previous minibuffer inputs + so the user can reuse them. * Initial Input:: Specifying initial contents for the minibuffer. * Completion:: How to invoke and customize completion. * Yes-or-No Queries:: Asking a question with a simple answer. -* Multiple Queries:: Asking a series of similar questions. -* Reading a Password:: Reading a password from the terminal. +* Multiple Queries:: Asking a series of similar questions. +* Reading a Password:: Reading a password from the terminal. * Minibuffer Commands:: Commands used as key bindings in minibuffers. * Minibuffer Contents:: How such commands access the minibuffer text. * Minibuffer Windows:: Operating on the special minibuffer windows. @@ -667,7 +667,7 @@ Command Loop * Distinguish Interactive:: Making a command distinguish interactive calls. * Command Loop Info:: Variables set by the command loop for you to examine. * Adjusting Point:: Adjustment of point after a command. -* Input Events:: What input looks like when you read it. +* Input Events:: What input looks like when you read it. * Reading Input:: How to read input events from the keyboard or mouse. * Special Events:: Events processed immediately and individually. * Waiting:: Waiting for user input or elapsed time. @@ -701,7 +701,7 @@ Input Events * Event Examples:: Examples of the lists for mouse events. * Classifying Events:: Finding the modifier keys in an event symbol. Event types. -* Accessing Mouse:: Functions to extract info from mouse events. +* Accessing Mouse:: Functions to extract info from mouse events. * Accessing Scroll:: Functions to get info from scroll bar events. * Strings of Events:: Special considerations for putting keyboard character events in a string. @@ -851,9 +851,9 @@ Files * Changing Files:: Renaming files, changing protection, etc. * File Names:: Decomposing and expanding file names. * Contents of Directories:: Getting a list of the files in a directory. -* Create/Delete Dirs:: Creating and Deleting Directories. -* Magic File Names:: Defining "magic" special handling - for certain file names. +* Create/Delete Dirs:: Creating and Deleting Directories. +* Magic File Names:: Defining "magic" special handling + for certain file names. * Format Conversion:: Conversion to and from various file formats. Visiting Files @@ -865,7 +865,7 @@ Information about Files * Testing Accessibility:: Is a given file readable? Writable? * Kinds of Files:: Is it a directory? A symbolic link? -* Truenames:: Eliminating symbolic links from a file name. +* Truenames:: Eliminating symbolic links from a file name. * File Attributes:: How large is it? Any other names? Etc. * Locating Files:: How to find a file in standard places. @@ -935,8 +935,8 @@ Windows * Buffers and Windows:: Each window displays the contents of a buffer. * Displaying Buffers:: Higher-level functions for displaying a buffer and choosing a window for it. -* Choosing Window:: How to choose a window for displaying a buffer. -* Dedicated Windows:: How to avoid displaying another buffer in +* Choosing Window:: How to choose a window for displaying a buffer. +* Dedicated Windows:: How to avoid displaying another buffer in a specific window. * Window Point:: Each window has its own location of point. * Window Start and End:: Buffer positions indicating which text is @@ -956,37 +956,37 @@ Windows Frames -* Creating Frames:: Creating additional frames. +* Creating Frames:: Creating additional frames. * Multiple Terminals:: Displaying on several different devices. -* Frame Parameters:: Controlling frame size, position, font, etc. +* Frame Parameters:: Controlling frame size, position, font, etc. * Terminal Parameters:: Parameters common for all frames on terminal. * Frame Titles:: Automatic updating of frame titles. -* Deleting Frames:: Frames last until explicitly deleted. -* Finding All Frames:: How to examine all existing frames. -* Frames and Windows:: A frame contains windows; - display of text always works through windows. +* Deleting Frames:: Frames last until explicitly deleted. +* Finding All Frames:: How to examine all existing frames. +* Frames and Windows:: A frame contains windows; + display of text always works through windows. * Minibuffers and Frames:: How a frame finds the minibuffer to use. -* Input Focus:: Specifying the selected frame. +* Input Focus:: Specifying the selected frame. * Visibility of Frames:: Frames may be visible or invisible, or icons. * Raising and Lowering:: Raising a frame makes it hide other windows; - lowering it makes the others hide it. + lowering it makes the others hide it. * Frame Configurations:: Saving the state of all frames. -* Mouse Tracking:: Getting events that say when the mouse moves. -* Mouse Position:: Asking where the mouse is, or moving it. -* Pop-Up Menus:: Displaying a menu for the user to select from. +* Mouse Tracking:: Getting events that say when the mouse moves. +* Mouse Position:: Asking where the mouse is, or moving it. +* Pop-Up Menus:: Displaying a menu for the user to select from. * Dialog Boxes:: Displaying a box to ask yes or no. * Pointer Shape:: Specifying the shape of the mouse pointer. * Window System Selections::Transferring text to and from other X clients. * Drag and Drop:: Internals of Drag-and-Drop implementation. -* Color Names:: Getting the definitions of color names. +* Color Names:: Getting the definitions of color names. * Text Terminal Colors:: Defining colors for text-only terminals. -* Resources:: Getting resource values from the server. +* Resources:: Getting resource values from the server. * Display Feature Testing:: Determining the features of a terminal. Frame Parameters * Parameter Access:: How to change a frame's parameters. -* Initial Parameters:: Specifying frame parameters when you make a frame. +* Initial Parameters:: Specifying frame parameters when you make a frame. * Window Frame Parameters:: List of frame parameters for window systems. * Size and Position:: Changing the size and position of a frame. * Geometry:: Parsing geometry specifications. @@ -1045,7 +1045,7 @@ Text later use. * Undo:: Undoing changes to the text of a buffer. * Maintaining Undo:: How to enable and disable undo information. - How to control how much information is kept. + How to control how much information is kept. * Filling:: Functions for explicit filling. * Margins:: How to specify margins for filling commands. * Adaptive Fill:: Adaptive Fill mode chooses a fill prefix @@ -1071,7 +1071,7 @@ The Kill Ring * Kill Functions:: Functions that kill text. * Yanking:: How yanking is done. * Yank Commands:: Commands that access the kill ring. -* Low-Level Kill Ring:: Functions and variables for kill ring access. +* Low-Level Kill Ring:: Functions and variables for kill ring access. * Internals of Kill Ring:: Variables that hold kill ring data. Indentation @@ -1086,9 +1086,9 @@ Indentation Text Properties * Examining Properties:: Looking at the properties of one character. -* Changing Properties:: Setting the properties of a range of text. -* Property Search:: Searching for where a property changes value. -* Special Properties:: Particular properties with special meanings. +* Changing Properties:: Setting the properties of a range of text. +* Property Search:: Searching for where a property changes value. +* Special Properties:: Particular properties with special meanings. * Format Properties:: Properties for representing formatting of text. * Sticky Properties:: How inserted text gets properties from neighboring text. @@ -1098,8 +1098,8 @@ Text Properties do something when you click on them. * Fields:: The @code{field} property defines fields within the buffer. -* Not Intervals:: Why text properties do not use - Lisp-visible text intervals. +* Not Intervals:: Why text properties do not use + Lisp-visible text intervals. Non-@acronym{ASCII} Characters @@ -1142,7 +1142,7 @@ Searching and Matching * POSIX Regexps:: Searching POSIX-style for the longest match. * Match Data:: Finding out which part of the text matched, after a string or regexp search. -* Search and Replace:: Commands that loop, searching and replacing. +* Search and Replace:: Commands that loop, searching and replacing. * Standard Regexps:: Useful regexps for finding sentences, pages,... Regular Expressions @@ -1159,9 +1159,9 @@ Syntax of Regular Expressions The Match Data -* Replacing Match:: Replacing a substring that was matched. +* Replacing Match:: Replacing a substring that was matched. * Simple Match Data:: Accessing single items of match data, - such as where a particular subexpression started. + such as where a particular subexpression started. * Entire Match Data:: Accessing the entire match data at once, as a list. * Saving Match Data:: Saving and restoring the match data. @@ -1171,7 +1171,7 @@ Syntax Tables * Syntax Descriptors:: How characters are classified. * Syntax Table Functions:: How to create, examine and alter syntax tables. * Syntax Properties:: Overriding syntax with text properties. -* Motion and Syntax:: Moving over characters with certain syntaxes. +* Motion and Syntax:: Moving over characters with certain syntaxes. * Parsing Expressions:: Parsing balanced expressions using the syntax table. * Standard Syntax Tables:: Syntax tables used by various major modes. @@ -1260,10 +1260,10 @@ Emacs Display * Invisible Text:: Hiding part of the buffer text. * Selective Display:: Hiding part of the buffer text (the old way). * Temporary Displays:: Displays that go away automatically. -* Overlays:: Use overlays to highlight parts of the buffer. +* Overlays:: Use overlays to highlight parts of the buffer. * Width:: How wide a character or string is on the screen. * Line Height:: Controlling the height of lines. -* Faces:: A face defines a graphics style +* Faces:: A face defines a graphics style for text characters: font, colors, etc. * Fringes:: Controlling window fringes. * Scroll Bars:: Controlling vertical scroll bars. @@ -1272,9 +1272,9 @@ Emacs Display * Buttons:: Adding clickable buttons to Emacs buffers. * Abstract Display:: Emacs' Widget for Object Collections. * Blinking:: How Emacs shows the matching open parenthesis. -* Usual Display:: The usual conventions for displaying +* Usual Display:: The usual conventions for displaying nonprinting chars. -* Display Tables:: How to specify other conventions. +* Display Tables:: How to specify other conventions. * Beeping:: Audible signal to the user. * Window Systems:: Which window system is being used. @@ -1296,7 +1296,7 @@ Overlays * Managing Overlays:: Creating and moving overlays. * Overlay Properties:: How to read and set properties. - What properties do to the screen display. + What properties do to the screen display. * Finding Overlays:: Searching for overlays. Faces @@ -1376,14 +1376,14 @@ Operating System Interface * Getting Out:: How exiting works (permanent or temporary). * System Environment:: Distinguish the name and kind of system. * User Identification:: Finding the name and user id of the user. -* Time of Day:: Getting the current time. +* Time of Day:: Getting the current time. * Time Conversion:: Converting a time from numeric form to calendrical data and vice versa. * Time Parsing:: Converting a time from numeric form to text and vice versa. * Processor Run Time:: Getting the run time used by Emacs. * Time Calculations:: Adding, subtracting, comparing times, etc. -* Timers:: Setting a timer to call a function at a +* Timers:: Setting a timer to call a function at a certain time. * Idle Timers:: Setting a timer to call a function when Emacs has been idle for a certain length of time. @@ -1410,8 +1410,8 @@ Getting Out of Emacs Terminal Input -* Input Modes:: Options for how input is processed. -* Recording Input:: Saving histories of recent or all input events. +* Input Modes:: Options for how input is processed. +* Recording Input:: Saving histories of recent or all input events. Tips and Conventions @@ -1421,7 +1421,7 @@ Tips and Conventions * Compilation Tips:: Making compiled code run fast. * Warning Tips:: Turning off compiler warnings. * Documentation Tips:: Writing readable documentation strings. -* Comment Tips:: Conventions for writing comments. +* Comment Tips:: Conventions for writing comments. * Library Headers:: Standard headers for library packages. GNU Emacs Internals diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi index e9ef1999589..b1b1747d86c 100644 --- a/doc/lispref/errors.texi +++ b/doc/lispref/errors.texi @@ -63,11 +63,11 @@ sequence or buffer.@* @xref{Lisp and Coding Systems}. @item cyclic-function-indirection -@code{"Symbol's chain of function indirections\@* contains a loop"}@* +@code{"Symbol's chain of function indirections contains a loop"}@* @xref{Function Indirection}. @item cyclic-variable-indirection -@code{"Symbol's chain of variable indirections\@* contains a loop"}@* +@code{"Symbol's chain of variable indirections contains a loop"}@* @xref{Variable Aliases}. @item end-of-buffer diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi index f0d710f9775..6ed38f45dc8 100644 --- a/doc/lispref/eval.texi +++ b/doc/lispref/eval.texi @@ -110,7 +110,7 @@ forms. * Symbol Forms:: Symbols evaluate as variables. * Classifying Lists:: How to distinguish various sorts of list forms. * Function Indirection:: When a symbol appears as the car of a list, - we find the real function via the symbol. + we find the real function via the symbol. * Function Forms:: Forms that call functions. * Macro Forms:: Forms that call macros. * Special Forms:: "Special forms" are idiosyncratic primitives, diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 699a33ff22b..abdd2814b56 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -1,7 +1,8 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../../info/files @node Files, Backups and Auto-Saving, Documentation, Top @@ -38,9 +39,9 @@ to locale @code{system-message-locale}, and decoded using coding system * Changing Files:: Renaming files, changing protection, etc. * File Names:: Decomposing and expanding file names. * Contents of Directories:: Getting a list of the files in a directory. -* Create/Delete Dirs:: Creating and Deleting Directories. -* Magic File Names:: Defining "magic" special handling - for certain file names. +* Create/Delete Dirs:: Creating and Deleting Directories. +* Magic File Names:: Defining "magic" special handling + for certain file names. * Format Conversion:: Conversion to and from various file formats. @end menu @@ -755,7 +756,7 @@ otherwise noted. @menu * Testing Accessibility:: Is a given file readable? Writable? * Kinds of Files:: Is it a directory? A symbolic link? -* Truenames:: Eliminating symbolic links from a file name. +* Truenames:: Eliminating symbolic links from a file name. * File Attributes:: How large is it? Any other names? Etc. * Locating Files:: How to find a file in standard places. @end menu diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 9994210bd17..7dfe3242c5d 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -85,26 +85,26 @@ is the same as for @code{framep} above. * Frame Parameters:: Controlling frame size, position, font, etc. * Terminal Parameters:: Parameters common for all frames on terminal. * Frame Titles:: Automatic updating of frame titles. -* Deleting Frames:: Frames last until explicitly deleted. -* Finding All Frames:: How to examine all existing frames. -* Frames and Windows:: A frame contains windows; - display of text always works through windows. -* Minibuffers and Frames:: How a frame finds the minibuffer to use. -* Input Focus:: Specifying the selected frame. -* Visibility of Frames:: Frames may be visible or invisible, or icons. -* Raising and Lowering:: Raising a frame makes it hide other windows; - lowering it makes the others hide it. -* Frame Configurations:: Saving the state of all frames. -* Mouse Tracking:: Getting events that say when the mouse moves. -* Mouse Position:: Asking where the mouse is, or moving it. -* Pop-Up Menus:: Displaying a menu for the user to select from. +* Deleting Frames:: Frames last until explicitly deleted. +* Finding All Frames:: How to examine all existing frames. +* Frames and Windows:: A frame contains windows; + display of text always works through windows. +* Minibuffers and Frames:: How a frame finds the minibuffer to use. +* Input Focus:: Specifying the selected frame. +* Visibility of Frames:: Frames may be visible or invisible, or icons. +* Raising and Lowering:: Raising a frame makes it hide other windows; + lowering it makes the others hide it. +* Frame Configurations:: Saving the state of all frames. +* Mouse Tracking:: Getting events that say when the mouse moves. +* Mouse Position:: Asking where the mouse is, or moving it. +* Pop-Up Menus:: Displaying a menu for the user to select from. * Dialog Boxes:: Displaying a box to ask yes or no. * Pointer Shape:: Specifying the shape of the mouse pointer. * Window System Selections:: Transferring text to and from other X clients. * Drag and Drop:: Internals of Drag-and-Drop implementation. -* Color Names:: Getting the definitions of color names. +* Color Names:: Getting the definitions of color names. * Text Terminal Colors:: Defining colors for text-only terminals. -* Resources:: Getting resource values from the server. +* Resources:: Getting resource values from the server. * Display Feature Testing:: Determining the features of a terminal. @end menu @@ -343,7 +343,7 @@ variables. @xref{Frame-Local Variables}. @menu * Parameter Access:: How to change a frame's parameters. -* Initial Parameters:: Specifying frame parameters when you make a frame. +* Initial Parameters:: Specifying frame parameters when you make a frame. * Window Frame Parameters:: List of frame parameters for window systems. * Size and Position:: Changing the size and position of a frame. * Geometry:: Parsing geometry specifications. diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 7e8ac09b44e..d5c89dd7cf3 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -1,7 +1,8 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../../info/functions @node Functions, Macros, Variables, Top diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 6b076d8ee3a..2420e777fe8 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -518,8 +518,7 @@ If all args return nil, return nil. @end group @group usage: (or CONDITIONS ...) */) - (args) - Lisp_Object args; + (Lisp_Object args) @{ register Lisp_Object val = Qnil; struct gcpro gcpro1; @@ -618,15 +617,15 @@ All the usual rules for documentation strings in Lisp code too. @end table - After the call to the @code{DEFUN} macro, you must write the argument -name list that every C function must have, followed by ordinary C -declarations for the arguments. For a function with a fixed maximum -number of arguments, declare a C argument for each Lisp argument, and -give them all type @code{Lisp_Object}. When a Lisp function has no -upper limit on the number of arguments, its implementation in C actually -receives exactly two arguments: the first is the number of Lisp -arguments, and the second is the address of a block containing their -values. They have types @code{int} and @w{@code{Lisp_Object *}}. + After the call to the @code{DEFUN} macro, you must write the +argument list that every C function must have, including the types for +the arguments. For a function with a fixed maximum number of +arguments, declare a C argument for each Lisp argument, and give them +all type @code{Lisp_Object}. When a Lisp function has no upper limit +on the number of arguments, its implementation in C actually receives +exactly two arguments: the first is the number of Lisp arguments, and +the second is the address of a block containing their values. They +have types @code{int} and @w{@code{Lisp_Object *}}. @cindex @code{GCPRO} and @code{UNGCPRO} @cindex protect C variables from garbage collection @@ -761,22 +760,22 @@ If they are on the border between WINDOW and its right sibling,\n\ @group switch (coordinates_in_window (XWINDOW (window), &x, &y)) @{ - case 0: /* NOT in window at all. */ + case 0: /* NOT in window at all. */ return Qnil; @end group @group - case 1: /* In text part of window. */ + case 1: /* In text part of window. */ return Fcons (make_number (x), make_number (y)); @end group @group - case 2: /* In mode line of window. */ + case 2: /* In mode line of window. */ return Qmode_line; @end group @group - case 3: /* On right border of window. */ + case 3: /* On right border of window. */ return Qvertical_line; @end group diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index d886b990dd8..e1052a9912e 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi @@ -1,7 +1,8 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1998, 1999, 2000, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../../info/keymaps @node Keymaps, Modes, Command Loop, Top @@ -16,19 +17,19 @@ used to look up the next input event; this continues until a command is found. The whole process is called @dfn{key lookup}. @menu -* Key Sequences:: Key sequences as Lisp objects. +* Key Sequences:: Key sequences as Lisp objects. * Keymap Basics:: Basic concepts of keymaps. -* Format of Keymaps:: What a keymap looks like as a Lisp object. -* Creating Keymaps:: Functions to create and copy keymaps. -* Inheritance and Keymaps:: How one keymap can inherit the bindings - of another keymap. +* Format of Keymaps:: What a keymap looks like as a Lisp object. +* Creating Keymaps:: Functions to create and copy keymaps. +* Inheritance and Keymaps:: How one keymap can inherit the bindings + of another keymap. * Prefix Keys:: Defining a key with a keymap as its definition. * Active Keymaps:: How Emacs searches the active keymaps for a key binding. * Searching Keymaps:: A pseudo-Lisp summary of searching active maps. * Controlling Active Maps:: Each buffer has a local keymap to override the standard (global) bindings. - A minor mode can also override them. + A minor mode can also override them. * Key Lookup:: Finding a key's binding in one keymap. * Functions for Key Lookup:: How to request key lookup. * Changing Key Bindings:: Redefining a key in a keymap. @@ -36,7 +37,7 @@ is found. The whole process is called @dfn{key lookup}. * Translation Keymaps:: Keymaps for translating sequences of events. * Key Binding Commands:: Interactive interfaces for redefining keys. * Scanning Keymaps:: Looking through all keymaps, for printing help. -* Menu Keymaps:: Defining a menu as a keymap. +* Menu Keymaps:: Defining a menu as a keymap. @end menu @node Key Sequences @@ -1959,11 +1960,11 @@ is active for the next input event, that activates the keyboard menu feature. @menu -* Defining Menus:: How to make a keymap that defines a menu. -* Mouse Menus:: How users actuate the menu with the mouse. -* Keyboard Menus:: How users actuate the menu with the keyboard. -* Menu Example:: Making a simple menu. -* Menu Bar:: How to customize the menu bar. +* Defining Menus:: How to make a keymap that defines a menu. +* Mouse Menus:: How users actuate the menu with the mouse. +* Keyboard Menus:: How users actuate the menu with the keyboard. +* Menu Example:: Making a simple menu. +* Menu Bar:: How to customize the menu bar. * Tool Bar:: A tool bar is a row of images. * Modifying Menus:: How to add new items to a menu. @end menu @@ -2413,10 +2414,10 @@ Next we define the menu items: @smallexample (define-key menu-bar-replace-menu [tags-repl-continue] '(menu-item "Continue Replace" tags-loop-continue - :help "Continue last tags replace operation")) + :help "Continue last tags replace operation")) (define-key menu-bar-replace-menu [tags-repl] '(menu-item "Replace in tagged files" tags-query-replace - :help "Interactively replace a regexp in all tagged files")) + :help "Interactively replace a regexp in all tagged files")) (define-key menu-bar-replace-menu [separator-replace-tags] '(menu-item "--")) ;; @r{@dots{}} @@ -2656,8 +2657,8 @@ using an indirection through @code{tool-bar-map}. By default, the global map binds @code{[tool-bar]} as follows: @example (global-set-key [tool-bar] - '(menu-item "tool bar" ignore - :filter (lambda (ignore) tool-bar-map))) + '(menu-item "tool bar" ignore + :filter (lambda (ignore) tool-bar-map))) @end example @noindent Thus the tool bar map is derived dynamically from the value of variable diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index 7e3240d72de..bbdd67fc3a5 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi @@ -1,7 +1,8 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../../info/loading @node Loading, Byte Compilation, Customization, Top @@ -43,9 +44,9 @@ containing Lisp code. * Repeated Loading:: Precautions about loading a file twice. * Named Features:: Loading a library if it isn't already loaded. * Where Defined:: Finding which file defined a certain symbol. -* Unloading:: How to "unload" a library that was loaded. -* Hooks for Loading:: Providing code to be run when - particular libraries are loaded. +* Unloading:: How to "unload" a library that was loaded. +* Hooks for Loading:: Providing code to be run when + particular libraries are loaded. @end menu @node How Programs Do Loading diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index bfe73ce27f4..3588704b054 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -1,7 +1,8 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, 2002, -@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../../info/minibuf @node Minibuffers, Command Loop, Read and Print, Top @@ -22,13 +23,13 @@ argument. * Intro to Minibuffers:: Basic information about minibuffers. * Text from Minibuffer:: How to read a straight text string. * Object from Minibuffer:: How to read a Lisp object or expression. -* Minibuffer History:: Recording previous minibuffer inputs - so the user can reuse them. +* Minibuffer History:: Recording previous minibuffer inputs + so the user can reuse them. * Initial Input:: Specifying initial contents for the minibuffer. * Completion:: How to invoke and customize completion. * Yes-or-No Queries:: Asking a question with a simple answer. -* Multiple Queries:: Asking a series of similar questions. -* Reading a Password:: Reading a password from the terminal. +* Multiple Queries:: Asking a series of similar questions. +* Reading a Password:: Reading a password from the terminal. * Minibuffer Commands:: Commands used as key bindings in minibuffers. * Minibuffer Contents:: How such commands access the minibuffer text. * Minibuffer Windows:: Operating on the special minibuffer windows. diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index e5eb90863af..858226ecdfc 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -1342,7 +1342,7 @@ or like this, using @code{add-to-list} (@pxref{List Variables}): Global minor modes distributed with Emacs should if possible support enabling and disabling via Custom (@pxref{Customization}). To do this, the first step is to define the mode variable with @code{defcustom}, and -specify @code{:type boolean}. +specify @code{:type 'boolean}. If just setting the variable is not sufficient to enable the mode, you should also specify a @code{:set} method which enables the mode by diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi index fdec0448e02..62b4796350e 100644 --- a/doc/lispref/numbers.texi +++ b/doc/lispref/numbers.texi @@ -21,10 +21,10 @@ exact; they have a fixed, limited amount of precision. @menu * Integer Basics:: Representation and range of integers. -* Float Basics:: Representation and range of floating point. +* Float Basics:: Representation and range of floating point. * Predicates on Numbers:: Testing for numbers. * Comparison of Numbers:: Equality and inequality predicates. -* Numeric Conversions:: Converting float to integer and vice versa. +* Numeric Conversions:: Converting float to integer and vice versa. * Arithmetic Operations:: How to add, subtract, multiply and divide. * Rounding Operations:: Explicitly rounding floating point numbers. * Bitwise Operations:: Logical and, or, not, shifting. diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 9fbc51ae12f..4f37eb10b7a 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -1,7 +1,8 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../../info/os @node System Interface, Antinews, Display, Top @@ -20,14 +21,14 @@ terminal and the screen. * Getting Out:: How exiting works (permanent or temporary). * System Environment:: Distinguish the name and kind of system. * User Identification:: Finding the name and user id of the user. -* Time of Day:: Getting the current time. +* Time of Day:: Getting the current time. * Time Conversion:: Converting a time from numeric form to calendrical data and vice versa. * Time Parsing:: Converting a time from numeric form to text and vice versa. * Processor Run Time:: Getting the run time used by Emacs. * Time Calculations:: Adding, subtracting, comparing times, etc. -* Timers:: Setting a timer to call a function at a certain time. +* Timers:: Setting a timer to call a function at a certain time. * Idle Timers:: Setting a timer to call a function when Emacs has been idle for a certain length of time. * Terminal Input:: Accessing and recording terminal input. @@ -1815,8 +1816,8 @@ manipulating terminal input. See @ref{Display}, for related functions. @menu -* Input Modes:: Options for how input is processed. -* Recording Input:: Saving histories of recent or all input events. +* Input Modes:: Options for how input is processed. +* Recording Input:: Saving histories of recent or all input events. @end menu @node Input Modes diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 85628bdfac6..1a4a766c81c 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -1,7 +1,8 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../../info/processes @node Processes, Display, Abbrevs, Top @@ -51,13 +52,13 @@ Processes}. * Sentinels:: Sentinels run when process run-status changes. * Query Before Exit:: Whether to query if exiting will kill a process. * System Processes:: Accessing other processes running on your system. -* Transaction Queues:: Transaction-based communication with subprocesses. +* Transaction Queues:: Transaction-based communication with subprocesses. * Network:: Opening network connections. * Network Servers:: Network servers let Emacs accept net connections. * Datagrams:: UDP network connections. * Low-Level Network:: Lower-level but more general function to create connections and servers. -* Misc Network:: Additional relevant functions for network connections. +* Misc Network:: Additional relevant functions for net connections. * Serial Ports:: Communicating with serial ports. * Byte Packing:: Using bindat to pack and unpack binary data. @end menu diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 722f76cdd7f..b4b4c23b1ed 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -1,7 +1,8 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../../info/searching @node Searching and Matching, Syntax Tables, Non-ASCII Characters, Top @@ -22,7 +23,7 @@ portions of it. * POSIX Regexps:: Searching POSIX-style for the longest match. * Match Data:: Finding out which part of the text matched, after a string or regexp search. -* Search and Replace:: Commands that loop, searching and replacing. +* Search and Replace:: Commands that loop, searching and replacing. * Standard Regexps:: Useful regexps for finding sentences, pages,... @end menu @@ -609,8 +610,8 @@ maximum. For example, @samp{c[ad]\@{1,2\@}r} matches the strings @samp{car}, @samp{cdr}, @samp{caar}, @samp{cadr}, @samp{cdar}, and @samp{cddr}, and nothing else.@* -@samp{\@{0,1\@}} or @samp{\@{,1\@}} is equivalent to @samp{?}. @* -@samp{\@{0,\@}} or @samp{\@{,\@}} is equivalent to @samp{*}. @* +@samp{\@{0,1\@}} or @samp{\@{,1\@}} is equivalent to @samp{?}.@* +@samp{\@{0,\@}} or @samp{\@{,\@}} is equivalent to @samp{*}.@* @samp{\@{1,\@}} is equivalent to @samp{+}. @item \( @dots{} \) @@ -1213,9 +1214,9 @@ can't avoid another intervening search, you must save and restore the match data around it, to prevent it from being overwritten. @menu -* Replacing Match:: Replacing a substring that was matched. +* Replacing Match:: Replacing a substring that was matched. * Simple Match Data:: Accessing single items of match data, - such as where a particular subexpression started. + such as where a particular subexpression started. * Entire Match Data:: Accessing the entire match data at once, as a list. * Saving Match Data:: Saving and restoring the match data. @end menu diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index f55c93abf31..a73c4790b96 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi @@ -1,7 +1,8 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../../info/sequences @node Sequences Arrays Vectors, Hash Tables, Lists, Top @@ -669,13 +670,13 @@ For example, here is how to examine the elements of the syntax table: (let (accumulator) (map-char-table #'(lambda (key value) - (setq accumulator - (cons (list - (if (consp key) - (list (car key) (cdr key)) - key) - value) - accumulator))) + (setq accumulator + (cons (list + (if (consp key) + (list (car key) (cdr key)) + key) + value) + accumulator))) (syntax-table)) accumulator) @result{} diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 34613a823ba..1128ca87d8a 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -1,7 +1,8 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../../info/strings @node Strings and Characters, Lists, Numbers, Top @@ -31,7 +32,7 @@ keyboard character events. * String Conversion:: Converting to and from characters and strings. * Formatting Strings:: @code{format}: Emacs's analogue of @code{printf}. * Case Conversion:: Case conversion functions. -* Case Tables:: Customizing case conversion. +* Case Tables:: Customizing case conversion. @end menu @node String Basics diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi index a3d5631baf8..9add9b76e79 100644 --- a/doc/lispref/syntax.texi +++ b/doc/lispref/syntax.texi @@ -1,7 +1,8 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../../info/syntax @node Syntax Tables, Abbrevs, Searching and Matching, Top @@ -23,7 +24,7 @@ functions in this chapter. * Desc: Syntax Descriptors. How characters are classified. * Syntax Table Functions:: How to create, examine and alter syntax tables. * Syntax Properties:: Overriding syntax with text properties. -* Motion and Syntax:: Moving over characters with certain syntaxes. +* Motion and Syntax:: Moving over characters with certain syntaxes. * Parsing Expressions:: Parsing balanced expressions using the syntax table. * Standard Syntax Tables:: Syntax tables used by various major modes. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 2eff8b109a0..f52d1db5c9c 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -1,7 +1,8 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, -@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../../info/text @node Text, Non-ASCII Characters, Markers, Top @@ -42,7 +43,7 @@ the character after point. * The Kill Ring:: Where removed text sometimes is saved for later use. * Undo:: Undoing changes to the text of a buffer. * Maintaining Undo:: How to enable and disable undo information. - How to control how much information is kept. + How to control how much information is kept. * Filling:: Functions for explicit filling. * Margins:: How to specify margins for filling commands. * Adaptive Fill:: Adaptive Fill mode chooses a fill prefix from context. @@ -821,7 +822,7 @@ would be difficult to change the terminology now. * Kill Functions:: Functions that kill text. * Yanking:: How yanking is done. * Yank Commands:: Commands that access the kill ring. -* Low-Level Kill Ring:: Functions and variables for kill ring access. +* Low-Level Kill Ring:: Functions and variables for kill ring access. * Internals of Kill Ring:: Variables that hold kill ring data. @end menu @@ -1298,13 +1299,16 @@ This function places a boundary element in the undo list. The undo command stops at such a boundary, and successive undo commands undo to earlier and earlier boundaries. This function returns @code{nil}. -The editor command loop automatically creates an undo boundary before -each key sequence is executed. Thus, each undo normally undoes the -effects of one command. Self-inserting input characters are an -exception. The command loop makes a boundary for the first such -character; the next 19 consecutive self-inserting input characters do -not make boundaries, and then the 20th does, and so on as long as -self-inserting characters continue. +The editor command loop automatically calls @code{undo-boundary} just +before executing each key sequence, so that each undo normally undoes +the effects of one command. As an exception, the command +@code{self-insert-command}, which produces self-inserting input +characters (@pxref{Commands for Insertion}), may remove the boundary +inserted by the command loop: a boundary is accepted for the first +such character, the next 19 consecutive self-inserting input +characters do not have boundaries, and then the 20th does; and so on +as long as the self-inserting characters continue. Hence, sequences +of consecutive character insertions can be undone as a group. All buffer modifications add a boundary whenever the previous undoable change was made in some other buffer. This is to ensure that @@ -2593,9 +2597,9 @@ along with the characters; this includes such diverse functions as @menu * Examining Properties:: Looking at the properties of one character. -* Changing Properties:: Setting the properties of a range of text. -* Property Search:: Searching for where a property changes value. -* Special Properties:: Particular properties with special meanings. +* Changing Properties:: Setting the properties of a range of text. +* Property Search:: Searching for where a property changes value. +* Special Properties:: Particular properties with special meanings. * Format Properties:: Properties for representing formatting of text. * Sticky Properties:: How inserted text gets properties from neighboring text. @@ -2605,8 +2609,8 @@ along with the characters; this includes such diverse functions as do something when you click on them. * Fields:: The @code{field} property defines fields within the buffer. -* Not Intervals:: Why text properties do not use - Lisp-visible text intervals. +* Not Intervals:: Why text properties do not use + Lisp-visible text intervals. @end menu @node Examining Properties diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index c1f1423dabf..de281b0e147 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi @@ -1,7 +1,8 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993, 1995, 1998, 1999, 2001, 2002, -@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +@c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../../info/tips @node Tips, GNU Emacs Internals, GPL, Top @@ -28,7 +29,7 @@ all. * Compilation Tips:: Making compiled code run fast. * Warning Tips:: Turning off compiler warnings. * Documentation Tips:: Writing readable documentation strings. -* Comment Tips:: Conventions for writing comments. +* Comment Tips:: Conventions for writing comments. * Library Headers:: Standard headers for library packages. @end menu diff --git a/doc/lispref/vol1.texi b/doc/lispref/vol1.texi index 052d83eacd7..4c0ae27c043 100644 --- a/doc/lispref/vol1.texi +++ b/doc/lispref/vol1.texi @@ -164,7 +164,7 @@ Reference Manual, corresponding to GNU Emacs version @value{EMACSVER}. files are made. * Buffers:: Creating and using buffer objects. * Windows:: Manipulating windows and displaying buffers. -* Frames:: Making multiple system-level windows. +* Frames:: Making multiple system-level windows. * Positions:: Buffer positions and motion functions. * Markers:: Markers represent positions and update automatically when the text is changed. @@ -176,7 +176,7 @@ Reference Manual, corresponding to GNU Emacs version @value{EMACSVER}. * Abbrevs:: How Abbrev mode works, and its data structures. * Processes:: Running and communicating with subprocesses. -* Display:: Features for controlling the screen display. +* Display:: Features for controlling the screen display. * System Interface:: Getting the user id, system type, environment variables, and other such things. @@ -311,10 +311,10 @@ Editing Types Numbers * Integer Basics:: Representation and range of integers. -* Float Basics:: Representation and range of floating point. +* Float Basics:: Representation and range of floating point. * Predicates on Numbers:: Testing for numbers. * Comparison of Numbers:: Equality and inequality predicates. -* Numeric Conversions:: Converting float to integer and vice versa. +* Numeric Conversions:: Converting float to integer and vice versa. * Arithmetic Operations:: How to add, subtract, multiply and divide. * Rounding Operations:: Explicitly rounding floating point numbers. * Bitwise Operations:: Logical and, or, not, shifting. @@ -331,7 +331,7 @@ Strings and Characters * String Conversion:: Converting to and from characters and strings. * Formatting Strings:: @code{format}: Emacs's analogue of @code{printf}. * Case Conversion:: Case conversion functions. -* Case Tables:: Customizing case conversion. +* Case Tables:: Customizing case conversion. Lists @@ -399,7 +399,7 @@ Kinds of Forms * Symbol Forms:: Symbols evaluate as variables. * Classifying Lists:: How to distinguish various sorts of list forms. * Function Indirection:: When a symbol appears as the car of a list, - we find the real function via the symbol. + we find the real function via the symbol. * Function Forms:: Forms that call functions. * Macro Forms:: Forms that call macros. * Special Forms:: "Special forms" are idiosyncratic primitives, @@ -480,9 +480,9 @@ Functions * Function Cells:: Accessing or setting the function definition of a symbol. * Obsolete Functions:: Declaring functions obsolete. -* Inline Functions:: Defining functions that the compiler +* Inline Functions:: Defining functions that the compiler will open code. -* Declaring Functions:: Telling the compiler that a function is defined. +* Declaring Functions:: Telling the compiler that a function is defined. * Function Safety:: Determining whether a function is safe to call. * Related Topics:: Cross-references to specific Lisp primitives that have a special bearing on how @@ -542,9 +542,9 @@ Loading * Repeated Loading:: Precautions about loading a file twice. * Named Features:: Loading a library if it isn't already loaded. * Where Defined:: Finding which file defined a certain symbol. -* Unloading:: How to "unload" a library that was loaded. -* Hooks for Loading:: Providing code to be run when - particular libraries are loaded. +* Unloading:: How to "unload" a library that was loaded. +* Hooks for Loading:: Providing code to be run when + particular libraries are loaded. Byte Compilation @@ -554,7 +554,7 @@ Byte Compilation * Dynamic Loading:: Dynamic loading of individual functions. * Eval During Compile:: Code to be evaluated when you compile. * Compiler Errors:: Handling compiler error messages. -* Byte-Code Objects:: The data type used for byte-compiled functions. +* Byte-Code Objects:: The data type used for byte-compiled functions. * Disassembly:: Disassembling byte-code; how to read byte-code. Advising Emacs Lisp Functions @@ -583,7 +583,7 @@ Debugging Lisp Programs The Lisp Debugger * Error Debugging:: Entering the debugger when an error happens. -* Infinite Loops:: Stopping and debugging a program that doesn't exit. +* Infinite Loops:: Stopping and debugging a program that doesn't exit. * Function Debugging:: Entering it when a certain function is called. * Explicit Debug:: Entering it at a certain point in the program. * Using Debugger:: What the debugger does; what you see while in it. @@ -593,24 +593,24 @@ The Lisp Debugger Edebug -* Using Edebug:: Introduction to use of Edebug. -* Instrumenting:: You must instrument your code - in order to debug it with Edebug. +* Using Edebug:: Introduction to use of Edebug. +* Instrumenting:: You must instrument your code + in order to debug it with Edebug. * Edebug Execution Modes:: Execution modes, stopping more or less often. -* Jumping:: Commands to jump to a specified place. -* Edebug Misc:: Miscellaneous commands. -* Breaks:: Setting breakpoints to make the program stop. -* Trapping Errors:: Trapping errors with Edebug. -* Edebug Views:: Views inside and outside of Edebug. -* Edebug Eval:: Evaluating expressions within Edebug. -* Eval List:: Expressions whose values are displayed - each time you enter Edebug. -* Printing in Edebug:: Customization of printing. -* Trace Buffer:: How to produce trace output in a buffer. -* Coverage Testing:: How to test evaluation coverage. -* The Outside Context:: Data that Edebug saves and restores. +* Jumping:: Commands to jump to a specified place. +* Edebug Misc:: Miscellaneous commands. +* Breaks:: Setting breakpoints to make the program stop. +* Trapping Errors:: Trapping errors with Edebug. +* Edebug Views:: Views inside and outside of Edebug. +* Edebug Eval:: Evaluating expressions within Edebug. +* Eval List:: Expressions whose values are displayed + each time you enter Edebug. +* Printing in Edebug:: Customization of printing. +* Trace Buffer:: How to produce trace output in a buffer. +* Coverage Testing:: How to test evaluation coverage. +* The Outside Context:: Data that Edebug saves and restores. * Edebug and Macros:: Specifying how to handle macro calls. -* Edebug Options:: Option variables for customizing Edebug. +* Edebug Options:: Option variables for customizing Edebug. Breaks @@ -627,8 +627,8 @@ The Outside Context Edebug and Macros * Instrumenting Macro Calls::The basic problem. -* Specification List:: How to specify complex patterns of evaluation. -* Backtracking:: What Edebug does when matching fails. +* Specification List:: How to specify complex patterns of evaluation. +* Backtracking:: What Edebug does when matching fails. * Specification Examples:: To help understand specifications. Debugging Invalid Lisp Syntax @@ -653,13 +653,13 @@ Minibuffers * Intro to Minibuffers:: Basic information about minibuffers. * Text from Minibuffer:: How to read a straight text string. * Object from Minibuffer:: How to read a Lisp object or expression. -* Minibuffer History:: Recording previous minibuffer inputs - so the user can reuse them. +* Minibuffer History:: Recording previous minibuffer inputs + so the user can reuse them. * Initial Input:: Specifying initial contents for the minibuffer. * Completion:: How to invoke and customize completion. * Yes-or-No Queries:: Asking a question with a simple answer. -* Multiple Queries:: Asking a series of similar questions. -* Reading a Password:: Reading a password from the terminal. +* Multiple Queries:: Asking a series of similar questions. +* Reading a Password:: Reading a password from the terminal. * Minibuffer Commands:: Commands used as key bindings in minibuffers. * Minibuffer Contents:: How such commands access the minibuffer text. * Minibuffer Windows:: Operating on the special minibuffer windows. @@ -687,7 +687,7 @@ Command Loop * Distinguish Interactive:: Making a command distinguish interactive calls. * Command Loop Info:: Variables set by the command loop for you to examine. * Adjusting Point:: Adjustment of point after a command. -* Input Events:: What input looks like when you read it. +* Input Events:: What input looks like when you read it. * Reading Input:: How to read input events from the keyboard or mouse. * Special Events:: Events processed immediately and individually. * Waiting:: Waiting for user input or elapsed time. @@ -721,7 +721,7 @@ Input Events * Event Examples:: Examples of the lists for mouse events. * Classifying Events:: Finding the modifier keys in an event symbol. Event types. -* Accessing Mouse:: Functions to extract info from mouse events. +* Accessing Mouse:: Functions to extract info from mouse events. * Accessing Scroll:: Functions to get info from scroll bar events. * Strings of Events:: Special considerations for putting keyboard character events in a string. @@ -871,9 +871,9 @@ Files * Changing Files:: Renaming files, changing protection, etc. * File Names:: Decomposing and expanding file names. * Contents of Directories:: Getting a list of the files in a directory. -* Create/Delete Dirs:: Creating and Deleting Directories. -* Magic File Names:: Defining "magic" special handling - for certain file names. +* Create/Delete Dirs:: Creating and Deleting Directories. +* Magic File Names:: Defining "magic" special handling + for certain file names. * Format Conversion:: Conversion to and from various file formats. Visiting Files @@ -885,7 +885,7 @@ Information about Files * Testing Accessibility:: Is a given file readable? Writable? * Kinds of Files:: Is it a directory? A symbolic link? -* Truenames:: Eliminating symbolic links from a file name. +* Truenames:: Eliminating symbolic links from a file name. * File Attributes:: How large is it? Any other names? Etc. * Locating Files:: How to find a file in standard places. @@ -955,8 +955,8 @@ Windows * Buffers and Windows:: Each window displays the contents of a buffer. * Displaying Buffers:: Higher-level functions for displaying a buffer and choosing a window for it. -* Choosing Window:: How to choose a window for displaying a buffer. -* Dedicated Windows:: How to avoid displaying another buffer in +* Choosing Window:: How to choose a window for displaying a buffer. +* Dedicated Windows:: How to avoid displaying another buffer in a specific window. * Window Point:: Each window has its own location of point. * Window Start and End:: Buffer positions indicating which text is @@ -976,37 +976,37 @@ Windows Frames -* Creating Frames:: Creating additional frames. +* Creating Frames:: Creating additional frames. * Multiple Terminals:: Displaying on several different devices. -* Frame Parameters:: Controlling frame size, position, font, etc. +* Frame Parameters:: Controlling frame size, position, font, etc. * Terminal Parameters:: Parameters common for all frames on terminal. * Frame Titles:: Automatic updating of frame titles. -* Deleting Frames:: Frames last until explicitly deleted. -* Finding All Frames:: How to examine all existing frames. -* Frames and Windows:: A frame contains windows; - display of text always works through windows. +* Deleting Frames:: Frames last until explicitly deleted. +* Finding All Frames:: How to examine all existing frames. +* Frames and Windows:: A frame contains windows; + display of text always works through windows. * Minibuffers and Frames:: How a frame finds the minibuffer to use. -* Input Focus:: Specifying the selected frame. +* Input Focus:: Specifying the selected frame. * Visibility of Frames:: Frames may be visible or invisible, or icons. * Raising and Lowering:: Raising a frame makes it hide other windows; - lowering it makes the others hide it. + lowering it makes the others hide it. * Frame Configurations:: Saving the state of all frames. -* Mouse Tracking:: Getting events that say when the mouse moves. -* Mouse Position:: Asking where the mouse is, or moving it. -* Pop-Up Menus:: Displaying a menu for the user to select from. +* Mouse Tracking:: Getting events that say when the mouse moves. +* Mouse Position:: Asking where the mouse is, or moving it. +* Pop-Up Menus:: Displaying a menu for the user to select from. * Dialog Boxes:: Displaying a box to ask yes or no. * Pointer Shape:: Specifying the shape of the mouse pointer. * Window System Selections::Transferring text to and from other X clients. * Drag and Drop:: Internals of Drag-and-Drop implementation. -* Color Names:: Getting the definitions of color names. +* Color Names:: Getting the definitions of color names. * Text Terminal Colors:: Defining colors for text-only terminals. -* Resources:: Getting resource values from the server. +* Resources:: Getting resource values from the server. * Display Feature Testing:: Determining the features of a terminal. Frame Parameters * Parameter Access:: How to change a frame's parameters. -* Initial Parameters:: Specifying frame parameters when you make a frame. +* Initial Parameters:: Specifying frame parameters when you make a frame. * Window Frame Parameters:: List of frame parameters for window systems. * Size and Position:: Changing the size and position of a frame. * Geometry:: Parsing geometry specifications. @@ -1065,7 +1065,7 @@ Text later use. * Undo:: Undoing changes to the text of a buffer. * Maintaining Undo:: How to enable and disable undo information. - How to control how much information is kept. + How to control how much information is kept. * Filling:: Functions for explicit filling. * Margins:: How to specify margins for filling commands. * Adaptive Fill:: Adaptive Fill mode chooses a fill prefix @@ -1091,7 +1091,7 @@ The Kill Ring * Kill Functions:: Functions that kill text. * Yanking:: How yanking is done. * Yank Commands:: Commands that access the kill ring. -* Low-Level Kill Ring:: Functions and variables for kill ring access. +* Low-Level Kill Ring:: Functions and variables for kill ring access. * Internals of Kill Ring:: Variables that hold kill ring data. Indentation @@ -1106,9 +1106,9 @@ Indentation Text Properties * Examining Properties:: Looking at the properties of one character. -* Changing Properties:: Setting the properties of a range of text. -* Property Search:: Searching for where a property changes value. -* Special Properties:: Particular properties with special meanings. +* Changing Properties:: Setting the properties of a range of text. +* Property Search:: Searching for where a property changes value. +* Special Properties:: Particular properties with special meanings. * Format Properties:: Properties for representing formatting of text. * Sticky Properties:: How inserted text gets properties from neighboring text. @@ -1118,8 +1118,8 @@ Text Properties do something when you click on them. * Fields:: The @code{field} property defines fields within the buffer. -* Not Intervals:: Why text properties do not use - Lisp-visible text intervals. +* Not Intervals:: Why text properties do not use + Lisp-visible text intervals. Non-@acronym{ASCII} Characters @@ -1162,7 +1162,7 @@ Searching and Matching * POSIX Regexps:: Searching POSIX-style for the longest match. * Match Data:: Finding out which part of the text matched, after a string or regexp search. -* Search and Replace:: Commands that loop, searching and replacing. +* Search and Replace:: Commands that loop, searching and replacing. * Standard Regexps:: Useful regexps for finding sentences, pages,... Regular Expressions @@ -1179,9 +1179,9 @@ Syntax of Regular Expressions The Match Data -* Replacing Match:: Replacing a substring that was matched. +* Replacing Match:: Replacing a substring that was matched. * Simple Match Data:: Accessing single items of match data, - such as where a particular subexpression started. + such as where a particular subexpression started. * Entire Match Data:: Accessing the entire match data at once, as a list. * Saving Match Data:: Saving and restoring the match data. @@ -1191,7 +1191,7 @@ Syntax Tables * Syntax Descriptors:: How characters are classified. * Syntax Table Functions:: How to create, examine and alter syntax tables. * Syntax Properties:: Overriding syntax with text properties. -* Motion and Syntax:: Moving over characters with certain syntaxes. +* Motion and Syntax:: Moving over characters with certain syntaxes. * Parsing Expressions:: Parsing balanced expressions using the syntax table. * Standard Syntax Tables:: Syntax tables used by various major modes. @@ -1280,10 +1280,10 @@ Emacs Display * Invisible Text:: Hiding part of the buffer text. * Selective Display:: Hiding part of the buffer text (the old way). * Temporary Displays:: Displays that go away automatically. -* Overlays:: Use overlays to highlight parts of the buffer. +* Overlays:: Use overlays to highlight parts of the buffer. * Width:: How wide a character or string is on the screen. * Line Height:: Controlling the height of lines. -* Faces:: A face defines a graphics style +* Faces:: A face defines a graphics style for text characters: font, colors, etc. * Fringes:: Controlling window fringes. * Scroll Bars:: Controlling vertical scroll bars. @@ -1292,9 +1292,9 @@ Emacs Display * Buttons:: Adding clickable buttons to Emacs buffers. * Abstract Display:: Emacs' Widget for Object Collections. * Blinking:: How Emacs shows the matching open parenthesis. -* Usual Display:: The usual conventions for displaying +* Usual Display:: The usual conventions for displaying nonprinting chars. -* Display Tables:: How to specify other conventions. +* Display Tables:: How to specify other conventions. * Beeping:: Audible signal to the user. * Window Systems:: Which window system is being used. @@ -1316,7 +1316,7 @@ Overlays * Managing Overlays:: Creating and moving overlays. * Overlay Properties:: How to read and set properties. - What properties do to the screen display. + What properties do to the screen display. * Finding Overlays:: Searching for overlays. Faces @@ -1396,14 +1396,14 @@ Operating System Interface * Getting Out:: How exiting works (permanent or temporary). * System Environment:: Distinguish the name and kind of system. * User Identification:: Finding the name and user id of the user. -* Time of Day:: Getting the current time. +* Time of Day:: Getting the current time. * Time Conversion:: Converting a time from numeric form to calendrical data and vice versa. * Time Parsing:: Converting a time from numeric form to text and vice versa. * Processor Run Time:: Getting the run time used by Emacs. * Time Calculations:: Adding, subtracting, comparing times, etc. -* Timers:: Setting a timer to call a function at a +* Timers:: Setting a timer to call a function at a certain time. * Idle Timers:: Setting a timer to call a function when Emacs has been idle for a certain length of time. @@ -1430,8 +1430,8 @@ Getting Out of Emacs Terminal Input -* Input Modes:: Options for how input is processed. -* Recording Input:: Saving histories of recent or all input events. +* Input Modes:: Options for how input is processed. +* Recording Input:: Saving histories of recent or all input events. Tips and Conventions @@ -1441,7 +1441,7 @@ Tips and Conventions * Compilation Tips:: Making compiled code run fast. * Warning Tips:: Turning off compiler warnings. * Documentation Tips:: Writing readable documentation strings. -* Comment Tips:: Conventions for writing comments. +* Comment Tips:: Conventions for writing comments. * Library Headers:: Standard headers for library packages. GNU Emacs Internals diff --git a/doc/lispref/vol2.texi b/doc/lispref/vol2.texi index d6358f3ecfc..195b89ce3f6 100644 --- a/doc/lispref/vol2.texi +++ b/doc/lispref/vol2.texi @@ -163,7 +163,7 @@ Reference Manual, corresponding to GNU Emacs version @value{EMACSVER}. files are made. * Buffers:: Creating and using buffer objects. * Windows:: Manipulating windows and displaying buffers. -* Frames:: Making multiple system-level windows. +* Frames:: Making multiple system-level windows. * Positions:: Buffer positions and motion functions. * Markers:: Markers represent positions and update automatically when the text is changed. @@ -175,7 +175,7 @@ Reference Manual, corresponding to GNU Emacs version @value{EMACSVER}. * Abbrevs:: How Abbrev mode works, and its data structures. * Processes:: Running and communicating with subprocesses. -* Display:: Features for controlling the screen display. +* Display:: Features for controlling the screen display. * System Interface:: Getting the user id, system type, environment variables, and other such things. @@ -310,10 +310,10 @@ Editing Types Numbers * Integer Basics:: Representation and range of integers. -* Float Basics:: Representation and range of floating point. +* Float Basics:: Representation and range of floating point. * Predicates on Numbers:: Testing for numbers. * Comparison of Numbers:: Equality and inequality predicates. -* Numeric Conversions:: Converting float to integer and vice versa. +* Numeric Conversions:: Converting float to integer and vice versa. * Arithmetic Operations:: How to add, subtract, multiply and divide. * Rounding Operations:: Explicitly rounding floating point numbers. * Bitwise Operations:: Logical and, or, not, shifting. @@ -330,7 +330,7 @@ Strings and Characters * String Conversion:: Converting to and from characters and strings. * Formatting Strings:: @code{format}: Emacs's analogue of @code{printf}. * Case Conversion:: Case conversion functions. -* Case Tables:: Customizing case conversion. +* Case Tables:: Customizing case conversion. Lists @@ -398,7 +398,7 @@ Kinds of Forms * Symbol Forms:: Symbols evaluate as variables. * Classifying Lists:: How to distinguish various sorts of list forms. * Function Indirection:: When a symbol appears as the car of a list, - we find the real function via the symbol. + we find the real function via the symbol. * Function Forms:: Forms that call functions. * Macro Forms:: Forms that call macros. * Special Forms:: "Special forms" are idiosyncratic primitives, @@ -479,9 +479,9 @@ Functions * Function Cells:: Accessing or setting the function definition of a symbol. * Obsolete Functions:: Declaring functions obsolete. -* Inline Functions:: Defining functions that the compiler +* Inline Functions:: Defining functions that the compiler will open code. -* Declaring Functions:: Telling the compiler that a function is defined. +* Declaring Functions:: Telling the compiler that a function is defined. * Function Safety:: Determining whether a function is safe to call. * Related Topics:: Cross-references to specific Lisp primitives that have a special bearing on how @@ -541,9 +541,9 @@ Loading * Repeated Loading:: Precautions about loading a file twice. * Named Features:: Loading a library if it isn't already loaded. * Where Defined:: Finding which file defined a certain symbol. -* Unloading:: How to "unload" a library that was loaded. -* Hooks for Loading:: Providing code to be run when - particular libraries are loaded. +* Unloading:: How to "unload" a library that was loaded. +* Hooks for Loading:: Providing code to be run when + particular libraries are loaded. Byte Compilation @@ -553,7 +553,7 @@ Byte Compilation * Dynamic Loading:: Dynamic loading of individual functions. * Eval During Compile:: Code to be evaluated when you compile. * Compiler Errors:: Handling compiler error messages. -* Byte-Code Objects:: The data type used for byte-compiled functions. +* Byte-Code Objects:: The data type used for byte-compiled functions. * Disassembly:: Disassembling byte-code; how to read byte-code. Advising Emacs Lisp Functions @@ -582,7 +582,7 @@ Debugging Lisp Programs The Lisp Debugger * Error Debugging:: Entering the debugger when an error happens. -* Infinite Loops:: Stopping and debugging a program that doesn't exit. +* Infinite Loops:: Stopping and debugging a program that doesn't exit. * Function Debugging:: Entering it when a certain function is called. * Explicit Debug:: Entering it at a certain point in the program. * Using Debugger:: What the debugger does; what you see while in it. @@ -592,24 +592,24 @@ The Lisp Debugger Edebug -* Using Edebug:: Introduction to use of Edebug. -* Instrumenting:: You must instrument your code - in order to debug it with Edebug. +* Using Edebug:: Introduction to use of Edebug. +* Instrumenting:: You must instrument your code + in order to debug it with Edebug. * Edebug Execution Modes:: Execution modes, stopping more or less often. -* Jumping:: Commands to jump to a specified place. -* Edebug Misc:: Miscellaneous commands. -* Breaks:: Setting breakpoints to make the program stop. -* Trapping Errors:: Trapping errors with Edebug. -* Edebug Views:: Views inside and outside of Edebug. -* Edebug Eval:: Evaluating expressions within Edebug. -* Eval List:: Expressions whose values are displayed - each time you enter Edebug. -* Printing in Edebug:: Customization of printing. -* Trace Buffer:: How to produce trace output in a buffer. -* Coverage Testing:: How to test evaluation coverage. -* The Outside Context:: Data that Edebug saves and restores. +* Jumping:: Commands to jump to a specified place. +* Edebug Misc:: Miscellaneous commands. +* Breaks:: Setting breakpoints to make the program stop. +* Trapping Errors:: Trapping errors with Edebug. +* Edebug Views:: Views inside and outside of Edebug. +* Edebug Eval:: Evaluating expressions within Edebug. +* Eval List:: Expressions whose values are displayed + each time you enter Edebug. +* Printing in Edebug:: Customization of printing. +* Trace Buffer:: How to produce trace output in a buffer. +* Coverage Testing:: How to test evaluation coverage. +* The Outside Context:: Data that Edebug saves and restores. * Edebug and Macros:: Specifying how to handle macro calls. -* Edebug Options:: Option variables for customizing Edebug. +* Edebug Options:: Option variables for customizing Edebug. Breaks @@ -626,8 +626,8 @@ The Outside Context Edebug and Macros * Instrumenting Macro Calls::The basic problem. -* Specification List:: How to specify complex patterns of evaluation. -* Backtracking:: What Edebug does when matching fails. +* Specification List:: How to specify complex patterns of evaluation. +* Backtracking:: What Edebug does when matching fails. * Specification Examples:: To help understand specifications. Debugging Invalid Lisp Syntax @@ -652,13 +652,13 @@ Minibuffers * Intro to Minibuffers:: Basic information about minibuffers. * Text from Minibuffer:: How to read a straight text string. * Object from Minibuffer:: How to read a Lisp object or expression. -* Minibuffer History:: Recording previous minibuffer inputs - so the user can reuse them. +* Minibuffer History:: Recording previous minibuffer inputs + so the user can reuse them. * Initial Input:: Specifying initial contents for the minibuffer. * Completion:: How to invoke and customize completion. * Yes-or-No Queries:: Asking a question with a simple answer. -* Multiple Queries:: Asking a series of similar questions. -* Reading a Password:: Reading a password from the terminal. +* Multiple Queries:: Asking a series of similar questions. +* Reading a Password:: Reading a password from the terminal. * Minibuffer Commands:: Commands used as key bindings in minibuffers. * Minibuffer Contents:: How such commands access the minibuffer text. * Minibuffer Windows:: Operating on the special minibuffer windows. @@ -686,7 +686,7 @@ Command Loop * Distinguish Interactive:: Making a command distinguish interactive calls. * Command Loop Info:: Variables set by the command loop for you to examine. * Adjusting Point:: Adjustment of point after a command. -* Input Events:: What input looks like when you read it. +* Input Events:: What input looks like when you read it. * Reading Input:: How to read input events from the keyboard or mouse. * Special Events:: Events processed immediately and individually. * Waiting:: Waiting for user input or elapsed time. @@ -720,7 +720,7 @@ Input Events * Event Examples:: Examples of the lists for mouse events. * Classifying Events:: Finding the modifier keys in an event symbol. Event types. -* Accessing Mouse:: Functions to extract info from mouse events. +* Accessing Mouse:: Functions to extract info from mouse events. * Accessing Scroll:: Functions to get info from scroll bar events. * Strings of Events:: Special considerations for putting keyboard character events in a string. @@ -870,9 +870,9 @@ Files * Changing Files:: Renaming files, changing protection, etc. * File Names:: Decomposing and expanding file names. * Contents of Directories:: Getting a list of the files in a directory. -* Create/Delete Dirs:: Creating and Deleting Directories. -* Magic File Names:: Defining "magic" special handling - for certain file names. +* Create/Delete Dirs:: Creating and Deleting Directories. +* Magic File Names:: Defining "magic" special handling + for certain file names. * Format Conversion:: Conversion to and from various file formats. Visiting Files @@ -884,7 +884,7 @@ Information about Files * Testing Accessibility:: Is a given file readable? Writable? * Kinds of Files:: Is it a directory? A symbolic link? -* Truenames:: Eliminating symbolic links from a file name. +* Truenames:: Eliminating symbolic links from a file name. * File Attributes:: How large is it? Any other names? Etc. * Locating Files:: How to find a file in standard places. @@ -954,8 +954,8 @@ Windows * Buffers and Windows:: Each window displays the contents of a buffer. * Displaying Buffers:: Higher-level functions for displaying a buffer and choosing a window for it. -* Choosing Window:: How to choose a window for displaying a buffer. -* Dedicated Windows:: How to avoid displaying another buffer in +* Choosing Window:: How to choose a window for displaying a buffer. +* Dedicated Windows:: How to avoid displaying another buffer in a specific window. * Window Point:: Each window has its own location of point. * Window Start and End:: Buffer positions indicating which text is @@ -975,37 +975,37 @@ Windows Frames -* Creating Frames:: Creating additional frames. +* Creating Frames:: Creating additional frames. * Multiple Terminals:: Displaying on several different devices. -* Frame Parameters:: Controlling frame size, position, font, etc. +* Frame Parameters:: Controlling frame size, position, font, etc. * Terminal Parameters:: Parameters common for all frames on terminal. * Frame Titles:: Automatic updating of frame titles. -* Deleting Frames:: Frames last until explicitly deleted. -* Finding All Frames:: How to examine all existing frames. -* Frames and Windows:: A frame contains windows; - display of text always works through windows. +* Deleting Frames:: Frames last until explicitly deleted. +* Finding All Frames:: How to examine all existing frames. +* Frames and Windows:: A frame contains windows; + display of text always works through windows. * Minibuffers and Frames:: How a frame finds the minibuffer to use. -* Input Focus:: Specifying the selected frame. +* Input Focus:: Specifying the selected frame. * Visibility of Frames:: Frames may be visible or invisible, or icons. * Raising and Lowering:: Raising a frame makes it hide other windows; - lowering it makes the others hide it. + lowering it makes the others hide it. * Frame Configurations:: Saving the state of all frames. -* Mouse Tracking:: Getting events that say when the mouse moves. -* Mouse Position:: Asking where the mouse is, or moving it. -* Pop-Up Menus:: Displaying a menu for the user to select from. +* Mouse Tracking:: Getting events that say when the mouse moves. +* Mouse Position:: Asking where the mouse is, or moving it. +* Pop-Up Menus:: Displaying a menu for the user to select from. * Dialog Boxes:: Displaying a box to ask yes or no. * Pointer Shape:: Specifying the shape of the mouse pointer. * Window System Selections::Transferring text to and from other X clients. * Drag and Drop:: Internals of Drag-and-Drop implementation. -* Color Names:: Getting the definitions of color names. +* Color Names:: Getting the definitions of color names. * Text Terminal Colors:: Defining colors for text-only terminals. -* Resources:: Getting resource values from the server. +* Resources:: Getting resource values from the server. * Display Feature Testing:: Determining the features of a terminal. Frame Parameters * Parameter Access:: How to change a frame's parameters. -* Initial Parameters:: Specifying frame parameters when you make a frame. +* Initial Parameters:: Specifying frame parameters when you make a frame. * Window Frame Parameters:: List of frame parameters for window systems. * Size and Position:: Changing the size and position of a frame. * Geometry:: Parsing geometry specifications. @@ -1064,7 +1064,7 @@ Text later use. * Undo:: Undoing changes to the text of a buffer. * Maintaining Undo:: How to enable and disable undo information. - How to control how much information is kept. + How to control how much information is kept. * Filling:: Functions for explicit filling. * Margins:: How to specify margins for filling commands. * Adaptive Fill:: Adaptive Fill mode chooses a fill prefix @@ -1090,7 +1090,7 @@ The Kill Ring * Kill Functions:: Functions that kill text. * Yanking:: How yanking is done. * Yank Commands:: Commands that access the kill ring. -* Low-Level Kill Ring:: Functions and variables for kill ring access. +* Low-Level Kill Ring:: Functions and variables for kill ring access. * Internals of Kill Ring:: Variables that hold kill ring data. Indentation @@ -1105,9 +1105,9 @@ Indentation Text Properties * Examining Properties:: Looking at the properties of one character. -* Changing Properties:: Setting the properties of a range of text. -* Property Search:: Searching for where a property changes value. -* Special Properties:: Particular properties with special meanings. +* Changing Properties:: Setting the properties of a range of text. +* Property Search:: Searching for where a property changes value. +* Special Properties:: Particular properties with special meanings. * Format Properties:: Properties for representing formatting of text. * Sticky Properties:: How inserted text gets properties from neighboring text. @@ -1117,8 +1117,8 @@ Text Properties do something when you click on them. * Fields:: The @code{field} property defines fields within the buffer. -* Not Intervals:: Why text properties do not use - Lisp-visible text intervals. +* Not Intervals:: Why text properties do not use + Lisp-visible text intervals. Non-@acronym{ASCII} Characters @@ -1161,7 +1161,7 @@ Searching and Matching * POSIX Regexps:: Searching POSIX-style for the longest match. * Match Data:: Finding out which part of the text matched, after a string or regexp search. -* Search and Replace:: Commands that loop, searching and replacing. +* Search and Replace:: Commands that loop, searching and replacing. * Standard Regexps:: Useful regexps for finding sentences, pages,... Regular Expressions @@ -1178,9 +1178,9 @@ Syntax of Regular Expressions The Match Data -* Replacing Match:: Replacing a substring that was matched. +* Replacing Match:: Replacing a substring that was matched. * Simple Match Data:: Accessing single items of match data, - such as where a particular subexpression started. + such as where a particular subexpression started. * Entire Match Data:: Accessing the entire match data at once, as a list. * Saving Match Data:: Saving and restoring the match data. @@ -1190,7 +1190,7 @@ Syntax Tables * Syntax Descriptors:: How characters are classified. * Syntax Table Functions:: How to create, examine and alter syntax tables. * Syntax Properties:: Overriding syntax with text properties. -* Motion and Syntax:: Moving over characters with certain syntaxes. +* Motion and Syntax:: Moving over characters with certain syntaxes. * Parsing Expressions:: Parsing balanced expressions using the syntax table. * Standard Syntax Tables:: Syntax tables used by various major modes. @@ -1279,10 +1279,10 @@ Emacs Display * Invisible Text:: Hiding part of the buffer text. * Selective Display:: Hiding part of the buffer text (the old way). * Temporary Displays:: Displays that go away automatically. -* Overlays:: Use overlays to highlight parts of the buffer. +* Overlays:: Use overlays to highlight parts of the buffer. * Width:: How wide a character or string is on the screen. * Line Height:: Controlling the height of lines. -* Faces:: A face defines a graphics style +* Faces:: A face defines a graphics style for text characters: font, colors, etc. * Fringes:: Controlling window fringes. * Scroll Bars:: Controlling vertical scroll bars. @@ -1291,9 +1291,9 @@ Emacs Display * Buttons:: Adding clickable buttons to Emacs buffers. * Abstract Display:: Emacs' Widget for Object Collections. * Blinking:: How Emacs shows the matching open parenthesis. -* Usual Display:: The usual conventions for displaying +* Usual Display:: The usual conventions for displaying nonprinting chars. -* Display Tables:: How to specify other conventions. +* Display Tables:: How to specify other conventions. * Beeping:: Audible signal to the user. * Window Systems:: Which window system is being used. @@ -1315,7 +1315,7 @@ Overlays * Managing Overlays:: Creating and moving overlays. * Overlay Properties:: How to read and set properties. - What properties do to the screen display. + What properties do to the screen display. * Finding Overlays:: Searching for overlays. Faces @@ -1395,14 +1395,14 @@ Operating System Interface * Getting Out:: How exiting works (permanent or temporary). * System Environment:: Distinguish the name and kind of system. * User Identification:: Finding the name and user id of the user. -* Time of Day:: Getting the current time. +* Time of Day:: Getting the current time. * Time Conversion:: Converting a time from numeric form to calendrical data and vice versa. * Time Parsing:: Converting a time from numeric form to text and vice versa. * Processor Run Time:: Getting the run time used by Emacs. * Time Calculations:: Adding, subtracting, comparing times, etc. -* Timers:: Setting a timer to call a function at a +* Timers:: Setting a timer to call a function at a certain time. * Idle Timers:: Setting a timer to call a function when Emacs has been idle for a certain length of time. @@ -1429,8 +1429,8 @@ Getting Out of Emacs Terminal Input -* Input Modes:: Options for how input is processed. -* Recording Input:: Saving histories of recent or all input events. +* Input Modes:: Options for how input is processed. +* Recording Input:: Saving histories of recent or all input events. Tips and Conventions @@ -1440,7 +1440,7 @@ Tips and Conventions * Compilation Tips:: Making compiled code run fast. * Warning Tips:: Turning off compiler warnings. * Documentation Tips:: Writing readable documentation strings. -* Comment Tips:: Conventions for writing comments. +* Comment Tips:: Conventions for writing comments. * Library Headers:: Standard headers for library packages. GNU Emacs Internals diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index de7ebbc405e..704f3ad3321 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -22,8 +22,8 @@ windows. * Buffers and Windows:: Each window displays the contents of a buffer. * Displaying Buffers:: Higher-level functions for displaying a buffer and choosing a window for it. -* Choosing Window:: How to choose a window for displaying a buffer. -* Dedicated Windows:: How to avoid displaying another buffer in +* Choosing Window:: How to choose a window for displaying a buffer. +* Dedicated Windows:: How to avoid displaying another buffer in a specific window. * Window Point:: Each window has its own location of point. * Window Start and End:: Buffer positions indicating which text is diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index a159715a69d..44d1e00be0d 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,74 @@ +2010-07-19 Juanma Barranquero + + * org.texi: Fix typo in previous change (2010-07-19T09:47:27Z!carsten.dominik@gmail.com). + +2010-07-19 Carsten Dominik + + * org.texi: Add macros to get plain quotes in PDF output. + List additional contributors. + (Capture): New section, replaces the section about remember. + (Working With Source Code): New chapter, focused on documenting Org + Babel. + (Code evaluation security): New section. + (MobileOrg): Document DropBox support. + (TaskJuggler export): Document taskjuggler and Gantt chart support. + (Special symbols): Show how to display UTF8 characters for entities. + (Global TODO list): Clarify the use of the "M" key and the differences + to the "m" key. + (RSS Feeds): Mention Atom feeds as well. + (Setting tags): Remove paragraph about + `org-complete-tags-always-offer-all-agenda-tags'. + +2010-07-17 Michael Albinus + + * tramp.texi (Inline methods): Remove remark about doubled "-t" + argument. + (Frequently Asked Questions): Recommend "sshx" and "scpx" for + echoing shells. + +2010-07-10 Michael Albinus + + * tramp.texi (Inline methods): Remove "kludgy" phrase. + (Filename Syntax): Describe port numbers. + +2010-07-09 Michael Albinus + + * dbus.texi (Top): Introduce Index. Emphasize "nil" whereever + forgotten. + (Type Conversion): Precise conversion of natural numbers. + (Errors and Events): Add "debugging" to concept index. Add variable + `dbus-debug'. + +2010-07-04 Michael Albinus + + * dbus.texi (Receiving Method Calls): Add optional argument + EMITS-SIGNAL to `dbus-register-property'. + +2010-06-27 Alex Schroeder + + * nxml-mode.texi (Commands for locating a schema): Fix typo. + +2010-06-24 Glenn Morris + + * ada-mode.texi, auth.texi, autotype.texi, calc.texi, cc-mode.texi: + * dired-x.texi, ebrowse.texi, ede.texi, edt.texi, eieio.texi: + * emacs-mime.texi, epa.texi, erc.texi, eshell.texi, eudc.texi: + * flymake.texi, gnus.texi, info.texi, mairix-el.texi, message.texi: + * newsticker.texi, org.texi, pgg.texi, rcirc.texi, reftex.texi: + * remember.texi, sasl.texi, semantic.texi, ses.texi, smtpmail.texi: + * speedbar.texi, tramp.texi, url.texi, viper.texi, widget.texi: + * woman.texi: Start direntry descriptions in column 32, per Texinfo + convention. Make them end with a period. + +2010-06-23 Glenn Morris + + * autotype.texi, cl.texi, dired-x.texi, ebrowse.texi, ede.texi: + * eieio.texi, epa.texi, faq.texi, flymake.texi, forms.texi: + * gnus-faq.texi, idlwave.texi, mh-e.texi, nxml-mode.texi, org.texi: + * pcl-cvs.texi, pgg.texi, reftex.texi, sasl.texi, sc.texi, + * sem-user.texi, semantic.texi, sieve.texi, smtpmail.texi, + * speedbar.texi, vip.texi, viper.texi, widget.texi: Untabify. + 2010-06-10 Glenn Morris * idlwave.texi (Load-Path Shadows): @@ -38,7 +109,7 @@ * Version 23.2 released. -2010-05-01 Daniel E. Doherty (tiny change) +2010-05-01 Daniel E. Doherty (tiny change) * calc.texi (Tutorial): Use "^{\prime}" to indicate primes. @@ -187,7 +258,7 @@ 2010-01-17 Michael Albinus * tramp.texi (Frequently Asked Questions): Add GNU Emacs 23 and - SXEmacs 22 to the supported systems. New item for hung ssh sessions. + SXEmacs 22 to the supported systems. New item for hung ssh sessions. 2010-01-17 Glenn Morris @@ -6451,10 +6522,6 @@ (INFO_TARGETS): Add ../info/cc-mode. (DVI_TARGETS): Add cc-mode.dvi. -1996-05-25 Karl Heuer - - * Version 19.31 released. - 1995-11-24 Richard Stallman * Version 19.30 released. diff --git a/doc/misc/ada-mode.texi b/doc/misc/ada-mode.texi index 86d63e5ed9b..b746824df67 100644 --- a/doc/misc/ada-mode.texi +++ b/doc/misc/ada-mode.texi @@ -3,8 +3,8 @@ @settitle Ada Mode @copying -Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, -2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +2007, 2008, 2009, 2010 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -22,7 +22,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Ada mode: (ada-mode). Emacs mode for editing and compiling Ada code. +* Ada mode: (ada-mode). Emacs mode for editing and compiling Ada code. @end direntry @titlepage diff --git a/doc/misc/auth.texi b/doc/misc/auth.texi index a2c319c583f..85e691d4b62 100644 --- a/doc/misc/auth.texi +++ b/doc/misc/auth.texi @@ -31,7 +31,7 @@ license to the document, as described in section 6 of the license. @dircategory Emacs @direntry -* Auth-source: (auth). The Emacs auth-source library. +* Auth-source: (auth). The Emacs auth-source library. @end direntry @titlepage diff --git a/doc/misc/autotype.texi b/doc/misc/autotype.texi index a2ea8ad2c11..3f7ad21f1d3 100644 --- a/doc/misc/autotype.texi +++ b/doc/misc/autotype.texi @@ -10,8 +10,8 @@ @c @cindex autotypist @copying -Copyright @copyright{} 1994, 1995, 1999, 2001, 2002, 2003, 2004, -2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright @copyright{} 1994, 1995, 1999, 2001, 2002, 2003, 2004, 2005, +2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -29,8 +29,8 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Autotype: (autotype). Convenient features for text that you enter frequently - in Emacs. +* Autotype: (autotype). Convenient features for text that you + enter frequently in Emacs. @end direntry @titlepage @@ -92,7 +92,7 @@ completions and expansions of text at point. after point. * Autoinserting:: Filling up empty files as soon as you visit them. * Copyrights:: Inserting and updating copyrights. -* Executables:: Turning interpreter scripts into executables. +* Executables:: Turning interpreter scripts into executables. * Timestamps:: Updating dates and times in modified files. * QuickURL:: Inserting URLs based on text at point. * Tempo:: Flexible template insertion. @@ -201,7 +201,7 @@ the output from @kbd{M-x list-abbrevs} to make it look like this: @example (c-mode-abbrev-table) -"if" 0 "" c-if +"if" 0 "" c-if @end example @noindent diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index 12b8d8e162d..ab81cf1bca2 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi @@ -111,7 +111,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Calc: (calc). Advanced desk calculator and mathematical tool. +* Calc: (calc). Advanced desk calculator and mathematical tool. @end direntry @titlepage diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi index bfe09b64244..c1d8db80dae 100644 --- a/doc/misc/cc-mode.texi +++ b/doc/misc/cc-mode.texi @@ -180,8 +180,8 @@ developing GNU and promoting software freedom.'' @comment here is by request from the FSF folks. @dircategory Emacs @direntry -* CC Mode: (ccmode). Emacs mode for editing C, C++, Objective-C, - Java, Pike, AWK, and CORBA IDL code. +* CC Mode: (ccmode). Emacs mode for editing C, C++, Objective-C, + Java, Pike, AWK, and CORBA IDL code. @end direntry @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index 39561341b0d..755b2f3f1b7 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -24,7 +24,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* CL: (cl). Partial Common Lisp support for Emacs Lisp. +* CL: (cl). Partial Common Lisp support for Emacs Lisp. @end direntry @finalout diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi index c92cb279f09..248884532df 100644 --- a/doc/misc/dbus.texi +++ b/doc/misc/dbus.texi @@ -5,6 +5,9 @@ @c @setchapternewpage odd @c %**end of header +@syncodeindex vr cp +@syncodeindex fn cp + @copying Copyright @copyright{} 2007, 2008, 2009, 2010 Free Software Foundation, Inc. @@ -51,6 +54,8 @@ another. An overview of D-Bus can be found at * Receiving Method Calls:: Offering own methods. * Signals:: Sending and receiving signals. * Errors and Events:: Errors and events. +* Index:: Index including concepts, functions, variables. + * GNU Free Documentation License:: The license for this documentation. @end menu @@ -418,7 +423,8 @@ Example: @result{} "/org/freedesktop/SystemToolsBackends/UsersConfig" @end lisp -If @var{object} has no @var{attribute}, the function returns nil. +If @var{object} has no @var{attribute}, the function returns +@code{nil}. @end defun @@ -669,7 +675,7 @@ A @var{property} value can be retrieved by the function @defun dbus-get-property bus service path interface property This function returns the value of @var{property} of @var{interface}. It will be checked at @var{bus}, @var{service}, @var{path}. The -result can be any valid D-Bus value, or nil if there is no +result can be any valid D-Bus value, or @code{nil} if there is no @var{property}. Example: @lisp @@ -863,12 +869,12 @@ Lisp function call. The following mapping to D-Bus types is applied, when the corresponding D-Bus message is created: @example -@multitable {@code{t} and @code{nil}} {@expansion{}} {DBUS_TYPE_BOOLEAN} +@multitable {negative integer} {@expansion{}} {DBUS_TYPE_BOOLEAN} @item Lisp type @tab @tab D-Bus type @item @item @code{t} and @code{nil} @tab @expansion{} @tab DBUS_TYPE_BOOLEAN -@item number @tab @expansion{} @tab DBUS_TYPE_UINT32 -@item integer @tab @expansion{} @tab DBUS_TYPE_INT32 +@item natural number @tab @expansion{} @tab DBUS_TYPE_UINT32 +@item negative integer @tab @expansion{} @tab DBUS_TYPE_INT32 @item float @tab @expansion{} @tab DBUS_TYPE_DOUBLE @item string @tab @expansion{} @tab DBUS_TYPE_STRING @item list @tab @expansion{} @tab DBUS_TYPE_ARRAY @@ -889,19 +895,19 @@ types are represented by the type symbols @code{:byte}, Example: @lisp -(dbus-call-method @dots{} @var{NUMBER} @var{STRING}) +(dbus-call-method @dots{} @var{NAT-NUMBER} @var{STRING}) @end lisp is equivalent to @lisp -(dbus-call-method @dots{} :uint32 @var{NUMBER} :string @var{STRING}) +(dbus-call-method @dots{} :uint32 @var{NAT-NUMBER} :string @var{STRING}) @end lisp but different to @lisp -(dbus-call-method @dots{} :int32 @var{NUMBER} :signature @var{STRING}) +(dbus-call-method @dots{} :int32 @var{NAT-NUMBER} :signature @var{STRING}) @end lisp The value for a byte D-Bus type can be any integer in the range 0 @@ -994,17 +1000,17 @@ Output parameters of D-Bus methods and signals are mapped to Lisp objects. @example -@multitable {DBUS_TYPE_OBJECT_PATH} {@expansion{}} {@code{t} or @code{nil}} +@multitable {DBUS_TYPE_OBJECT_PATH} {@expansion{}} {natural number or float} @item D-Bus type @tab @tab Lisp type @item @item DBUS_TYPE_BOOLEAN @tab @expansion{} @tab @code{t} or @code{nil} -@item DBUS_TYPE_BYTE @tab @expansion{} @tab number -@item DBUS_TYPE_UINT16 @tab @expansion{} @tab number -@item DBUS_TYPE_INT16 @tab @expansion{} @tab number -@item DBUS_TYPE_UINT32 @tab @expansion{} @tab number or float -@item DBUS_TYPE_INT32 @tab @expansion{} @tab number or float -@item DBUS_TYPE_UINT64 @tab @expansion{} @tab number or float -@item DBUS_TYPE_INT64 @tab @expansion{} @tab number or float +@item DBUS_TYPE_BYTE @tab @expansion{} @tab natural number +@item DBUS_TYPE_UINT16 @tab @expansion{} @tab natural number +@item DBUS_TYPE_INT16 @tab @expansion{} @tab integer +@item DBUS_TYPE_UINT32 @tab @expansion{} @tab natural number or float +@item DBUS_TYPE_INT32 @tab @expansion{} @tab integer or float +@item DBUS_TYPE_UINT64 @tab @expansion{} @tab natural number or float +@item DBUS_TYPE_INT64 @tab @expansion{} @tab integer or float @item DBUS_TYPE_DOUBLE @tab @expansion{} @tab float @item DBUS_TYPE_STRING @tab @expansion{} @tab string @item DBUS_TYPE_OBJECT_PATH @tab @expansion{} @tab string @@ -1030,7 +1036,7 @@ The signal @code{PropertyModified}, discussed as example in (@var{BOOL} stands here for either @code{nil} or @code{t}): @lisp -(@var{NUMBER} ((@var{STRING} @var{BOOL} @var{BOOL}) (@var{STRING} @var{BOOL} @var{BOOL}) @dots{})) +(@var{INTEGER} ((@var{STRING} @var{BOOL} @var{BOOL}) (@var{STRING} @var{BOOL} @var{BOOL}) @dots{})) @end lisp @defun dbus-byte-array-to-string byte-array @@ -1359,7 +1365,7 @@ The test runs then @end example @end defun -@defun dbus-register-property bus service path interface property access value +@defun dbus-register-property bus service path interface property access value &optional emits-signal With this function, an application declares a @var{property} on the D-Bus @var{bus}. @@ -1387,7 +1393,12 @@ only way to change their values. Properties with access type The interface @samp{org.freedesktop.DBus.Properties} is added to @var{path}, including a default handler for the @samp{Get}, -@samp{GetAll} and @samp{Set} methods of this interface. Example: +@samp{GetAll} and @samp{Set} methods of this interface. When +@var{emits-signal} is non-@code{nil}, the signal +@samp{PropertiesChanged} is sent when the property is changed by +@code{dbus-set-property}. + +@noindent Example: @lisp (dbus-register-property @@ -1399,7 +1410,7 @@ The interface @samp{org.freedesktop.DBus.Properties} is added to (dbus-register-property :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor" - "org.freedesktop.TextEditor" "version" :readwrite emacs-version) + "org.freedesktop.TextEditor" "version" :readwrite emacs-version t) @result{} ((:session "org.freedesktop.TextEditor" "version") ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor")) @@ -1570,9 +1581,16 @@ which objects the GNU/Linux @code{hal} daemon adds. @node Errors and Events @chapter Errors and events. +@cindex debugging @cindex errors @cindex events +The internal actions can be traced by running in a debug mode. + +@defvar dbus-debug +If this variable is non-@code{nil}, D-Bus specific debug messages are raised. +@end defvar + Input parameters of @code{dbus-call-method}, @code{dbus-call-method-non-blocking}, @code{dbus-call-method-asynchronously}, and @@ -1587,8 +1605,7 @@ appended to the @code{dbus-error}. @defspec dbus-ignore-errors forms@dots{} This executes @var{forms} exactly like a @code{progn}, except that @code{dbus-error} errors are ignored during the @var{forms}. These -errors can be made visible when variable @code{dbus-debug} is set to -@code{t}. +errors can be made visible when @code{dbus-debug} is set to @code{t}. @end defspec Incoming D-Bus messages are handled as Emacs events, see @pxref{Misc @@ -1636,12 +1653,12 @@ The result is either the symbol @code{:system} or the symbol @code{:session}. @defun dbus-event-message-type event Returns the message type of the corresponding D-Bus message. The -result is a number. +result is a natural number. @end defun @defun dbus-event-serial-number event Returns the serial number of the corresponding D-Bus message. -The result is a number. +The result is a natural number. @end defun @defun dbus-event-service-name event @@ -1691,6 +1708,12 @@ D-Bus applications running. Therefore, they shall check carefully, whether a given D-Bus error is related to them. +@node Index +@unnumbered Index + +@printindex cp + + @node GNU Free Documentation License @appendix GNU Free Documentation License @include doclicense.texi diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi index 5e70153f9a2..0d05833d0ac 100644 --- a/doc/misc/dired-x.texi +++ b/doc/misc/dired-x.texi @@ -3,7 +3,7 @@ @c dired-x.texi --- Sebastian Kremer's Extra DIRED hacked up for GNU Emacs @c @c Author: Sebastian Kremer -@c Lawrence R. Dodd +@c Lawrence R. Dodd @c [Dodd's address no longer valid.] @comment %**start of header (This is for running Texinfo on a region.) @@ -14,7 +14,7 @@ @iftex @finalout @end iftex -@c @setchapternewpage odd % For book style double sided manual. +@c @setchapternewpage odd % For book style double sided manual. @comment %**end of header (This is for running Texinfo on a region.) @copying @@ -37,7 +37,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Dired-X: (dired-x). Dired Extra Features. +* Dired-X: (dired-x). Dired Extra Features. @end direntry @c @smallbook diff --git a/doc/misc/ebrowse.texi b/doc/misc/ebrowse.texi index 2c9df216681..86cae35a6f4 100644 --- a/doc/misc/ebrowse.texi +++ b/doc/misc/ebrowse.texi @@ -29,7 +29,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Ebrowse: (ebrowse). A C++ class browser for Emacs. +* Ebrowse: (ebrowse). A C++ class browser for Emacs. @end direntry @titlepage @@ -55,14 +55,14 @@ Ebrowse. @end ifnottex @menu -* Overview:: What is it and how does it work? -* Generating browser files:: How to process C++ source files -* Loading a Tree:: How to start browsing -* Tree Buffers:: Traversing class hierarchies -* Member Buffers:: Looking at member information -* Tags-like Functions:: Finding members from source files +* Overview:: What is it and how does it work? +* Generating browser files:: How to process C++ source files +* Loading a Tree:: How to start browsing +* Tree Buffers:: Traversing class hierarchies +* Member Buffers:: Looking at member information +* Tags-like Functions:: Finding members from source files * GNU Free Documentation License:: The license for this documentation. -* Concept Index:: An entry for each concept defined +* Concept Index:: An entry for each concept defined @end menu @@ -215,10 +215,10 @@ When invoked with option @samp{--help}, @command{ebrowse} prints a list of available command line options.@refill @menu -* Input files:: Specifying which files to parse -* Output file:: Changing the output file name -* Structs and unions:: Omitting @code{struct}s and @code{union}s -* Matching:: Setting regular expression lengths +* Input files:: Specifying which files to parse +* Output file:: Changing the output file name +* Structs and unions:: Omitting @code{struct}s and @code{union}s +* Matching:: Setting regular expression lengths * Verbosity:: Getting feedback for lengthy operations @end menu @@ -454,17 +454,17 @@ Tree-specific commands are bound to simple keystrokes, similar to buffers. @menu -* Source Display:: Viewing and finding a class declaration -* Member Display:: Showing members, switching to member buffers -* Go to Class:: Finding a class -* Quitting:: Discarding and burying the tree buffer -* File Name Display:: Showing file names in the tree -* Expanding and Collapsing:: Expanding and collapsing branches -* Tree Indentation:: Changing the tree indentation -* Killing Classes:: Removing class from the tree -* Saving a Tree:: Saving a modified tree -* Statistics:: Displaying class tree statistics -* Marking Classes:: Marking and unmarking classes +* Source Display:: Viewing and finding a class declaration +* Member Display:: Showing members, switching to member buffers +* Go to Class:: Finding a class +* Quitting:: Discarding and burying the tree buffer +* File Name Display:: Showing file names in the tree +* Expanding and Collapsing:: Expanding and collapsing branches +* Tree Indentation:: Changing the tree indentation +* Killing Classes:: Removing class from the tree +* Saving a Tree:: Saving a modified tree +* Statistics:: Displaying class tree statistics +* Marking Classes:: Marking and unmarking classes @end menu @@ -625,17 +625,15 @@ given by a prefix argument. Here is an example of a tree buffer with file names displayed. @example -| Collection (unknown) -| IndexedCollection (indexedcltn.h) -| Array (array.h) -| FixedArray (fixedarray.h) -| Set (set.h) -| Dictionary (dict.h) +| Collection (unknown) +| IndexedCollection (indexedcltn.h) +| Array (array.h) +| FixedArray (fixedarray.h) +| Set (set.h) +| Dictionary (dict.h) @end example - - @node Expanding and Collapsing, Tree Indentation, File Name Display, Tree Buffers @comment node-name, next, previous, up @section Expanding and Collapsing a Tree @@ -818,20 +816,20 @@ like in tree buffers, menus are provided for certain areas in the buffer: members, classes, and the buffer itself. @menu -* Switching Member Lists:: Choosing which members to display -* Finding/Viewing:: Modifying source code -* Inherited Members:: Display of Inherited Members -* Searching Members:: Finding members in member buffer -* Switching to Tree:: Going back to the tree buffer -* Filters:: Selective member display -* Attributes:: Display of @code{virtual} etc. -* Long and Short Display:: Comprehensive and verbose display -* Regexp Display:: Showing matching regular expressions -* Switching Classes:: Displaying another class -* Killing/Burying:: Getting rid of the member buffer -* Column Width:: Display style -* Redisplay:: Redrawing the member list -* Getting Help:: How to get help for key bindings +* Switching Member Lists:: Choosing which members to display +* Finding/Viewing:: Modifying source code +* Inherited Members:: Display of Inherited Members +* Searching Members:: Finding members in member buffer +* Switching to Tree:: Going back to the tree buffer +* Filters:: Selective member display +* Attributes:: Display of @code{virtual} etc. +* Long and Short Display:: Comprehensive and verbose display +* Regexp Display:: Showing matching regular expressions +* Switching Classes:: Displaying another class +* Killing/Burying:: Getting rid of the member buffer +* Column Width:: Display style +* Redisplay:: Redrawing the member list +* Getting Help:: How to get help for key bindings @end menu @@ -1234,7 +1232,7 @@ This key is bound to @code{describe-mode}. @comment ************************************************************** -@comment *** TAGS LIKE FUNCTIONS +@comment *** TAGS LIKE FUNCTIONS @comment ************************************************************** @node Tags-like Functions, GNU Free Documentation License, Member Buffers, Top @@ -1245,14 +1243,14 @@ Ebrowse provides tags functions similar to those of the standard Emacs Tags facility, but better suited to the needs of C++ programmers. @menu -* Finding and Viewing:: Going to a member declaration/definition -* Position Stack:: Moving to previous locations -* Search & Replace:: Searching and replacing over class tree files -* Members in Files:: Listing all members in a given file -* Apropos:: Listing members matching a regular expression -* Symbol Completion:: Completing names while editing +* Finding and Viewing:: Going to a member declaration/definition +* Position Stack:: Moving to previous locations +* Search & Replace:: Searching and replacing over class tree files +* Members in Files:: Listing all members in a given file +* Apropos:: Listing members matching a regular expression +* Symbol Completion:: Completing names while editing * Member Buffer Display:: Quickly display a member buffer for some - identifier + identifier @end menu diff --git a/doc/misc/ede.texi b/doc/misc/ede.texi index ace3c25914d..7e1d6c7907a 100644 --- a/doc/misc/ede.texi +++ b/doc/misc/ede.texi @@ -5,8 +5,8 @@ @copying This file describes EDE, the Emacs Development Environment. -Copyright @copyright{} 1998, 1999, 2000, 2001, 2004, 2005, 2008, 2009, 2010 -Free Software Foundation, Inc. +Copyright @copyright{} 1998, 1999, 2000, 2001, 2004, 2005, 2008, 2009, +2010 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -24,7 +24,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* ede: (ede). Project management for Emacs +* ede: (ede). Project management for Emacs. @end direntry @titlepage @@ -404,8 +404,8 @@ lookup for @semantic{}, improving code completion performance. @menu * ede-cpp-root:: This project marks the root of a C/C++ code project. * ede-simple subclassing:: Create your own simple project. -* ede-emacs:: A project for working with Emacs. -* ede-linux:: A project for working with Linux kernels. +* ede-emacs:: A project for working with Emacs. +* ede-linux:: A project for working with Linux kernels. * Custom Locate:: Customizing how to locate files in a simple project @end menu @@ -525,14 +525,14 @@ Return nil if there isn't one." ) (add-to-list 'ede-project-class-files - (ede-project-autoload "cpp-root" - :name "CPP ROOT" - :file 'ede-cpp-root - :proj-file 'MY-FILE-FOR-DIR + (ede-project-autoload "cpp-root" + :name "CPP ROOT" + :file 'ede-cpp-root + :proj-file 'MY-FILE-FOR-DIR :proj-root 'MY-ROOT-FCN - :load-type 'MY-LOAD - :class-sym 'ede-cpp-root) - t) + :load-type 'MY-LOAD + :class-sym 'ede-cpp-root) + t) @end example This example only creates an auto-loader, and does not create a new kind @@ -751,9 +751,9 @@ Here is an example for an instantiation of an Emacs Lisp source code object: @example (defvar ede-source-emacs (ede-sourcecode "ede-emacs-source" - :name "Emacs Lisp" - :sourcepattern "\\.el$" - :garbagepattern '("*.elc")) + :name "Emacs Lisp" + :sourcepattern "\\.el$" + :garbagepattern '("*.elc")) "Emacs Lisp source code definition.") @end example diff --git a/doc/misc/edt.texi b/doc/misc/edt.texi index a93aada07a1..d394137d76b 100644 --- a/doc/misc/edt.texi +++ b/doc/misc/edt.texi @@ -25,7 +25,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* EDT: (edt). An Emacs emulation of the EDT editor. +* EDT: (edt). An Emacs emulation of the EDT editor. @end direntry @titlepage diff --git a/doc/misc/eieio.texi b/doc/misc/eieio.texi index b5567f3a489..169e52c1bd0 100644 --- a/doc/misc/eieio.texi +++ b/doc/misc/eieio.texi @@ -29,7 +29,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* eieio: (eieio). Objects for Emacs +* eieio: (eieio). Objects for Emacs. @end direntry @titlepage @@ -295,8 +295,8 @@ This option is here to support programs written with older versions of @menu * Inheritance:: How to specify parents classes -* Slot Options:: How to specify features of a slot. -* Class Options:: How to specify features for this class. +* Slot Options:: How to specify features of a slot. +* Class Options:: How to specify features for this class. @end menu @node Inheritance diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi index 0ce94bfcf69..713a55c7cc7 100644 --- a/doc/misc/emacs-mime.texi +++ b/doc/misc/emacs-mime.texi @@ -31,7 +31,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Emacs MIME: (emacs-mime). Emacs MIME de/composition library. +* Emacs MIME: (emacs-mime). Emacs MIME de/composition library. @end direntry @iftex @finalout diff --git a/doc/misc/epa.texi b/doc/misc/epa.texi index b02e41e914b..f9c48b1588a 100644 --- a/doc/misc/epa.texi +++ b/doc/misc/epa.texi @@ -33,7 +33,7 @@ license to the document, as described in section 6 of the license. @dircategory Emacs @direntry -* EasyPG Assistant: (epa). An Emacs user interface to GNU Privacy Guard. +* EasyPG Assistant: (epa). An Emacs user interface to GNU Privacy Guard. @end direntry @titlepage @@ -142,15 +142,15 @@ about the key you selected. @example u Daiki Ueno u A5B6B2D4B15813FE 1024bits DSA - Created: 2001-10-09 - Expires: 2007-09-04 - Capabilities: sign certify - Fingerprint: 8003 7CD0 0F1A 9400 03CA 50AA A5B6 B2D4 B158 13FE + Created: 2001-10-09 + Expires: 2007-09-04 + Capabilities: sign certify + Fingerprint: 8003 7CD0 0F1A 9400 03CA 50AA A5B6 B2D4 B158 13FE u 4447461B2A9BEA2D 2048bits ELGAMAL_E - Created: 2001-10-09 - Expires: 2007-09-04 - Capabilities: encrypt - Fingerprint: 9003 D76B 73B7 4A8A E588 10AF 4447 461B 2A9B EA2D + Created: 2001-10-09 + Expires: 2007-09-04 + Capabilities: encrypt + Fingerprint: 9003 D76B 73B7 4A8A E588 10AF 4447 461B 2A9B EA2D @end example @noindent diff --git a/doc/misc/erc.texi b/doc/misc/erc.texi index 537a34b6d68..1c547bf80e5 100644 --- a/doc/misc/erc.texi +++ b/doc/misc/erc.texi @@ -8,7 +8,8 @@ @copying This manual is for ERC version 5.3. -Copyright @copyright{} 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright @copyright{} 2005, 2006, 2007, 2008, 2009, 2010 +Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -29,7 +30,7 @@ and modified without restriction. @dircategory Emacs @direntry -* ERC: (erc). Powerful, modular, and extensible IRC client for Emacs. +* ERC: (erc). Powerful and extensible IRC client for Emacs. @end direntry @titlepage diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi index 96825559197..6ec431dccfd 100644 --- a/doc/misc/eshell.texi +++ b/doc/misc/eshell.texi @@ -8,8 +8,8 @@ @copying This manual is for Eshell, the Emacs shell. -Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, -2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +2007, 2008, 2009, 2010 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -27,7 +27,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Eshell: (eshell). A command shell implemented in Emacs Lisp. +* Eshell: (eshell). A command shell implemented in Emacs Lisp. @end direntry @titlepage diff --git a/doc/misc/eudc.texi b/doc/misc/eudc.texi index 09d7f5cb5a8..48606e0d664 100644 --- a/doc/misc/eudc.texi +++ b/doc/misc/eudc.texi @@ -31,7 +31,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* EUDC: (eudc). An Emacs client for directory servers (LDAP, PH). +* EUDC: (eudc). Emacs client for directory servers (LDAP, PH). @end direntry @footnotestyle end diff --git a/doc/misc/faq.texi b/doc/misc/faq.texi index 924240aeb53..f4dc0247197 100644 --- a/doc/misc/faq.texi +++ b/doc/misc/faq.texi @@ -41,7 +41,7 @@ distribution.] @dircategory Emacs @direntry -* Emacs FAQ: (efaq). Frequently Asked Questions about Emacs. +* Emacs FAQ: (efaq). Frequently Asked Questions about Emacs. @end direntry @c The @titlepage stuff only appears in the printed version diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index 764c6481641..0606fcc134d 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi @@ -11,8 +11,8 @@ This manual is for GNU Flymake (version @value{VERSION}, @value{UPDATED}), which is a universal on-the-fly syntax checker for GNU Emacs. -Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -Foundation, Inc. +Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009, 2010 +Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -30,7 +30,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Flymake: (flymake). A universal on-the-fly syntax checker. +* Flymake: (flymake). A universal on-the-fly syntax checker. @end direntry @titlepage @@ -409,7 +409,7 @@ First, we write the @code{init-function}: (defun flymake-perl-init () (let* ((temp-file (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace)) - (local-file (file-relative-name + (local-file (file-relative-name temp-file (file-name-directory buffer-file-name)))) (list "perl" (list "-wc " local-file)))) diff --git a/doc/misc/forms.texi b/doc/misc/forms.texi index 614844fd6c2..a7779763c3f 100644 --- a/doc/misc/forms.texi +++ b/doc/misc/forms.texi @@ -1,4 +1,4 @@ -\input texinfo @c -*-texinfo-*- +\input texinfo @c -*-texinfo-*- @c documentation for forms-mode @c Written by Johan Vromans, and edited by Richard Stallman @@ -37,8 +37,8 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Forms: (forms). Emacs package for editing data bases - by filling in forms. +* Forms: (forms). Emacs package for editing data bases + by filling in forms. @end direntry @titlepage diff --git a/doc/misc/gnus-faq.texi b/doc/misc/gnus-faq.texi index 2b3c0aa5e25..78a22740e32 100644 --- a/doc/misc/gnus-faq.texi +++ b/doc/misc/gnus-faq.texi @@ -1,8 +1,8 @@ @c \input texinfo @c -*-texinfo-*- @c Uncomment 1st line before texing this file alone. @c %**start of header -@c Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -@c 2008, 2009, 2010 Free Software Foundation, Inc. +@c Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +@c 2009, 2010 Free Software Foundation, Inc. @c @c Do not modify this file, it was generated from gnus-faq.xml, available from @c . @@ -550,7 +550,7 @@ want something different, change the line above to something like this: @example (add-to-list 'gnus-secondary-select-methods '(nnspool "" - (nnspool-directory "/usr/local/myspoolddir"))) + (nnspool-directory "/usr/local/myspoolddir"))) @end example @noindent @@ -635,8 +635,8 @@ mail, it's @example (eval-after-load "mail-source" '(add-to-list 'mail-sources - '(directory :path "/path/to/procmail-dir/" - :suffix ".prcml"))) + '(directory :path "/path/to/procmail-dir/" + :suffix ".prcml"))) @end example @noindent @@ -691,10 +691,10 @@ about the server there. @example (add-to-list 'gnus-secondary-select-methods - '(nnimap "Give the baby a name" - (nnimap-address "imap.yourProvider.net") - (nnimap-port 143) - (nnimap-list-pattern "archive.*"))) + '(nnimap "Give the baby a name" + (nnimap-address "imap.yourProvider.net") + (nnimap-port 143) + (nnimap-list-pattern "archive.*"))) @end example @noindent @@ -874,7 +874,7 @@ say this in ~/.gnus.el: @example (setq gnus-visible-headers '("^From" "^Subject" "^Date" "^Newsgroups" "^Followup-To" - "^User-Agent" "^X-Newsreader" "^X-Mailer")) + "^User-Agent" "^X-Newsreader" "^X-Mailer")) @end example @noindent @@ -1099,18 +1099,18 @@ buffer top-right, article buffer bottom-right: (gnus-add-configuration '(article (horizontal 1.0 - (vertical 25 - (group 1.0)) - (vertical 1.0 - (summary 0.25 point) - (article 1.0))))) + (vertical 25 + (group 1.0)) + (vertical 1.0 + (summary 0.25 point) + (article 1.0))))) (gnus-add-configuration '(summary (horizontal 1.0 - (vertical 25 - (group 1.0)) - (vertical 1.0 - (summary 1.0 point))))) + (vertical 25 + (group 1.0)) + (vertical 1.0 + (summary 1.0 point))))) @end example @noindent @@ -1480,7 +1480,7 @@ You can store your mail addresses in a ~/.mailrc file using a simple alias syntax: @example -alias al "Al " +alias al "Al " @end example @noindent @@ -1644,9 +1644,9 @@ the group to use. @example (setq gnus-message-archive-group - '((if (message-news-p) - "nnml:Send-News" - "nnml:Send-Mail"))) + '((if (message-news-p) + "nnml:Send-News" + "nnml:Send-Mail"))) @end example @noindent diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 3ef173c8db0..c3a7058289d 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -322,7 +322,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Gnus: (gnus). The newsreader Gnus. +* Gnus: (gnus). The newsreader Gnus. @end direntry @iftex @finalout diff --git a/doc/misc/idlwave.texi b/doc/misc/idlwave.texi index 94a2c2c6db7..0618f110c30 100644 --- a/doc/misc/idlwave.texi +++ b/doc/misc/idlwave.texi @@ -41,7 +41,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* IDLWAVE: (idlwave). Major mode and shell for IDL files. +* IDLWAVE: (idlwave). Major mode and shell for IDL files. @end direntry @titlepage diff --git a/doc/misc/info.texi b/doc/misc/info.texi index b1157c0c4eb..97cc17812e4 100644 --- a/doc/misc/info.texi +++ b/doc/misc/info.texi @@ -40,7 +40,7 @@ license to the document, as described in section 6 of the license. @dircategory Texinfo documentation system @direntry -* Info: (info). How to use the documentation browsing system. +* Info: (info). How to use the documentation browsing system. @end direntry @titlepage diff --git a/doc/misc/mairix-el.texi b/doc/misc/mairix-el.texi index b08d5d8e316..578164e8e57 100644 --- a/doc/misc/mairix-el.texi +++ b/doc/misc/mairix-el.texi @@ -24,7 +24,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Mairix: (mairix-el). Emacs interface to the Mairix mail indexer. +* Mairix: (mairix-el). Emacs interface to the Mairix mail indexer. @end direntry @titlepage diff --git a/doc/misc/message.texi b/doc/misc/message.texi index 1667c5ca503..283d29c0de4 100644 --- a/doc/misc/message.texi +++ b/doc/misc/message.texi @@ -27,7 +27,8 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Message: (message). Mail and news composition mode that goes with Gnus. +* Message: (message). Mail and news composition mode that + goes with Gnus. @end direntry @iftex @finalout diff --git a/doc/misc/mh-e.texi b/doc/misc/mh-e.texi index f7a46778c96..ed64f91ac39 100644 --- a/doc/misc/mh-e.texi +++ b/doc/misc/mh-e.texi @@ -24,8 +24,8 @@ This is version @value{VERSION}@value{EDITION} of @cite{The MH-E Manual}, last updated @value{UPDATED}. -Copyright @copyright{} 1995, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 -Free Software Foundation, Inc. +Copyright @copyright{} 1995, 2001, 2002, 2003, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. @c This dual license has been agreed upon by the FSF. @@ -58,7 +58,7 @@ Public License.'' @c Info Directory Entry @dircategory Emacs @direntry -* MH-E: (mh-e). Emacs interface to the MH mail system. +* MH-E: (mh-e). Emacs interface to the MH mail system. @end direntry @c Title Page @@ -7767,7 +7767,7 @@ will need to run @samp{sa-learn --rebuild} periodically. This can be done by adding the following to your @file{crontab}: @smallexample -0 * * * * sa-learn --rebuild > /dev/null 2>&1 +0 * * * * sa-learn --rebuild > /dev/null 2>&1 @end smallexample @subheading Bogofilter diff --git a/doc/misc/newsticker.texi b/doc/misc/newsticker.texi index 926885b7e13..5c975772139 100644 --- a/doc/misc/newsticker.texi +++ b/doc/misc/newsticker.texi @@ -32,7 +32,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Newsticker: (newsticker). A Newsticker for Emacs. +* Newsticker: (newsticker). A Newsticker for Emacs. @end direntry @titlepage diff --git a/doc/misc/nxml-mode.texi b/doc/misc/nxml-mode.texi index c1ea64fe9a9..593bf92d00a 100644 --- a/doc/misc/nxml-mode.texi +++ b/doc/misc/nxml-mode.texi @@ -187,7 +187,7 @@ and the buffer showing possible completions will contain @example Possible completions are: -xml:lang xmlns +xml:lang xmlns @end example @noindent @@ -520,7 +520,7 @@ enough. If you want to use a schema that has not yet been added to the schema locating files, you can use the command @kbd{C-c C-s C-f} -to manually select the file contaiing the schema for the document in +to manually select the file containing the schema for the document in current buffer. Emacs will read the file-name of the schema from the minibuffer. After reading the file-name, Emacs will ask whether you wish to add a rule to a schema locating file that persistently diff --git a/doc/misc/org.texi b/doc/misc/org.texi index c4285d59f27..9074f171e4b 100644 --- a/doc/misc/org.texi +++ b/doc/misc/org.texi @@ -1,10 +1,16 @@ + \input texinfo @c %**start of header @setfilename ../../info/org @settitle The Org Manual -@set VERSION 6.35i -@set DATE April 2010 +@set VERSION 7.01 +@set DATE July 2010 + +@c Use proper quote and backtick for code sections in PDF output +@c Cf. Texinfo manual 14.2 +@set txicodequoteundirected +@set txicodequotebacktick @c Version and Contact Info @set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage} @@ -76,6 +82,7 @@ license to the document, as described in section 6 of the license. @subtitle Release @value{VERSION} @author by Carsten Dominik +with contributions by David O'Toole, Bastien Guerry, Philip Rooke, Dan Davison, Eric Schulte, and Thomas Dye @c The following two commands start the copyright page. @page @@ -94,347 +101,400 @@ license to the document, as described in section 6 of the license. @end ifnottex @menu -* Introduction:: Getting started -* Document Structure:: A tree works like your brain -* Tables:: Pure magic for quick formatting -* Hyperlinks:: Notes in context -* TODO Items:: Every tree branch can be a TODO item -* Tags:: Tagging headlines and matching sets of tags -* Properties and Columns:: Storing information about an entry -* Dates and Times:: Making items useful for planning -* Capture - Refile - Archive:: The ins and outs for projects -* Agenda Views:: Collecting information into views -* Markup:: Prepare text for rich export -* Exporting:: Sharing and publishing of notes -* Publishing:: Create a web site of linked Org files -* Miscellaneous:: All the rest which did not fit elsewhere -* Hacking:: How to hack your way around -* MobileOrg:: Viewing and capture on a mobile device -* History and Acknowledgments:: How Org came into being -* Main Index:: An index of Org's concepts and features -* Key Index:: Key bindings and where they are described -* Variable Index:: Variables mentioned in the manual +* Introduction:: Getting started +* Document Structure:: A tree works like your brain +* Tables:: Pure magic for quick formatting +* Hyperlinks:: Notes in context +* TODO Items:: Every tree branch can be a TODO item +* Tags:: Tagging headlines and matching sets of tags +* Properties and Columns:: Storing information about an entry +* Dates and Times:: Making items useful for planning +* Capture - Refile - Archive:: The ins and outs for projects +* Agenda Views:: Collecting information into views +* Markup:: Prepare text for rich export +* Exporting:: Sharing and publishing of notes +* Publishing:: Create a web site of linked Org files +* Working With Source Code:: Export, evaluate, and tangle code blocks +* Miscellaneous:: All the rest which did not fit elsewhere +* Hacking:: How to hack your way around +* MobileOrg:: Viewing and capture on a mobile device +* History and Acknowledgments:: How Org came into being +* Main Index:: An index of Org's concepts and features +* Key Index:: Key bindings and where they are described +* Variable Index:: Variables mentioned in the manual @detailmenu --- The Detailed Node Listing --- Introduction -* Summary:: Brief summary of what Org does -* Installation:: How to install a downloaded version of Org -* Activation:: How to activate Org for certain buffers -* Feedback:: Bug reports, ideas, patches etc. -* Conventions:: Type-setting conventions in the manual +* Summary:: Brief summary of what Org does +* Installation:: How to install a downloaded version of Org +* Activation:: How to activate Org for certain buffers +* Feedback:: Bug reports, ideas, patches etc. +* Conventions:: Type-setting conventions in the manual -Document Structure +Document structure -* Outlines:: Org is based on Outline mode -* Headlines:: How to typeset Org tree headlines -* Visibility cycling:: Show and hide, much simplified -* Motion:: Jumping to other headlines -* Structure editing:: Changing sequence and level of headlines -* Sparse trees:: Matches embedded in context -* Plain lists:: Additional structure within an entry -* Drawers:: Tucking stuff away -* Blocks:: Folding blocks -* Footnotes:: How footnotes are defined in Org's syntax -* Orgstruct mode:: Structure editing outside Org +* Outlines:: Org is based on Outline mode +* Headlines:: How to typeset Org tree headlines +* Visibility cycling:: Show and hide, much simplified +* Motion:: Jumping to other headlines +* Structure editing:: Changing sequence and level of headlines +* Sparse trees:: Matches embedded in context +* Plain lists:: Additional structure within an entry +* Drawers:: Tucking stuff away +* Blocks:: Folding blocks +* Footnotes:: How footnotes are defined in Org's syntax +* Orgstruct mode:: Structure editing outside Org Tables -* Built-in table editor:: Simple tables -* Column width and alignment:: Overrule the automatic settings -* Column groups:: Grouping to trigger vertical lines -* Orgtbl mode:: The table editor as minor mode -* The spreadsheet:: The table editor has spreadsheet capabilities -* Org-Plot:: Plotting from org tables +* Built-in table editor:: Simple tables +* Column width and alignment:: Overrule the automatic settings +* Column groups:: Grouping to trigger vertical lines +* Orgtbl mode:: The table editor as minor mode +* The spreadsheet:: The table editor has spreadsheet capabilities +* Org-Plot:: Plotting from org tables The spreadsheet -* References:: How to refer to another field or range -* Formula syntax for Calc:: Using Calc to compute stuff -* Formula syntax for Lisp:: Writing formulas in Emacs Lisp -* Field formulas:: Formulas valid for a single field -* Column formulas:: Formulas valid for an entire column +* References:: How to refer to another field or range +* Formula syntax for Calc:: Using Calc to compute stuff +* Formula syntax for Lisp:: Writing formulas in Emacs Lisp +* Field formulas:: Formulas valid for a single field +* Column formulas:: Formulas valid for an entire column * Editing and debugging formulas:: Fixing formulas -* Updating the table:: Recomputing all dependent fields -* Advanced features:: Field names, parameters and automatic recalc +* Updating the table:: Recomputing all dependent fields +* Advanced features:: Field names, parameters and automatic recalc Hyperlinks -* Link format:: How links in Org are formatted -* Internal links:: Links to other places in the current file -* External links:: URL-like links to the world -* Handling links:: Creating, inserting and following -* Using links outside Org:: Linking from my C source code? -* Link abbreviations:: Shortcuts for writing complex links -* Search options:: Linking to a specific location -* Custom searches:: When the default search is not enough +* Link format:: How links in Org are formatted +* Internal links:: Links to other places in the current file +* External links:: URL-like links to the world +* Handling links:: Creating, inserting and following +* Using links outside Org:: Linking from my C source code? +* Link abbreviations:: Shortcuts for writing complex links +* Search options:: Linking to a specific location +* Custom searches:: When the default search is not enough Internal links -* Radio targets:: Make targets trigger links in plain text +* Radio targets:: Make targets trigger links in plain text -TODO Items +TODO items -* TODO basics:: Marking and displaying TODO entries -* TODO extensions:: Workflow and assignments -* Progress logging:: Dates and notes for progress -* Priorities:: Some things are more important than others -* Breaking down tasks:: Splitting a task into manageable pieces -* Checkboxes:: Tick-off lists +* TODO basics:: Marking and displaying TODO entries +* TODO extensions:: Workflow and assignments +* Progress logging:: Dates and notes for progress +* Priorities:: Some things are more important than others +* Breaking down tasks:: Splitting a task into manageable pieces +* Checkboxes:: Tick-off lists Extended use of TODO keywords -* Workflow states:: From TODO to DONE in steps -* TODO types:: I do this, Fred does the rest -* Multiple sets in one file:: Mixing it all, and still finding your way -* Fast access to TODO states:: Single letter selection of a state -* Per-file keywords:: Different files, different requirements -* Faces for TODO keywords:: Highlighting states -* TODO dependencies:: When one task needs to wait for others +* Workflow states:: From TODO to DONE in steps +* TODO types:: I do this, Fred does the rest +* Multiple sets in one file:: Mixing it all, and still finding your way +* Fast access to TODO states:: Single letter selection of a state +* Per-file keywords:: Different files, different requirements +* Faces for TODO keywords:: Highlighting states +* TODO dependencies:: When one task needs to wait for others Progress logging -* Closing items:: When was this entry marked DONE? -* Tracking TODO state changes:: When did the status change? -* Tracking your habits:: How consistent have you been? +* Closing items:: When was this entry marked DONE? +* Tracking TODO state changes:: When did the status change? +* Tracking your habits:: How consistent have you been? Tags -* Tag inheritance:: Tags use the tree structure of the outline -* Setting tags:: How to assign tags to a headline -* Tag searches:: Searching for combinations of tags +* Tag inheritance:: Tags use the tree structure of the outline +* Setting tags:: How to assign tags to a headline +* Tag searches:: Searching for combinations of tags -Properties and Columns +Properties and columns -* Property syntax:: How properties are spelled out -* Special properties:: Access to other Org mode features -* Property searches:: Matching property values -* Property inheritance:: Passing values down the tree -* Column view:: Tabular viewing and editing -* Property API:: Properties for Lisp programmers +* Property syntax:: How properties are spelled out +* Special properties:: Access to other Org-mode features +* Property searches:: Matching property values +* Property inheritance:: Passing values down the tree +* Column view:: Tabular viewing and editing +* Property API:: Properties for Lisp programmers Column view -* Defining columns:: The COLUMNS format property -* Using column view:: How to create and use column view -* Capturing column view:: A dynamic block for column view +* Defining columns:: The COLUMNS format property +* Using column view:: How to create and use column view +* Capturing column view:: A dynamic block for column view Defining columns -* Scope of column definitions:: Where defined, where valid? -* Column attributes:: Appearance and content of a column +* Scope of column definitions:: Where defined, where valid? +* Column attributes:: Appearance and content of a column -Dates and Times +Dates and times -* Timestamps:: Assigning a time to a tree entry -* Creating timestamps:: Commands which insert timestamps -* Deadlines and scheduling:: Planning your work -* Clocking work time:: Tracking how long you spend on a task -* Resolving idle time:: Resolving time if you've been idle -* Effort estimates:: Planning work effort in advance -* Relative timer:: Notes with a running timer +* Timestamps:: Assigning a time to a tree entry +* Creating timestamps:: Commands which insert timestamps +* Deadlines and scheduling:: Planning your work +* Clocking work time:: Tracking how long you spend on a task +* Resolving idle time:: Resolving time if you've been idle +* Effort estimates:: Planning work effort in advance +* Relative timer:: Notes with a running timer Creating timestamps -* The date/time prompt:: How Org mode helps you entering date and time -* Custom time format:: Making dates look different +* The date/time prompt:: How Org-mode helps you entering date and time +* Custom time format:: Making dates look different Deadlines and scheduling -* Inserting deadline/schedule:: Planning items -* Repeated tasks:: Items that show up again and again +* Inserting deadline/schedule:: Planning items +* Repeated tasks:: Items that show up again and again Capture - Refile - Archive -* Remember:: Capture new tasks/ideas with little interruption -* Attachments:: Add files to tasks. -* RSS Feeds:: Getting input from RSS feeds -* Protocols:: External (e.g. Browser) access to Emacs and Org -* Refiling notes:: Moving a tree from one place to another -* Archiving:: What to do with finished projects +* Capture:: Capturing new stuff +* Attachments:: Add files to tasks +* RSS Feeds:: Getting input from RSS feeds +* Protocols:: External (e.g. Browser) access to Emacs and Org +* Refiling notes:: Moving a tree from one place to another +* Archiving:: What to do with finished projects -Remember +Capture -* Setting up Remember for Org:: Some code for .emacs to get things going -* Remember templates:: Define the outline of different note types -* Storing notes:: Directly get the note to where it belongs +* Setting up capture:: Where notes will be stored +* Using capture:: Commands to invoke and terminate capture +* Capture templates:: Define the outline of different note types + +Capture templates + +* Template elements:: What is needed for a complete template entry +* Template expansion:: Filling in information about time and context Archiving -* Moving subtrees:: Moving a tree to an archive file -* Internal archiving:: Switch off a tree but keep i in the file +* Moving subtrees:: Moving a tree to an archive file +* Internal archiving:: Switch off a tree but keep it in the file -Agenda Views +Agenda views -* Agenda files:: Files being searched for agenda information -* Agenda dispatcher:: Keyboard access to agenda views -* Built-in agenda views:: What is available out of the box? -* Presentation and sorting:: How agenda items are prepared for display -* Agenda commands:: Remote editing of Org trees -* Custom agenda views:: Defining special searches and views -* Exporting Agenda Views:: Writing a view to a file -* Agenda column view:: Using column view for collected entries +* Agenda files:: Files being searched for agenda information +* Agenda dispatcher:: Keyboard access to agenda views +* Built-in agenda views:: What is available out of the box? +* Presentation and sorting:: How agenda items are prepared for display +* Agenda commands:: Remote editing of Org trees +* Custom agenda views:: Defining special searches and views +* Exporting Agenda Views:: Writing a view to a file +* Agenda column view:: Using column view for collected entries The built-in agenda views -* Weekly/daily agenda:: The calendar page with current tasks -* Global TODO list:: All unfinished action items +* Weekly/daily agenda:: The calendar page with current tasks +* Global TODO list:: All unfinished action items * Matching tags and properties:: Structured information with fine-tuned search -* Timeline:: Time-sorted view for single file -* Search view:: Find entries by searching for text -* Stuck projects:: Find projects you need to review +* Timeline:: Time-sorted view for single file +* Search view:: Find entries by searching for text +* Stuck projects:: Find projects you need to review Presentation and sorting -* Categories:: Not all tasks are equal -* Time-of-day specifications:: How the agenda knows the time -* Sorting of agenda items:: The order of things +* Categories:: Not all tasks are equal +* Time-of-day specifications:: How the agenda knows the time +* Sorting of agenda items:: The order of things Custom agenda views -* Storing searches:: Type once, use often -* Block agenda:: All the stuff you need in a single buffer -* Setting Options:: Changing the rules +* Storing searches:: Type once, use often +* Block agenda:: All the stuff you need in a single buffer +* Setting Options:: Changing the rules Markup for rich export -* Structural markup elements:: The basic structure as seen by the exporter -* Images and tables:: Tables and Images will be included -* Literal examples:: Source code examples with special formatting -* Include files:: Include additional files into a document -* Index entries:: -* Macro replacement:: Use macros to create complex output -* Embedded LaTeX:: LaTeX can be freely used inside Org documents +* Structural markup elements:: The basic structure as seen by the exporter +* Images and tables:: Tables and Images will be included +* Literal examples:: Source code examples with special formatting +* Include files:: Include additional files into a document +* Index entries:: Making an index +* Macro replacement:: Use macros to create complex output +* Embedded LaTeX:: LaTeX can be freely used inside Org documents Structural markup elements -* Document title:: Where the title is taken from -* Headings and sections:: The document structure as seen by the exporter -* Table of contents:: The if and where of the table of contents -* Initial text:: Text before the first heading? -* Lists:: Lists -* Paragraphs:: Paragraphs -* Footnote markup:: Footnotes -* Emphasis and monospace:: Bold, italic, etc. -* Horizontal rules:: Make a line -* Comment lines:: What will *not* be exported +* Document title:: Where the title is taken from +* Headings and sections:: The document structure as seen by the exporter +* Table of contents:: The if and where of the table of contents +* Initial text:: Text before the first heading? +* Lists:: Lists +* Paragraphs:: Paragraphs +* Footnote markup:: Footnotes +* Emphasis and monospace:: Bold, italic, etc. +* Horizontal rules:: Make a line +* Comment lines:: What will *not* be exported Embedded La@TeX{} -* Special symbols:: Greek letters and other symbols -* Subscripts and superscripts:: Simple syntax for raising/lowering text -* LaTeX fragments:: Complex formulas made easy -* Previewing LaTeX fragments:: What will this snippet look like? -* CDLaTeX mode:: Speed up entering of formulas +* Special symbols:: Greek letters and other symbols +* Subscripts and superscripts:: Simple syntax for raising/lowering text +* LaTeX fragments:: Complex formulas made easy +* Previewing LaTeX fragments:: What will this snippet look like? +* CDLaTeX mode:: Speed up entering of formulas Exporting -* Selective export:: Using tags to select and exclude trees -* Export options:: Per-file export settings -* The export dispatcher:: How to access exporter commands -* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding -* HTML export:: Exporting to HTML -* LaTeX and PDF export:: Exporting to La@TeX{}, and processing to PDF -* DocBook export:: Exporting to DocBook -* Freemind export:: Exporting to Freemind mind maps -* XOXO export:: Exporting to XOXO -* iCalendar export:: Exporting in iCalendar format +* Selective export:: Using tags to select and exclude trees +* Export options:: Per-file export settings +* The export dispatcher:: How to access exporter commands +* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding +* HTML export:: Exporting to HTML +* LaTeX and PDF export:: Exporting to La@TeX{}, and processing to PDF +* DocBook export:: Exporting to DocBook +* TaskJuggler export:: Exporting to TaskJuggler +* Freemind export:: Exporting to Freemind mind maps +* XOXO export:: Exporting to XOXO +* iCalendar export:: Exporting in iCalendar format HTML export -* HTML Export commands:: How to invoke HTML export -* Quoting HTML tags:: Using direct HTML in Org mode -* Links in HTML export:: How links will be interpreted and formatted -* Tables in HTML export:: How to modify the formatting of tables -* Images in HTML export:: How to insert figures into HTML output -* Text areas in HTML export:: An alternative way to show an example -* CSS support:: Changing the appearance of the output -* Javascript support:: Info and Folding in a web browser +* HTML Export commands:: How to invoke HTML export +* Quoting HTML tags:: Using direct HTML in Org-mode +* Links in HTML export:: How links will be interpreted and formatted +* Tables in HTML export:: How to modify the formatting of tables +* Images in HTML export:: How to insert figures into HTML output +* Text areas in HTML export:: An alternative way to show an example +* CSS support:: Changing the appearance of the output +* JavaScript support:: Info and Folding in a web browser La@TeX{} and PDF export -* LaTeX/PDF export commands:: Which key invokes which commands -* Header and sectioning:: Setting up the export file structure -* Quoting LaTeX code:: Incorporating literal La@TeX{} code -* Tables in LaTeX export:: Options for exporting tables to La@TeX{} -* Images in LaTeX export:: How to insert figures into La@TeX{} output -* Beamer class export:: Turning the file into a presentation +* LaTeX/PDF export commands:: Which key invokes which commands +* Header and sectioning:: Setting up the export file structure +* Quoting LaTeX code:: Incorporating literal La@TeX{} code +* Tables in LaTeX export:: Options for exporting tables to La@TeX{} +* Images in LaTeX export:: How to insert figures into La@TeX{} output +* Beamer class export:: Turning the file into a presentation DocBook export -* DocBook export commands:: How to invoke DocBook export -* Quoting DocBook code:: Incorporating DocBook code in Org files -* Recursive sections:: Recursive sections in DocBook -* Tables in DocBook export:: Tables are exported as HTML tables -* Images in DocBook export:: How to insert figures into DocBook output -* Special characters:: How to handle special characters +* DocBook export commands:: How to invoke DocBook export +* Quoting DocBook code:: Incorporating DocBook code in Org files +* Recursive sections:: Recursive sections in DocBook +* Tables in DocBook export:: Tables are exported as HTML tables +* Images in DocBook export:: How to insert figures into DocBook output +* Special characters:: How to handle special characters Publishing -* Configuration:: Defining projects -* Uploading files:: How to get files up on the server -* Sample configuration:: Example projects -* Triggering publication:: Publication commands +* Configuration:: Defining projects +* Uploading files:: How to get files up on the server +* Sample configuration:: Example projects +* Triggering publication:: Publication commands Configuration -* Project alist:: The central configuration variable -* Sources and destinations:: From here to there -* Selecting files:: What files are part of the project? -* Publishing action:: Setting the function doing the publishing -* Publishing options:: Tweaking HTML export -* Publishing links:: Which links keep working after publishing? -* Sitemap:: Generating a list of all pages -* Generating an index:: An index that reaches across pages +* Project alist:: The central configuration variable +* Sources and destinations:: From here to there +* Selecting files:: What files are part of the project? +* Publishing action:: Setting the function doing the publishing +* Publishing options:: Tweaking HTML export +* Publishing links:: Which links keep working after publishing? +* Sitemap:: Generating a list of all pages +* Generating an index:: An index that reaches across pages Sample configuration -* Simple example:: One-component publishing -* Complex example:: A multi-component publishing example +* Simple example:: One-component publishing +* Complex example:: A multi-component publishing example + +Working with source code + +* Structure of code blocks:: Code block syntax described +* Editing source code:: Language major-mode editing +* Exporting code blocks:: Export contents and/or results +* Extracting source code:: Create pure source code files +* Evaluating code blocks:: Place results of evaluation in the Org-mode buffer +* Library of Babel:: Use and contribute to a library of useful code blocks +* Languages:: List of supported code block languages +* Header arguments:: Configure code block functionality +* Results of evaluation:: How evaluation results are handled +* Noweb reference syntax:: Literate programming in Org-mode +* Key bindings and useful functions:: Work quickly with code blocks +* Batch execution:: Call functions from the command line + +Header arguments + +* Using header arguments:: Different ways to set header arguments +* Specific header arguments:: List of header arguments + +Using header arguments + +* System-wide header arguments:: Set global default values +* Language-specific header arguments:: Set default values by language +* Buffer-wide header arguments:: Set default values for a specific buffer +* Header arguments in Org-mode properties:: Set default values for a buffer or heading +* Code block specific header arguments:: The most common way to set values + +Specific header arguments + +* var:: Pass arguments to code blocks +* results:: Specify the type of results and how they will be collected and handled +* file:: Specify a path for file output +* dir:: Specify the default directory for code block execution +* exports:: Export code and/or results +* tangle:: Toggle tangling and specify file name +* no-expand:: Turn off variable assignment and noweb expansion during tangling +* session:: Preserve the state of code evaluation +* noweb:: Toggle expansion of noweb references +* cache:: Avoid re-evaluating unchanged code blocks +* hlines:: Handle horizontal lines in tables +* colnames:: Handle column names in tables +* rownames:: Handle row names in tables +* shebang:: Make tangled files executable Miscellaneous -* Completion:: M-TAB knows what you need -* Speed keys:: Electic commands at the beginning of a headline -* Customization:: Adapting Org to your taste -* In-buffer settings:: Overview of the #+KEYWORDS -* The very busy C-c C-c key:: When in doubt, press C-c C-c -* Clean view:: Getting rid of leading stars in the outline -* TTY keys:: Using Org on a tty -* Interaction:: Other Emacs packages +* Completion:: M-TAB knows what you need +* Speed keys:: Electric commands at the beginning of a headline +* Code evaluation security:: Org mode files evaluate inline code +* Customization:: Adapting Org to your taste +* In-buffer settings:: Overview of the #+KEYWORDS +* The very busy C-c C-c key:: When in doubt, press C-c C-c +* Clean view:: Getting rid of leading stars in the outline +* TTY keys:: Using Org on a tty +* Interaction:: Other Emacs packages Interaction with other packages -* Cooperation:: Packages Org cooperates with -* Conflicts:: Packages that lead to conflicts +* Cooperation:: Packages Org cooperates with +* Conflicts:: Packages that lead to conflicts Hacking -* Hooks:: Who to reach into Org's internals -* Add-on packages:: Available extensions -* Adding hyperlink types:: New custom link types -* Context-sensitive commands:: How to add functionality to such commands -* Tables in arbitrary syntax:: Orgtbl for La@TeX{} and other programs -* Dynamic blocks:: Automatically filled blocks -* Special agenda views:: Customized views +* Hooks:: Who to reach into Org's internals +* Add-on packages:: Available extensions +* Adding hyperlink types:: New custom link types +* Context-sensitive commands:: How to add functionality to such commands +* Tables in arbitrary syntax:: Orgtbl for La@TeX{} and other programs +* Dynamic blocks:: Automatically filled blocks +* Special agenda views:: Customized views * Extracting agenda information:: Postprocessing of agenda information -* Using the property API:: Writing programs that use entry properties -* Using the mapping API:: Mapping over all or selected entries +* Using the property API:: Writing programs that use entry properties +* Using the mapping API:: Mapping over all or selected entries Tables and lists in arbitrary syntax -* Radio tables:: Sending and receiving radio tables -* A LaTeX example:: Step by step, almost a tutorial -* Translator functions:: Copy and modify -* Radio lists:: Doing the same for lists +* Radio tables:: Sending and receiving radio tables +* A LaTeX example:: Step by step, almost a tutorial +* Translator functions:: Copy and modify +* Radio lists:: Doing the same for lists MobileOrg -* Setting up the staging area:: Where to interact with the mobile device -* Pushing to MobileOrg:: Uploading Org files and agendas -* Pulling from MobileOrg:: Integrating captured and flagged items +* Setting up the staging area:: Where to interact with the mobile device +* Pushing to MobileOrg:: Uploading Org files and agendas +* Pulling from MobileOrg:: Integrating captured and flagged items @end detailmenu @end menu @@ -444,11 +504,11 @@ MobileOrg @cindex introduction @menu -* Summary:: Brief summary of what Org does -* Installation:: How to install a downloaded version of Org -* Activation:: How to activate Org for certain buffers -* Feedback:: Bug reports, ideas, patches etc. -* Conventions:: Type-setting conventions in the manual +* Summary:: Brief summary of what Org does +* Installation:: How to install a downloaded version of Org +* Activation:: How to activate Org for certain buffers +* Feedback:: Bug reports, ideas, patches etc. +* Conventions:: Type-setting conventions in the manual @end menu @node Summary, Installation, Introduction, Introduction @@ -473,33 +533,13 @@ structured ASCII file, as HTML, or (TODO and agenda items only) as an iCalendar file. It can also serve as a publishing tool for a set of linked web pages. -An important design aspect that distinguishes Org from, for example, -Planner/Muse is that it encourages you to store every piece of information -only once. In Planner, you have project pages, day pages and possibly -other files, duplicating some information such as tasks. In Org, -you only have notes files. In your notes you mark entries as tasks, and -label them with tags and timestamps. All necessary lists, like a -schedule for the day, the agenda for a meeting, tasks lists selected by -tags, etc., are created dynamically when you need them. +As a project planning environment, Org works by adding metadata to outline +nodes. Based on this data, specific entries can be extracted in queries and +create dynamic @i{agenda views}. -Org keeps simple things simple. When first fired up, it should -feel like a straightforward, easy to use outliner. Complexity is not -imposed, but a large amount of functionality is available when you need -it. Org is a toolbox and can be used in different ways, for -example as: - -@example -@r{@bullet{} an outline extension with visibility cycling and structure editing} -@r{@bullet{} an ASCII system and table editor for taking structured notes} -@r{@bullet{} an ASCII table editor with spreadsheet-like capabilities} -@r{@bullet{} a TODO list editor} -@r{@bullet{} a full agenda and planner with deadlines and work scheduling} -@pindex GTD, Getting Things Done -@r{@bullet{} an environment to implement David Allen's GTD system} -@r{@bullet{} a basic database application} -@r{@bullet{} a simple hypertext system, with HTML and La@TeX{} export} -@r{@bullet{} a publishing tool to create a set of interlinked webpages} -@end example +Org mode contains the Org Babel environment which allows to work with +embedded source code block in a file, to facilitate code evaluation, +documentation, and tangling. Org's automatic, context-sensitive table editor with spreadsheet capabilities can be integrated into any major mode by activating the @@ -508,6 +548,25 @@ tables in arbitrary file types, for example in La@TeX{}. The structure editing and list creation capabilities can be used outside Org with the minor Orgstruct mode. +Org keeps simple things simple. When first fired up, it should +feel like a straightforward, easy to use outliner. Complexity is not +imposed, but a large amount of functionality is available when you need +it. Org is a toolbox and can be used in different ways and for different +ends, for example: + +@example +@r{@bullet{} an outline extension with visibility cycling and structure editing} +@r{@bullet{} an ASCII system and table editor for taking structured notes} +@r{@bullet{} a TODO list editor} +@r{@bullet{} a full agenda and planner with deadlines and work scheduling} +@pindex GTD, Getting Things Done +@r{@bullet{} an environment in which to implement David Allen's GTD system} +@r{@bullet{} a simple hypertext system, with HTML and La@TeX{} export} +@r{@bullet{} a publishing tool to create a set of interlinked webpages} +@r{@bullet{} an environment for literate programming} +@end example + + @cindex FAQ There is a website for Org which provides links to the newest version of Org, as well as additional information, frequently asked @@ -603,14 +662,6 @@ Do not forget to activate Org as described in the following section. @cindex global key bindings @cindex key bindings, global -@iftex -@b{Important:} @i{If you use copy-and-paste to copy Lisp code from the -PDF documentation as viewed by some PDF viewers to your @file{.emacs} file, the -single-quote character comes out incorrectly and the code will not work. -You need to fix the single-quotes by hand, or copy from Info -documentation.} -@end iftex - Add the following lines to your @file{.emacs} file. The last three lines define @emph{global} keys for the commands @command{org-store-link}, @command{org-agenda}, and @command{org-iswitchb}---please choose suitable @@ -633,9 +684,9 @@ active. You can do this with either one of the following two lines (add-hook 'org-mode-hook 'turn-on-font-lock) ; Org buffers only @end lisp -@cindex Org mode, turning on +@cindex Org-mode, turning on With this setup, all files with extension @samp{.org} will be put -into Org mode. As an alternative, make the first line of a file look +into Org-mode. As an alternative, make the first line of a file look like this: @example @@ -643,7 +694,7 @@ MY PROJECTS -*- mode: org; -*- @end example @vindex org-insert-mode-line-in-empty-file -@noindent which will select Org mode for this buffer no matter what +@noindent which will select Org-mode for this buffer no matter what the file's name is. See also the variable @code{org-insert-mode-line-in-empty-file}. @@ -746,7 +797,7 @@ special meaning are written with all capitals. @end table @node Document Structure, Tables, Introduction, Top -@chapter Document Structure +@chapter Document structure @cindex document structure @cindex structure of document @@ -754,17 +805,17 @@ Org is based on Outline mode and provides flexible commands to edit the structure of the document. @menu -* Outlines:: Org is based on Outline mode -* Headlines:: How to typeset Org tree headlines -* Visibility cycling:: Show and hide, much simplified -* Motion:: Jumping to other headlines -* Structure editing:: Changing sequence and level of headlines -* Sparse trees:: Matches embedded in context -* Plain lists:: Additional structure within an entry -* Drawers:: Tucking stuff away -* Blocks:: Folding blocks -* Footnotes:: How footnotes are defined in Org's syntax -* Orgstruct mode:: Structure editing outside Org +* Outlines:: Org is based on Outline mode +* Headlines:: How to typeset Org tree headlines +* Visibility cycling:: Show and hide, much simplified +* Motion:: Jumping to other headlines +* Structure editing:: Changing sequence and level of headlines +* Sparse trees:: Matches embedded in context +* Plain lists:: Additional structure within an entry +* Drawers:: Tucking stuff away +* Blocks:: Folding blocks +* Footnotes:: How footnotes are defined in Org's syntax +* Orgstruct mode:: Structure editing outside Org @end menu @node Outlines, Headlines, Document Structure, Document Structure @@ -786,11 +837,14 @@ command, @command{org-cycle}, which is bound to the @key{TAB} key. @cindex headlines @cindex outline tree @vindex org-special-ctrl-a/e +@vindex org-special-ctrl-k +@vindex org-ctrl-k-protect-subtree -Headlines define the structure of an outline tree. The headlines in -Org start with one or more stars, on the left margin@footnote{See -the variable @code{org-special-ctrl-a/e} to configure special behavior -of @kbd{C-a} and @kbd{C-e} in headlines.}. For example: +Headlines define the structure of an outline tree. The headlines in Org +start with one or more stars, on the left margin@footnote{See the variables +@code{org-special-ctrl-a/e}, @code{org-special-ctrl-k}, and +@code{org-ctrl-k-protect-subtree} to configure special behavior of @kbd{C-a}, +@kbd{C-e}, and @kbd{C-k} in headlines.}. For example: @example * Top level headline @@ -881,6 +935,9 @@ exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command (@pxref{Agenda commands}). With a prefix argument show, on each level, all sibling headings. With double prefix arg, also show the entire subtree of the parent. +@kindex C-c C-k +@item C-c C-k +Expose all the headings of the subtree, CONTENT view for just one subtree. @kindex C-c C-x b @item C-c C-x b Show the current subtree in an indirect buffer@footnote{The indirect @@ -1138,7 +1195,7 @@ functionality. @vindex org-show-following-heading @vindex org-show-siblings @vindex org-show-entry-below -An important feature of Org mode is the ability to construct @emph{sparse +An important feature of Org-mode is the ability to construct @emph{sparse trees} for selected information in an outline tree, so that the entire document is folded as much as possible, but the selected information is made visible along with the headline structure above it@footnote{See also the @@ -1147,7 +1204,7 @@ variables @code{org-show-hierarchy-above}, @code{org-show-following-heading}, control on how much context is shown around each match.}. Just try it out and you will see immediately how it works. -Org mode contains several commands creating such trees, all these +Org-mode contains several commands creating such trees, all these commands can be accessed through a dispatcher: @table @kbd @@ -1222,7 +1279,9 @@ visually indistinguishable from true headlines. In short: even though as bullets. @item @emph{Ordered} list items start with a numeral followed by either a period or -a right parenthesis, such as @samp{1.} or @samp{1)}. +a right parenthesis, such as @samp{1.} or @samp{1)}. If you want a list to +start a different value (e.g. 20), start the text of the item with +@code{[@@start:20]}. @item @emph{Description} list items are unordered list items, and contain the separator @samp{ :: } to separate the description @emph{term} from the @@ -1267,6 +1326,11 @@ properly (@pxref{Exporting}). Since indentation is what governs the structure of these lists, many structural constructs like @code{#+BEGIN_...} blocks can be indented to signal that they should be part of a list item. +@vindex org-list-demote-modify-bullet +If you find that using a different bullet for a sub-list (than that used for +the current list-level) improves readability, customize the variable +@code{org-list-demote-modify-bullet}. + The following commands act on items when the cursor is in the first line of an item (the line with the bullet or number). @@ -1321,6 +1385,11 @@ similar effect. Move the item including subitems up/down (swap with previous/next item of same indentation). If the list is ordered, renumbering is automatic. +@kindex M-@key{left} +@kindex M-@key{right} +@item M-@key{left} +@itemx M-@key{right} +Decrease/increase the indentation of an item, leaving children alone. @kindex M-S-@key{left} @kindex M-S-@key{right} @item M-S-@key{left} @@ -1371,7 +1440,7 @@ numerically, alphabetically, by time, or by custom function. @vindex org-drawers Sometimes you want to keep information associated with an entry, but you -normally don't want to see it. For this, Org mode has @emph{drawers}. +normally don't want to see it. For this, Org-mode has @emph{drawers}. Drawers need to be configured with the variable @code{org-drawers}@footnote{You can define drawers on a per-file basis with a line like @code{#+DRAWERS: HIDDEN PROPERTIES STATE}}. Drawers @@ -1389,7 +1458,7 @@ look like this: Visibility cycling (@pxref{Visibility cycling}) on the headline will hide and show the entry, but keep the drawer collapsed to a single line. In order to look inside the drawer, you need to move the cursor to the drawer line and -press @key{TAB} there. Org mode uses the @code{PROPERTIES} drawer for +press @key{TAB} there. Org-mode uses the @code{PROPERTIES} drawer for storing properties (@pxref{Properties and Columns}), and you can also arrange for state change notes (@pxref{Tracking TODO state changes}) and clock times (@pxref{Clocking work time}) to be stored in a drawer @code{LOGBOOK}. If you @@ -1425,8 +1494,8 @@ or on a per-file basis by using @section Footnotes @cindex footnotes -Org mode supports the creation of footnotes. In contrast to the -@file{footnote.el} package, Org mode's footnotes are designed for work on a +Org-mode supports the creation of footnotes. In contrast to the +@file{footnote.el} package, Org-mode's footnotes are designed for work on a larger document, not only for one-off documents like emails. The basic syntax is similar to the one used by @file{footnote.el}, i.e. a footnote is defined in a paragraph that is started by a footnote marker in square @@ -1440,7 +1509,7 @@ The Org homepage[fn:1] now looks a lot better than it used to. [fn:1] The link is: http://orgmode.org @end example -Org mode extends the number-based syntax to @emph{named} footnotes and +Org-mode extends the number-based syntax to @emph{named} footnotes and optional inline definition. Using plain numbers as markers (as @file{footnote.el} does) is supported for backward compatibility, but not encouraged because of possible conflicts with La@TeX{} snippets (@pxref{Embedded @@ -1449,7 +1518,7 @@ LaTeX}). Here are the valid references: @table @code @item [1] A plain numeric footnote marker. Compatible with @file{footnote.el}, but not -recommended because somthing like @samp{[1]} could easily be part of a code +recommended because something like @samp{[1]} could easily be part of a code snippet. @item [fn:name] A named footnote reference, where @code{name} is a unique label word, or, for @@ -1534,7 +1603,7 @@ you can use the usual commands to follow these links. @cindex Orgstruct mode @cindex minor mode for structure editing -If you like the intuitive way the Org mode structure editing and list +If you like the intuitive way the Org-mode structure editing and list formatting works, you might want to use these commands in other modes like Text mode or Mail mode as well. The minor mode @code{orgstruct-mode} makes this possible. Toggle the mode with @kbd{M-x orgstruct-mode}, or @@ -1571,12 +1640,12 @@ calculator). @end ifnotinfo @menu -* Built-in table editor:: Simple tables -* Column width and alignment:: Overrule the automatic settings -* Column groups:: Grouping to trigger vertical lines -* Orgtbl mode:: The table editor as minor mode -* The spreadsheet:: The table editor has spreadsheet capabilities -* Org-Plot:: Plotting from org tables +* Built-in table editor:: Simple tables +* Column width and alignment:: Overrule the automatic settings +* Column groups:: Grouping to trigger vertical lines +* Orgtbl mode:: The table editor as minor mode +* The spreadsheet:: The table editor has spreadsheet capabilities +* Org-Plot:: Plotting from org tables @end menu @node Built-in table editor, Column width and alignment, Tables, Tables @@ -1874,6 +1943,9 @@ to the right and of string-rich column to the left, you and use @samp{} or @samp{} in a similar fashion. You may also combine alignment and field width like this: @samp{}. +Lines which only contain these formatting cookies will be removed +automatically when exporting the document. + @node Column groups, Orgtbl mode, Column width and alignment, Tables @section Column groups @cindex grouping columns in tables @@ -1890,18 +1962,18 @@ a group of its own. Boundaries between column groups will upon export be marked with vertical lines. Here is an example: @example -| | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) | -|---+----+-----+-----+-----+---------+------------| -| / | <> | < | | > | < | > | -| # | 1 | 1 | 1 | 1 | 1 | 1 | -| # | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 | -| # | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 | -|---+----+-----+-----+-----+---------+------------| -#+TBLFM: $3=$2^2::$4=$2^3::$5=$2^4::$6=sqrt($2)::$7=sqrt(sqrt(($2))) +| N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) | +|---+-----+-----+-----+---------+------------| +| / | < | | > | < | > | +| 1 | 1 | 1 | 1 | 1 | 1 | +| 2 | 4 | 8 | 16 | 1.4142 | 1.1892 | +| 3 | 9 | 27 | 81 | 1.7321 | 1.3161 | +|---+-----+-----+-----+---------+------------| +#+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1))) @end example It is also sufficient to just insert the column group starters after -every vertical line you'd like to have: +every vertical line you would like to have: @example | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) | @@ -1947,14 +2019,14 @@ fields in the table corresponding to the references at the point in the formula, moving these references by arrow keys @menu -* References:: How to refer to another field or range -* Formula syntax for Calc:: Using Calc to compute stuff -* Formula syntax for Lisp:: Writing formulas in Emacs Lisp -* Field formulas:: Formulas valid for a single field -* Column formulas:: Formulas valid for an entire column +* References:: How to refer to another field or range +* Formula syntax for Calc:: Using Calc to compute stuff +* Formula syntax for Lisp:: Writing formulas in Emacs Lisp +* Field formulas:: Formulas valid for a single field +* Column formulas:: Formulas valid for an entire column * Editing and debugging formulas:: Fixing formulas -* Updating the table:: Recomputing all dependent fields -* Advanced features:: Field names, parameters and automatic recalc +* Updating the table:: Recomputing all dependent fields +* Advanced features:: Field names, parameters and automatic recalc @end menu @node References, Formula syntax for Calc, The spreadsheet, The spreadsheet @@ -2456,6 +2528,11 @@ hline are left alone, assuming that these are part of the table header. Iterate the table by recomputing it until no further changes occur. This may be necessary if some computed fields use the value of other fields that are computed @i{later} in the calculation sequence. +@item M-x org-table-recalculate-buffer-tables +Recompute all tables in the current buffer. +@item M-x org-table-iterate-buffer-tables +Iterate all tables in the current buffer, in order to converge table-to-table +dependencies. @end table @node Advanced features, , Updating the table, The spreadsheet @@ -2563,7 +2640,7 @@ functions. @node Org-Plot, , The spreadsheet, Tables @section Org-Plot @cindex graph, in tables -@cindex plot tables using gnuplot +@cindex plot tables using Gnuplot @cindex #+PLOT Org-Plot can produce 2D and 3D graphs of information stored in org tables @@ -2653,14 +2730,14 @@ Like HTML, Org provides links inside a file, external links to other files, Usenet articles, emails, and much more. @menu -* Link format:: How links in Org are formatted -* Internal links:: Links to other places in the current file -* External links:: URL-like links to the world -* Handling links:: Creating, inserting and following -* Using links outside Org:: Linking from my C source code? -* Link abbreviations:: Shortcuts for writing complex links -* Search options:: Linking to a specific location -* Custom searches:: When the default search is not enough +* Link format:: How links in Org are formatted +* Internal links:: Links to other places in the current file +* External links:: URL-like links to the world +* Handling links:: Creating, inserting and following +* Using links outside Org:: Linking from my C source code? +* Link abbreviations:: Shortcuts for writing complex links +* Search options:: Linking to a specific location +* Custom searches:: When the default search is not enough @end menu @node Link format, Internal links, Hyperlinks, Hyperlinks @@ -2736,7 +2813,7 @@ headlines@footnote{To insert a link targeting a headline, in-buffer completion can be used. Just type a star followed by a few optional letters into the buffer and press @kbd{M-@key{TAB}}. All headlines in the current buffer will be offered as completions. @xref{Handling links}, for more -commands creating links.}. When searching, Org mode will first try an +commands creating links.}. When searching, Org-mode will first try an exact match, but then move on to more and more lenient searches. For example, the link @samp{[[*My Targets]]} will find any of the following: @@ -2753,7 +2830,7 @@ several times in direct succession goes back to positions recorded earlier. @menu -* Radio targets:: Make targets trigger links in plain text +* Radio targets:: Make targets trigger links in plain text @end menu @node Radio targets, , Internal links, Internal links @@ -2799,6 +2876,7 @@ the colon. The following list shows examples for each link type. @example http://www.astro.uva.nl/~dominik @r{on the web} +doi:10.1000/182 @r{DOI for an electronic resource} file:/home/dominik/images/jupiter.jpg @r{file, absolute path} /home/dominik/images/jupiter.jpg @r{same as above} file:papers/last.pdf @r{file, relative path} @@ -2826,6 +2904,7 @@ gnus:group @r{Gnus group link} gnus:group#id @r{Gnus article link} bbdb:R.*Stallman @r{BBDB link (with regexp)} irc:/irc.com/#emacs/bob @r{IRC link} +info:org:External%20links @r{Info node link (with encoded space)} shell:ls *.org @r{A shell command} elisp:org-agenda @r{Interactive Elisp command} elisp:(find-file-other-frame "Elisp.org") @r{Elisp form to evaluate} @@ -2966,14 +3045,14 @@ to the current directory using @samp{../}. Otherwise an absolute path is used, if possible with @samp{~/} for your home directory. You can force an absolute path with two @kbd{C-u} prefixes. @c -@item C-c C-l @r{(with cursor on existing link)} +@item C-c C-l @ @r{(with cursor on existing link)} When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the link and description parts of the link. @c @cindex following links @kindex C-c C-o -@kindex RET -@item C-c C-o @r{or} @key{RET} +@kindex @key{RET} +@item C-c C-o @ @r{(or, if @code{org-return-follows-link} is set, also} @key{RET} @vindex org-file-apps Open link at point. This will launch a web browser for URLs (using @command{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for @@ -3004,6 +3083,14 @@ Like @kbd{mouse-2}, but force file links to be opened with Emacs, and internal links to be displayed in another window@footnote{See the variable @code{org-display-internal-link-with-indirect-buffer}}. @c +@cindex inlining images +@cindex images, inlining +@kindex C-c C-x C-v +@item C-c C-x C-v +Toggle the inline display of linked images. Normally this will only inline +images that have no description part in the link, i.e. images that will also +be inlined during export. When called with a prefix argument, also display +images that do have a link description. @cindex mark ring @kindex C-c % @item C-c % @@ -3063,8 +3150,9 @@ abbreviated link looks like this @noindent @vindex org-link-abbrev-alist -where the tag is optional. The @i{linkword} must be a word; letter, numbers, -@samp{-}, and @samp{_} are allowed here. Abbreviations are resolved +where the tag is optional. +The @i{linkword} must be a word, starting with a letter, followed by +letters, numbers, @samp{-}, and @samp{_}. Abbreviations are resolved according to the information in the variable @code{org-link-abbrev-alist} that relates the linkwords to replacement text. Here is an example: @@ -3145,7 +3233,7 @@ Link to a heading with a @code{CUSTOM_ID} property @item /regexp/ Do a regular expression search for @code{regexp}. This uses the Emacs command @code{occur} to list all matches in a separate window. If the -target file is in Org mode, @code{org-occur} is used to create a +target file is in Org-mode, @code{org-occur} is used to create a sparse tree with the matches. @c If the target file is a directory, @c @code{grep} will be used to search all files in the directory. @@ -3181,10 +3269,10 @@ for Bib@TeX{} database files, and you can use the corresponding code as an implementation example. See the file @file{org-bibtex.el}. @node TODO Items, Tags, Hyperlinks, Top -@chapter TODO Items +@chapter TODO items @cindex TODO items -Org mode does not maintain TODO lists as separate documents@footnote{Of +Org-mode does not maintain TODO lists as separate documents@footnote{Of course, you can make a document that contains only long lists of TODO items, but this is not required.}. Instead, TODO items are an integral part of the notes file, because TODO items usually come up while taking notes! With Org @@ -3193,16 +3281,16 @@ information is not duplicated, and the entire context from which the TODO item emerged is always present. Of course, this technique for managing TODO items scatters them -throughout your notes file. Org mode compensates for this by providing +throughout your notes file. Org-mode compensates for this by providing methods to give you an overview of all the things that you have to do. @menu -* TODO basics:: Marking and displaying TODO entries -* TODO extensions:: Workflow and assignments -* Progress logging:: Dates and notes for progress -* Priorities:: Some things are more important than others -* Breaking down tasks:: Splitting a task into manageable pieces -* Checkboxes:: Tick-off lists +* TODO basics:: Marking and displaying TODO entries +* TODO extensions:: Workflow and assignments +* Progress logging:: Dates and notes for progress +* Priorities:: Some things are more important than others +* Breaking down tasks:: Splitting a task into manageable pieces +* Checkboxes:: Tick-off lists @end menu @node TODO basics, TODO extensions, TODO Items, TODO Items @@ -3249,27 +3337,26 @@ mostly if more than two TODO states are possible (@pxref{TODO extensions}). See also @ref{Conflicts}, for a discussion of the interaction with @code{shift-selection-mode}. See also the variable @code{org-treat-S-cursor-todo-selection-as-state-change}. -@kindex C-c C-v @kindex C-c / t @cindex sparse tree, for TODO -@item C-c C-v @itemx C-c / t @vindex org-todo-keywords View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}). Folds the -entire buffer, but shows all TODO items and the headings hierarchy above -them. With a prefix argument, search for a specific TODO. You will be -prompted for the keyword, and you can also give a list of keywords like -@code{KWD1|KWD2|...} to list entries that match any one of these keywords. -With numeric prefix argument N, show the tree for the Nth keyword in the -variable @code{org-todo-keywords}. With two prefix arguments, find all TODO -and DONE entries. +entire buffer, but shows all TODO items (with not-DONE state) and the +headings hierarchy above them. With a prefix argument (or by using @kbd{C-c +/ T}), search for a specific TODO. You will be prompted for the keyword, and +you can also give a list of keywords like @code{KWD1|KWD2|...} to list +entries that match any one of these keywords. With numeric prefix argument +N, show the tree for the Nth keyword in the variable +@code{org-todo-keywords}. With two prefix arguments, find all TODO states, +both un-done and done. @kindex C-c a t @item C-c a t -Show the global TODO list. Collects the TODO items from all agenda -files (@pxref{Agenda Views}) into a single buffer. The new buffer will -be in @code{agenda-mode}, which provides commands to examine and -manipulate the TODO entries from the new buffer (@pxref{Agenda -commands}). @xref{Global TODO list}, for more information. +Show the global TODO list. Collects the TODO items (with not-DONE states) +from all agenda files (@pxref{Agenda Views}) into a single buffer. The new +buffer will be in @code{agenda-mode}, which provides commands to examine and +manipulate the TODO entries from the new buffer (@pxref{Agenda commands}). +@xref{Global TODO list}, for more information. @kindex S-M-@key{RET} @item S-M-@key{RET} Insert a new TODO entry below the current one. @@ -3286,7 +3373,7 @@ option @code{org-todo-state-tags-triggers} for details. @vindex org-todo-keywords By default, marked TODO entries have one of only two states: TODO and -DONE. Org mode allows you to classify TODO items in more complex ways +DONE. Org-mode allows you to classify TODO items in more complex ways with @emph{TODO keywords} (stored in @code{org-todo-keywords}). With special setup, the TODO keyword system can work differently in different files. @@ -3295,13 +3382,13 @@ Note that @i{tags} are another way to classify headlines in general and TODO items in particular (@pxref{Tags}). @menu -* Workflow states:: From TODO to DONE in steps -* TODO types:: I do this, Fred does the rest -* Multiple sets in one file:: Mixing it all, and still finding your way -* Fast access to TODO states:: Single letter selection of a state -* Per-file keywords:: Different files, different requirements -* Faces for TODO keywords:: Highlighting states -* TODO dependencies:: When one task needs to wait for others +* Workflow states:: From TODO to DONE in steps +* TODO types:: I do this, Fred does the rest +* Multiple sets in one file:: Mixing it all, and still finding your way +* Fast access to TODO states:: Single letter selection of a state +* Per-file keywords:: Different files, different requirements +* Faces for TODO keywords:: Highlighting states +* TODO dependencies:: When one task needs to wait for others @end menu @node Workflow states, TODO types, TODO extensions, TODO extensions @@ -3311,7 +3398,7 @@ TODO items in particular (@pxref{Tags}). You can use TODO keywords to indicate different @emph{sequential} states in the process of working on an item, for example@footnote{Changing -this variable only becomes effective after restarting Org mode in a +this variable only becomes effective after restarting Org-mode in a buffer.}: @lisp @@ -3354,7 +3441,7 @@ be set up like this: In this case, different keywords do not indicate a sequence, but rather different types. So the normal work flow would be to assign a task to a -person, and later to mark it DONE. Org mode supports this style by adapting +person, and later to mark it DONE. Org-mode supports this style by adapting the workings of the command @kbd{C-c C-t}@footnote{This is also true for the @kbd{t} command in the timeline and agenda buffers.}. When used several times in succession, it will still cycle through all names, in order to first @@ -3362,10 +3449,10 @@ select the right type for a task. But when you return to the item after some time and execute @kbd{C-c C-t} again, it will switch from any name directly to DONE. Use prefix arguments or completion to quickly select a specific name. You can also review the items of a specific TODO type in a sparse tree -by using a numeric prefix to @kbd{C-c C-v}. For example, to see all things -Lucy has to do, you would use @kbd{C-3 C-c C-v}. To collect Lucy's items +by using a numeric prefix to @kbd{C-c / t}. For example, to see all things +Lucy has to do, you would use @kbd{C-3 C-c / t}. To collect Lucy's items from all agenda files into a single buffer, you would use the numeric prefix -argument as well when creating the global TODO list: @kbd{C-3 C-c t}. +argument as well when creating the global TODO list: @kbd{C-3 C-c a t}. @node Multiple sets in one file, Fast access to TODO states, TODO types, TODO extensions @subsection Multiple keyword sets in one file @@ -3385,7 +3472,7 @@ like this: (sequence "|" "CANCELED"))) @end lisp -The keywords should all be different, this helps Org mode to keep track +The keywords should all be different, this helps Org-mode to keep track of which subsequence should be used for a given entry. In this setup, @kbd{C-c C-t} only operates within a subsequence, so it switches from @code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to @@ -3482,9 +3569,9 @@ Remember that the keywords after the vertical bar (or the last keyword if no bar is there) must always mean that the item is DONE (although you may use a different word). After changing one of these lines, use @kbd{C-c C-c} with the cursor still in the line to make the changes -known to Org mode@footnote{Org mode parses these lines only when -Org mode is activated after visiting a file. @kbd{C-c C-c} with the -cursor in a line starting with @samp{#+} is simply restarting Org mode +known to Org-mode@footnote{Org-mode parses these lines only when +Org-mode is activated after visiting a file. @kbd{C-c C-c} with the +cursor in a line starting with @samp{#+} is simply restarting Org-mode for the current buffer.}. @node Faces for TODO keywords, TODO dependencies, Per-file keywords, TODO extensions @@ -3494,7 +3581,7 @@ for the current buffer.}. @vindex org-todo @r{(face)} @vindex org-done @r{(face)} @vindex org-todo-keyword-faces -Org mode highlights TODO keywords with special faces: @code{org-todo} +Org-mode highlights TODO keywords with special faces: @code{org-todo} for keywords indicating that an item still has to be acted upon, and @code{org-done} for keywords indicating that an item is finished. If you are using more than 2 different states, you might want to use @@ -3584,7 +3671,7 @@ module @file{org-depend.el}. @cindex progress logging @cindex logging, of progress -Org mode can automatically record a timestamp and possibly a note when +Org-mode can automatically record a timestamp and possibly a note when you mark a TODO item as DONE, or even each time you change the state of a TODO item. This system is highly configurable, settings can be on a per-keyword basis and can be localized to a file or even a subtree. For @@ -3592,9 +3679,9 @@ information on how to clock working time for a task, see @ref{Clocking work time}. @menu -* Closing items:: When was this entry marked DONE? -* Tracking TODO state changes:: When did the status change? -* Tracking your habits:: How consistent have you been? +* Closing items:: When was this entry marked DONE? +* Tracking TODO state changes:: When did the status change? +* Tracking your habits:: How consistent have you been? @end menu @node Closing items, Tracking TODO state changes, Progress logging, Progress logging @@ -3648,7 +3735,7 @@ behavior---the recommended drawer for this is called @code{LOGBOOK}. You can also overrule the setting of this variable for a subtree by setting a @code{LOG_INTO_DRAWER} property. -Since it is normally too much to record a note for every state, Org mode +Since it is normally too much to record a note for every state, Org-mode expects configuration on a per-keyword basis for this. This is achieved by adding special markers @samp{!} (for a timestamp) and @samp{@@} (for a note) in parentheses after each keyword. For example, with the setting @@ -3662,7 +3749,7 @@ in parentheses after each keyword. For example, with the setting @vindex org-log-done you not only define global TODO keywords and fast access keys, but also request that a time is recorded when the entry is set to -DONE@footnote{It is possible that Org mode will record two timestamps +DONE@footnote{It is possible that Org-mode will record two timestamps when you are using both @code{org-log-done} and state change logging. However, it will never prompt for two notes---if you have configured both, the state change recording note will take precedence and cancel @@ -3778,7 +3865,7 @@ If the task was going to be overdue the next day. If the task was overdue on that day. @end table -In addition to coloring each day, the day is also marked with an asterix if +In addition to coloring each day, the day is also marked with an asterisk if the task was actually done that day, and an exclamation mark to show where the current day falls in the graph. @@ -3808,10 +3895,9 @@ which should only be done in certain contexts, for example. @section Priorities @cindex priorities -If you use Org mode extensively, you may end up enough TODO items that +If you use Org-mode extensively, you may end up with enough TODO items that it starts to make sense to prioritize them. Prioritizing can be done by -placing a @emph{priority cookie} into the headline of a TODO item, like -this +placing a @emph{priority cookie} into the headline of a TODO item, like this @example *** TODO [#A] Write letter to Sam Fortune @@ -3819,11 +3905,11 @@ this @noindent @vindex org-priority-faces -By default, Org mode supports three priorities: @samp{A}, @samp{B}, and +By default, Org-mode supports three priorities: @samp{A}, @samp{B}, and @samp{C}. @samp{A} is the highest priority. An entry without a cookie is treated as priority @samp{B}. Priorities make a difference only in the agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have no -inherent meaning to Org mode. The cookies can be highlighted with special +inherent meaning to Org-mode. The cookies can be highlighted with special faces by customizing the variable @code{org-priority-faces}. Priorities can be attached to any outline tree entries; they do not need @@ -3877,7 +3963,7 @@ with detailed subtasks on the tree@footnote{To keep subtasks out of the global TODO list, see the @code{org-agenda-todo-list-sublevels}.}. To keep the overview over the fraction of subtasks that are already completed, insert either @samp{[/]} or @samp{[%]} anywhere in the headline. These cookies will -be updates each time the todo status of a child changes, or when pressing +be updated each time the TODO status of a child changes, or when pressing @kbd{C-c C-c} on the cookie. For example: @example @@ -4043,7 +4129,7 @@ entry twice (checkboxes with @kbd{C-c C-c}). @cindex sparse tree, tag based An excellent way to implement labels and contexts for cross-correlating -information is to assign @i{tags} to headlines. Org mode has extensive +information is to assign @i{tags} to headlines. Org-mode has extensive support for tags. @vindex org-tag-faces @@ -4057,9 +4143,9 @@ You may specify special faces for specific tags using the variable (@pxref{Faces for TODO keywords}). @menu -* Tag inheritance:: Tags use the tree structure of the outline -* Setting tags:: How to assign tags to a headline -* Tag searches:: Searching for combinations of tags +* Tag inheritance:: Tags use the tree structure of the outline +* Setting tags:: How to assign tags to a headline +* Tag searches:: Searching for combinations of tags @end menu @node Tag inheritance, Setting tags, Tags, Tags @@ -4123,7 +4209,7 @@ also a special command for inserting tags: @item C-c C-q @cindex completion, of tags @vindex org-tags-column -Enter new tags for the current headline. Org mode will either offer +Enter new tags for the current headline. Org-mode will either offer completion or a special single-key interface for setting tags, see below. After pressing @key{RET}, the tags will be inserted and aligned to @code{org-tags-column}. When called with a @kbd{C-u} prefix, all @@ -4167,7 +4253,7 @@ by adding a STARTUP option line to that file: #+STARTUP: noptag @end example -By default Org mode uses the standard minibuffer completion facilities for +By default Org-mode uses the standard minibuffer completion facilities for entering tags. However, it also implements another, quicker, tag selection method called @emph{fast tag selection}. This allows you to select and deselect tags with just a single key press. For this to work well you should @@ -4289,26 +4375,6 @@ C-c}). If you set the variable to the value @code{expert}, the special window is not even shown for single-key tag selection, it comes up only when you press an extra @kbd{C-c}. -@vindex org-complete-tags-always-offer-all-agenda-tags -As said before, when setting tags and @code{org-tag-alist} is nil, then the -list of tags in the current buffer is used. Normally, this behavior is very -convenient, except in org remember buffers (@pxref{Remember}), because there -are no tags that can be calculated dynamically. Here, you most probably want -to have completion for all tags in all agenda files. This can be done by -setting @code{org-complete-tags-always-offer-all-agenda-tags} to non-nil in -those buffers. - -@lisp -(add-hook 'org-remember-mode-hook - (lambda () - (set (make-local-variable - 'org-complete-tags-always-offer-all-agenda-tags) - t))) -@end lisp - -Of course, you can also set it to @code{t} globally if you always want to -have completion of all tags in all agenda files. - @node Tag searches, , Setting tags, Tags @section Tag searches @cindex tag searches @@ -4346,11 +4412,11 @@ and properties. For a complete description with many examples, see @node Properties and Columns, Dates and Times, Tags, Top -@chapter Properties and Columns +@chapter Properties and columns @cindex properties Properties are a set of key-value pairs associated with an entry. There -are two main applications for properties in Org mode. First, properties +are two main applications for properties in Org-mode. First, properties are like tags, but with a value. Second, you can use properties to implement (very basic) database capabilities in an Org buffer. For an example of the first application, imagine maintaining a file where @@ -4366,12 +4432,12 @@ Properties can be conveniently edited and viewed in column view (@pxref{Column view}). @menu -* Property syntax:: How properties are spelled out -* Special properties:: Access to other Org mode features -* Property searches:: Matching property values -* Property inheritance:: Passing values down the tree -* Column view:: Tabular viewing and editing -* Property API:: Properties for Lisp programmers +* Property syntax:: How properties are spelled out +* Special properties:: Access to other Org-mode features +* Property searches:: Matching property values +* Property inheritance:: Passing values down the tree +* Column view:: Tabular viewing and editing +* Property API:: Properties for Lisp programmers @end menu @node Property syntax, Special properties, Properties and Columns, Properties and Columns @@ -4465,7 +4531,7 @@ nearest column format definition. @section Special properties @cindex properties, special -Special properties provide an alternative access method to Org mode +Special properties provide an alternative access method to Org-mode features, like the TODO state or the priority of an entry, discussed in the previous chapters. This interface exists so that you can include these states in a column view (@pxref{Column view}), or to use them in @@ -4553,16 +4619,18 @@ a regular expression and matched against the property values. @vindex org-use-property-inheritance The outline structure of Org-mode documents lends itself for an inheritance model of properties: if the parent in a tree has a certain -property, the children can inherit this property. Org mode does not +property, the children can inherit this property. Org-mode does not turn this on by default, because it can slow down property searches significantly and is often not needed. However, if you find inheritance useful, you can turn it on by setting the variable @code{org-use-property-inheritance}. It may be set to @code{t} to make all properties inherited from the parent, to a list of properties that should be inherited, or to a regular expression that matches -inherited properties. +inherited properties. If a property has the value @samp{nil}, this is +interpreted as an explicit undefine of he property, so that inheritance +search will stop at this value and return @code{nil}. -Org mode has a few properties for which inheritance is hard-coded, at +Org-mode has a few properties for which inheritance is hard-coded, at least for the special applications for which they are used: @cindex property, COLUMNS @@ -4593,7 +4661,7 @@ subtree (@pxref{Tracking TODO state changes}). A great way to view and edit properties in an outline tree is @emph{column view}. In column view, each outline node is turned into a table row. Columns in this table provide access to properties of the -entries. Org mode implements columns by overlaying a tabular structure +entries. Org-mode implements columns by overlaying a tabular structure over the headline of each item. While the headlines have been turned into a table row, you can still change the visibility of the outline tree. For example, you get a compact table by switching to CONTENTS @@ -4605,9 +4673,9 @@ Column view also works in agenda buffers (@pxref{Agenda Views}) where queries have collected selected items, possibly from a number of files. @menu -* Defining columns:: The COLUMNS format property -* Using column view:: How to create and use column view -* Capturing column view:: A dynamic block for column view +* Defining columns:: The COLUMNS format property +* Using column view:: How to create and use column view +* Capturing column view:: A dynamic block for column view @end menu @node Defining columns, Using column view, Column view, Column view @@ -4619,8 +4687,8 @@ Setting up a column view first requires defining the columns. This is done by defining a column format line. @menu -* Scope of column definitions:: Where defined, where valid? -* Column attributes:: Appearance and content of a column +* Scope of column definitions:: Where defined, where valid? +* Column attributes:: Appearance and content of a column @end menu @node Scope of column definitions, Column attributes, Defining columns, Defining columns @@ -4677,7 +4745,7 @@ optional. The individual parts have the following meaning: @{+@} @r{Sum numbers in this column.} @{+;%.1f@} @r{Like @samp{+}, but format result with @samp{%.1f}.} @{$@} @r{Currency, short for @samp{+;%.2f}.} - @{:@} @r{Sum times, HH:MM:SS, plain numbers are hours.} + @{:@} @r{Sum times, HH:MM, plain numbers are hours.} @{X@} @r{Checkbox status, @samp{[X]} if all children are @samp{[X]}.} @{X/@} @r{Checkbox status, @samp{[n/m]}.} @{X%@} @r{Checkbox status, @samp{[n%]}.} @@ -4888,7 +4956,7 @@ features based on them. For more information see @ref{Using the property API}. @node Dates and Times, Capture - Refile - Archive, Properties and Columns, Top -@chapter Dates and Times +@chapter Dates and times @cindex dates @cindex times @cindex timestamp @@ -4896,19 +4964,19 @@ property API}. To assist project planning, TODO items can be labeled with a date and/or a time. The specially formatted string carrying the date and time -information is called a @emph{timestamp} in Org mode. This may be a +information is called a @emph{timestamp} in Org-mode. This may be a little confusing because timestamp is often used as indicating when -something was created or last changed. However, in Org mode this term +something was created or last changed. However, in Org-mode this term is used in a much wider sense. @menu -* Timestamps:: Assigning a time to a tree entry -* Creating timestamps:: Commands which insert timestamps -* Deadlines and scheduling:: Planning your work -* Clocking work time:: Tracking how long you spend on a task -* Resolving idle time:: Resolving time if you've been idle -* Effort estimates:: Planning work effort in advance -* Relative timer:: Notes with a running timer +* Timestamps:: Assigning a time to a tree entry +* Creating timestamps:: Commands which insert timestamps +* Deadlines and scheduling:: Planning your work +* Clocking work time:: Tracking how long you spend on a task +* Resolving idle time:: Resolving time if you've been idle +* Effort estimates:: Planning work effort in advance +* Relative timer:: Notes with a running timer @end menu @@ -4954,7 +5022,7 @@ following will show up in the agenda every Wednesday: @end example @item Diary-style sexp entries -For more complex date specifications, Org mode supports using the +For more complex date specifications, Org-mode supports using the special sexp diary entries implemented in the Emacs calendar/diary package. For example @@ -4993,7 +5061,7 @@ angular ones. These timestamps are inactive in the sense that they do @cindex creating timestamps @cindex timestamps, creating -For Org mode to recognize timestamps, they need to be in the specific +For Org-mode to recognize timestamps, they need to be in the specific format. All commands listed below produce timestamps in the correct format. @@ -5064,8 +5132,8 @@ the following column). @menu -* The date/time prompt:: How Org mode helps you entering date and time -* Custom time format:: Making dates look different +* The date/time prompt:: How Org-mode helps you entering date and time +* Custom time format:: Making dates look different @end menu @node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps @@ -5074,17 +5142,17 @@ the following column). @cindex time, reading in minibuffer @vindex org-read-date-prefer-future -When Org mode prompts for a date/time, the default is shown in default +When Org-mode prompts for a date/time, the default is shown in default date/time format, and the prompt therefore seems to ask for a specific format. But it will in fact accept any string containing some date and/or time information, and it is really smart about interpreting your input. You can, for example, use @kbd{C-y} to paste a (possibly multi-line) string -copied from an email message. Org mode will find whatever information is in +copied from an email message. Org-mode will find whatever information is in there and derive anything you have not specified from the @emph{default date and time}. The default is usually the current date and time, but when modifying an existing timestamp, or when entering the second stamp of a range, it is taken from the stamp in the buffer. When filling in -information, Org mode assumes that most of the time you will want to enter a +information, Org-mode assumes that most of the time you will want to enter a date in the future: if you omit the month/year and the given day/month is @i{before} today, it will assume that you mean a future date@footnote{See the variable @code{org-read-date-prefer-future}. You may set that variable to @@ -5093,7 +5161,7 @@ tomorrow.}. If the date has been automatically shifted into the future, the time prompt will show this with @samp{(=>F).} For example, let's assume that today is @b{June 13, 2006}. Here is how -various inputs will be interpreted, the items filled in by Org mode are +various inputs will be interpreted, the items filled in by Org-mode are in @b{bold}. @example @@ -5101,8 +5169,8 @@ in @b{bold}. 2/5/3 --> 2003-02-05 14 --> @b{2006}-@b{06}-14 12 --> @b{2006}-@b{07}-12 -2/5 --> @b{2003}-02-05 -Fri --> nearest Friday (defaultdate or later) +2/5 --> @b{2007}-02-05 +Fri --> nearest Friday (default date or later) sep 15 --> @b{2006}-09-15 feb 15 --> @b{2007}-02-15 sep 12 9 --> 2009-09-12 @@ -5149,6 +5217,8 @@ from the minibuffer: @kindex < @kindex > +@kindex M-v +@kindex C-v @kindex mouse-1 @kindex S-@key{right} @kindex S-@key{left} @@ -5158,12 +5228,13 @@ from the minibuffer: @kindex M-S-@key{left} @kindex @key{RET} @example -> / < @r{Scroll calendar forward/backward by one month.} +@key{RET} @r{Choose date at cursor in calendar.} mouse-1 @r{Select date by clicking on it.} S-@key{right}/@key{left} @r{One day forward/backward.} S-@key{down}/@key{up} @r{One week forward/backward.} M-S-@key{right}/@key{left} @r{One month forward/backward.} -@key{RET} @r{Choose date in calendar.} +> / < @r{Scroll calendar forward/backward by one month.} +M-v / C-v @r{Scroll calendar forward/backward by 3 months.} @end example @vindex org-read-date-display-live @@ -5182,7 +5253,7 @@ minibuffer@footnote{If you find this distracting, turn the display of with @vindex org-display-custom-times @vindex org-time-stamp-custom-formats -Org mode uses the standard ISO notation for dates and times as it is +Org-mode uses the standard ISO notation for dates and times as it is defined in ISO 8601. If you cannot get used to this and require another representation of date and time to keep you happy, you can get it by customizing the variables @code{org-display-custom-times} and @@ -5195,7 +5266,7 @@ Toggle the display of custom formats for dates and times. @end table @noindent -Org mode needs the default format for scanning, so the custom date/time +Org-mode needs the default format for scanning, so the custom date/time format does not @emph{replace} the default format---instead it is put @emph{over} the default format using text properties. This has the following consequences: @@ -5272,30 +5343,30 @@ I.e. the task will automatically be forwarded until completed. @end example @noindent -@b{Important:} Scheduling an item in Org mode should @i{not} be +@b{Important:} Scheduling an item in Org-mode should @i{not} be understood in the same way that we understand @i{scheduling a meeting}. Setting a date for a meeting is just a simple appointment, you should mark this entry with a simple plain timestamp, to get this item shown on the date where it applies. This is a frequent misunderstanding by -Org users. In Org mode, @i{scheduling} means setting a date when you +Org users. In Org-mode, @i{scheduling} means setting a date when you want to start working on an action item. @end table You may use timestamps with repeaters in scheduling and deadline -entries. Org mode will issue early and late warnings based on the +entries. Org-mode will issue early and late warnings based on the assumption that the timestamp represents the @i{nearest instance} of the repeater. However, the use of diary sexp entries like @c @code{<%%(diary-float t 42)>} @c -in scheduling and deadline timestamps is limited. Org mode does not +in scheduling and deadline timestamps is limited. Org-mode does not know enough about the internals of each sexp function to issue early and late warnings. However, it will show the item on each day where the sexp entry matches. @menu -* Inserting deadline/schedule:: Planning items -* Repeated tasks:: Items that show up again and again +* Inserting deadline/schedule:: Planning items +* Repeated tasks:: Items that show up again and again @end menu @node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling @@ -5361,7 +5432,7 @@ Sparse tree for deadlines and scheduled items after a given date. @cindex tasks, repeated @cindex repeated tasks -Some tasks need to be repeated again and again. Org mode helps to +Some tasks need to be repeated again and again. Org-mode helps to organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED, or plain timestamp. In the following example @example @@ -5375,17 +5446,21 @@ from that time. If you need both a repeater and a special warning period in a deadline entry, the repeater should come first and the warning period last: @code{DEADLINE: <2005-10-01 Sat +1m -3d>}. -Deadlines and scheduled items produce entries in the agenda when they -are over-due, so it is important to be able to mark such an entry as -completed once you have done so. When you mark a DEADLINE or a SCHEDULE -with the TODO keyword DONE, it will no longer produce entries in the -agenda. The problem with this is, however, that then also the -@emph{next} instance of the repeated entry will not be active. Org mode -deals with this in the following way: When you try to mark such an entry -DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating -timestamp by the repeater interval, and immediately set the entry state -back to TODO. In the example above, setting the state to DONE would -actually switch the date like this: +@vindex org-todo-repeat-to-state +Deadlines and scheduled items produce entries in the agenda when they are +over-due, so it is important to be able to mark such an entry as completed +once you have done so. When you mark a DEADLINE or a SCHEDULE with the TODO +keyword DONE, it will no longer produce entries in the agenda. The problem +with this is, however, that then also the @emph{next} instance of the +repeated entry will not be active. Org-mode deals with this in the following +way: When you try to mark such an entry DONE (using @kbd{C-c C-t}), it will +shift the base date of the repeating timestamp by the repeater interval, and +immediately set the entry state back to TODO@footnote{In fact, the target +state is taken from, in this sequence, the @code{REPEAT_TO_STATE} property or +the variable @code{org-todo-repeat-to-state}. If neither of these is +specified, the target state defaults to the first state of the TODO state +sequence.}. In the example above, setting the state to DONE would actually +switch the date like this: @example ** TODO Pay the rent @@ -5410,7 +5485,7 @@ task, this may not be the best way to handle it. For example, if you forgot to call you father for 3 weeks, it does not make sense to call him 3 times in a single day to make up for it. Finally, there are tasks like changing batteries which should always repeat a certain time -@i{after} the last time you did it. For these tasks, Org mode has +@i{after} the last time you did it. For these tasks, Org-mode has special repeaters markers with @samp{++} and @samp{.+}. For example: @example @@ -5437,7 +5512,7 @@ created for this purpose, it is described in @ref{Structure editing}. @node Clocking work time, Resolving idle time, Deadlines and scheduling, Dates and Times @section Clocking work time -Org mode allows you to clock the time you spend on specific tasks in a +Org-mode allows you to clock the time you spend on specific tasks in a project. When you start working on an item, you can start the clock. When you stop working on that task, or when you mark the task done, the clock is stopped and the corresponding time interval is recorded. It @@ -5573,6 +5648,8 @@ new table. The @samp{BEGIN} line can specify options: :tend @r{A time string specifying when to stop considering times.} :step @r{@code{week} or @code{day}, to split the table into chunks.} @r{To use this, @code{:block} or @code{:tstart}, @code{:tend} are needed.} +:stepskip0 @r{Don't show steps that have zero time} +:tags @r{A tags match to select entries that should contribute} :link @r{Link the item headlines in the table to their origins.} :formula @r{Content of a @code{#+TBLFM} line to be added and evaluated.} @r{As a special case, @samp{:formula %} adds a column with % time.} @@ -5665,8 +5742,8 @@ use the shift key and press @kbd{S}. Remember that using shift will always leave you clocked out, no matter which option you choose. @item C To cancel the clock altogether, use @kbd{C}. Note that if instead of -cancelling you subtract the away time, and the resulting clock amount is less -than a minute, the clock will still be cancelled rather than clutter up the +canceling you subtract the away time, and the resulting clock amount is less +than a minute, the clock will still be canceled rather than clutter up the log with an empty entry. @end table @@ -5794,7 +5871,7 @@ timer is reset to 0. When called with a @kbd{C-u} prefix, reset the timer to specific starting offset. The user is prompted for the offset, with a default taken from a timer string at point, if any, So this can be used to restart taking notes after a break in the process. When called with a double -prefix argument @kbd{C-c C-u}, change all timer strings in the active region +prefix argument @kbd{C-u C-u}, change all timer strings in the active region by a certain amount. This can be used to fix timer strings if the timer was not started at exactly the right moment. @end table @@ -5805,155 +5882,282 @@ not started at exactly the right moment. An important part of any organization system is the ability to quickly capture new ideas and tasks, and to associate reference material with them. -Org uses the @file{remember.el} package to create tasks, and stores files +Org does this using a process called @i{capture}. It also can store files related to a task (@i{attachments}) in a special directory. Once in the system, tasks and projects need to be moved around. Moving completed project trees to an archive file keeps the system compact and fast. @menu -* Remember:: Capture new tasks/ideas with little interruption -* Attachments:: Add files to tasks. -* RSS Feeds:: Getting input from RSS feeds -* Protocols:: External (e.g. Browser) access to Emacs and Org -* Refiling notes:: Moving a tree from one place to another -* Archiving:: What to do with finished projects +* Capture:: Capturing new stuff +* Attachments:: Add files to tasks +* RSS Feeds:: Getting input from RSS feeds +* Protocols:: External (e.g. Browser) access to Emacs and Org +* Refiling notes:: Moving a tree from one place to another +* Archiving:: What to do with finished projects @end menu -@node Remember, Attachments, Capture - Refile - Archive, Capture - Refile - Archive -@section Remember -@cindex @file{remember.el} +@node Capture, Attachments, Capture - Refile - Archive, Capture - Refile - Archive +@section Capture +@cindex capture -The Remember package by John Wiegley lets you store quick notes with little -interruption of your work flow. It is an excellent way to add new notes and -tasks to Org files. The @code{remember.el} package is part of Emacs 23, not -Emacs 22. See @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for -more information. +Org's method for capturing new items is heavily inspired by John Wiegley +excellent remember package. Up to version 6.36 Org used a special setup +for @file{remember.el}. @file{org-remember.el} is still part of Org-mode for +backward compatibility with existing setups. You can find the documentation +for org-remember at @url{http://orgmode.org/org-remember.pdf}. -Org significantly expands the possibilities of Remember: you may define -templates for different note types, and associate target files and headlines -with specific templates. It also allows you to select the location where a -note should be stored interactively, on the fly. +The new capturing setup described here is preferred and should be used by new +users. To convert your @code{org-remember-templates}, run the command +@example +@kbd{M-x org-capture-import-remember-templates @key{RET}} +@end example +@noindent and then customize the new variable with @kbd{M-x +customize-variable org-capture-templates}, check the result, and save the +customization. You can then use both remember and capture until +you are familiar with the new mechanism. + +Capture lets you quickly store notes with little interruption of your work +flow. The basic process of capturing is very similar to remember, but Org +does enhance it with templates and more. @menu -* Setting up Remember for Org:: Some code for .emacs to get things going -* Remember templates:: Define the outline of different note types -* Storing notes:: Directly get the note to where it belongs +* Setting up capture:: Where notes will be stored +* Using capture:: Commands to invoke and terminate capture +* Capture templates:: Define the outline of different note types @end menu -@node Setting up Remember for Org, Remember templates, Remember, Remember -@subsection Setting up Remember for Org +@node Setting up capture, Using capture, Capture, Capture +@subsection Setting up capture -The following customization will tell Remember to use Org files as -target, and to create annotations compatible with Org links. +The following customization sets a default target file for notes, and defines +a global key@footnote{Please select your own key, @kbd{C-c c} is only a +suggestion.} for capturing new material. @example -(org-remember-insinuate) -(setq org-directory "~/path/to/my/orgfiles/") (setq org-default-notes-file (concat org-directory "/notes.org")) -(define-key global-map "\C-cr" 'org-remember) +(define-key global-map "\C-cc" 'org-capture) @end example -@noindent -The last line binds the command @code{org-remember} to a global -key@footnote{Please select your own key, @kbd{C-c r} is only a -suggestion.}. @code{org-remember} basically just calls Remember, -but it makes a few things easier: if there is an active region, it will -automatically copy the region into the Remember buffer. It also allows -to jump to the buffer and location where Remember notes are being -stored: just call @code{org-remember} with a prefix argument. If you -use two prefix arguments, Org jumps to the location where the last -remember note was stored. +@node Using capture, Capture templates, Setting up capture, Capture +@subsection Using capture -The Remember buffer will actually use @code{org-mode} as its major mode, so -that all editing features of Org mode are available. In addition to this, a -minor mode @code{org-remember-mode} is turned on, for the single purpose that -you can use its keymap @code{org-remember-mode-map} to overwrite some of -Org mode's key bindings. +@table @kbd +@kindex C-c c +@item C-c c +Call the command @code{org-capture}. If you have templates defined +@pxref{Capture templates}, it will offer these templates for selection or use +a new Org outline node as the default template. It will insert the template +into the target file and switch to an indirect buffer narrowed to this new +node. You may then insert the information you want. -You can also call @code{org-remember} in a special way from the agenda, -using the @kbd{k r} key combination. With this access, any timestamps -inserted by the selected Remember template (see below) will default to -the cursor date in the agenda, rather than to the current date. +@kindex C-c C-c +@item C-c C-c +Once you have finished entering information into the capture buffer, +@kbd{C-c C-c} will return you to the window configuration before the capture +process, so that you can resume your work without further distraction. -@node Remember templates, Storing notes, Setting up Remember for Org, Remember -@subsection Remember templates -@cindex templates, for Remember +@kindex C-c C-w +@item C-c C-w +Finalize the capture process by refiling (@pxref{Refiling notes}) the note to +a different place. -In combination with Org, you can use templates to generate -different types of Remember notes. For example, if you would like -to use one template to create general TODO entries, another one for -journal entries, and a third one for collecting random ideas, you could -use: +@kindex C-c C-k +@item C-c C-k +Abort the capture process and return to the previous state. +@end table + +You can also call @code{org-capture} in a special way from the agenda, using +the @kbd{k c} key combination. With this access, any timestamps inserted by +the selected capture template will default to the cursor date in the agenda, +rather than to the current date. + +@node Capture templates, , Using capture, Capture +@subsection Capture templates +@cindex templates, for Capture + +You can use templates for different types of capture items, and +for different target locations. The easiest way to create such templates is +through the customize interface. + +@table @kbd +@kindex C-c c C +@item C-c c C +Customize the variable @code{org-capture-templates}. +@end table + +Before we give the formal description of template definitions, let's look at +an example. Say you would like to use one template to create general TODO +entries, and you want to put these entries under the heading @samp{Tasks} in +your file @file{~/org/gtd.org}. Also, a date tree in the file +@file{journal.org} should capture journal entries. A possible configuration +would look like: @example -(setq org-remember-templates - '(("Todo" ?t "* TODO %?\n %i\n %a" "~/org/TODO.org" "Tasks") - ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org") - ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas"))) +(setq org-capture-templates + '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks") + "* TODO %?\n %i\n %a") + ("j" "Journal" entry (file+datetree "~/org/journal.org") + "* %?\nEntered on %U\n %i\n %a"))) @end example -@vindex org-remember-default-headline -@vindex org-directory -@noindent In these entries, the first string is just a name, and the -character specifies how to select the template. It is useful if the -character is also the first letter of the name. The next string specifies -the template. Two more (optional) strings give the file in which, and the -headline under which, the new note should be stored. The file (if not -present or @code{nil}) defaults to @code{org-default-notes-file}, the heading -to @code{org-remember-default-headline}. If the file name is not an absolute -path, it will be interpreted relative to @code{org-directory}. - -The heading can also be the symbols @code{top} or @code{bottom} to send notes -as level 1 entries to the beginning or end of the file, respectively. It may -also be the symbol @code{date-tree}. Then, a tree with year on level 1, -month on level 2 and day on level three will be build in the file, and the -entry will be filed into the tree under the current date@footnote{If the file -contains an entry with a @code{DATE_TREE} property, the entire date tree will -be build under that entry.} - -An optional sixth element specifies the contexts in which the user can select -the template. This element can be a list of major modes or a function. -@code{org-remember} will first check whether the function returns @code{t} or -if we are in any of the listed major modes, and exclude templates for which -this condition is not fulfilled. Templates that do not specify this element -at all, or that use @code{nil} or @code{t} as a value will always be -selectable. - -So for example: - -@example -(setq org-remember-templates - '(("Bug" ?b "* BUG %?\n %i\n %a" "~/org/BUGS.org" "Bugs" (emacs-lisp-mode)) - ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org" "X" my-check) - ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas"))) -@end example - -@noindent -The first template will only be available when invoking @code{org-remember} -from an buffer in @code{emacs-lisp-mode}. The second template will only be -available when the function @code{my-check} returns @code{t}. The third -template will be proposed in any context. - -When you call @kbd{M-x org-remember} (or @kbd{M-x remember}) to remember -something, Org will prompt for a key to select the template (if you have -more than one template) and then prepare the buffer like +@noindent If you then press @kbd{C-c c t}, Org will prepare the template +for you like this: @example * TODO - [[file:@var{link to where you called remember}]] + [[file:@var{link to where you initiated capture}]] @end example @noindent -During expansion of the template, special @kbd{%}-escapes@footnote{If you -need one of these sequences literally, escape the @kbd{%} with a backslash.} -allow dynamic insertion of content: +During expansion of the template, @code{%a} has been replaced by a link to +the location from where you called the capture command. This can be +extremely useful for deriving tasks from emails, for example. You fill in +the task definition, press @code{C-c C-c} and Org returns you to the same +place where you started the capture process. + + +@menu +* Template elements:: What is needed for a complete template entry +* Template expansion:: Filling in information about time and context +@end menu + +@node Template elements, Template expansion, Capture templates, Capture templates +@subsubsection Template elements + +Now lets look at the elements of a template definition. Each entry in +@code{org-capture-templates} is a list with the following items: + +@table @var +@item keys +The keys that will select the template, as a string, characters +only, for example @code{"a"} for a template to be selected with a +single key, or @code{"bt"} for selection with two keys. When using +several keys, keys using the same prefix key must be sequential +in the list and preceded by a 2-element entry explaining the +prefix key, for example @example + ("b" "Templates for marking stuff to buy") +@end example +@noindent If you do not define a template for the @kbd{C} key, this key will +be used to open the customize buffer for this complex variable. + +@item description +A short string describing the template, which will be shown during +selection. + +@item type +The type of entry, a symbol. Valid values are: +@table @code +@item entry +An Org-mode node, with a headline. Will be filed as the child of the +target entry or as a top-level entry. The target file should be an Org-mode +file. +@item item +A plain list item, placed in the first plain list at the target +location. Again the target file should be an Org file. +@item checkitem +A checkbox item. This only differs from the plain list item by the +default template. +@item table-line +a new line in the first table at the target location. Where exactly the +line will be inserted depends on the properties @code{:prepend} and +@code{:table-line-pos} (see below). +@item plain +Text to be inserted as it is. +@end table + +@item target +Specification of where the captured item should be placed. +In Org-mode files, targets usually define a node. Entries will become +children of this node, other types will be added to the table or list in the +body of this node. + +Valid values are: +@table @code +@item (file "path/to/file") +Text will be placed at the beginning or end of that file. + +@item (id "id of existing org entry") +Filing as child of this entry, or in the body of the entry. + +@item (file+headline "path/to/file" "node headline") +Fast configuration if the target heading is unique in the file. + +@item (file+olp "path/to/file" "Level 1 heading" "Level 2" ...) +For non-unique headings, the full path is safer. + +@item (file+regexp "path/to/file" "regexp to find location") +Use a regular expression to position the cursor. + +@item (file+datetree "path/to/file") +Will create a heading in a date tree. + +@item (file+function "path/to/file" function-finding-location) +A function to find the right location in the file. + +@item (clock) +File to the entry that is currently being clocked. + +@item (function function-finding-location) +Most general way, write your own function to find both +file and location. +@end table + +@item template +The template for creating the capture item. If you leave this empty, an +appropriate default template will be used. Otherwise this is a string with +escape codes, which will be replaced depending on time and context of the +capture call. The string with escapes may be loaded from a template file, +using the special syntax @code{(file "path/to/template")}. See below for +more details. + +@item properties +The rest of the entry is a property list of additional options. +Recognized properties are: +@table @code +@item :prepend +Normally new captured information will be appended at +the target location (last child, last table line, last list item...). +Setting this property will change that. + +@item :immediate-finish +When set, do not offer to edit the information, just +file it away immediately. This makes sense if the template only needs +information that can be added automatically. + +@item :empty-lines +Set this to the number of lines to insert +before and after the new item. Default 0, only common other value is 1. + +@item :clock-in +Start the clock in this item. + +@item :clock-resume +If starting the capture interrupted a clock, restart that clock when finished +with the capture. + +@item :unnarrowed +Do not narrow the target buffer, simply show the full buffer. Default is to +narrow it so that you only see the new material. +@end table +@end table + +@node Template expansion, , Template elements, Capture templates +@subsubsection Template expansion + +In the template itself, special @kbd{%}-escapes@footnote{If you need one of +these sequences literally, escape the @kbd{%} with a backslash.} allow +dynamic insertion of content: + +@comment SJE: should these sentences terminate in period? +@smallexample %^@{@var{prompt}@} @r{prompt the user for a string and replace this sequence with it.} @r{You may specify a default value and a completion table with} @r{%^@{prompt|default|completion2|completion3...@}} @r{The arrow keys access a prompt-specific history.} %a @r{annotation, normally the link created with @code{org-store-link}} %A @r{like @code{%a}, but prompt for the description part} -%i @r{initial content, the region when remember is called with C-u.} +%i @r{initial content, the region when capture is called while the} + @r{region is active.} @r{The entire text will be indented like @code{%i} itself.} %t @r{timestamp, date only} %T @r{timestamp with date and time} @@ -5965,28 +6169,25 @@ allow dynamic insertion of content: %x @r{Content of the X clipboard.} %^C @r{Interactive selection of which kill or clip to use.} %^L @r{Like @code{%^C}, but insert as link.} +%k @r{title of the currently clocked task} +%K @r{link to the currently clocked task} %^g @r{prompt for tags, with completion on tags in target file.} -%k @r{title of currently clocked task} -%K @r{link to currently clocked task} %^G @r{prompt for tags, with completion all tags in all agenda files.} %^@{@var{prop}@}p @r{Prompt the user for a value for property @var{prop}} %:keyword @r{specific information for certain link types, see below} %[@var{file}] @r{insert the contents of the file given by @var{file}} %(@var{sexp}) @r{evaluate Elisp @var{sexp} and replace with the result} -%! @r{immediately store note after completing the template} - @r{(skipping the @kbd{C-c C-c} that normally triggers storing)} -%& @r{jump to target location immediately after storing note} -@end example +@end smallexample @noindent For specific link types, the following keywords will be defined@footnote{If you define your own link types (@pxref{Adding hyperlink types}), any property you store with -@code{org-store-link-props} can be accessed in remember templates in a +@code{org-store-link-props} can be accessed in capture templates in a similar way.}: @vindex org-from-is-user-regexp -@example +@smallexample Link type | Available keywords -------------------+---------------------------------------------- bbdb | %:name %:company @@ -5998,91 +6199,25 @@ vm, wl, mh, rmail | %:type %:subject %:message-id gnus | %:group, @r{for messages also all email fields} w3, w3m | %:url info | %:file %:node -calendar | %:date" -@end example +calendar | %:date +@end smallexample @noindent To place the cursor after template expansion use: -@example +@smallexample %? @r{After completing the template, position cursor here.} -@end example - -@noindent -If you change your mind about which template to use, call -@code{org-remember} in the remember buffer. You may then select a new -template that will be filled with the previous context information. - -@node Storing notes, , Remember templates, Remember -@subsection Storing notes - -@vindex org-remember-clock-out-on-exit -When you are finished preparing a note with Remember, you have to press -@kbd{C-c C-c} to file the note away. If you have started the clock in the -Remember buffer, you will first be asked if you want to clock out -now@footnote{To avoid this query, configure the variable -@code{org-remember-clock-out-on-exit}.}. If you answer @kbd{n}, the clock -will continue to run after the note was filed away. - -The handler will then store the note in the file and under the headline -specified in the template, or it will use the default file and headline. The -window configuration will be restored, sending you back to the working -context before the call to Remember. To re-use the location found during the -last call to Remember, exit the Remember buffer with @kbd{C-0 C-c C-c}, -i.e. specify a zero prefix argument to @kbd{C-c C-c}. Another special case -is @kbd{C-2 C-c C-c} which files the note as a child of the currently clocked -item, and @kbd{C-3 C-c C-c} files as a sibling of the currently clocked item. - -@vindex org-remember-store-without-prompt -If you want to store the note directly to a different place, use -@kbd{C-1 C-c C-c} instead to exit Remember@footnote{Configure the -variable @code{org-remember-store-without-prompt} to make this behavior -the default.}. The handler will then first prompt for a target file---if -you press @key{RET}, the value specified for the template is used. -Then the command offers the headings tree of the selected file, with the -cursor position at the default headline (if you specified one in the -template). You can either immediately press @key{RET} to get the note -placed there. Or you can use the following keys to find a different -location: -@example -@key{TAB} @r{Cycle visibility.} -@key{down} / @key{up} @r{Next/previous visible headline.} -n / p @r{Next/previous visible headline.} -f / b @r{Next/previous headline same level.} -u @r{One level up.} -@c 0-9 @r{Digit argument.} -@end example -@noindent -Pressing @key{RET} or @key{left} or @key{right} -then leads to the following result. - -@vindex org-reverse-note-order -@multitable @columnfractions 0.2 0.15 0.65 -@item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted} -@item on headline @tab @key{RET} @tab as sublevel of the heading at cursor, first or last -@item @tab @tab depending on @code{org-reverse-note-order}. -@item @tab @key{left}/@key{right} @tab as same level, before/after current heading -@item buffer-start @tab @key{RET} @tab as level 2 heading at end of file or level 1 at beginning -@item @tab @tab depending on @code{org-reverse-note-order}. -@item not on headline @tab @key{RET} - @tab at cursor position, level taken from context. -@end multitable - -Before inserting the text into a tree, the function ensures that the text has -a headline, i.e. a first line that starts with a @samp{*}. If not, a -headline is constructed from the current date. If you have indented the text -of the note below the headline, the indentation will be adapted if inserting -the note into the tree requires demotion from level 1. +@end smallexample -@node Attachments, RSS Feeds, Remember, Capture - Refile - Archive +@node Attachments, RSS Feeds, Capture, Capture - Refile - Archive @section Attachments @cindex attachments @vindex org-attach-directory It is often useful to associate reference material with an outline node/task. Small chunks of plain text can simply be stored in the subtree of a project. -Hyperlinks (@pxref{Hyperlinks}) can be used to establish associations with +Hyperlinks (@pxref{Hyperlinks}) can establish associations with files that live elsewhere on your computer or in the cloud, like emails or source code files belonging to a project. Another method is @i{attachments}, which are files located in a directory belonging to an outline node. Org @@ -6099,14 +6234,14 @@ choice to an entry. You can also make children inherit the attachment directory from a parent, so that an entire subtree uses the same attached directory. -@noindent The following commands deal with attachments. +@noindent The following commands deal with attachments: @table @kbd @kindex C-c C-a @item C-c C-a The dispatcher for commands related to the attachment system. After these -keys, a list of commands is displayed and you need to press an additional key +keys, a list of commands is displayed and you must press an additional key to select a command: @table @kbd @@ -6136,7 +6271,7 @@ attachments yourself. @kindex C-c C-a o @item o @vindex org-file-apps -Open current task's attachment. If there are more than one, prompt for a +Open current task's attachment. If there is more than one, prompt for a file name first. Opening will follow the rules set by @code{org-file-apps}. For more details, see the information on following hyperlinks (@pxref{Handling links}). @@ -6179,23 +6314,27 @@ same directory for attachments as the parent does. @node RSS Feeds, Protocols, Attachments, Capture - Refile - Archive @section RSS feeds @cindex RSS feeds +@cindex Atom feeds -Org has the capability to add and change entries based on information found in -RSS feeds. You could use this to make a task out of each new podcast in a +Org can add and change entries based on information found in RSS feeds and +Atom feeds. You could use this to make a task out of each new podcast in a podcast feed. Or you could use a phone-based note-creating service on the -web to import tasks into Org. To access feeds, you need to configure the -variable @code{org-feed-alist}. The docstring of this variable has detailed +web to import tasks into Org. To access feeds, configure the variable +@code{org-feed-alist}. The docstring of this variable has detailed information. Here is just an example: @example (setq org-feed-alist - '(("ReQall" "http://www.reqall.com/user/feeds/rss/a1b2c3....." - "~/org/feeds.org" "ReQall Entries") + '(("Slashdot" + "http://rss.slashdot.org/Slashdot/slashdot" + "~/txt/org/feeds.org" "Slashdot Entries"))) @end example + @noindent -will configure that new items from the feed provided by @file{reqall.com} -will result in new entries in the file @file{~/org/feeds.org} under the -heading @samp{ReQall Entries}, whenever the following command is used: +will configure that new items from the feed provided by +@code{rss.slashdot.org} will result in new entries in the file +@file{~/org/feeds.org} under the heading @samp{Slashdot Entries}, whenever +the following command is used: @table @kbd @kindex C-c C-x g @@ -6216,8 +6355,8 @@ list of drawers in that file: #+DRAWERS: LOGBOOK PROPERTIES FEEDSTATUS @end example -For more information, see @file{org-feed.el} and the docstring of -@code{org-feed-alist}. +For more information, including how to read atom feeds, see +@file{org-feed.el} and the docstring of @code{org-feed-alist}. @node Protocols, Refiling notes, RSS Feeds, Capture - Refile - Archive @section Protocols for external access @@ -6227,7 +6366,7 @@ For more information, see @file{org-feed.el} and the docstring of You can set up Org for handling protocol calls from outside applications that are passed to Emacs through the @file{emacsserver}. For example, you can configure bookmarks in your web browser to send a link to the current page to -Org and create a note from it using Remember (@pxref{Remember}). Or you +Org and create a note from it using capture (@pxref{Capture}). Or you could create a bookmark that will tell Emacs to open the local source file of a remote website you are looking at with the browser. See @uref{http://orgmode.org/worg/org-contrib/org-protocol.php} for detailed @@ -6251,6 +6390,7 @@ process, you can use the following special command: @vindex org-outline-path-complete-in-steps @vindex org-refile-allow-creating-parent-nodes @vindex org-log-refile +@vindex org-refile-use-cache Refile the entry or region at point. This command offers possible locations for refiling the entry and lets you select one with completion. The item (or all items in the region) is filed below the target heading as a subitem. @@ -6276,6 +6416,10 @@ Use the refile interface to jump to a heading. Jump to the location where @code{org-refile} last moved a tree to. @item C-2 C-c C-w Refile as the child of the item currently being clocked. +@item C-0 C-c C-w @ @r{or} @ C-u C-u C-u C-c C-w +Clear the target cache. Caching of refile targets can be turned on by +setting @code{org-refile-use-cache}. To make the command seen new possible +targets, you have to clear the cache with this command. @end table @node Archiving, , Refiling notes, Capture - Refile - Archive @@ -6296,8 +6440,8 @@ Archive the current entry using the command specified in the variable @end table @menu -* Moving subtrees:: Moving a tree to an archive file -* Internal archiving:: Switch off a tree but keep i in the file +* Moving subtrees:: Moving a tree to an archive file +* Internal archiving:: Switch off a tree but keep it in the file @end menu @node Moving subtrees, Internal archiving, Archiving, Archiving @@ -6390,12 +6534,12 @@ Archived trees are not exported (@pxref{Exporting}), only the headline is. Configure the details using the variable @code{org-export-with-archived-trees}. @item -@vindex org-columns-skip-arrchived-trees +@vindex org-columns-skip-archived-trees Archived trees are excluded from column view unless the variable -@code{org-columns-skip-arrchived-trees} is configured to @code{nil}. +@code{org-columns-skip-archived-trees} is configured to @code{nil}. @end itemize -The following commands help managing the ARCHIVE tag: +The following commands help manage the ARCHIVE tag: @table @kbd @kindex C-c C-x a @@ -6424,7 +6568,7 @@ outline. @node Agenda Views, Markup, Capture - Refile - Archive, Top -@chapter Agenda Views +@chapter Agenda views @cindex agenda views Due to the way Org works, TODO items, time-stamped items, and @@ -6474,14 +6618,14 @@ window configuration is restored when the agenda exits: @code{org-agenda-restore-windows-after-quit}. @menu -* Agenda files:: Files being searched for agenda information -* Agenda dispatcher:: Keyboard access to agenda views -* Built-in agenda views:: What is available out of the box? -* Presentation and sorting:: How agenda items are prepared for display -* Agenda commands:: Remote editing of Org trees -* Custom agenda views:: Defining special searches and views -* Exporting Agenda Views:: Writing a view to a file -* Agenda column view:: Using column view for collected entries +* Agenda files:: Files being searched for agenda information +* Agenda dispatcher:: Keyboard access to agenda views +* Built-in agenda views:: What is available out of the box? +* Presentation and sorting:: How agenda items are prepared for display +* Agenda commands:: Remote editing of Org trees +* Custom agenda views:: Defining special searches and views +* Exporting Agenda Views:: Writing a view to a file +* Agenda column view:: Using column view for collected entries @end menu @node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views @@ -6623,12 +6767,12 @@ a number of special tags matches. @xref{Custom agenda views}. In this section we describe the built-in views. @menu -* Weekly/daily agenda:: The calendar page with current tasks -* Global TODO list:: All unfinished action items +* Weekly/daily agenda:: The calendar page with current tasks +* Global TODO list:: All unfinished action items * Matching tags and properties:: Structured information with fine-tuned search -* Timeline:: Time-sorted view for single file -* Search view:: Find entries by searching for text -* Stuck projects:: Find projects you need to review +* Timeline:: Time-sorted view for single file +* Search view:: Find entries by searching for text +* Stuck projects:: Find projects you need to review @end menu @node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views @@ -6671,7 +6815,7 @@ anniversaries, lunar phases, sunrise/set, recurrent appointments Org. It can be very useful to combine output from Org with the diary. -In order to include entries from the Emacs diary into Org mode's +In order to include entries from the Emacs diary into Org-mode's agenda, you only need to customize the variable @lisp @@ -6680,7 +6824,7 @@ agenda, you only need to customize the variable @noindent After that, everything will happen automatically. All diary entries including holidays, anniversaries, etc., will be included in the -agenda buffer created by Org mode. @key{SPC}, @key{TAB}, and +agenda buffer created by Org-mode. @key{SPC}, @key{TAB}, and @key{RET} can be used from the agenda buffer to jump to the diary file in order to edit existing diary entries. The @kbd{i} command to insert new entries for the current date works in the agenda buffer, as @@ -6691,7 +6835,7 @@ between calendar and agenda. If you are using the diary only for sexp entries and holidays, it is faster to not use the above setting, but instead to copy or even move -the entries into an Org file. Org mode evaluates diary-style sexp +the entries into an Org file. Org-mode evaluates diary-style sexp entries, and does it faster because there is no overhead for first creating the diary display. Note that the sexp entries must start at the left margin, no whitespace is allowed before them. For example, @@ -6721,7 +6865,7 @@ following to one your your agenda files: * Anniversaries :PROPERTIES: :CATEGORY: Anniv - :END + :END: %%(org-bbdb-anniversaries) @end example @@ -6766,20 +6910,20 @@ collected into a single place. @table @kbd @kindex C-c a t @item C-c a t -Show the global TODO list. This collects the TODO items from all -agenda files (@pxref{Agenda Views}) into a single buffer. The buffer is in -@code{agenda-mode}, so there are commands to examine and manipulate -the TODO entries directly from that buffer (@pxref{Agenda commands}). +Show the global TODO list. This collects the TODO items from all agenda +files (@pxref{Agenda Views}) into a single buffer. By default, this lists +items with a state the is not a DONE state. The buffer is in +@code{agenda-mode}, so there are commands to examine and manipulate the TODO +entries directly from that buffer (@pxref{Agenda commands}). @kindex C-c a T @item C-c a T @cindex TODO keyword matching @vindex org-todo-keywords -Like the above, but allows selection of a specific TODO keyword. You -can also do this by specifying a prefix argument to @kbd{C-c a t}. With -a @kbd{C-u} prefix you are prompted for a keyword, and you may also -specify several keywords by separating them with @samp{|} as the boolean OR -operator. With a numeric prefix, the nth keyword in -@code{org-todo-keywords} is selected. +Like the above, but allows selection of a specific TODO keyword. You can +also do this by specifying a prefix argument to @kbd{C-c a t}. You are +prompted for a keyword, and you may also specify several keywords by +separating them with @samp{|} as the boolean OR operator. With a numeric +prefix, the nth keyword in @code{org-todo-keywords} is selected. @kindex r The @kbd{r} key in the agenda buffer regenerates it, and you can give a prefix argument to this command to change the selected TODO keyword, @@ -6841,11 +6985,12 @@ define a custom command for it (@pxref{Agenda dispatcher}). @item C-c a M @vindex org-tags-match-list-sublevels @vindex org-agenda-tags-todo-honor-ignore-options -Like @kbd{C-c a m}, but only select headlines that are also TODO items and -force checking subitems (see variable @code{org-tags-match-list-sublevels}). -To exclude scheduled/deadline items, see the variable -@code{org-agenda-tags-todo-honor-ignore-options}. Matching specific TODO -keywords together with a tags match is also possible, see @ref{Tag searches}. +Like @kbd{C-c a m}, but only select headlines that are also TODO items in a +not-DONE state and force checking subitems (see variable +@code{org-tags-match-list-sublevels}). To exclude scheduled/deadline items, +see the variable @code{org-agenda-tags-todo-honor-ignore-options}. Matching +specific TODO keywords together with a tags match is also possible, see +@ref{Tag searches}. @end table The commands available in the tags list are described in @ref{Agenda @@ -6950,7 +7095,7 @@ other properties will slow down the search. However, once you have paid the price by accessing one property, testing additional properties is cheap again. -You can configure Org mode to use property inheritance during a search, but +You can configure Org-mode to use property inheritance during a search, but beware that this can slow down searches considerably. See @ref{Property inheritance}, for details. @@ -6959,12 +7104,13 @@ different way to test TODO states in a search. For this, terminate the tags/property part of the search string (which may include several terms connected with @samp{|}) with a @samp{/} and then specify a Boolean expression just for TODO keywords. The syntax is then similar to that for -tags, but should be applied with care: for example, a positive -selection on several TODO keywords cannot meaningfully be combined with -boolean AND. However, @emph{negative selection} combined with AND can be -meaningful. To make sure that only lines are checked that actually have any -TODO keyword (resulting in a speed-up), use @kbd{C-c a M}, or equivalently -start the TODO part after the slash with @samp{!}. Examples: +tags, but should be applied with care: for example, a positive selection on +several TODO keywords cannot meaningfully be combined with boolean AND. +However, @emph{negative selection} combined with AND can be meaningful. To +make sure that only lines are checked that actually have any TODO keyword +(resulting in a speed-up), use @kbd{C-c a M}, or equivalently start the TODO +part after the slash with @samp{!}. Using @kbd{C-c a M} or @samp{/!} will +not match TODO keywords in a DONE state. Examples: @table @samp @item work/WAITING @@ -6982,7 +7128,7 @@ Select @samp{:work:}-tagged TODO lines that are either @samp{WAITING} or @cindex timeline, single file @cindex time-sorted view -The timeline summarizes all time-stamped items from a single Org mode +The timeline summarizes all time-stamped items from a single Org-mode file in a @emph{time-sorted view}. The main purpose of this command is to give an overview over events in a project. @@ -7004,7 +7150,7 @@ The commands available in the timeline buffer are listed in @cindex text search @cindex searching, for text -This agenda view is a general text search facility for Org mode entries. +This agenda view is a general text search facility for Org-mode entries. It is particularly useful to find notes. @table @kbd @@ -7036,7 +7182,7 @@ If you are following a system like David Allen's GTD to organize your work, one of the ``duties'' you have is a regular review to make sure that all projects move along. A @emph{stuck} project is a project that has no defined next actions, so it will never show up in the TODO lists -Org mode produces. During the review, you need to identify such +Org-mode produces. During the review, you need to identify such projects and define next actions for them. @table @kbd @@ -7055,7 +7201,7 @@ work for you. The built-in default assumes that all your projects are level-2 headlines, and that a project is not stuck if it has at least one entry marked with a TODO keyword TODO or NEXT or NEXTACTION. -Let's assume that you, in your own way of using Org mode, identify +Let's assume that you, in your own way of using Org-mode, identify projects with a tag PROJECT, and that you use a TODO keyword MAYBE to indicate a project that should not be considered yet. Let's further assume that the TODO keyword DONE marks finished projects, and that NEXT @@ -7082,7 +7228,7 @@ will still be searched for stuck projects. @cindex presentation, of agenda items @vindex org-agenda-prefix-format -Before displaying items in an agenda view, Org mode visually prepares +Before displaying items in an agenda view, Org-mode visually prepares the items and sorts them. Each item occupies a single line. The line starts with a @emph{prefix} that contains the @emph{category} (@pxref{Categories}) of the item and other important information. You can @@ -7091,9 +7237,9 @@ The prefix is followed by a cleaned-up version of the outline headline associated with the item. @menu -* Categories:: Not all tasks are equal -* Time-of-day specifications:: How the agenda knows the time -* Sorting of agenda items:: The order of things +* Categories:: Not all tasks are equal +* Time-of-day specifications:: How the agenda knows the time +* Sorting of agenda items:: The order of things @end menu @node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting @@ -7129,7 +7275,7 @@ longer than 10 characters. @subsection Time-of-day specifications @cindex time-of-day specification -Org mode checks each agenda item for a time-of-day specification. The +Org-mode checks each agenda item for a time-of-day specification. The time can be part of the timestamp that triggered inclusion into the agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}. Time ranges can be specified with two timestamps, like @@ -7141,7 +7287,7 @@ plain text (like @samp{12:45} or a @samp{8:30-1pm}). If the agenda integrates the Emacs diary (@pxref{Weekly/daily agenda}), time specifications in diary entries are recognized as well. -For agenda display, Org mode extracts the time and displays it in a +For agenda display, Org-mode extracts the time and displays it in a standard 24 hour format as part of the prefix. The example times in the previous paragraphs would end up in the agenda like this: @@ -7590,7 +7736,7 @@ agenda, change a tag for all headings in the region. @c @kindex , @item , -Set the priority for the current item. Org mode prompts for the +Set the priority for the current item. Org-mode prompts for the priority character. If you reply with @key{SPC}, the priority cookie is removed from the entry. @c @@ -7642,7 +7788,7 @@ m @r{Mark the entry at point for action. You can also make entries} @r{in Org files with @kbd{C-c C-x C-k}.} d @r{Set the deadline of the marked entry to the date at point.} s @r{Schedule the marked entry at the date at point.} -r @r{Call @code{org-remember} with the cursor date as default date.} +r @r{Call @code{org-capture} with the cursor date as default date.} @end example @noindent Press @kbd{r} afterward to refresh the agenda and see the effect of the @@ -7731,7 +7877,7 @@ d @r{Set deadline to a specific date.} Open the Emacs calendar and move to the date at the agenda cursor. @c @item c -When in the calendar, compute and show the Org mode agenda for the +When in the calendar, compute and show the Org-mode agenda for the date at the cursor. @c @cindex diary entries, creating from agenda @@ -7749,7 +7895,7 @@ If you configure @code{org-agenda-diary-file} to point to an Org-mode file, Org will create entries (in org-mode syntax) in that file instead. Most entries will be stored in a date-based outline tree that will later make it easy to archive appointments from previous months/years. The tree will be -build under an entry with a @code{DATE_TREE} property, or else with years as +built under an entry with a @code{DATE_TREE} property, or else with years as top-level entries. Emacs will prompt you for the entry text - if you specify it, the entry will be created in @code{org-agenda-diary-file} without further interaction. If you directly press @key{RET} at the prompt without typing @@ -7817,9 +7963,9 @@ agenda buffers. Custom agenda commands will be accessible through the dispatcher (@pxref{Agenda dispatcher}), just like the default commands. @menu -* Storing searches:: Type once, use often -* Block agenda:: All the stuff you need in a single buffer -* Setting Options:: Changing the rules +* Storing searches:: Type once, use often +* Block agenda:: All the stuff you need in a single buffer +* Setting Options:: Changing the rules @end menu @node Storing searches, Block agenda, Custom agenda views, Custom agenda views @@ -7929,7 +8075,7 @@ command @kbd{C-c a o} provides a similar view for office tasks. @cindex options, for custom agenda views @vindex org-agenda-custom-commands -Org mode contains a number of variables regulating agenda construction +Org-mode contains a number of variables regulating agenda construction and display. The global variables define the behavior for all agenda commands, including the custom commands. However, if you want to change some settings just for a single custom view, you can do so. Setting @@ -8001,7 +8147,7 @@ yourself. @cindex agenda views, exporting If you are away from your computer, it can be very useful to have a printed -version of some agenda views to carry around. Org mode can export custom +version of some agenda views to carry around. Org-mode can export custom agenda views as plain text, HTML@footnote{You need to install Hrvoje Niksic's @file{htmlize.el}.}, Postscript, PDF@footnote{To create PDF output, the ghostscript @file{ps2pdf} utility must be installed on the system. Selecting @@ -8066,7 +8212,7 @@ or absolute. @end lisp The extension of the file name determines the type of export. If it is -@file{.html}, Org mode will use the @file{htmlize.el} package to convert +@file{.html}, Org-mode will use the @file{htmlize.el} package to convert the buffer to HTML and save it to this file name. If the extension is @file{.ps}, @code{ps-print-buffer-with-faces} is used to produce Postscript output. If the extension is @file{.ics}, iCalendar export is @@ -8200,33 +8346,33 @@ the agenda). When exporting Org-mode documents, the exporter tries to reflect the structure of the document as accurately as possible in the backend. Since export targets like HTML, La@TeX{}, or DocBook allow much richer formatting, -Org mode has rules on how to prepare text for rich export. This section +Org-mode has rules on how to prepare text for rich export. This section summarizes the markup rules used in an Org-mode buffer. @menu -* Structural markup elements:: The basic structure as seen by the exporter -* Images and tables:: Tables and Images will be included -* Literal examples:: Source code examples with special formatting -* Include files:: Include additional files into a document -* Index entries:: -* Macro replacement:: Use macros to create complex output -* Embedded LaTeX:: LaTeX can be freely used inside Org documents +* Structural markup elements:: The basic structure as seen by the exporter +* Images and tables:: Tables and Images will be included +* Literal examples:: Source code examples with special formatting +* Include files:: Include additional files into a document +* Index entries:: Making an index +* Macro replacement:: Use macros to create complex output +* Embedded LaTeX:: LaTeX can be freely used inside Org documents @end menu @node Structural markup elements, Images and tables, Markup, Markup @section Structural markup elements @menu -* Document title:: Where the title is taken from -* Headings and sections:: The document structure as seen by the exporter -* Table of contents:: The if and where of the table of contents -* Initial text:: Text before the first heading? -* Lists:: Lists -* Paragraphs:: Paragraphs -* Footnote markup:: Footnotes -* Emphasis and monospace:: Bold, italic, etc. -* Horizontal rules:: Make a line -* Comment lines:: What will *not* be exported +* Document title:: Where the title is taken from +* Headings and sections:: The document structure as seen by the exporter +* Table of contents:: The if and where of the table of contents +* Initial text:: Text before the first heading? +* Lists:: Lists +* Paragraphs:: Paragraphs +* Footnote markup:: Footnotes +* Emphasis and monospace:: Bold, italic, etc. +* Horizontal rules:: Make a line +* Comment lines:: What will *not* be exported @end menu @node Document title, Headings and sections, Structural markup elements, Structural markup elements @@ -8293,7 +8439,7 @@ the table of contents entirely, by configuring the variable @cindex text before first headline, markup rules @cindex #+TEXT -Org mode normally exports the text before the first headline, and even uses +Org-mode normally exports the text before the first headline, and even uses the first line as the document title. The text will be fully marked up. If you need to include literal HTML, La@TeX{}, or DocBook code, use the special constructs described below in the sections for the individual exporters. @@ -8421,8 +8567,8 @@ Toggle the COMMENT keyword at the beginning of an entry. @cindex tables, markup rules @cindex #+CAPTION @cindex #+LABEL -Both the native Org mode tables (@pxref{Tables}) and tables formatted with -the @file{table.el} package will be exported properly. For Org mode tables, +Both the native Org-mode tables (@pxref{Tables}) and tables formatted with +the @file{table.el} package will be exported properly. For Org-mode tables, the lines before the first horizontal separator line will become table header lines. You can use the following lines somewhere before the table to assign a caption and a label for cross references, and in the text you can refer to @@ -8440,8 +8586,8 @@ Some backends (HTML, La@TeX{}, and DocBook) allow you to directly include images into the exported document. Org does this, if a link to an image files does not have a description part, for example @code{[[./img/a.jpg]]}. If you wish to define a caption for the image and maybe a label for internal -cross references, you sure that the link is on a line by itself precede it -with: +cross references, make sure that the link is on a line by itself and precede +it with @code{#+CAPTION} and @code{#+LABEL} as follows: @example #+CAPTION: This is the caption for the next figure link (or table) @@ -8495,9 +8641,9 @@ be used to fontify the example: @example #+BEGIN_SRC emacs-lisp -(defun org-xor (a b) - "Exclusive or." - (if a (not b) b)) + (defun org-xor (a b) + "Exclusive or." + (if a (not b) b)) #+END_SRC @end example @@ -8543,7 +8689,7 @@ Edit the source code example at point in its native mode. This works by switching to a temporary buffer with the source code. You need to exit by pressing @kbd{C-c '} again@footnote{Upon exit, lines starting with @samp{*} or @samp{#} will get a comma prepended, to keep them from being interpreted -by Org as outline nodes or special comments. These commas will be striped +by Org as outline nodes or special comments. These commas will be stripped for editing with @kbd{C-c '}, and also for export.}, the edited version will then replace the old version in the Org buffer. Fixed-width regions (where each line starts with a colon followed by a space) will be edited @@ -8576,7 +8722,7 @@ include your @file{.emacs} file, you could use: The optional second and third parameter are the markup (e.g. @samp{quote}, @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the language for formatting the contents. The markup is optional, if it is not -given, the text will be assumed to be in Org mode format and will be +given, the text will be assumed to be in Org-mode format and will be processed normally. The include line will also allow additional keyword parameters @code{:prefix1} and @code{:prefix} to specify prefixes for the first line and for each following line, as well as any options accepted by @@ -8593,7 +8739,7 @@ Visit the include file at point. @end table @node Index entries, Macro replacement, Include files, Markup -@section Index enries +@section Index entries @cindex index entries, for publishing You can specify entries that will be used for generating an index during @@ -8602,7 +8748,7 @@ the contains an exclamation mark will create a sub item. See @ref{Generating an index} for more information. @example -* Curriculum Vitae +* Curriculum Vitae #+INDEX: CV #+INDEX: Application!CV @end example @@ -8646,20 +8792,20 @@ mathematical symbols and the occasional formula. La@TeX{}@footnote{La@TeX{} is a macro system based on Donald E. Knuth's @TeX{} system. Many of the features described here as ``La@TeX{}'' are really from @TeX{}, but for simplicity I am blurring this distinction.} is widely used to typeset -scientific documents. Org mode supports embedding La@TeX{} code into its +scientific documents. Org-mode supports embedding La@TeX{} code into its files, because many academics are used to reading La@TeX{} source code, and because it can be readily processed into images for HTML production. It is not necessary to mark La@TeX{} macros and code in any special way. -If you observe a few conventions, Org mode knows how to find it and what +If you observe a few conventions, Org-mode knows how to find it and what to do with it. @menu -* Special symbols:: Greek letters and other symbols -* Subscripts and superscripts:: Simple syntax for raising/lowering text -* LaTeX fragments:: Complex formulas made easy -* Previewing LaTeX fragments:: What will this snippet look like? -* CDLaTeX mode:: Speed up entering of formulas +* Special symbols:: Greek letters and other symbols +* Subscripts and superscripts:: Simple syntax for raising/lowering text +* LaTeX fragments:: Complex formulas made easy +* Previewing LaTeX fragments:: What will this snippet look like? +* CDLaTeX mode:: Speed up entering of formulas @end menu @node Special symbols, Subscripts and superscripts, Embedded LaTeX, Embedded LaTeX @@ -8675,14 +8821,14 @@ You can use La@TeX{} macros to insert special symbols like @samp{\alpha} to indicate the Greek letter, or @samp{\to} to indicate an arrow. Completion for these macros is available, just type @samp{\} and maybe a few letters, and press @kbd{M-@key{TAB}} to see possible completions. Unlike La@TeX{} -code, Org mode allows these macros to be present without surrounding math +code, Org-mode allows these macros to be present without surrounding math delimiters, for example: @example Angles are written as Greek letters \alpha, \beta and \gamma. @end example -@vindex org-html-entities +@vindex org-entities During export, these symbols will be transformed into the native format of the exporter backend. Strings like @code{\alpha} will be exported as @code{α} in the HTML output, and as @code{$\alpha$} in the La@TeX{} @@ -8691,11 +8837,24 @@ output. Similarly, @code{\nbsp} will become @code{ } in HTML and like this: @samp{\Aacute@{@}stor}. A large number of entities is provided, with names taken from both HTML and -La@TeX{}, see the variable @code{org-html-entities} for the complete list. +La@TeX{}, see the variable @code{org-entities} for the complete list. @samp{\-} is treated as a shy hyphen, and @samp{--}, @samp{---}, and @samp{...} are all converted into special commands creating hyphens of different lengths or a compact set of dots. +If you would like to see entities displayed as utf8 characters, use the +following command@footnote{You can turn this on by default by setting the +variable @code{org-pretty-entities}, or on a per-file base with the +@code{#+STARTUP} option @code{entitiespretty}.}: + +@table @kbd +@kindex C-c C-x \ +@item C-c C-x \ +Toggle display of entities as UTF8 characters. This does not change the +buffer content which remains plain ASCII, but it overlays the UTF8 character +for display purposes only. +@end table + @node Subscripts and superscripts, LaTeX fragments, Special symbols, Embedded LaTeX @subsection Subscripts and superscripts @cindex subscript @@ -8724,6 +8883,12 @@ convention, or use, on a per-file basis: #+OPTIONS: ^:@{@} @end example +@table @kbd +@kindex C-c C-x \ +@item C-c C-x \ +In addition to showing entities as UTF8 characters, this command will also +format sub- and superscripts in a WYSIWYM way. +@end table @node LaTeX fragments, Previewing LaTeX fragments, Subscripts and superscripts, Embedded LaTeX @subsection La@TeX{} fragments @@ -8736,7 +8901,7 @@ MathML, but that is not yet fully supported by many browsers, and there is no decent converter for turning La@TeX{} or ASCII representations of formulas into MathML. So for the time being, converting formulas into images seems the way to go.}. More complex expressions need a dedicated -formula processor. To this end, Org mode can contain arbitrary La@TeX{} +formula processor. To this end, Org-mode can contain arbitrary La@TeX{} fragments. It provides commands to preview the typeset result of these fragments, and upon export to HTML, all fragments will be converted to images and inlined into the HTML document@footnote{The La@TeX{} export @@ -8823,12 +8988,12 @@ setting is active: CDLa@TeX{} mode is a minor mode that is normally used in combination with a major La@TeX{} mode like AUC@TeX{} in order to speed-up insertion of -environments and math templates. Inside Org mode, you can make use of +environments and math templates. Inside Org-mode, you can make use of some of the features of CDLa@TeX{} mode. You need to install @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with AUC@TeX{}) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}. -Don't use CDLa@TeX{} mode itself under Org mode, but use the light -version @code{org-cdlatex-mode} that comes as part of Org mode. Turn it +Don't use CDLa@TeX{} mode itself under Org-mode, but use the light +version @code{org-cdlatex-mode} that comes as part of Org-mode. Turn it on for the current buffer with @code{M-x org-cdlatex-mode}, or for all Org files with @@ -8845,7 +9010,7 @@ Environment templates can be inserted with @kbd{C-c @{}. @item @kindex @key{TAB} The @key{TAB} key will do template expansion if the cursor is inside a -La@TeX{} fragment@footnote{Org mode has a method to test if the cursor is +La@TeX{} fragment@footnote{Org-mode has a method to test if the cursor is inside such a fragment, see the documentation of the function @code{org-inside-LaTeX-fragment-p}.}. For example, @key{TAB} will expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor @@ -8886,28 +9051,30 @@ Org-mode documents can be exported into a variety of other formats. For printing and sharing of notes, ASCII export produces a readable and simple version of an Org file. HTML export allows you to publish a notes file on the web, while the XOXO format provides a solid base for exchange with a -broad range of other applications. La@TeX{} export lets you use Org mode and +broad range of other applications. La@TeX{} export lets you use Org-mode and its structured editing functions to easily create La@TeX{} files. DocBook export makes it possible to convert Org files to many other formats using -DocBook tools. To incorporate entries with associated times like deadlines -or appointments into a desktop calendar program like iCal, Org mode can also -produce extracts in the iCalendar format. Currently Org mode only supports -export, not import of these different formats. +DocBook tools. For project management you can create gantt and resource +charts by using TaskJuggler export. To incorporate entries with associated +times like deadlines or appointments into a desktop calendar program like +iCal, Org-mode can also produce extracts in the iCalendar format. Currently +Org-mode only supports export, not import of these different formats. Org supports export of selected regions when @code{transient-mark-mode} is enabled (default in Emacs 23). @menu -* Selective export:: Using tags to select and exclude trees -* Export options:: Per-file export settings -* The export dispatcher:: How to access exporter commands -* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding -* HTML export:: Exporting to HTML -* LaTeX and PDF export:: Exporting to La@TeX{}, and processing to PDF -* DocBook export:: Exporting to DocBook -* Freemind export:: Exporting to Freemind mind maps -* XOXO export:: Exporting to XOXO -* iCalendar export:: Exporting in iCalendar format +* Selective export:: Using tags to select and exclude trees +* Export options:: Per-file export settings +* The export dispatcher:: How to access exporter commands +* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding +* HTML export:: Exporting to HTML +* LaTeX and PDF export:: Exporting to La@TeX{}, and processing to PDF +* DocBook export:: Exporting to DocBook +* TaskJuggler export:: Exporting to TaskJuggler +* Freemind export:: Exporting to Freemind mind maps +* XOXO export:: Exporting to XOXO +* iCalendar export:: Exporting in iCalendar format @end menu @node Selective export, Export options, Exporting, Exporting @@ -8968,6 +9135,7 @@ Insert template with export options, see example below. @cindex #+LINK_HOME @cindex #+EXPORT_SELECT_TAGS @cindex #+EXPORT_EXCLUDE_TAGS +@cindex #+XSLT @cindex #+LATEX_HEADER @vindex user-full-name @vindex user-mail-address @@ -8990,6 +9158,7 @@ Insert template with export options, see example below. #+LATEX_HEADER: extra line(s) for the LaTeX header, like \usepackage@{xyz@} #+EXPORT_SELECT_TAGS: Tags that select a tree for export #+EXPORT_EXCLUDE_TAGS: Tags that exclude a tree from export +#+XSLT: the XSLT stylesheet used by DocBook exporter to generate FO file @end example @noindent @@ -9153,19 +9322,19 @@ the text and the link in a note before the next heading. See the variable @section HTML export @cindex HTML export -Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive +Org-mode contains an HTML (XHTML 1.0 strict) exporter with extensive HTML formatting, in ways similar to John Gruber's @emph{markdown} language, but with additional support for tables. @menu -* HTML Export commands:: How to invoke HTML export -* Quoting HTML tags:: Using direct HTML in Org mode -* Links in HTML export:: How links will be interpreted and formatted -* Tables in HTML export:: How to modify the formatting of tables -* Images in HTML export:: How to insert figures into HTML output -* Text areas in HTML export:: An alternative way to show an example -* CSS support:: Changing the appearance of the output -* Javascript support:: Info and Folding in a web browser +* HTML Export commands:: How to invoke HTML export +* Quoting HTML tags:: Using direct HTML in Org-mode +* Links in HTML export:: How links will be interpreted and formatted +* Tables in HTML export:: How to modify the formatting of tables +* Images in HTML export:: How to insert figures into HTML output +* Text areas in HTML export:: An alternative way to show an example +* CSS support:: Changing the appearance of the output +* JavaScript support:: Info and Folding in a web browser @end menu @node HTML Export commands, Quoting HTML tags, HTML export, HTML export @@ -9289,7 +9458,7 @@ and @code{style} attributes for a link: Org-mode tables are exported to HTML using the table tag defined in @code{org-export-html-table-tag}. The default setting makes tables without cell borders and frame. If you would like to change this for individual -tables, place somthing like the following before the table: +tables, place something like the following before the table: @cindex #+CAPTION @cindex #+ATTR_HTML @@ -9320,7 +9489,7 @@ will link to a high resolution version of the image, you could use: [[file:highres.jpg][file:thumb.jpg]] @end example -If you need to add attributes to an inlines image, use a @code{#+ATTR_HTML}. +If you need to add attributes to an inlined image, use a @code{#+ATTR_HTML}. In the example below we specify the @code{alt} and @code{title} attributes to support text viewers and accessibility, and align it to the right. @@ -9350,14 +9519,14 @@ respectively. For example @example #+BEGIN_EXAMPLE -t -w 40 -(defun org-xor (a b) - "Exclusive or." - (if a (not b) b)) + (defun org-xor (a b) + "Exclusive or." + (if a (not b) b)) #+END_EXAMPLE @end example -@node CSS support, Javascript support, Text areas in HTML export, HTML export +@node CSS support, JavaScript support, Text areas in HTML export, HTML export @subsection CSS support @cindex CSS, for HTML export @cindex HTML export, CSS @@ -9428,8 +9597,8 @@ referring to an external file. @c FIXME: More about header and footer styles @c FIXME: Talk about links and targets. -@node Javascript support, , CSS support, HTML export -@subsection Javascript supported display of web pages +@node JavaScript support, , CSS support, HTML export +@subsection JavaScript supported display of web pages @cindex Rose, Sebastian Sebastian Rose has written a JavaScript program especially designed to @@ -9501,7 +9670,7 @@ pages, configure the variable @code{org-export-html-use-infojs}. @cindex PDF export @cindex Guerry, Bastien -Org mode contains a La@TeX{} exporter written by Bastien Guerry. With +Org-mode contains a La@TeX{} exporter written by Bastien Guerry. With further processing@footnote{The default LaTeX output is designed for processing with pdftex or latex. It includes packages that are not compatible with xetex and possibly luatex. See the variables @@ -9512,12 +9681,12 @@ implement links and cross references, the PDF output file will be fully linked. @menu -* LaTeX/PDF export commands:: Which key invokes which commands -* Header and sectioning:: Setting up the export file structure -* Quoting LaTeX code:: Incorporating literal La@TeX{} code -* Tables in LaTeX export:: Options for exporting tables to La@TeX{} -* Images in LaTeX export:: How to insert figures into La@TeX{} output -* Beamer class export:: Turning the file into a presentation +* LaTeX/PDF export commands:: Which key invokes which commands +* Header and sectioning:: Setting up the export file structure +* Quoting LaTeX code:: Incorporating literal La@TeX{} code +* Tables in LaTeX export:: Options for exporting tables to La@TeX{} +* Images in LaTeX export:: How to insert figures into La@TeX{} output +* Beamer class export:: Turning the file into a presentation @end menu @node LaTeX/PDF export commands, Header and sectioning, LaTeX and PDF export, LaTeX and PDF export @@ -9547,11 +9716,11 @@ Export to a temporary buffer, do not create a file. @item C-c C-e v L Export only the visible part of the document. @item M-x org-export-region-as-latex -Convert the region to La@TeX{} under the assumption that it was Org mode +Convert the region to La@TeX{} under the assumption that it was Org-mode syntax before. This is a global command that can be invoked in any buffer. @item M-x org-replace-region-by-latex -Replace the active region (assumed to be in Org mode syntax) by La@TeX{} +Replace the active region (assumed to be in Org-mode syntax) by La@TeX{} code. @kindex C-c C-e p @item C-c C-e p @@ -9644,8 +9813,10 @@ All lines between these markers are exported literally For La@TeX{} export of a table, you can specify a label and a caption (@pxref{Images and tables}). You can also use the @code{ATTR_LaTeX} line to -request a longtable environment for the table, so that it may span several -pages. Finally, you can set the alignment string: +request a @code{longtable} environment for the table, so that it may span +several pages, or provide the @code{multicolumn} keyword that will make the +table span the page in a multicolumn environment (@code{table*} environment). +Finally, you can set the alignment string: @cindex #+CAPTION @cindex #+LABEL @@ -9676,12 +9847,12 @@ options that can be used in the optional argument of the @code{figure} environment, add something like @samp{placement=[h!]} to the Attributes. -If you'd like to let text flow around the image, add the word @samp{wrap} to -the @code{#+ATTR_LaTeX:} line, which will make the figure occupy the left -half of the page. To fine-tune, the @code{placement} field will be the -set of additional arguments needed by the @code{wrapfigure} environment. -Note that if you change the size of the image, you need to use compatible -settings for @code{\includegraphics} and @code{wrapfigure}. +If you would like to let text flow around the image, add the word @samp{wrap} +to the @code{#+ATTR_LaTeX:} line, which will make the figure occupy the left +half of the page. To fine-tune, the @code{placement} field will be the set +of additional arguments needed by the @code{wrapfigure} environment. Note +that if you change the size of the image, you need to use compatible settings +for @code{\includegraphics} and @code{wrapfigure}. @cindex #+CAPTION @cindex #+LABEL @@ -9702,14 +9873,14 @@ If you need references to a label created in this way, write @node Beamer class export, , Images in LaTeX export, LaTeX and PDF export @subsection Beamer class export -The LaTeX class @file{beamer} allows to produce high quality presentations +The LaTeX class @file{beamer} allows production of high quality presentations using LaTeX and pdf processing. Org-mode has special support for turning an Org-mode file or tree into a @file{beamer} presentation. When the LaTeX class for the current buffer (as set with @code{#+LaTeX_CLASS: beamer}) or subtree (set with a @code{LaTeX_CLASS} property) is @code{beamer}, a special export mode will turn the file or tree into a beamer -presentation. Any tree with not-to-deep level nesting should in principle be +presentation. Any tree with not-too-deep level nesting should in principle be exportable as a beamer presentation. By default, the top-level entries (or the first level below the selected subtree heading) will be turned into frames, and the outline structure below this level will become itemize lists. @@ -9741,7 +9912,7 @@ set an options argument for the implied @code{columns} environment. @item BEAMER_col The width of a column that should start with this entry. If this property is set, the entry will also get a @code{:BMCOL:} property to make this visible. -Also this tag is only a visual aid. When his is a plain number, it will be +Also this tag is only a visual aid. When this is a plain number, it will be interpreted as a fraction of @code{\textwidth}. Otherwise it will be assumed that you have specified the units, like @samp{3cm}. The first such property in a frame will start a @code{columns} environment to surround the columns. @@ -9785,7 +9956,7 @@ environment or the @code{BEAMER_col} property. Column view provides a great way to set the environment of a node and other important parameters. Make sure you are using a COLUMN format that is geared toward this special purpose. The command @kbd{M-x -org-beamer-settings-template} does define such a format. +org-beamer-settings-template} defines such a format. Here is a simple example Org document that is intended for beamer export. @@ -9799,7 +9970,7 @@ Here is a simple example Org document that is intended for beamer export. #+COLUMNS: %35ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Args) %4BEAMER_col(Col) %8BEAMER_extra(Ex) * This is the first structural section - + ** Frame 1 \\ with a subtitle *** Thanks to Eric Fraga :BMCOL:B_block: :PROPERTIES: @@ -9826,11 +9997,11 @@ Here is a simple example Org document that is intended for beamer export. For more information, see the documentation on Worg. -@node DocBook export, Freemind export, LaTeX and PDF export, Exporting +@node DocBook export, TaskJuggler export, LaTeX and PDF export, Exporting @section DocBook export @cindex DocBook export @cindex PDF export -@cindex Cui, Baoqui +@cindex Cui, Baoqiu Org contains a DocBook exporter written by Baoqiu Cui. Once an Org file is exported to DocBook format, it can be further processed to produce other @@ -9840,12 +10011,12 @@ tools and stylesheets. Currently DocBook exporter only supports DocBook V5.0. @menu -* DocBook export commands:: How to invoke DocBook export -* Quoting DocBook code:: Incorporating DocBook code in Org files -* Recursive sections:: Recursive sections in DocBook -* Tables in DocBook export:: Tables are exported as HTML tables -* Images in DocBook export:: How to insert figures into DocBook output -* Special characters:: How to handle special characters +* DocBook export commands:: How to invoke DocBook export +* Quoting DocBook code:: Incorporating DocBook code in Org files +* Recursive sections:: Recursive sections in DocBook +* Tables in DocBook export:: Tables are exported as HTML tables +* Images in DocBook export:: How to insert figures into DocBook output +* Special characters:: How to handle special characters @end menu @node DocBook export commands, Quoting DocBook code, DocBook export, DocBook export @@ -9877,6 +10048,13 @@ need to have XSLT processor and XSL-FO processor software installed on your system. Check variables @code{org-export-docbook-xslt-proc-command} and @code{org-export-docbook-xsl-fo-proc-command}. +@vindex org-export-docbook-xslt-stylesheet +The stylesheet argument @code{%s} in variable +@code{org-export-docbook-xslt-proc-command} is replaced by the value of +variable @code{org-export-docbook-xslt-stylesheet}, which needs to be set by +the user. You can also overrule this global setting on a per-file basis by +adding an in-buffer setting @code{#+XSLT:} to the Org file. + @kindex C-c C-e v D @item C-c C-e v D Export only the visible part of the document. @@ -9964,21 +10142,21 @@ or @code{width}, can be specified in two ways: you can either customize variable @code{org-export-docbook-default-image-attributes} or use the @code{#+ATTR_DOCBOOK:} line. Attributes specified in variable @code{org-export-docbook-default-image-attributes} are applied to all inline -images in the Org file to be exported (unless they are overwritten by image +images in the Org file to be exported (unless they are overridden by image attributes specified in @code{#+ATTR_DOCBOOK:} lines). The @code{#+ATTR_DOCBOOK:} line can be used to specify additional image -attributes or overwrite default image attributes for individual images. If +attributes or override default image attributes for individual images. If the same attribute appears in both the @code{#+ATTR_DOCBOOK:} line and variable @code{org-export-docbook-default-image-attributes}, the former -overwrites the latter. Here is an example about how image attributes can be +takes precedence. Here is an example about how image attributes can be set: @cindex #+CAPTION @cindex #+LABEL @cindex #+ATTR_DOCBOOK @example -#+CAPTION: The logo of Org mode +#+CAPTION: The logo of Org-mode #+LABEL: unicorn-svg #+ATTR_DOCBOOK: scalefit="1" width="100%" depth="100%" [[./img/org-mode-unicorn.svg]] @@ -9995,12 +10173,12 @@ more types to this list as long as DocBook supports them. @cindex Special characters in DocBook export @vindex org-export-docbook-doctype -@vindex org-html-entities +@vindex org-entities Special characters that are written in @TeX{}-like syntax, such as @code{\alpha}, @code{\Gamma}, and @code{\Zeta}, are supported by DocBook exporter. These characters are rewritten to XML entities, like @code{α}, @code{Γ}, and @code{Ζ}, based on the list saved in variable -@code{org-html-entities}. As long as the generated DocBook file includes the +@code{org-entities}. As long as the generated DocBook file includes the corresponding entities, these special characters are recognized. You can customize variable @code{org-export-docbook-doctype} to include the @@ -10019,12 +10197,142 @@ special characters included in XHTML entities: " @end example -@node Freemind export, XOXO export, DocBook export, Exporting +@node TaskJuggler export, Freemind export, DocBook export, Exporting +@section TaskJuggler export +@cindex TaskJuggler export +@cindex Project management + +@uref{http://www.taskjuggler.org/, TaskJuggler} is a project management tool. +It provides an optimizing scheduler that computes your project time lines and +resource assignments based on the project outline and the constraints that +you have provided. + +The TaskJuggler exporter is a bit different from other exporters, such as the +HTML and LaTeX exporters for example, in that it does not export all the +nodes of a document or strictly follow the order of the nodes in the +document. + +Instead the TaskJuggler exporter looks for a tree that defines the tasks and +a optionally tree that defines the resources for this project. It then +creates a TaskJuggler file based on these trees and the attributes defined in +all the nodes. + +@subsection TaskJuggler export commands + +@table @kbd +@kindex C-c C-e j +@item C-c C-e j +Export as TaskJuggler file. + +@kindex C-c C-e J +@item C-c C-e J +Export as TaskJuggler file and then open the file with TaskJugglerUI. +@end table + +@subsection Tasks + +@vindex org-export-taskjuggler-project-tag +Create your tasks as you usually do with Org-mode. Assign efforts to each +task using properties (it's easiest to do this in the column view). You +should end up with something similar to the example by Peter Jones in +@url{http://www.contextualdevelopment.com/static/artifacts/articles/2008/project-planning/project-planning.org}. +Now mark the top node of your tasks with a tag named +@code{:taskjuggler_project:} (or whatever you customized +@code{org-export-taskjuggler-project-tag} to). You are now ready to export +the project plan with @kbd{C-c C-e J} which will export the project plan and +open a gantt chart in TaskJugglerUI. + +@subsection Resources + +@vindex org-export-taskjuggler-resource-tag +Next you can define resources and assign those to work on specific tasks. You +can group your resources hierarchically. Tag the top node of the resources +with @code{:taskjuggler_resource:} (or whatever you customized +@code{org-export-taskjuggler-resource-tag} to). You can optionally assign an +identifier (named @samp{resource_id}) to the resources (using the standard +Org properties commands, @pxref{Property syntax}) or you can let the exporter +generate identifiers automatically (the exporter picks the first word of the +headline as the identifier as long as it is unique, see the documentation of +@code{org-taskjuggler-get-unique-id}). Using that identifier you can then +allocate resources to tasks. This is again done with the @samp{allocate} +property on the tasks. Do this in column view or when on the task type +@kbd{C-c C-x p allocate @key{RET} @key{RET}}. + +Once the allocations are done you can again export to TaskJuggler and check +in the Resource Allocation Graph which person is working on what task at what +time. + +@subsection Export of properties + +The exporter also takes TODO state information into consideration, i.e. if a +task is marked as done it will have the corresponding attribute in +TaskJuggler (@samp{complete 100}). Also it will export any property on a task +resource or resource node which is known to TaskJuggler, such as +@samp{limits}, @samp{vacation}, @samp{shift}, @samp{booking}, +@samp{efficiency}, @samp{journalentry}, @samp{rate} for resources or +@samp{account}, @samp{start}, @samp{note}, @samp{duration}, @samp{end}, +@samp{journalentry}, @samp{milestone}, @samp{reference}, @samp{responsible}, +@samp{scheduling}, etc for tasks. + +@subsection Dependencies + +The exporter will handle dependencies that are defined in the tasks either +with the @samp{ORDERED} attribute (@pxref{TODO dependencies}), with the +@samp{BLOCKER} attribute (see org-depend.el) or alternatively with a +@samp{depends} attribute. Both the @samp{BLOCKER} and the @samp{depends} +attribute can be either @samp{previous-sibling} or a reference to an +identifier (named @samp{task_id}) which is defined for another task in the +project. @samp{BLOCKER} and the @samp{depends} attribute can define multiple +dependencies separated by either space or comma. You can also specify +optional attributes on the dependency by simply appending it. The following +examples should illustrate this: + +@example +* Preparation + :PROPERTIES: + :task_id: preparation + :ORDERED: t + :END: +* Training material + :PROPERTIES: + :task_id: training_material + :ORDERED: t + :END: +** Markup Guidelines + :PROPERTIES: + :Effort: 2.0 + :END: +** Workflow Guidelines + :PROPERTIES: + :Effort: 2.0 + :END: +* Presentation + :PROPERTIES: + :Effort: 2.0 + :BLOCKER: training_material @{ gapduration 1d @} preparation + :END: +@end example + +@subsection Reports + +@vindex org-export-taskjuggler-default-reports +TaskJuggler can produce many kinds of reports (e.g. gantt chart, resource +allocation, etc). The user defines what kind of reports should be generated +for a project in the TaskJuggler file. The exporter will automatically insert +some default reports in the file. These defaults are defined in +@code{org-export-taskjuggler-default-reports}. They can be modified using +customize along with a number of other options. For a more complete list, see +@kbd{M-x customize-group @key{RET} org-export-taskjuggler @key{RET}}. + +For more information and examples see the Org-taskjuggler tutorial at +@uref{http://orgmode.org/worg/org-tutorials/org-taskjuggler.php}. + +@node Freemind export, XOXO export, TaskJuggler export, Exporting @section Freemind export @cindex Freemind export @cindex mind map -The freemind exporter was written by Lennart Borgman. +The Freemind exporter was written by Lennart Borgman. @table @kbd @kindex C-c C-e m @@ -10036,7 +10344,7 @@ Export as Freemind mind map @file{myfile.mm}. @section XOXO export @cindex XOXO export -Org mode contains an exporter that produces XOXO-style output. +Org-mode contains an exporter that produces XOXO-style output. Currently, this exporter only handles the general outline structure and does not interpret any additional Org-mode features. @@ -10057,10 +10365,10 @@ Export only the visible part of the document. @vindex org-icalendar-use-deadline @vindex org-icalendar-use-scheduled @vindex org-icalendar-categories -Some people use Org mode for keeping track of projects, but still prefer a +Some people use Org-mode for keeping track of projects, but still prefer a standard calendar application for anniversaries and appointments. In this case it can be useful to show deadlines and other time-stamped items in Org -files in the calendar application. Org mode can export calendar information +files in the calendar application. Org-mode can export calendar information in the standard iCalendar format. If you also want to have TODO entries included in the export, configure the variable @code{org-icalendar-include-todo}. Plain timestamps are exported as VEVENT, @@ -10118,10 +10426,9 @@ and the description from the body (limited to How this calendar is best read and updated, depends on the application you are using. The FAQ covers this issue. -@node Publishing, Miscellaneous, Exporting, Top +@node Publishing, Working With Source Code, Exporting, Top @chapter Publishing @cindex publishing -@cindex O'Toole, David Org includes a publishing management system that allows you to configure automatic HTML conversion of @emph{projects} composed of interlinked org @@ -10135,10 +10442,10 @@ conversion so that files are available in both formats on the server. Publishing has been contributed to Org by David O'Toole. @menu -* Configuration:: Defining projects -* Uploading files:: How to get files up on the server -* Sample configuration:: Example projects -* Triggering publication:: Publication commands +* Configuration:: Defining projects +* Uploading files:: How to get files up on the server +* Sample configuration:: Example projects +* Triggering publication:: Publication commands @end menu @node Configuration, Uploading files, Publishing, Publishing @@ -10148,14 +10455,14 @@ Publishing needs significant configuration to specify files, destination and many other properties of a project. @menu -* Project alist:: The central configuration variable -* Sources and destinations:: From here to there -* Selecting files:: What files are part of the project? -* Publishing action:: Setting the function doing the publishing -* Publishing options:: Tweaking HTML export -* Publishing links:: Which links keep working after publishing? -* Sitemap:: Generating a list of all pages -* Generating an index:: An index that reaches across pages +* Project alist:: The central configuration variable +* Sources and destinations:: From here to there +* Selecting files:: What files are part of the project? +* Publishing action:: Setting the function doing the publishing +* Publishing options:: Tweaking HTML export +* Publishing links:: Which links keep working after publishing? +* Sitemap:: Generating a list of all pages +* Generating an index:: An index that reaches across pages @end menu @node Project alist, Sources and destinations, Configuration, Configuration @@ -10437,10 +10744,10 @@ file is part of any project in @code{org-publish-project-alist}. @subsection Generating a sitemap @cindex sitemap, of published pages -The following properties may be used to control publishing of +The following properties may be used to control publishing of a map of files for a given project. -@multitable @columnfractions 0.25 0.75 +@multitable @columnfractions 0.35 0.65 @item @code{:auto-sitemap} @tab When non-nil, publish a sitemap during @code{org-publish-current-project} or @code{org-publish-all}. @@ -10456,6 +10763,19 @@ becomes @file{sitemap.html}). @tab Plug-in function to use for generation of the sitemap. Defaults to @code{org-publish-org-sitemap}, which generates a plain list of links to all files in the project. + +@item @code{:sitemap-sort-folders} +@tab Where folders should appear in the sitemap. Set this to @code{first} +(default) or @code{last} to display folders first or last, +respectively. Any other value will mix files and folders. + +@item @code{:sitemap-alphabetically} +@tab The site map is normally sorted alphabetically. Set this explicitly to +@code{nil} to turn off sorting. + +@item @code{:sitemap-ignore-case} +@tab Should sorting be case-sensitive? Default @code{nil}. + @end multitable @node Generating an index, , Sitemap, Configuration @@ -10482,7 +10802,7 @@ a title, style information etc. For those people already utilizing third party sync tools such as @command{rsync} or @command{unison}, it might be preferable not to use the built in -@i{remote} publishing facilities of Org mode which rely heavily on +@i{remote} publishing facilities of Org-mode which rely heavily on Tramp. Tramp, while very useful and powerful, tends not to be so efficient for multiple file transfer and has been known to cause problems under heavy usage. @@ -10516,8 +10836,8 @@ project publishing only a set of Org files. The second example is more complex, with a multi-component project. @menu -* Simple example:: One-component publishing -* Complex example:: A multi-component publishing example +* Simple example:: One-component publishing +* Complex example:: A multi-component publishing example @end menu @node Simple example, Complex example, Sample configuration, Sample configuration @@ -10549,7 +10869,7 @@ excluded. To ensure that links are preserved, care should be taken to replicate your directory structure on the web server, and to use relative file paths. For example, if your Org files are kept in @file{~/org} and your -publishable images in @file{~/images}, you'd link to an image with +publishable images in @file{~/images}, you would link to an image with @c @example file:../images/myimage.png @@ -10617,18 +10937,1370 @@ above, or by customizing the variable @code{org-publish-use-timestamps-flag}. This may be necessary in particular if files include other files via @code{#+SETUPFILE:} or @code{#+INCLUDE:}. -@node Miscellaneous, Hacking, Publishing, Top +@comment node-name, next, previous, up +@comment Working With Source Code, Miscellaneous, Publishing, Top + +@node Working With Source Code, Miscellaneous, Publishing, Top +@chapter Working with source code +@cindex Schulte, Eric +@cindex Davison, Dan +@cindex source code, working with + +Source code can be included in Org-mode documents using a @samp{src} block, +e.g. + +@example +#+BEGIN_SRC emacs-lisp + (defun org-xor (a b) + "Exclusive or." + (if a (not b) b)) +#+END_SRC +@end example + +Org-mode provides a number of features for working with live source code, +including editing of code blocks in their native major-mode, evaluation of +code blocks, tangling of code blocks, and exporting code blocks and +their results in several formats. This functionality was contributed by Dan +Davison and Eric Schulte, and was originally named Org-babel. + +The following sections describe Org-mode's code block handling facilities. + +@menu +* Structure of code blocks:: Code block syntax described +* Editing source code:: Language major-mode editing +* Exporting code blocks:: Export contents and/or results +* Extracting source code:: Create pure source code files +* Evaluating code blocks:: Place results of evaluation in the Org-mode buffer +* Library of Babel:: Use and contribute to a library of useful code blocks +* Languages:: List of supported code block languages +* Header arguments:: Configure code block functionality +* Results of evaluation:: How evaluation results are handled +* Noweb reference syntax:: Literate programming in Org-mode +* Key bindings and useful functions:: Work quickly with code blocks +* Batch execution:: Call functions from the command line +@end menu + +@comment node-name, next, previous, up +@comment Structure of code blocks, Editing source code, Working With Source Code, Working With Source Code + +@node Structure of code blocks, Editing source code, Working With Source Code, Working With Source Code +@section Structure of code blocks +@cindex code block, structure +@cindex source code, block structure + +The structure of code blocks is as follows: + +@example +#+srcname: +#+begin_src
+ +#+end_src +@end example + +@table @code +@item +This name is associated with the code block. This is similar to the +@samp{#+tblname} lines that can be used to name tables in Org-mode files. +Referencing the name of a code block makes it possible to evaluate the +block from other places in the file, other files, or from Org-mode table +formulas (see @ref{The spreadsheet}). +@item +The language of the code in the block. +@item +Switches controlling exportation of the code block (see switches discussion in +@ref{Literal examples}) +@item
+Optional header arguments control many aspects of evaluation, export and +tangling of code blocks. See the @ref{Header arguments} +section. Header arguments can also be set on a per-buffer or per-subtree +basis using properties. +@item +The source code. +@end table + +@comment node-name, next, previous, up +@comment Editing source code, Exporting code blocks, Structure of code blocks, Working With Source Code + +@node Editing source code, Exporting code blocks, Structure of code blocks, Working With Source Code +@section Editing source code +@cindex code block, editing +@cindex source code, editing + +@kindex C-c ' +Use @kbd{C-c '} to edit the current code block. This brings up +a language major-mode edit buffer containing the body of the code +block. Saving this buffer will write the new contents back to the Org +buffer. Use @kbd{C-c '} again to exit. + +The @code{org-src-mode} minor mode will be active in the edit buffer. The +following variables can be used to configure the behavior of the edit +buffer. See also the customization group @code{org-edit-structure} for +further configuration options. + +@table @code +@item org-src-lang-modes +If an Emacs major-mode named @code{-mode} exists, where +@code{} is the language named in the header line of the code block, +then the edit buffer will be placed in that major-mode. This variable +can be used to map arbitrary language names to existing major modes. +@item org-src-window-setup +Controls the way Emacs windows are rearranged when the edit buffer is created. +@item org-src-preserve-indentation +This variable is especially useful for tangling languages such as +python, in which whitespace indentation in the output is critical. +@item org-src-ask-before-returning-to-edit-buffer +By default, Org will ask before returning to an open edit buffer. Set +this variable to nil to switch without asking. +@end table + +@comment node-name, next, previous, up +@comment Exporting code blocks, Extracting source code, Editing source code, Working With Source Code + +@node Exporting code blocks, Extracting source code, Editing source code, Working With Source Code +@section Exporting code blocks +@cindex code block, exporting +@cindex source code, exporting + +It is possible to export the @emph{contents} of code blocks, the +@emph{results} of code block evaluation, @emph{neither}, or @emph{both}. For +most languages, the default exports the contents of code blocks. However, for +some languages (e.g. @code{ditaa}) the default exports the results of code +block evaluation. For information on exporting code block bodies, see +@ref{Literal examples}. + +The @code{:exports} header argument can be used to specify export +behavior: + +@subsubheading Header arguments: +@table @code +@item :exports code +The default in most languages. The body of the code block is exported, as +described in @ref{Literal examples}. +@item :exports results +The code block will be evaluated and the results will be placed in the +Org-mode buffer for export, either updating previous results of the code +block located anywhere in the buffer or, if no previous results exist, +placing the results immediately after the code block. The body of the code +block will not be exported. +@item :exports both +Both the code block and its results will be exported. +@item :exports none +Neither the code block nor its results will be exported. +@end table + +It is possible to inhibit the evaluation of code blocks during export. +Setting the the @code{org-export-babel-evaluate} variable to @code{nil} will +ensure that no code blocks are evaluated as part of the export process. This +can be useful in situations where potentially untrusted Org-mode files are +exported in an automated fashion, for example when Org-mode is used as the +markup language for a wiki. + +@comment node-name, next, previous, up +@comment Extracting source code, Evaluating code blocks, Exporting code blocks, Working With Source Code +@node Extracting source code, Evaluating code blocks, Exporting code blocks, Working With Source Code +@section Extracting source code +@cindex source code, extracting +@cindex code block, extracting source code + +Creating pure source code files by extracting code from source blocks is +referred to as ``tangling''---a term adopted from the literate programming +community. During ``tangling'' of code blocks their bodies are expanded +using @code{org-babel-expand-src-block} which can expand both variable and +``noweb'' style references (see @ref{Noweb reference syntax}). + +@subsubheading Header arguments +@table @code +@item :tangle no +The default. The code block is not included in the tangled output. +@item :tangle yes +Include the code block in the tangled output. The output file name is the +name of the org file with the extension @samp{.org} replaced by the extension +for the block language. +@item :tangle filename +Include the code block in the tangled output to file @samp{filename}. +@end table + +@kindex C-c C-v t +@subsubheading Functions +@table @code +@item org-babel-tangle @kbd{C-c C-v t} +Tangle the current file. +@item org-babel-tangle-file +Choose a file to tangle. +@end table + +@subsubheading Hooks +@table @code +@item org-babel-post-tangle-hook +This hook is run from within code files tangled by @code{org-babel-tangle}. +Example applications could include post-processing, compilation or evaluation +of tangled code files. +@end table + +@node Evaluating code blocks, Library of Babel, Extracting source code, Working With Source Code +@section Evaluating code blocks +@cindex code block, evaluating +@cindex source code, evaluating + +Code blocks can be evaluated@footnote{Whenever code is evaluated there is a +potential for that code to do harm. Org-mode provides a number of safeguards +to ensure that it only evaluates code with explicit confirmation from the +user. For information on these safeguards (and on how to disable them) see +@ref{Code evaluation security}.} and the results placed in the Org-mode +buffer. By default, evaluation is only turned on for @code{emacs-lisp} code +blocks, however support exists for evaluating blocks in many languages. See +@ref{Languages} for a list of supported languages. See @ref{Structure of +code blocks} for information on the syntax used to define a code block. + +@kindex C-c C-c +There are a number of ways to evaluate code blocks. The simplest is to press +@kbd{C-c C-c} or @kbd{C-c C-v e} with the point on a code block@footnote{The +@code{org-babel-no-eval-on-ctrl-c-ctrl-c} variable can be used to remove code +evaluation from the @kbd{C-c C-c} key binding.}. This will call the +@code{org-babel-execute-src-block} function to evaluate the block and insert +its results into the Org-mode buffer. + +It is also possible to evaluate named code blocks from anywhere in an +Org-mode buffer or an Org-mode table. @code{#+call} (or synonymously +@code{#+function} or @code{#+lob}) lines can be used to remotely execute code +blocks located in the current Org-mode buffer or in the ``Library of Babel'' +(see @ref{Library of Babel}). These lines use the following syntax. + +@example +#+call: ()
+#+function: ()
+#+lob: ()
+@end example + +@table @code +@item +The name of the code block to be evaluated. +@item +Arguments specified in this section will be passed to the code block. +@item
+Header arguments can be placed after the function invocation. See +@ref{Header arguments} for more information on header arguments. +@end table + + +@node Library of Babel, Languages, Evaluating code blocks, Working With Source Code +@section Library of Babel +@cindex babel, library of +@cindex source code, library +@cindex code block, library + +The ``Library of Babel'' is a library of code blocks +that can be called from any Org-mode file. The library is housed in an +Org-mode file located in the @samp{contrib} directory of Org-mode. +Org-mode users can deposit functions they believe to be generally +useful in the library. + +Code blocks defined in the ``Library of Babel'' can be called remotely as if +they were in the current Org-mode buffer (see @ref{Evaluating code blocks} +for information on the syntax of remote code block evaluation). + +@kindex C-c C-v l +Code blocks located in any Org-mode file can be loaded into the ``Library of +Babel'' with the @code{org-babel-lob-ingest} function, bound to @kbd{C-c C-v +l}. + +@node Languages, Header arguments, Library of Babel, Working With Source Code +@section Languages +@cindex babel, languages +@cindex source code, languages +@cindex code block, languages + +Code blocks in the following languages are supported. + +@multitable @columnfractions 0.28 0.3 0.22 0.2 +@item @b{Language} @tab @b{Identifier} @tab @b{Language} @tab @b{Identifier} +@item Asymptote @tab asymptote @tab C @tab C +@item C++ @tab C++ @tab Clojure @tab clojure +@item css @tab css @tab ditaa @tab ditaa +@item Graphviz @tab dot @tab Emacs Lisp @tab emacs-lisp +@item gnuplot @tab gnuplot @tab Haskell @tab haskell +@item LaTeX @tab latex @tab Matlab @tab matlab +@item Mscgen @tab mscgen @tab Objective Caml @tab ocaml +@item Octave @tab octave @tab OZ @tab oz +@item Perl @tab perl @tab Python @tab python +@item R @tab R @tab Ruby @tab ruby +@item Sass @tab sass @tab GNU Screen @tab screen +@item shell @tab sh @tab SQL @tab sql +@item Sqlite @tab sqlite +@end multitable + +Language-specific documentation is available for some languages. If +available, it can be found at +@uref{http://orgmode.org/worg/org-contrib/babel/languages}. + +The @code{org-babel-load-languages} controls which languages are enabled for +evaluation (by default only @code{emacs-lisp} is enabled). This variable can +be set using the customization interface or by adding code like the following +to your emacs configuration. + +@quotation +The following disables @code{emacs-lisp} evaluation and enables evaluation of +@code{R} code blocks. +@end quotation + +@lisp +(org-babel-do-load-languages + 'org-babel-load-languages + '((emacs-lisp . nil) + (R . t))) +@end lisp + +It is also possible to enable support for a language by loading the related +elisp file with @code{require}. + +@quotation +The following adds support for evaluating @code{clojure} code blocks. +@end quotation + +@lisp +(require 'ob-clojure) +@end lisp + +@node Header arguments, Results of evaluation, Languages, Working With Source Code +@section Header arguments +@cindex code block, header arguments +@cindex source code, block header arguments + +Code block functionality can be configured with header arguments. This +section provides an overview of the use of header arguments, and then +describes each header argument in detail. + +@menu +* Using header arguments:: Different ways to set header arguments +* Specific header arguments:: List of header arguments +@end menu + +@node Using header arguments, Specific header arguments, Header arguments, Header arguments +@subsection Using header arguments + +The values of header arguments can be set in five different ways, each more +specific (and having higher priority) than the last. +@menu +* System-wide header arguments:: Set global default values +* Language-specific header arguments:: Set default values by language +* Buffer-wide header arguments:: Set default values for a specific buffer +* Header arguments in Org-mode properties:: Set default values for a buffer or heading +* Code block specific header arguments:: The most common way to set values +@end menu + + +@node System-wide header arguments, Language-specific header arguments, Using header arguments, Using header arguments +@subsubheading System-wide header arguments +@vindex org-babel-default-header-args +System-wide values of header arguments can be specified by customizing the +@code{org-babel-default-header-args} variable: + +@example +:session => "none" +:results => "replace" +:exports => "code" +:cache => "no" +:noweb => "no" +@end example + +@c @example +@c org-babel-default-header-args is a variable defined in `org-babel.el'. +@c Its value is +@c ((:session . "none") +@c (:results . "replace") +@c (:exports . "code") +@c (:cache . "no") +@c (:noweb . "no")) + + +@c Documentation: +@c Default arguments to use when evaluating a code block. +@c @end example + +For example, the following example could be used to set the default value of +@code{:noweb} header arguments to @code{yes}. This would have the effect of +expanding @code{:noweb} references by default when evaluating source code +blocks. + +@lisp +(setq org-babel-default-header-args +(cons '(:noweb . "yes") +(assq-delete-all :noweb org-babel-default-header-args))) +@end lisp + +@node Language-specific header arguments, Buffer-wide header arguments, System-wide header arguments, Using header arguments +@subsubheading Language-specific header arguments +Each language can define its own set of default header arguments. See the +language-specific documentation available online at +@uref{http://orgmode.org/worg/org-contrib/babel}. + +@node Buffer-wide header arguments, Header arguments in Org-mode properties, Language-specific header arguments, Using header arguments +@subsubheading Buffer-wide header arguments +Buffer-wide header arguments may be specified through the use of a special +line placed anywhere in an Org-mode file. The line consists of the +@code{#+BABEL:} keyword followed by a series of header arguments which may be +specified using the standard header argument syntax. + +For example the following would set @code{session} to @code{*R*}, and +@code{results} to @code{silent} for every code block in the buffer, ensuring +that all execution took place in the same session, and no results would be +inserted into the buffer. + +@example +#+BABEL: :session *R* :results silent +@end example + +@node Header arguments in Org-mode properties, Code block specific header arguments, Buffer-wide header arguments, Using header arguments +@subsubheading Header arguments in Org-mode properties + +Header arguments are also read from Org-mode properties (see @ref{Property +syntax}), which can be set on a buffer-wide or per-heading basis. An example +of setting a header argument for all code blocks in a buffer is + +@example +#+property: tangle yes +@end example + +When properties are used to set default header arguments, they are looked up +with inheritance, so the value of the @code{:cache} header argument will default +to @code{yes} in all code blocks in the subtree rooted at the following +heading: + +@example +* outline header +:PROPERTIES: +:cache: yes +:END: +@end example + +@kindex C-c C-x p +@vindex org-babel-default-header-args +Properties defined in this way override the properties set in +@code{org-babel-default-header-args}. It is convenient to use the +@code{org-set-property} function bound to @kbd{C-c C-x p} to set properties +in Org-mode documents. + +@node Code block specific header arguments, , Header arguments in Org-mode properties, Using header arguments +@subsubheading Code block specific header arguments + +The most common way to assign values to header arguments is at the +code block level. This can be done by listing a sequence of header +arguments and their values as part of the @code{#+begin_src} line. +Properties set in this way override both the values of +@code{org-babel-default-header-args} and header arguments specified as +properties. In the following example, the @code{:results} header argument +is set to @code{silent}, meaning the results of execution will not be +inserted in the buffer, and the @code{:exports} header argument is set to +@code{code}, meaning only the body of the code block will be +preserved on export to HTML or LaTeX. + +@example +#+source: factorial +#+begin_src haskell :results silent :exports code :var n=0 +fac 0 = 1 +fac n = n * fac (n-1) +#+end_src +@end example + +Similarly, it is possible to set header arguments for inline code blocks: + +@example +src_haskell[:exports both]@{fac 5@} +@end example + +Header arguments for ``Library of Babel'' or function call lines can be set as shown below: + +@example +#+call: factorial(n=5) :exports results +@end example + +@node Specific header arguments, , Using header arguments, Header arguments +@subsection Specific header arguments +The following header arguments are defined: + +@menu +* var:: Pass arguments to code blocks +* results:: Specify the type of results and how they will + be collected and handled +* file:: Specify a path for file output +* dir:: Specify the default (possibly remote) + directory for code block execution +* exports:: Export code and/or results +* tangle:: Toggle tangling and specify file name +* no-expand:: Turn off variable assignment and noweb + expansion during tangling +* comments:: Toggle insertion of comments in tangled + code files +* session:: Preserve the state of code evaluation +* noweb:: Toggle expansion of noweb references +* cache:: Avoid re-evaluating unchanged code blocks +* hlines:: Handle horizontal lines in tables +* colnames:: Handle column names in tables +* rownames:: Handle row names in tables +* shebang:: Make tangled files executable +* eval:: Limit evaluation of specific code blocks +@end menu + +@node var, results, Specific header arguments, Specific header arguments +@subsubsection @code{:var} +The @code{:var} header argument is used to pass arguments to code blocks. +The specifics of how arguments are included in a code block vary by language; +these are addressed in the language-specific documentation. However, the +syntax used to specify arguments is the same across all languages. The +values passed to arguments can be literal values, values from org-mode tables +and literal example blocks, or the results of other code blocks. + +These values can be indexed in a manner similar to arrays---see the +``indexable variable values'' heading below. + +The following syntax is used to pass arguments to code blocks using the +@code{:var} header argument. + +@example +:var name=assign +@end example + +where @code{assign} can take one of the following forms + +@itemize @bullet +@item literal value +either a string @code{"string"} or a number @code{9}. +@item reference +a table name: + +@example +#+tblname: example-table +| 1 | +| 2 | +| 3 | +| 4 | + +#+source: table-length +#+begin_src emacs-lisp :var table=example-table +(length table) +#+end_src + +#+results: table-length +: 4 +@end example + +a code block name, as assigned by @code{#+srcname:}, followed by +parentheses: + +@example +#+begin_src emacs-lisp :var length=table-length() +(* 2 length) +#+end_src + +#+results: +: 8 +@end example + +In addition, an argument can be passed to the code block referenced +by @code{:var}. The argument is passed within the parentheses following the +code block name: + +@example +#+source: double +#+begin_src emacs-lisp :var input=8 +(* 2 input) +#+end_src + +#+results: double +: 16 + +#+source: squared +#+begin_src emacs-lisp :var input=double(input=1) +(* input input) +#+end_src + +#+results: squared +: 4 +@end example +@end itemize + +@subsubheading Alternate argument syntax +It is also possible to specify arguments in a potentially more natural way +using the @code{#+source:} line of a code block. As in the following +example arguments can be packed inside of parenthesis, separated by commas, +following the source name. + +@example +#+source: double(input=0, x=2) +#+begin_src emacs-lisp +(* 2 (+ input x)) +#+end_src +@end example + +@subsubheading Indexable variable values +It is possible to reference portions of variable values by ``indexing'' into +the variables. Indexes are 0 based with negative values counting back from +the end. If an index is separated by @code{,}s then each subsequent section +will index into the next deepest nesting or dimension of the value. The +following example assigns the last cell of the first row the table +@code{example-table} to the variable @code{data}: + +@example +#+results: example-table +| 1 | a | +| 2 | b | +| 3 | c | +| 4 | d | + +#+begin_src emacs-lisp :var data=example-table[0,-1] + data +#+end_src + +#+results: +: a +@end example + +Ranges of variable values can be referenced using two integers separated by a +@code{:}, in which case the entire inclusive range is referenced. For +example the following assigns the middle three rows of @code{example-table} +to @code{data}. + +@example +#+results: example-table +| 1 | a | +| 2 | b | +| 3 | c | +| 4 | d | +| 5 | 3 | + +#+begin_src emacs-lisp :var data=example-table[1:3] + data +#+end_src + +#+results: +| 2 | b | +| 3 | c | +| 4 | d | +@end example + +Additionally, an empty index, or the single character @code{*}, are both +interpreted to mean the entire range and as such are equivalent to +@code{0:-1}, as shown in the following example in which the entire first +column is referenced. + +@example +#+results: example-table +| 1 | a | +| 2 | b | +| 3 | c | +| 4 | d | + +#+begin_src emacs-lisp :var data=example-table[,0] + data +#+end_src + +#+results: +| 1 | 2 | 3 | 4 | +@end example + +It is possible to index into the results of code blocks as well as tables. +Any number of dimensions can be indexed. Dimensions are separated from one +another by commas, as shown in the following example. + +@example +#+source: 3D +#+begin_src emacs-lisp + '(((1 2 3) (4 5 6) (7 8 9)) + ((10 11 12) (13 14 15) (16 17 18)) + ((19 20 21) (22 23 24) (25 26 27))) +#+end_src + +#+begin_src emacs-lisp :var data=3D[1,,1] + data +#+end_src + +#+results: +| 11 | 14 | 17 | +@end example + +@node results, file, var, Specific header arguments +@subsubsection @code{:results} + +There are three classes of @code{:results} header argument. Only one option of +each type may be supplied per code block. + +@itemize @bullet +@item +@b{collection} header arguments specify how the results should be collected +from the code block +@item +@b{type} header arguments specify what type of result the code block will +return---which has implications for how they will be inserted into the +Org-mode buffer +@item +@b{handling} header arguments specify how the results of evaluating the code +block should be handled. +@end itemize + +@subsubheading Collection +The following options are mutually exclusive, and specify how the results +should be collected from the code block. + +@itemize @bullet +@item @code{value} +This is the default. The result is the value of the last statement in the +code block. This header argument places the evaluation in functional +mode. Note that in some languages, e.g., python, use of this result type +requires that a @code{return} statement be included in the body of the source +code block. E.g., @code{:results value}. +@item @code{output} +The result is the collection of everything printed to STDOUT during the +execution of the code block. This header argument places the +evaluation in scripting mode. E.g., @code{:results output}. +@end itemize + +@subsubheading Type + +The following options are mutually exclusive and specify what type of results +the code block will return. By default, results are inserted as either a +table or scalar depending on their value. + +@itemize @bullet +@item @code{table}, @code{vector} +The results should be interpreted as an Org-mode table. If a single value is +returned, it will be converted into a table with one row and one column. +E.g., @code{:results value table}. +@item @code{scalar}, @code{verbatim} +The results should be interpreted literally---they will not be +converted into a table. The results will be inserted into the Org-mode +buffer as quoted text. E.g., @code{:results value verbatim}. +@item @code{file} +The results will be interpreted as the path to a file, and will be inserted +into the Org-mode buffer as a file link. E.g., @code{:results value file}. +@item @code{raw}, @code{org} +The results are interpreted as raw Org-mode code and are inserted directly +into the buffer. If the results look like a table they will be aligned as +such by Org-mode. E.g., @code{:results value raw}. +@item @code{html} +Results are assumed to be HTML and will be enclosed in a @code{begin_html} +block. E.g., @code{:results value html}. +@item @code{latex} +Results assumed to be LaTeX and are enclosed in a @code{begin_latex} block. +E.g., @code{:results value latex}. +@item @code{code} +Result are assumed to be parseable code and are enclosed in a code block. +E.g., @code{:results value code}. +@item @code{pp} +The result is converted to pretty-printed code and is enclosed in a code +block. This option currently supports Emacs Lisp, python, and ruby. E.g., +@code{:results value pp}. +@end itemize + +@subsubheading Handling +The following results options indicate what happens with the +results once they are collected. + +@itemize @bullet +@item @code{silent} +The results will be echoed in the minibuffer but will not be inserted into +the Org-mode buffer. E.g., @code{:results output silent}. +@item @code{replace} +The default value. Any existing results will be removed, and the new results +will be inserted into the Org-mode buffer in their place. E.g., +@code{:results output replace}. +@item @code{append} +If there are pre-existing results of the code block then the new results will +be appended to the existing results. Otherwise the new results will be +inserted as with @code{replace}. +@item @code{prepend} +If there are pre-existing results of the code block then the new results will +be prepended to the existing results. Otherwise the new results will be +inserted as with @code{replace}. +@end itemize + +@node file, dir, results, Specific header arguments +@subsubsection @code{:file} + +The header argument @code{:file} is used to specify a path for file output. +An Org-mode style @code{file:} link is inserted into the buffer as the result +(see @ref{Link format}). Common examples are graphical output from R, +gnuplot, ditaa and LaTeX code blocks. + +Note that for some languages, including R, gnuplot, LaTeX and ditaa, +graphical output is sent to the specified file without the file being +referenced explicitly in the code block. See the documentation for the +individual languages for details. In contrast, general purpose languages such +as python and ruby require that the code explicitly create output +corresponding to the path indicated by @code{:file}. + + +@node dir, exports, file, Specific header arguments +@subsubsection @code{:dir} and remote execution + +While the @code{:file} header argument can be used to specify the path to the +output file, @code{:dir} specifies the default directory during code block +execution. If it is absent, then the directory associated with the current +buffer is used. In other words, supplying @code{:dir path} temporarily has +the same effect as changing the current directory with @kbd{M-x cd path}, and +then not supplying @code{:dir}. Under the surface, @code{:dir} simply sets +the value of the Emacs variable @code{default-directory}. + +When using @code{:dir}, you should supply a relative path for file output +(e.g. @code{:file myfile.jpg} or @code{:file results/myfile.jpg}) in which +case that path will be interpreted relative to the default directory. + +In other words, if you want your plot to go into a folder called Work in your +home directory, you could use + +@example +#+begin_src R :file myplot.png :dir ~/Work +matplot(matrix(rnorm(100), 10), type="l") +#+end_src +@end example + +@subsubheading Remote execution +A directory on a remote machine can be specified using tramp file syntax, in +which case the code will be evaluated on the remote machine. An example is + +@example +#+begin_src R :file plot.png :dir /dand@@yakuba.princeton.edu: +plot(1:10, main=system("hostname", intern=TRUE)) +#+end_src +@end example + +Text results will be returned to the local Org-mode buffer as usual, and file +output will be created on the remote machine with relative paths interpreted +relative to the remote directory. An Org-mode link to the remote file will be +created. + +So, in the above example a plot will be created on the remote machine, +and a link of the following form will be inserted in the org buffer: + +@example +[[file:/scp:dand@@yakuba.princeton.edu:/home/dand/plot.png][plot.png]] +@end example + +Most of this functionality follows immediately from the fact that @code{:dir} +sets the value of the Emacs variable @code{default-directory}, thanks to +tramp. Those using XEmacs, or GNU Emacs prior to version 23 may need to +install tramp separately in order for the these features to work correctly. + +@subsubheading Further points + +@itemize @bullet +@item +If @code{:dir} is used in conjunction with @code{:session}, although it will +determine the starting directory for a new session as expected, no attempt is +currently made to alter the directory associated with an existing session. +@item +@code{:dir} should typically not be used to create files during export with +@code{:exports results} or @code{:exports both}. The reason is that, in order +to retain portability of exported material between machines, during export +links inserted into the buffer will *not* be expanded against @code{default +directory}. Therefore, if @code{default-directory} is altered using +@code{:dir}, it is probable that the file will be created in a location to +which the link does not point. +@end itemize + +@node exports, tangle, dir, Specific header arguments +@subsubsection @code{:exports} + +The @code{:exports} header argument specifies what should be included in HTML +or LaTeX exports of the Org-mode file. + +@itemize @bullet +@item @code{code} +The default. The body of code is included into the exported file. E.g., +@code{:exports code}. +@item @code{results} +The result of evaluating the code is included in the exported file. E.g., +@code{:exports results}. +@item @code{both} +Both the code and results are included in the exported file. E.g., +@code{:exports both}. +@item @code{none} +Nothing is included in the exported file. E.g., @code{:exports none}. +@end itemize + +@node tangle, comments, exports, Specific header arguments +@subsubsection @code{:tangle} + +The @code{:tangle} header argument specifies whether or not the code +block should be included in tangled extraction of source code files. + +@itemize @bullet +@item @code{yes} +The code block is exported to a source code file named after the +basename (name w/o extension) of the Org-mode file. E.g., @code{:tangle +yes}. +@item @code{no} +The default. The code block is not exported to a source code file. +E.g., @code{:tangle no}. +@item other +Any other string passed to the @code{:tangle} header argument is interpreted +as a file basename to which the block will be exported. E.g., @code{:tangle +basename}. +@end itemize + +@node comments, no-expand, tangle, Specific header arguments +@subsubsection @code{:comments} +By default code blocks are tangled to source-code files without any insertion +of comments beyond those which may already exist in the body of the code +block. The @code{:comments} header argument can be set to ``yes'' +e.g. @code{:comments yes} to enable the insertion of comments around code +blocks during tangling. The inserted comments contain pointers back to the +original Org file from which the comment was tangled. + +@node no-expand, session, comments, Specific header arguments +@subsubsection @code{:no-expand} + +By default, code blocks are expanded with @code{org-babel-expand-src-block} +during tangling. This has the effect of assigning values to variables +specified with @code{:var} (see @ref{var}), and of replacing ``noweb'' +references (see @ref{Noweb reference syntax}) with their targets. The +@code{:no-expand} header argument can be used to turn off this behavior. + +@node session, noweb, no-expand, Specific header arguments +@subsubsection @code{:session} + +The @code{:session} header argument starts a session for an interpreted +language where state is preserved. + +By default, a session is not started. + +A string passed to the @code{:session} header argument will give the session +a name. This makes it possible to run concurrent sessions for each +interpreted language. + +@node noweb, cache, session, Specific header arguments +@subsubsection @code{:noweb} + +The @code{:noweb} header argument controls expansion of ``noweb'' style (see +@ref{Noweb reference syntax}) references in a code block. This header +argument can have one of two values: @code{yes} or @code{no}. + +@itemize @bullet +@item @code{no} +The default. No ``noweb'' syntax specific action is taken on evaluating +code blocks, However, noweb references will still be expanded during +tangling. +@item @code{yes} +All ``noweb'' syntax references in the body of the code block will be +expanded before the block is evaluated. +@end itemize + +@subsubheading Noweb prefix lines +Noweb insertions are now placed behind the line prefix of the +@code{<>}. +This behavior is illustrated in the following example. Because the +@code{<>} noweb reference appears behind the SQL comment syntax, +each line of the expanded noweb reference will be commented. + +This code block: + +@example +-- <> +@end example + + +expands to: + +@example +-- this is the +-- multi-line body of example +@end example + +Note that noweb replacement text that does not contain any newlines will not +be affected by this change, so it is still possible to use inline noweb +references. + +@node cache, hlines, noweb, Specific header arguments +@subsubsection @code{:cache} + +The @code{:cache} header argument controls the use of in-buffer caching of +the results of evaluating code blocks. It can be used to avoid re-evaluating +unchanged code blocks. This header argument can have one of two +values: @code{yes} or @code{no}. + +@itemize @bullet +@item @code{no} +The default. No caching takes place, and the code block will be evaluated +every time it is called. +@item @code{yes} +Every time the code block is run a sha1 hash of the code and arguments +passed to the block will be generated. This hash is packed into the +@code{#+results:} line and will be checked on subsequent +executions of the code block. If the code block has not +changed since the last time it was evaluated, it will not be re-evaluated. +@end itemize + +@node hlines, colnames, cache, Specific header arguments +@subsubsection @code{:hlines} + +Tables are frequently represented with one or more horizontal lines, or +hlines. The @code{:hlines} argument to a code block accepts the +values @code{yes} or @code{no}, with a default value of @code{no}. + +@itemize @bullet +@item @code{no} +Strips horizontal lines from the input table. In most languages this is the +desired effect because an @code{hline} symbol is interpreted as an unbound +variable and raises an error. Setting @code{:hlines no} or relying on the +default value yields the following results. + +@example +#+tblname: many-cols +| a | b | c | +|---+---+---| +| d | e | f | +|---+---+---| +| g | h | i | + +#+source: echo-table +#+begin_src python :var tab=many-cols + return tab +#+end_src + +#+results: echo-table +| a | b | c | +| d | e | f | +| g | h | i | +@end example + +@item @code{yes} +Leaves hlines in the table. Setting @code{:hlines yes} has this effect. + +@example +#+tblname: many-cols +| a | b | c | +|---+---+---| +| d | e | f | +|---+---+---| +| g | h | i | + +#+source: echo-table +#+begin_src python :var tab=many-cols :hlines yes + return tab +#+end_src + +#+results: echo-table +| a | b | c | +|---+---+---| +| d | e | f | +|---+---+---| +| g | h | i | +@end example +@end itemize + +@node colnames, rownames, hlines, Specific header arguments +@subsubsection @code{:colnames} + +The @code{:colnames} header argument accepts the values @code{yes}, +@code{no}, or @code{nil} for unassigned. The default value is @code{nil}. + +@itemize @bullet +@item @code{nil} +If an input table looks like it has column names +(because its second row is an hline), then the column +names will be removed from the table before +processing, then reapplied to the results. + +@example +#+tblname: less-cols +| a | +|---| +| b | +| c | + +#+srcname: echo-table-again +#+begin_src python :var tab=less-cols + return [[val + '*' for val in row] for row in tab] +#+end_src + +#+results: echo-table-again +| a | +|----| +| b* | +| c* | +@end example + +@item @code{no} +No column name pre-processing takes place + +@item @code{yes} +Column names are removed and reapplied as with @code{nil} even if the table +does not ``look like'' it has column names (i.e. the second row is not an +hline) +@end itemize + +@node rownames, shebang, colnames, Specific header arguments +@subsubsection @code{:rownames} + +The @code{:rownames} header argument can take on the values @code{yes} +or @code{no}, with a default value of @code{no}. + +@itemize @bullet +@item @code{no} +No row name pre-processing will take place. + +@item @code{yes} +The first column of the table is removed from the table before processing, +and is then reapplied to the results. + +@example +#+tblname: with-rownames +| one | 1 | 2 | 3 | 4 | 5 | +| two | 6 | 7 | 8 | 9 | 10 | + +#+srcname: echo-table-once-again +#+begin_src python :var tab=with-rownames :rownames yes + return [[val + 10 for val in row] for row in tab] +#+end_src + +#+results: echo-table-once-again +| one | 11 | 12 | 13 | 14 | 15 | +| two | 16 | 17 | 18 | 19 | 20 | +@end example +@end itemize + +@node shebang, eval, rownames, Specific header arguments +@subsubsection @code{:shebang} + +Setting the @code{:shebang} header argument to a string value +(e.g. @code{:shebang "#!/bin/bash"}) causes the string to be inserted as the +first line of any tangled file holding the code block, and the file +permissions of the tangled file are set to make it executable. + +@node eval, , shebang, Specific header arguments +@subsubsection @code{:eval} +The @code{:eval} header argument can be used to limit the evaluation of +specific code blocks. @code{:eval} accepts two arguments ``never'' and +``query''. @code{:eval never} will ensure that a code block is never +evaluated, this can be useful for protecting against the evaluation of +dangerous code blocks. @code{:eval query} will require a query for every +execution of a code block regardless of the value of the +@code{org-confirm-babel-evaluate} variable. + +@node Results of evaluation, Noweb reference syntax, Header arguments, Working With Source Code +@section Results of evaluation +@cindex code block, results of evaluation +@cindex source code, results of evaluation + +The way in which results are handled depends on whether a session is invoked, +as well as on whether @code{:results value} or @code{:results output} is +used. The following table shows the possibilities: + +@multitable @columnfractions 0.26 0.33 0.41 +@item @tab @b{Non-session} @tab @b{Session} +@item @code{:results value} @tab value of last expression @tab value of last expression +@item @code{:results output} @tab contents of STDOUT @tab concatenation of interpreter output +@end multitable + +Note: With @code{:results value}, the result in both @code{:session} and +non-session is returned to Org-mode as a table (a one- or two-dimensional +vector of strings or numbers) when appropriate. + +@subsection Non-session +@subsubsection @code{:results value} +This is the default. Internally, the value is obtained by wrapping the code +in a function definition in the external language, and evaluating that +function. Therefore, code should be written as if it were the body of such a +function. In particular, note that python does not automatically return a +value from a function unless a @code{return} statement is present, and so a +@samp{return} statement will usually be required in python. + +This is the only one of the four evaluation contexts in which the code is +automatically wrapped in a function definition. + +@subsubsection @code{:results output} +The code is passed to the interpreter as an external process, and the +contents of the standard output stream are returned as text. (In certain +languages this also contains the error output stream; this is an area for +future work.) + +@subsection @code{:session} +@subsubsection @code{:results value} +The code is passed to the interpreter running as an interactive Emacs +inferior process. The result returned is the result of the last evaluation +performed by the interpreter. (This is obtained in a language-specific +manner: the value of the variable @code{_} in python and ruby, and the value +of @code{.Last.value} in R). + +@subsubsection @code{:results output} +The code is passed to the interpreter running as an interactive Emacs +inferior process. The result returned is the concatenation of the sequence of +(text) output from the interactive interpreter. Notice that this is not +necessarily the same as what would be sent to @code{STDOUT} if the same code +were passed to a non-interactive interpreter running as an external +process. For example, compare the following two blocks: + +@example +#+begin_src python :results output + print "hello" + 2 + print "bye" +#+end_src + +#+resname: +: hello +: bye +@end example + +In non-session mode, the '2' is not printed and does not appear. +@example +#+begin_src python :results output :session + print "hello" + 2 + print "bye" +#+end_src + +#+resname: +: hello +: 2 +: bye +@end example + +But in @code{:session} mode, the interactive interpreter receives input '2' +and prints out its value, '2'. (Indeed, the other print statements are +unnecessary here). + +@node Noweb reference syntax, Key bindings and useful functions, Results of evaluation, Working With Source Code +@section Noweb reference syntax +@cindex code block, noweb reference +@cindex syntax, noweb +@cindex source code, noweb reference + +The ``noweb'' (see @uref{http://www.cs.tufts.edu/~nr/noweb/}) Literate +Programming system allows named blocks of code to be referenced by using the +familiar Noweb syntax: + +@example +<> +@end example + +When a code block is tangled or evaluated, whether or not ``noweb'' +references are expanded depends upon the value of the @code{:noweb} header +argument. If @code{:noweb yes}, then a Noweb reference is expanded before +evaluation. If @code{:noweb no}, the default, then the reference is not +expanded before evaluation. + +Note: the default value, @code{:noweb no}, was chosen to ensure that +correct code is not broken in a language, such as Ruby, where +@code{<>} is a syntactically valid construct. If @code{<>} is not +syntactically valid in languages that you use, then please consider setting +the default value. + +@node Key bindings and useful functions, Batch execution, Noweb reference syntax, Working With Source Code +@section Key bindings and useful functions +@cindex code block, key bindings + +Many common Org-mode key sequences are re-bound depending on +the context. + +Within a code block, the following key bindings +are active: + +@multitable @columnfractions 0.25 0.75 +@kindex C-c C-c +@item @kbd{C-c C-c} @tab org-babel-execute-src-block +@kindex C-c C-o +@item @kbd{C-c C-o} @tab org-babel-open-src-block-result +@kindex C-up +@item @kbd{C-@key{up}} @tab org-babel-load-in-session +@kindex M-down +@item @kbd{M-@key{down}} @tab org-babel-pop-to-session +@end multitable + +In an Org-mode buffer, the following key bindings are active: + +@multitable @columnfractions 0.45 0.55 +@kindex C-c C-v a +@kindex C-c C-v C-a +@item @kbd{C-c C-v a} @ @ @r{or} @ @ @kbd{C-c C-v C-a} @tab org-babel-sha1-hash +@kindex C-c C-v b +@kindex C-c C-v C-b +@item @kbd{C-c C-v b} @ @ @r{or} @ @ @kbd{C-c C-v C-b} @tab org-babel-execute-buffer +@kindex C-c C-v f +@kindex C-c C-v C-f +@item @kbd{C-c C-v f} @ @ @r{or} @ @ @kbd{C-c C-v C-f} @tab org-babel-tangle-file +@kindex C-c C-v g +@item @kbd{C-c C-v g} @tab org-babel-goto-named-source-block +@kindex C-c C-v h +@item @kbd{C-c C-v h} @tab org-babel-describe-bindings +@kindex C-c C-v l +@kindex C-c C-v C-l +@item @kbd{C-c C-v l} @ @ @r{or} @ @ @kbd{C-c C-v C-l} @tab org-babel-lob-ingest +@kindex C-c C-v p +@kindex C-c C-v C-p +@item @kbd{C-c C-v p} @ @ @r{or} @ @ @kbd{C-c C-v C-p} @tab org-babel-expand-src-block +@kindex C-c C-v s +@kindex C-c C-v C-s +@item @kbd{C-c C-v s} @ @ @r{or} @ @ @kbd{C-c C-v C-s} @tab org-babel-execute-subtree +@kindex C-c C-v t +@kindex C-c C-v C-t +@item @kbd{C-c C-v t} @ @ @r{or} @ @ @kbd{C-c C-v C-t} @tab org-babel-tangle +@kindex C-c C-v z +@kindex C-c C-v C-z +@item @kbd{C-c C-v z} @ @ @r{or} @ @ @kbd{C-c C-v C-z} @tab org-babel-switch-to-session +@end multitable + +@c When possible these keybindings were extended to work when the control key is +@c kept pressed, resulting in the following additional keybindings. + +@c @multitable @columnfractions 0.25 0.75 +@c @item @kbd{C-c C-v C-a} @tab org-babel-sha1-hash +@c @item @kbd{C-c C-v C-b} @tab org-babel-execute-buffer +@c @item @kbd{C-c C-v C-f} @tab org-babel-tangle-file +@c @item @kbd{C-c C-v C-l} @tab org-babel-lob-ingest +@c @item @kbd{C-c C-v C-p} @tab org-babel-expand-src-block +@c @item @kbd{C-c C-v C-s} @tab org-babel-execute-subtree +@c @item @kbd{C-c C-v C-t} @tab org-babel-tangle +@c @item @kbd{C-c C-v C-z} @tab org-babel-switch-to-session +@c @end multitable + +@node Batch execution, , Key bindings and useful functions, Working With Source Code +@section Batch execution +@cindex code block, batch execution +@cindex source code, batch execution + +It is possible to call functions from the command line. This shell +script calls @code{org-babel-tangle} on every one of its arguments. + +Be sure to adjust the paths to fit your system. + +@example +#!/bin/sh +# -*- mode: shell-script -*- +# +# tangle a file with org-mode +# +DIR=`pwd` +FILES="" + +# wrap each argument in the code required to call tangle on it +for i in $@@; do +FILES="$FILES \"$i\"" +done + +emacsclient \ +--eval "(progn +(add-to-list 'load-path (expand-file-name \"~/src/org/lisp/\")) +(add-to-list 'load-path (expand-file-name \"~/src/org/contrib/lisp/\")) +(require 'org)(require 'org-exp)(require 'ob)(require 'ob-tangle) +(mapc (lambda (file) + (find-file (expand-file-name file \"$DIR\")) + (org-babel-tangle) + (kill-buffer)) '($FILES)))" +@end example + +@node Miscellaneous, Hacking, Working With Source Code, Top @chapter Miscellaneous @menu -* Completion:: M-TAB knows what you need -* Speed keys:: Electic commands at the beginning of a headline -* Customization:: Adapting Org to your taste -* In-buffer settings:: Overview of the #+KEYWORDS -* The very busy C-c C-c key:: When in doubt, press C-c C-c -* Clean view:: Getting rid of leading stars in the outline -* TTY keys:: Using Org on a tty -* Interaction:: Other Emacs packages +* Completion:: M-TAB knows what you need +* Speed keys:: Electric commands at the beginning of a headline +* Code evaluation security:: Org mode files evaluate inline code +* Customization:: Adapting Org to your taste +* In-buffer settings:: Overview of the #+KEYWORDS +* The very busy C-c C-c key:: When in doubt, press C-c C-c +* Clean view:: Getting rid of leading stars in the outline +* TTY keys:: Using Org on a tty +* Interaction:: Other Emacs packages @end menu @@ -10683,7 +12355,7 @@ buffer. After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}). @item After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or -@samp{OPTIONS} which set file-specific options for Org mode. When the +@samp{OPTIONS} which set file-specific options for Org-mode. When the option keyword is already complete, pressing @kbd{M-@key{TAB}} again will insert example settings for this keyword. @item @@ -10694,7 +12366,7 @@ Elsewhere, complete dictionary words using Ispell. @end itemize @end table -@node Speed keys, Customization, Completion, Miscellaneous +@node Speed keys, Code evaluation security, Completion, Miscellaneous @section Speed keys @cindex speed keys @vindex org-use-speed-commands @@ -10712,7 +12384,62 @@ or on a small mobile device with a limited keyboard. To see which commands are available, activate the feature and press @kbd{?} with the cursor at the beginning of a headline. -@node Customization, In-buffer settings, Speed keys, Miscellaneous +@node Code evaluation security, Customization, Speed keys, Miscellaneous +@section Code evaluation and security issues + +Org provides tool to work with the code snippets, including evaluating them. + +Running code on your machine always comes with a security risk. Badly +written or malicious code can be executed on purpose or by accident. Org has +default settings which will only evaluate such code if you give explicit +permission to do so, and as a casual user of these features you should leave +these precautions intact. + +For people who regularly work with such code, the confirmation prompts can +become annoying, and you might want to turn them off. This can be done, but +you must be aware of the risks that are involved. + +Code evaluation can happen under the following circumstances: + +@table @i +@item Source code blocks +Source code blocks can be evaluated during export, or when pressing @kbd{C-c +C-c} in the block. The most important thing to realize here is that Org mode +files which contain code snippets are in a certain sense like executable +files. So you should accept them and load them into Emacs only from trusted +sources - just like you would do with a program you install on your computer. + +Make sure you know what you are doing before customizing the variables +which take of the default security brakes. + +@defopt org-confirm-babel-evaluate +When set to t user is queried before code block evaluation +@end defopt + +@item Following @code{shell} and @code{elisp} links +Org has two link types that can directly evaluate code (@pxref{External +links}). These links can be problematic because the code to be evaluated his +not visible. + +@defopt org-confirm-shell-link-function +Function to queries user about shell link execution. +@end defopt +@defopt org-confirm-elisp-link-function +Functions to query user for Emacs Lisp link execution. +@end defopt + +@item Following @code{shell} and @code{elisp} links +Org has two link types that can directly evaluate code (@pxref{External +links}). These links can be problematic because the code to be evaluated his +not visible. @b{Security advice:} Do not use these links, use source code +blocks which make the associated actions much more transparent. + +@item Formulas in tables +Formulas in tables (@pxref{The spreadsheet}) are code that is evaluated +either by the @i{calc} interpreter, or by the @i{Emacs Lisp} interpreter. +@end table + +@node Customization, In-buffer settings, Code evaluation security, Miscellaneous @section Customization @cindex customization @cindex options, for customization @@ -10731,7 +12458,7 @@ lines into the buffer (@pxref{In-buffer settings}). @cindex in-buffer settings @cindex special keywords -Org mode uses special lines in the buffer to define settings on a +Org-mode uses special lines in the buffer to define settings on a per-file basis. These lines start with a @samp{#+} followed by a keyword, a colon, and then individual words defining a setting. Several setting words can be in the same line, but you can also have multiple @@ -10790,14 +12517,14 @@ buffer, most useful for specifying the allowed values of a property. @item #+SETUPFILE: file This line defines a file that holds more in-buffer setup. Normally this is entirely ignored. Only when the buffer is parsed for option-setting lines -(i.e. when starting Org mode for a file, when pressing @kbd{C-c C-c} in a +(i.e. when starting Org-mode for a file, when pressing @kbd{C-c C-c} in a settings line, or when exporting), then the contents of this file are parsed as if they had been included in the buffer. In particular, the file can be -any other Org mode file with internal setup. You can visit the file the +any other Org-mode file with internal setup. You can visit the file the cursor is in the line with @kbd{C-c '}. @item #+STARTUP: @cindex #+STARTUP: -This line sets options to be used at startup of Org mode, when an +This line sets options to be used at startup of Org-mode, when an Org file is being visited. The first set of options deals with the initial visibility of the outline @@ -10950,6 +12677,15 @@ To hide blocks on startup, use these keywords. The corresponding variable is hideblocks @r{Hide all begin/end blocks on startup} nohideblocks @r{Do not hide blocks on startup} @end example +@cindex org-pretty-entities +The the display of entities as UTF8 characters is governed by the variable +@code{org-pretty-entities} and the keywords +@cindex @code{entitiespretty}, STARTUP keyword +@cindex @code{entitiesplain}, STARTUP keyword +@example +entitiespretty @r{Show entities as UTF8 characters where possible} +entitiesplain @r{Leave entities plain} +@end example @item #+TAGS: TAG1(c1) TAG2(c2) @vindex org-tag-alist These lines (several such lines are allowed) specify the valid tags in @@ -10958,8 +12694,8 @@ keys. The corresponding variable is @code{org-tag-alist}. @item #+TBLFM: This line contains the formulas for the table directly above the line. @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+DATE:, -@itemx #+OPTIONS:, #+BIND: -@itemx #+DESCRIPTION:, #+KEYWORDS: +@itemx #+OPTIONS:, #+BIND:, #+XSLT:, +@itemx #+DESCRIPTION:, #+KEYWORDS:, @itemx #+LATEX_HEADER:, #+STYLE:, #+LINK_UP:, #+LINK_HOME:, @itemx #+EXPORT_SELECT_TAGS:, #+EXPORT_EXCLUDE_TAGS: These lines provide settings for exporting files. For more details see @@ -10997,7 +12733,7 @@ works even if the automatic table editor has been turned off. If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to the entire table. @item -If the current buffer is a Remember buffer, close the note and file it. +If the current buffer is a capture buffer, close the note and file it. With a prefix argument, file it, without further interaction, to the default location. @item @@ -11048,14 +12784,16 @@ more text | more text @end example @noindent -If you are using at least Emacs 23.1.50.3 and version 6.29 of Org, this kind -of view can be achieved dynamically at display time using -@code{org-indent-mode}. In this minor mode, all lines are prefixed for -display with the necessary amount of space@footnote{@code{org-indent-mode} -also sets the @code{wrap-prefix} property, such that @code{visual-line-mode} -(or purely setting @code{word-wrap}) wraps long lines (including headlines) -correctly indented. }. Also headlines are prefixed with additional stars, -so that the amount of indentation shifts by two@footnote{See the variable + +If you are using at least Emacs 23.2@footnote{Emacs 23.1 can actually crash +with @code{org-indent-mode}} and version 6.29 of Org, this kind of view can +be achieved dynamically at display time using @code{org-indent-mode}. In +this minor mode, all lines are prefixed for display with the necessary amount +of space@footnote{@code{org-indent-mode} also sets the @code{wrap-prefix} +property, such that @code{visual-line-mode} (or purely setting +@code{word-wrap}) wraps long lines (including headlines) correctly indented. +}. Also headlines are prefixed with additional stars, so that the amount of +indentation shifts by two@footnote{See the variable @code{org-indent-indentation-per-level}.} spaces per level. All headline stars but the last one are made invisible using the @code{org-hide} face@footnote{Turning on @code{org-indent-mode} sets @@ -11161,16 +12899,16 @@ is really only fun with @kbd{S-@key{cursor}} keys, whereas on a tty you would rather use @kbd{C-c .} to re-insert the timestamp. @multitable @columnfractions 0.15 0.2 0.1 0.2 -@item @b{Default} @tab @b{Alternative 1} @tab @b{Speed key} @tab @b{Alternative 2} -@item @kbd{S-@key{TAB}} @tab @kbd{C-u @key{TAB}} @tab @kbd{C} @tab -@item @kbd{M-@key{left}} @tab @kbd{C-c C-x l} @tab @kbd{l} @tab @kbd{@key{Esc} @key{left}} -@item @kbd{M-S-@key{left}} @tab @kbd{C-c C-x L} @tab @kbd{L} @tab +@item @b{Default} @tab @b{Alternative 1} @tab @b{Speed key} @tab @b{Alternative 2} +@item @kbd{S-@key{TAB}} @tab @kbd{C-u @key{TAB}} @tab @kbd{C} @tab +@item @kbd{M-@key{left}} @tab @kbd{C-c C-x l} @tab @kbd{l} @tab @kbd{@key{Esc} @key{left}} +@item @kbd{M-S-@key{left}} @tab @kbd{C-c C-x L} @tab @kbd{L} @tab @item @kbd{M-@key{right}} @tab @kbd{C-c C-x r} @tab @kbd{r} @tab @kbd{@key{Esc} @key{right}} -@item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R} @tab @kbd{R} @tab -@item @kbd{M-@key{up}} @tab @kbd{C-c C-x u} @tab @kbd{ } @tab @kbd{@key{Esc} @key{up}} -@item @kbd{M-S-@key{up}} @tab @kbd{C-c C-x U} @tab @kbd{U} @tab +@item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R} @tab @kbd{R} @tab +@item @kbd{M-@key{up}} @tab @kbd{C-c C-x u} @tab @kbd{ } @tab @kbd{@key{Esc} @key{up}} +@item @kbd{M-S-@key{up}} @tab @kbd{C-c C-x U} @tab @kbd{U} @tab @item @kbd{M-@key{down}} @tab @kbd{C-c C-x d} @tab @kbd{ } @tab @kbd{@key{Esc} @key{down}} -@item @kbd{M-S-@key{down}} @tab @kbd{C-c C-x D} @tab @kbd{D} @tab +@item @kbd{M-S-@key{down}} @tab @kbd{C-c C-x D} @tab @kbd{D} @tab @item @kbd{S-@key{RET}} @tab @kbd{C-c C-x c} @tab @kbd{ } @tab @item @kbd{M-@key{RET}} @tab @kbd{C-c C-x m} @tab @kbd{ } @tab @kbd{@key{Esc} @key{RET}} @item @kbd{M-S-@key{RET}} @tab @kbd{C-c C-x M} @tab @kbd{ } @tab @@ -11190,8 +12928,8 @@ Org lives in the world of GNU Emacs and interacts in various ways with other code out there. @menu -* Cooperation:: Packages Org cooperates with -* Conflicts:: Packages that lead to conflicts +* Cooperation:: Packages Org cooperates with +* Conflicts:: Packages that lead to conflicts @end menu @node Cooperation, Conflicts, Interaction, Interaction @@ -11226,11 +12964,11 @@ setup. See the installation instructions in the file @item @file{cdlatex.el} by Carsten Dominik @cindex @file{cdlatex.el} @cindex Dominik, Carsten -Org mode can make use of the CDLa@TeX{} package to efficiently enter +Org-mode can make use of the CDLa@TeX{} package to efficiently enter La@TeX{} fragments into Org files. See @ref{CDLaTeX mode}. @item @file{imenu.el} by Ake Stenhoff and Lars Lindberg @cindex @file{imenu.el} -Imenu allows menu access to an index of items in a file. Org mode +Imenu allows menu access to an index of items in a file. Org-mode supports Imenu---all you need to do to get the index is the following: @lisp (add-hook 'org-mode-hook @@ -11242,13 +12980,12 @@ the option @code{org-imenu-depth}. @item @file{remember.el} by John Wiegley @cindex @file{remember.el} @cindex Wiegley, John -Org cooperates with remember, see @ref{Remember}. -As of Emacs 23, @file{Remember.el} is part of the Emacs distribution. +Org used to use this package for capture, but no longer does. @item @file{speedbar.el} by Eric M. Ludlam @cindex @file{speedbar.el} @cindex Ludlam, Eric M. Speedbar is a package that creates a special frame displaying files and -index items in files. Org mode supports Speedbar and allows you to +index items in files. Org-mode supports Speedbar and allows you to drill into Org files directly from the Speedbar. It also allows you to restrict the scope of agenda commands to a file or a subtree by using the command @kbd{<} in the Speedbar frame. @@ -11284,13 +13021,13 @@ possible. @item @file{footnote.el} by Steven L. Baur @cindex @file{footnote.el} @cindex Baur, Steven L. -Org mode recognizes numerical footnotes as provided by this package. -However, Org mode also has its own footnote support (@pxref{Footnotes}), +Org-mode recognizes numerical footnotes as provided by this package. +However, Org-mode also has its own footnote support (@pxref{Footnotes}), which makes using @file{footnote.el} unnecessary. @end table @node Conflicts, , Cooperation, Interaction -@subsection Packages that lead to conflicts with Org mode +@subsection Packages that lead to conflicts with Org-mode @table @asis @@ -11302,7 +13039,7 @@ This conflicts with the use of @kbd{S-@key{cursor}} commands in Org to change timestamps, TODO keywords, priorities, and item bullet types if the cursor is at such a location. By default, @kbd{S-@key{cursor}} commands outside special contexts don't do anything, but you can customize the variable -@code{org-support-shift-select}. Org mode then tries to accommodate shift +@code{org-support-shift-select}. Org-mode then tries to accommodate shift selection by (i) using it outside of the special contexts where special commands apply, and by (ii) extending an existing active region even if the cursor moves across a special context. @@ -11317,7 +13054,7 @@ region. In fact, Emacs 23 has this built-in in the form of @code{shift-selection-mode}, see previous paragraph. If you are using Emacs 23, you probably don't want to use another package for this purpose. However, if you prefer to leave these keys to a different package while working in -Org mode, configure the variable @code{org-replace-disputed-keys}. When set, +Org-mode, configure the variable @code{org-replace-disputed-keys}. When set, Org will move the following key bindings in Org files, and in the agenda buffer (but not during date selection). @@ -11348,7 +13085,18 @@ fixed this problem: @item @file{windmove.el} by Hovav Shacham @cindex @file{windmove.el} This package also uses the @kbd{S-} keys, so everything written -in the paragraph above about CUA mode also applies here. +in the paragraph above about CUA mode also applies here. If you want make +the windmove function active in locations where Org-mode does not have +special functionality on @kbd{S-@key{cursor}}, add this to your +configuration: + +@lisp +;; Make windmove work in org-mode: +(add-hook 'org-shiftup-final-hook 'windmove-up) +(add-hook 'org-shiftleft-final-hook 'windmove-left) +(add-hook 'org-shiftdown-final-hook 'windmove-down) +(add-hook 'org-shiftright-final-hook 'windmove-right) +@end lisp @item @file{viper.el} by Michael Kifer @cindex @file{viper.el} @@ -11373,16 +13121,16 @@ This appendix covers some aspects where users can extend the functionality of Org. @menu -* Hooks:: Who to reach into Org's internals -* Add-on packages:: Available extensions -* Adding hyperlink types:: New custom link types -* Context-sensitive commands:: How to add functionality to such commands -* Tables in arbitrary syntax:: Orgtbl for La@TeX{} and other programs -* Dynamic blocks:: Automatically filled blocks -* Special agenda views:: Customized views +* Hooks:: Who to reach into Org's internals +* Add-on packages:: Available extensions +* Adding hyperlink types:: New custom link types +* Context-sensitive commands:: How to add functionality to such commands +* Tables in arbitrary syntax:: Orgtbl for La@TeX{} and other programs +* Dynamic blocks:: Automatically filled blocks +* Special agenda views:: Customized views * Extracting agenda information:: Postprocessing of agenda information -* Using the property API:: Writing programs that use entry properties -* Using the mapping API:: Mapping over all or selected entries +* Using the property API:: Writing programs that use entry properties +* Using the mapping API:: Mapping over all or selected entries @end menu @node Hooks, Add-on packages, Hacking, Hacking @@ -11401,7 +13149,7 @@ maintained by the Worg project and can be found at A large number of add-on packages have been written by various authors. These packages are not part of Emacs, but they are distributed as contributed -packages with the separate release available at the Org mode home page at +packages with the separate release available at the Org-mode home page at @uref{http://orgmode.org}. The list of contributed packages, along with documentation about each package, is maintained by the Worg project at @uref{http://orgmode.org/worg/org-contrib/}. @@ -11560,7 +13308,6 @@ hard to do in a general way, would lead to a customization nightmare, and would take away much of the simplicity of the Orgtbl-mode table editor. - This appendix describes a different approach. We keep the Orgtbl mode table in its native format (the @i{source table}), and use a custom function to @i{translate} the table to the correct syntax, and to @@ -11568,17 +13315,17 @@ function to @i{translate} the table to the correct syntax, and to the burden of writing conversion functions on the user, but it allows for a very flexible system. -Bastien added the ability to do the same with lists. You can use Org's -facilities to edit and structure lists by turning @code{orgstruct-mode} -on, then locally exporting such lists in another format (HTML, La@TeX{} -or Texinfo.) +Bastien added the ability to do the same with lists, in Orgstruct mode. You +can use Org's facilities to edit and structure lists by turning +@code{orgstruct-mode} on, then locally exporting such lists in another format +(HTML, La@TeX{} or Texinfo.) @menu -* Radio tables:: Sending and receiving radio tables -* A LaTeX example:: Step by step, almost a tutorial -* Translator functions:: Copy and modify -* Radio lists:: Doing the same for lists +* Radio tables:: Sending and receiving radio tables +* A LaTeX example:: Step by step, almost a tutorial +* Translator functions:: Copy and modify +* Radio lists:: Doing the same for lists @end menu @node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax @@ -11832,7 +13579,7 @@ containing the formatted table. If you write a generally useful translator, please post it on @email{emacs-orgmode@@gnu.org} so that others can benefit from your work. -@node Radio lists, , Translator functions, Tables in arbitrary syntax +@node Radio lists, , Translator functions, Tables in arbitrary syntax @subsection Radio lists @cindex radio lists @cindex org-list-insert-radio-list @@ -11846,7 +13593,9 @@ Here are the differences with radio tables: @itemize @minus @item -Use @code{ORGLST} instead of @code{ORGTBL}. +Orgstruct mode must be active. +@item +Use the @code{ORGLST} keyword instead of @code{ORGTBL}. @item The available translation functions for radio lists don't take parameters. @@ -11857,12 +13606,12 @@ parameters. Here is a La@TeX{} example. Let's say that you have this in your La@TeX{} file: -@cindex #+ORGLIST +@cindex #+ORGLST @example % BEGIN RECEIVE ORGLST to-buy % END RECEIVE ORGLST to-buy \begin@{comment@} -#+ORGLIST: SEND to-buy orgtbl-to-latex +#+ORGLST: SEND to-buy org-list-to-latex - a new house - a new computer + a new keyboard @@ -12328,11 +14077,13 @@ The following example counts the number of entries with TODO keyword @cindex iPhone @cindex MobileOrg -@i{MobileOrg} is an application for the @i{iPhone/iPod Touch} series of -devices, developed by Richard Moreland. @i{MobileOrg} offers offline viewing -and capture support for an Org-mode system rooted on a ``real'' computer. It -does also allow you to record changes to existing entries. For information -about @i{MobileOrg}, see @uref{http://mobileorg.ncogni.to/}). +@uref{http://mobileorg.ncogni.to/, MobileOrg} is an application for the +@i{iPhone/iPod Touch} series of devices, developed by Richard Moreland. +@i{MobileOrg} offers offline viewing and capture support for an Org-mode +system rooted on a ``real'' computer. It does also allow you to record +changes to existing entries. Android users should check out +@uref{http://wiki.github.com/matburt/mobileorg-android/, MobileOrg Android} +by Matt Jones. This appendix describes the support Org has for creating agenda views in a format that can be displayed by @i{MobileOrg}, and for integrating notes @@ -12340,52 +14091,42 @@ captured and changes made by @i{MobileOrg} into the main system. For changing tags and TODO states in MobileOrg, you should have set up the customization variables @code{org-todo-keywords} and @code{org-tags-alist} to -cover all important tags and todo keywords, even if individual files use only +cover all important tags and TODO keywords, even if individual files use only part of these. MobileOrg will also offer you states and tags set up with -in-buffer settings, but it will understand the logistics of todo state +in-buffer settings, but it will understand the logistics of TODO state @i{sets} (@pxref{Per-file keywords}) and @i{mutually exclusive} tags (@pxref{Setting tags}) only for those set in these variables. @menu -* Setting up the staging area:: Where to interact with the mobile device -* Pushing to MobileOrg:: Uploading Org files and agendas -* Pulling from MobileOrg:: Integrating captured and flagged items +* Setting up the staging area:: Where to interact with the mobile device +* Pushing to MobileOrg:: Uploading Org files and agendas +* Pulling from MobileOrg:: Integrating captured and flagged items @end menu @node Setting up the staging area, Pushing to MobileOrg, MobileOrg, MobileOrg @section Setting up the staging area -Org-mode has commands to prepare a directory with files for @i{MobileOrg}, -and to read captured notes from there. If Emacs can directly write to the -WebDAV directory@footnote{If you are using a public server, you might prefer -to encrypt the files on the server. This can be done with Org-mode 6.35 and -MobileOrg 1.2. On the Emacs side, configure the variables -@code{org-mobile-use-encryption} and @code{org-mobile-encryption-password}.} -accessed by @i{MobileOrg}, just point to this directory using the variable -@code{org-mobile-directory}. Using the @file{tramp} method, -@code{org-mobile-directory} may point to a remote directory accessible -through, for example, @file{ssh/scp}: +MobileOrg needs to interact with Emacs through directory on a +server@footnote{If you are using a public server, you might prefer to encrypt +the files on the server. This can be done with Org-mode 6.35 and, hopefully, +with MobileOrg 1.4 (please check before trying to use this). On the Emacs +side, configure the variables @code{org-mobile-use-encryption} and +@code{org-mobile-encryption-password}.}. The easiest way to create that +directory is to use a free @uref{http://dropbox.com,Dropbox.com} +account@footnote{If you cannot use Dropbox, or if your version of MobileOrg +does not support it, you can use a webdav server. For more information, +check out the the documentation of MobileOrg and also this +@uref{http://orgmode.org/worg/org-faq.php#mobileorg_webdav, FAQ entry}.}. +When MobileOrg first connects to your Dropbox, it will create a directory +@i{MobileOrg} inside the Dropbox. After the directory has been created, tell +Emacs about it: -@smallexample -(setq org-mobile-directory "/scpc:user@@remote.host:org/webdav/") -@end smallexample +@lisp +(setq org-mobile-directory "~/Dropbox/MobileOrg") +@end lisp -If Emacs cannot access the WebDAV directory directly using a @file{tramp} -method, or you prefer to maintain a local copy, you can use a local directory -for staging. Other means must then be used to keep this directory in sync -with the WebDAV directory. In the following example, files are staged in -@file{~/stage}, and Org-mode hooks take care of moving files to and from the -WebDAV directory using @file{scp}. - -@smallexample -(setq org-mobile-directory "~/stage/") -(add-hook 'org-mobile-post-push-hook - (lambda () (shell-command "scp -r ~/stage/* user@@wdhost:mobile/"))) -(add-hook 'org-mobile-pre-pull-hook - (lambda () (shell-command "scp user@@wdhost:mobile/mobileorg.org ~/stage/ "))) -(add-hook 'org-mobile-post-pull-hook - (lambda () (shell-command "scp ~/stage/mobileorg.org user@@wdhost:mobile/"))) -@end smallexample +Org-mode has commands to put files for @i{MobileOrg} into that directory, +and to read captured notes from there. @node Pushing to MobileOrg, Pulling from MobileOrg, Setting up the staging area, MobileOrg @section Pushing to MobileOrg @@ -12395,28 +14136,26 @@ to the directory @code{org-mobile-directory}. By default this list contains all agenda files (as listed in @code{org-agenda-files}), but additional files can be included by customizing @code{org-mobiles-files}. File names will be staged with path relative to @code{org-directory}, so all files should be -inside this directory. The push operation also creates (in the same -directory) a special Org file @file{agendas.org}. This file is an Org-mode -style outline, containing every custom agenda view defined by the user. -While creating the agendas, Org-mode will force@footnote{See the variable -@code{org-mobile-force-id-on-agenda-items}.} an ID property on all entries -referenced by the agendas, so that these entries can be uniquely identified -if @i{MobileOrg} flags them for further action. Finally, Org writes the file -@file{index.org}, containing links to all other files. If @i{MobileOrg} is -configured to request this file from the WebDAV server, all agendas and Org -files will be downloaded to the device. To speed up the download, MobileOrg -will only read files whose checksums@footnote{stored automatically in the -file @file{checksums.dat}} have changed. +inside this directory. The push operation also creates a special Org file +@file{agendas.org} with all custom agenda view defined by the +user@footnote{While creating the agendas, Org-mode will force (see the +variable @code{org-mobile-force-id-on-agenda-items}) ID properties on all +referenced entries, so that these entries can be uniquely +identified if @i{MobileOrg} flags them for further action.}. Finally, Org +writes the file @file{index.org}, containing links to all other files. +@i{MobileOrg} first reads this file from the server, and then downloads all +agendas and Org files listed in it. To speed up the download, MobileOrg will +only read files whose checksums@footnote{stored automatically in the file +@file{checksums.dat}} have changed. @node Pulling from MobileOrg, , Pushing to MobileOrg, MobileOrg @section Pulling from MobileOrg -When @i{MobileOrg} synchronizes with the WebDAV server, it not only pulls the -Org files for viewing. It also appends captured entries and pointers to -flagged and changed entries to the file @file{mobileorg.org} on the server. -Org has a @emph{pull} operation that integrates this information into an -inbox file and operates on the pointers to flagged entries. Here is how it -works: +When @i{MobileOrg} synchronizes with the server, it not only pulls the Org +files for viewing. It also appends captured entries and pointers to flagged +and changed entries to the file @file{mobileorg.org} on the server. Org has +a @emph{pull} operation that integrates this information into an inbox file +and operates on the pointers to flagged entries. Here is how it works: @enumerate @item @@ -12457,38 +14196,32 @@ this flagged entry is finished. If you are not able to process all flagged entries directly, you can always return to this agenda view using @kbd{C-c a ?}. Note, however, that there is a subtle difference. The view created automatically by @kbd{M-x -org-mobile-pull RET} is guaranteed to search all files that have been +org-mobile-pull @key{RET}} is guaranteed to search all files that have been addressed by the last pull. This might include a file that is not currently in your list of agenda files. If you later use @kbd{C-c a ?} to regenerate the view, only the current agenda files will be searched. @node History and Acknowledgments, Main Index, MobileOrg, Top -@appendix History and Acknowledgments -@cindex acknowledgements +@appendix History and acknowledgments +@cindex acknowledgments @cindex history @cindex thanks -Org was born in 2003, out of frustration over the user interface -of the Emacs Outline mode. I was trying to organize my notes and -projects, and using Emacs seemed to be the natural way to go. However, -having to remember eleven different commands with two or three keys per -command, only to hide and show parts of the outline tree, that seemed -entirely unacceptable to me. Also, when using outlines to take notes, I -constantly wanted to restructure the tree, organizing it parallel to my -thoughts and plans. @emph{Visibility cycling} and @emph{structure -editing} were originally implemented in the package -@file{outline-magic.el}, but quickly moved to the more general -@file{org.el}. As this environment became comfortable for project -planning, the next step was adding @emph{TODO entries}, basic -@emph{timestamps}, and @emph{table support}. These areas highlighted the two main -goals that Org still has today: to be a new, outline-based, -plain text mode with innovative and intuitive editing features, and to -incorporate project planning functionality directly into a notes file. - -A special thanks goes to @i{Bastien Guerry} who has not only written a large -number of extensions to Org (most of them integrated into the core by now), -but who has also helped in the development and maintenance of Org so much that he -should be considered the main co-contributor to this package. +Org was born in 2003, out of frustration over the user interface of the Emacs +Outline mode. I was trying to organize my notes and projects, and using +Emacs seemed to be the natural way to go. However, having to remember eleven +different commands with two or three keys per command, only to hide and show +parts of the outline tree, that seemed entirely unacceptable to me. Also, +when using outlines to take notes, I constantly wanted to restructure the +tree, organizing it parallel to my thoughts and plans. @emph{Visibility +cycling} and @emph{structure editing} were originally implemented in the +package @file{outline-magic.el}, but quickly moved to the more general +@file{org.el}. As this environment became comfortable for project planning, +the next step was adding @emph{TODO entries}, basic @emph{timestamps}, and +@emph{table support}. These areas highlighted the two main goals that Org +still has today: to be a new, outline-based, plain text mode with innovative +and intuitive editing features, and to incorporate project planning +functionality directly into a notes file. Since the first release, literally thousands of emails to me or to @email{emacs-orgmode@@gnu.org} have provided a constant stream of bug @@ -12499,6 +14232,38 @@ in shaping one or more aspects of Org. The list may not be complete, if I have forgotten someone, please accept my apologies and let me know. +Before I get to this list, a few special mentions are in order: + +@table @i +@item Bastien Guerry +Bastien has written a large number of extensions to Org (most of them +integrated into the core by now), including the LaTeX exporter and the plain +list parser. His support during the early days, when he basically acted as +co-maintainer, was central to the success of this project. Bastien also +invented Worg, helped establishing the Web presence of Org, and sponsors +hosting costs for the orgmode.org website. +@item Eric Schulte and Dan Davison +Eric and Dan are jointly responsible for the Org-babel system, which turns +Org into a multi-language environment for evaluating code and doing literate +programming and reproducible research. +@item John Wiegley +John has also contributed a number of great ideas and patches +directly to Org, including the attachment system (@file{org-attach.el}), +integration with Apple Mail (@file{org-mac-message.el}), hierarchical +dependencies of TODO items, habit tracking (@file{org-habits.el}), and +encryption (@file{org-crypt.el}). Also, the capture system is really an +extended copy of his great @file{remember.el}. +@item Sebastian Rose +Without Sebastian, the HTML/XHTML publishing of Org would be the pitiful work +of an ignorant amateur. Sebastian has pushed this part of Org onto a much +higher level. He also wrote @file{org-info.js}, a Java script for displaying +webpages derived from Org using an Info-like or a folding interface with +single-key navigation. +@end table + +@noindent OK, now to the full list of contributions! Again, please let me +know what I am missing here! + @itemize @bullet @item @@ -12518,7 +14283,7 @@ Org-mode website. @i{Tom Breton} wrote @file{org-choose.el}. @item @i{Charles Cave}'s suggestion sparked the implementation of templates -for Remember. +for Remember, which are now templates for capture. @item @i{Pavel Chalmoviansky} influenced the agenda treatment of items with specified time. @@ -12531,8 +14296,6 @@ calculations and improved XEmacs compatibility, in particular by porting @item @i{Baoqiu Cui} contributed the DocBook exporter. @item -@i{Dan Davison} wrote (together with @i{Eric Schulte}) Org Babel. -@item @i{Eddward DeVilla} proposed and tested checkbox statistics. He also came up with the idea of properties, and that there should be an API for them. @@ -12543,6 +14306,9 @@ them. inspired some of the early development, including HTML export. He also asked for a way to narrow wide table columns. @item +@i{Thomas S. Dye} contributed documentation on Worg and helped integrating +the Org-Babel documentation into the manual. +@item @i{Christian Egli} converted the documentation into Texinfo format, patched CSS formatting into the HTML exporter, and inspired the agenda. @item @@ -12564,9 +14330,6 @@ around a match in a hidden outline tree. @item @i{Niels Giesen} had the idea to automatically archive DONE trees. @item -@i{Bastien Guerry} wrote the La@TeX{} exporter and @file{org-bibtex.el}, and -has been prolific with patches, ideas, and bug reports. -@item @i{Kai Grossjohann} pointed out key-binding conflicts with other packages. @item @i{Bernt Hansen} has driven much of the support for auto-repeating tasks, @@ -12581,6 +14344,8 @@ patches. @i{Scott Jaderholm} proposed footnotes, control over whitespace between folded entries, and column view for properties. @item +@i{Matt Jones} wrote @i{MobileOrg Android}. +@item @i{Tokuya Kameshima} wrote @file{org-wl.el} and @file{org-mew.el}. @item @i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it. He also @@ -12589,6 +14354,10 @@ provided frequent feedback and some patches. @i{Matt Lundin} has proposed last-row references for table formulas and named invisible anchors. He has also worked a lot on the FAQ. @item +@i{David Maus} wrote @file{org-atom.el}, maintains the issues file for Org, +and is a prolific contributor on the mailing list with competent replies, +small fixes and patches. +@item @i{Jason F. McBrayer} suggested agenda export to CSV format. @item @i{Max Mikhanosha} came up with the idea of refiling. @@ -12611,6 +14380,9 @@ and being able to quickly restrict the agenda to a subtree. @i{Tim O'Callaghan} suggested in-file links, search options for general file links, and TAGS. @item +@i{Osamu Okano} wrote @file{orgcard2ref.pl}, a perl program to create a text +version of the reference card. +@item @i{Takeshi Okano} translated the manual and David O'Toole's tutorial into Japanese. @item @@ -12635,10 +14407,6 @@ also acted as mailing list moderator for some time. @item @i{Kevin Rogers} contributed code to access VM files on remote hosts. @item -@i{Sebastian Rose} wrote @file{org-info.js}, a Java script for displaying -webpages derived from Org using an Info-like or a folding interface with -single-key navigation. -@item @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a conflict with @file{allout.el}. @item @@ -12651,9 +14419,6 @@ of feedback, developed and applied standards to the Org documentation. @i{Christian Schlauer} proposed angular brackets around links, among other things. @item -@i{Eric Schulte} wrote @file{org-plot.el} and (together with @i{Dan Davison}) -Org Babel, and contributed various patches, small features and modules. -@item @i{Paul Sexton} wrote @file{org-ctags.el}. @item Linking to VM/BBDB/Gnus was first inspired by @i{Tom Shannon}'s @@ -12676,12 +14441,19 @@ tweaks and features. @i{Adam Spiers} asked for global linking commands, inspired the link extension system, added support for mairix, and proposed the mapping API. @item +@i{Ulf Stegemann} created the table to translate special symbols to HTML, +LaTeX, UTF-8, Latin-1 and ASCII. +@item @i{Andy Stewart} contributed code to @file{org-w3m.el}, to copy HTML content with links transformation to Org syntax. @item @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual chapter about publishing. @item +@i{Stefan Vollmar} organized a video-recorded talk at the +Max-Planck-Institute for Neurology. He also inspired the creation of a +concept index for HTML export. +@item @i{J@"urgen Vollmer} contributed code generating the table of contents in HTML output. @item @@ -12693,16 +14465,6 @@ keyword. @i{David Wainberg} suggested archiving, and improvements to the linking system. @item -@i{John Wiegley} wrote @file{emacs-wiki.el}, @file{planner.el}, and -@file{muse.el}, which have some overlap with Org. Initially the development -of Org was fully independent because I was not aware of the existence of -these packages. But with time I have occasionally looked at John's code and -learned a lot from it. John has also contributed a number of great ideas and -patches directly to Org, including the attachment system -(@file{org-attach.el}), integration with Apple Mail -(@file{org-mac-message.el}), hierarchical dependencies of TODO items, habit -tracking (@file{org-habits.el}). -@item @i{Carsten Wimmer} suggested some changes and helped fix a bug in linking to Gnus. @item @@ -12715,17 +14477,17 @@ and contributed various ideas and code snippets. @node Main Index, Key Index, History and Acknowledgments, Top -@unnumbered Concept Index +@unnumbered Concept index @printindex cp @node Key Index, Variable Index, Main Index, Top -@unnumbered Key Index +@unnumbered Key index @printindex ky @node Variable Index, , Key Index, Top -@unnumbered Variable Index +@unnumbered Variable index This is not a complete index of variables and faces, only the ones that are mentioned in the manual. For a more complete list, use @kbd{M-x @@ -12740,8 +14502,6 @@ org-customize @key{RET}} and then click yourself through the tree. @end ignore @c Local variables: -@c ispell-local-dictionary: "en_US-w_accents" -@c ispell-local-pdict: "./.aspell.org.pws" @c fill-column: 77 @c End: diff --git a/doc/misc/pcl-cvs.texi b/doc/misc/pcl-cvs.texi index 625d83a0e2c..e4adf47ddb2 100644 --- a/doc/misc/pcl-cvs.texi +++ b/doc/misc/pcl-cvs.texi @@ -26,7 +26,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* PCL-CVS: (pcl-cvs). Emacs front-end to CVS. +* PCL-CVS: (pcl-cvs). Emacs front-end to CVS. @end direntry @c The titlepage section does not appear in the Info file. diff --git a/doc/misc/pgg.texi b/doc/misc/pgg.texi index d2fd8fc097d..640dfd8f749 100644 --- a/doc/misc/pgg.texi +++ b/doc/misc/pgg.texi @@ -8,8 +8,8 @@ This file describes PGG @value{VERSION}, an Emacs interface to various PGP implementations. -Copyright @copyright{} 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -Free Software Foundation, Inc. +Copyright @copyright{} 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, +2010 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -27,7 +27,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* PGG: (pgg). Emacs interface to various PGP implementations. +* PGG: (pgg). Emacs interface to various PGP implementations. @end direntry @titlepage @@ -133,7 +133,7 @@ list autoload setting for desired functions as follows. * User Commands:: * Selecting an implementation:: * Caching passphrase:: -* Default user identity:: +* Default user identity:: @end menu @node User Commands @@ -376,7 +376,7 @@ variable @code{pgg-scheme-gpg-instance} and will be reused from now on. (defun pgg-make-scheme-gpg () (or pgg-scheme-gpg-instance (setq pgg-scheme-gpg-instance - (luna-make-entity 'pgg-scheme-gpg)))) + (luna-make-entity 'pgg-scheme-gpg)))) @end lisp The name of the function must follow the diff --git a/doc/misc/rcirc.texi b/doc/misc/rcirc.texi index 8d3f5e73966..c27cf4dc182 100644 --- a/doc/misc/rcirc.texi +++ b/doc/misc/rcirc.texi @@ -5,7 +5,8 @@ @c %**end of header @copying -Copyright @copyright{} 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright @copyright{} 2006, 2007, 2008, 2009, 2010 +Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -23,7 +24,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Rcirc: (rcirc). Internet Relay Chat (IRC) client. +* Rcirc: (rcirc). Internet Relay Chat (IRC) client. @end direntry @titlepage diff --git a/doc/misc/reftex.texi b/doc/misc/reftex.texi index f2d03afc924..9d06ceccd9e 100644 --- a/doc/misc/reftex.texi +++ b/doc/misc/reftex.texi @@ -46,7 +46,8 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* RefTeX: (reftex). Emacs support for LaTeX cross-references and citations. +* RefTeX: (reftex). Emacs support for LaTeX cross-references + and citations. @end direntry @finalout @@ -3281,7 +3282,7 @@ the style @file{multind.el} contains (TeX-add-style-hook "multind" (lambda () (and (fboundp 'reftex-add-index-macros) - (reftex-add-index-macros '(multind))))) + (reftex-add-index-macros '(multind))))) @end lisp If you have your own package @file{myindex} which defines the diff --git a/doc/misc/remember.texi b/doc/misc/remember.texi index f60d43031be..f9b75e1be00 100644 --- a/doc/misc/remember.texi +++ b/doc/misc/remember.texi @@ -27,7 +27,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Remember: (remember). Simple information manager for Emacs +* Remember: (remember). Simple information manager for Emacs. @end direntry @titlepage diff --git a/doc/misc/sasl.texi b/doc/misc/sasl.texi index ff3481b306a..8a8421b4870 100644 --- a/doc/misc/sasl.texi +++ b/doc/misc/sasl.texi @@ -32,7 +32,7 @@ license to the document, as described in section 6 of the license. @dircategory Emacs @direntry -* SASL: (sasl). The Emacs SASL library. +* SASL: (sasl). The Emacs SASL library. @end direntry @@ -148,7 +148,7 @@ of authentication functions. @example (defconst sasl-anonymous-steps - '(identity ;no initial response + '(identity ;no initial response sasl-anonymous-response)) (put 'sasl-anonymous 'sasl-mechanism @@ -232,7 +232,7 @@ authentication protocol exchange. For example, @example (process-send-string process - (if (sasl-step-data step) ;initial response + (if (sasl-step-data step) ;initial response (format "AUTH %s %s\r\n" name (base64-encode-string (sasl-step-data step) t)) (format "AUTH %s\r\n" name))) @end example diff --git a/doc/misc/sc.texi b/doc/misc/sc.texi index 55d0d733cf0..72a6bfc8989 100644 --- a/doc/misc/sc.texi +++ b/doc/misc/sc.texi @@ -7,7 +7,7 @@ @finalout @end iftex -@c @setchapternewpage odd % For book style double sided manual. +@c @setchapternewpage odd % For book style double sided manual. @comment %**end of header (This is for running Texinfo on a region.) @copying @@ -35,8 +35,8 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* SC: (sc). Supercite lets you cite parts of messages you're - replying to, in flexible ways. +* SC: (sc). Supercite lets you cite parts of messages + you're replying to, in flexible ways. @end direntry @titlepage @@ -1795,23 +1795,23 @@ interface was formally proposed by Martin Neitzel on Fri, 23 Jun 89, in a mail message to the Supercite mailing list: @example - Martin> Each news/mail-reader should provide a form of - Martin> mail-yank-original that + Martin> Each news/mail-reader should provide a form of + Martin> mail-yank-original that - Martin> 1: inserts the original message incl. header into the - Martin> reply buffer; no indentation/prefixing is done, the header - Martin> tends to be a "full blown" version rather than to be - Martin> stripped down. + Martin> 1: inserts the original message incl. header into the + Martin> reply buffer; no indentation/prefixing is done, the header + Martin> tends to be a "full blown" version rather than to be + Martin> stripped down. - Martin> 2: `point' is at the start of the header, `mark' at the - Martin> end of the message body. + Martin> 2: `point' is at the start of the header, `mark' at the + Martin> end of the message body. - Martin> 3: (run-hooks 'mail-yank-hooks) + Martin> 3: (run-hooks 'mail-yank-hooks) - Martin> [Supercite] should be run as such a hook and merely - Martin> rewrite the message. This way it isn't anymore - Martin> [Supercite]'s job to gather the original from obscure - Martin> sources. [@dots{}] + Martin> [Supercite] should be run as such a hook and merely + Martin> rewrite the message. This way it isn't anymore + Martin> [Supercite]'s job to gather the original from obscure + Martin> sources. [@dots{}] @end example @vindex mail-citation-hook diff --git a/doc/misc/sem-user.texi b/doc/misc/sem-user.texi index 5ad3b9c6e3d..c731c1843dd 100644 --- a/doc/misc/sem-user.texi +++ b/doc/misc/sem-user.texi @@ -1,7 +1,7 @@ @c This file is included by semantic.texi -@c Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010 -@c Free Software Foundation, Inc. +@c Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009, +@c 2010 Free Software Foundation, Inc. @c Permission is granted to copy, distribute and/or modify this @c document under the terms of the GNU Free Documentation License, @@ -328,8 +328,8 @@ for a given major mode, like this: @example (setq-mode-local c-mode - semanticdb-find-default-throttle - '(project unloaded system recursive)) + semanticdb-find-default-throttle + '(project unloaded system recursive)) @end example @defvar semanticdb-find-default-throttle diff --git a/doc/misc/semantic.texi b/doc/misc/semantic.texi index 08d82d35a43..65bd718dfff 100644 --- a/doc/misc/semantic.texi +++ b/doc/misc/semantic.texi @@ -43,7 +43,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Semantic: (semantic). Source code parser library and utilities. +* Semantic: (semantic). Source code parser library and utilities. @end direntry @titlepage @@ -224,8 +224,8 @@ grammar developers; it is useful mostly for the hackers who would like to learn more about how @semantic{} works. @menu -* Parser code :: Code used for the parsers -* Tag handling :: Code used for manipulating tags +* Parser code :: Code used for the parsers +* Tag handling :: Code used for manipulating tags * Semanticdb Internals :: Code used in the semantic database * Analyzer Internals :: Code used in the code analyzer * Tools :: Code used in user tools diff --git a/doc/misc/ses.texi b/doc/misc/ses.texi index af3970884c7..60d419083e2 100644 --- a/doc/misc/ses.texi +++ b/doc/misc/ses.texi @@ -11,8 +11,8 @@ @copying This file documents SES: the Simple Emacs Spreadsheet. -Copyright @copyright{} 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -Free Software Foundation, Inc. +Copyright @copyright{} 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, +2010 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -30,7 +30,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* SES: (ses). Simple Emacs Spreadsheet +* SES: (ses). Simple Emacs Spreadsheet. @end direntry @finalout diff --git a/doc/misc/sieve.texi b/doc/misc/sieve.texi index 8473f6cd359..9a1a0faf4c8 100644 --- a/doc/misc/sieve.texi +++ b/doc/misc/sieve.texi @@ -8,8 +8,8 @@ @copying This file documents the Emacs Sieve package, for server-side mail filtering. -Copyright @copyright{} 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -Free Software Foundation, Inc. +Copyright @copyright{} 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +2009, 2010 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -227,7 +227,7 @@ the @code{fileinto} command. require "fileinto"; if address "sender" "owner-w3-beta@@xemacs.org" @{ - fileinto "INBOX.w3-beta"; + fileinto "INBOX.w3-beta"; @} @end example @@ -238,7 +238,7 @@ required. @example if header :contains "Delivered-To" "auc-tex@@sunsite.dk" @{ - fileinto "INBOX.auc-tex"; + fileinto "INBOX.auc-tex"; @} @end example @@ -249,7 +249,7 @@ has been required. @example if address ["to", "cc"] "kerberos@@mit.edu" @{ - fileinto "INBOX.kerberos"; + fileinto "INBOX.kerberos"; @} @end example diff --git a/doc/misc/smtpmail.texi b/doc/misc/smtpmail.texi index fcb6ea65472..05bae38e7a8 100644 --- a/doc/misc/smtpmail.texi +++ b/doc/misc/smtpmail.texi @@ -22,7 +22,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* SMTP: (smtpmail). Emacs library for sending mail via SMTP. +* SMTP: (smtpmail). Emacs library for sending mail via SMTP. @end direntry @titlepage @@ -44,17 +44,17 @@ developing GNU and promoting software freedom.'' @end ifnottex @menu -* How Mail Works:: Brief introduction to mail concepts. +* How Mail Works:: Brief introduction to mail concepts. * Emacs Speaks SMTP:: How to use the SMTP library in Emacs. -* Authentication:: Authenticating yourself to the server. -* Queued delivery:: Sending mail without an internet connection. -* Server workarounds:: Mail servers with special requirements. -* Debugging:: Tracking down problems. +* Authentication:: Authenticating yourself to the server. +* Queued delivery:: Sending mail without an internet connection. +* Server workarounds:: Mail servers with special requirements. +* Debugging:: Tracking down problems. * GNU Free Documentation License:: The license for this documentation. Indices -* Index:: Index over variables and functions. +* Index:: Index over variables and functions. @end menu @node How Mail Works @@ -355,15 +355,15 @@ configurations of sendmail requires this behavior. Don't bother to set this unless you have get an error like: @example - Sending failed; SMTP protocol error + Sending failed; SMTP protocol error @end example when sending mail, and the debug buffer (@pxref{Debugging})) contains an error such as: @example - RCPT TO: @var{someone} - 501 @var{someone}: recipient address must contain a domain + RCPT TO: @var{someone} + 501 @var{someone}: recipient address must contain a domain @end example @end table diff --git a/doc/misc/speedbar.texi b/doc/misc/speedbar.texi index 8434e8aa28d..aaf9e938de7 100644 --- a/doc/misc/speedbar.texi +++ b/doc/misc/speedbar.texi @@ -23,7 +23,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Speedbar: (speedbar). File/Tag summarizing utility. +* Speedbar: (speedbar). File/Tag summarizing utility. @end direntry @titlepage @@ -1131,7 +1131,7 @@ beginning, like this: @example (add-to-list 'speedbar-dynamic-tags-function-list - '(my-fetch-dynamic-tags . my-insert-tag-list)) + '(my-fetch-dynamic-tags . my-insert-tag-list)) @end example If your parser is only good for a few types of files, make sure that it diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 7d41049897e..e2d777c5cc2 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -57,8 +57,8 @@ supports it in developing GNU and promoting software freedom.'' @c Entries for @command{install-info} to use @dircategory @value{emacsname} @direntry -* TRAMP: (tramp). Transparent Remote Access, Multiple Protocol - @value{emacsname} remote file access via rsh and rcp. +* TRAMP: (tramp). Transparent Remote Access, Multiple Protocol + @value{emacsname} remote file access via rsh and rcp. @end direntry @titlepage @@ -629,11 +629,11 @@ Two other variants, @option{ssh1_old} and @option{ssh2_old}, use the @command{ssh1} and @command{ssh2} commands explicitly. If you don't know what these are, you do not need these options. -All the methods based on @command{ssh} have an additional kludgy -feature: you can specify a host name which looks like @file{host#42} -(the real host name, then a hash sign, then a port number). This -means to connect to the given host but to also pass @code{-p 42} as -arguments to the @command{ssh} command. +All the methods based on @command{ssh} have an additional feature: you +can specify a host name which looks like @file{host#42} (the real host +name, then a hash sign, then a port number). This means to connect to +the given host but to also pass @code{-p 42} as arguments to the +@command{ssh} command. @item @option{telnet} @@ -693,8 +693,6 @@ This is also useful for Windows users where @command{ssh}, when invoked from an @value{emacsname} buffer, tells them that it is not allocating a pseudo tty. When this happens, the login shell is wont to not print any shell prompt, which confuses @value{tramp} mightily. -For reasons unknown, some Windows ports for @command{ssh} require the -doubled @samp{-t} option. This supports the @samp{-p} argument. @@ -2310,6 +2308,11 @@ using the @option{ssh} method to transfer files, and edit @file{.emacs} in my home directory I would specify the filename @file{@trampfn{ssh, daniel, melancholia, .emacs}}. +Finally, for some methods it is possible to specify a different port +number than the default one, given by the method. This is specified +by adding @file{#} to the host name, like in @file{@trampfn{ssh, +daniel, melancholia#42, .emacs}}. + @node Alternative Syntax @section URL-like filename syntax @@ -2798,7 +2801,7 @@ increase this level only temporarily, hunting bugs. @item @value{tramp} does not connect to the remote host -When @value{tramp} does not connect to the remote host, there are two +When @value{tramp} does not connect to the remote host, there are three reasons heading the bug mailing list: @itemize @minus @@ -2832,6 +2835,17 @@ the following command: [ $TERM = "dumb" ] && unsetopt zle && PS1='$ ' @end example +@item +Echoed characters after login + +When the remote machine opens an echoing shell, there might be control +characters in the welcome message. @value{tramp} tries to suppress +such echoes via the @code{stty -echo} command, but sometimes this +command is not reached, because the echoed output has confused +@value{tramp} already. In such situations it might be helpful to use +the @option{sshx} or @option{scpx} methods, which allocate a pseudo tty. +@xref{Inline methods}. + @item @value{tramp} doesn't transfer strings with more than 500 characters correctly diff --git a/doc/misc/url.texi b/doc/misc/url.texi index ea7f3211f52..a6bbf0bd3eb 100644 --- a/doc/misc/url.texi +++ b/doc/misc/url.texi @@ -15,7 +15,7 @@ @dircategory World Wide Web @dircategory Emacs @direntry -* URL: (url). URL loading package. +* URL: (url). URL loading package. @end direntry @copying diff --git a/doc/misc/vip.texi b/doc/misc/vip.texi index 26acf25cb8e..2a4d4191082 100644 --- a/doc/misc/vip.texi +++ b/doc/misc/vip.texi @@ -3,8 +3,8 @@ @settitle VIP @copying -Copyright @copyright{} 1987, 2001, 2002, 2003, 2004, -2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright @copyright{} 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, +2008, 2009, 2010 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -38,7 +38,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* VIP: (vip). An older VI-emulation for Emacs. +* VIP: (vip). An older VI-emulation for Emacs. @end direntry @ifnottex @@ -65,10 +65,10 @@ Comments and bug reports are welcome. Please send messages to @end ifnottex @menu -* Survey:: A survey of VIP. -* Vi Commands:: Details of Vi commands. -* Ex Commands:: Details of Ex commands. -* Customization:: How to customize VIP. +* Survey:: A survey of VIP. +* Vi Commands:: Details of Vi commands. +* Ex Commands:: Details of Ex commands. +* Customization:: How to customize VIP. * GNU Free Documentation License:: The license for this documentation. @end menu @@ -99,10 +99,10 @@ In this chapter we describe basics of VIP with emphasis on the features not found in Vi and on how to use VIP under GNU Emacs. @menu -* Basic Concepts:: Basic concepts in Emacs. -* Loading VIP:: How to load VIP automatically. -* Modes in VIP:: VIP has three modes, which are orthogonal to modes - in Emacs. +* Basic Concepts:: Basic concepts in Emacs. +* Loading VIP:: How to load VIP automatically. +* Modes in VIP:: VIP has three modes, which are orthogonal to modes + in Emacs. * Differences from Vi:: Differences of VIP from Vi is explained. @end menu @@ -253,10 +253,10 @@ emacs mode vi mode insert mode @end ifinfo @menu -* Emacs Mode:: This is the mode you should know better. -* Vi Mode:: Vi commands are executed in this mode. -* Insert Mode:: You can enter text, and also can do editing if you - know enough Emacs commands. +* Emacs Mode:: This is the mode you should know better. +* Vi Mode:: Vi commands are executed in this mode. +* Insert Mode:: You can enter text, and also can do editing if you + know enough Emacs commands. @end menu @node Emacs Mode, Vi Mode, Modes in VIP, Modes in VIP @@ -306,23 +306,23 @@ Thus typing @kbd{C-z x} in insert mode will have the same effect as typing The major differences from Vi are explained below. @menu -* Undoing:: You can undo more in VIP. -* Changing:: Commands for changing the text. -* Searching:: Search commands. -* z Command:: You can now use zH, zM and zL as well as z- etc. -* Counts:: Some Vi commands which do not accept a count now - accept one. -* Marking:: You can now mark the current point, beginning of - the buffer etc. -* Region Commands:: You can now give a region as an argument for delete - commands etc. -* New Commands:: Some new commands not available in Vi are added. -* New Bindings:: Bindings of some keys are changed for the - convenience of editing under Emacs. -* Window Commands:: Commands for moving among windows etc. -* Buffer Commands:: Commands for selecting buffers etc. -* File Commands:: Commands for visiting files etc. -* Misc Commands:: Other useful commands. +* Undoing:: You can undo more in VIP. +* Changing:: Commands for changing the text. +* Searching:: Search commands. +* z Command:: You can now use zH, zM and zL as well as z- etc. +* Counts:: Some Vi commands which do not accept a count now + accept one. +* Marking:: You can now mark the current point, beginning of + the buffer etc. +* Region Commands:: You can now give a region as an argument for delete + commands etc. +* New Commands:: Some new commands not available in Vi are added. +* New Bindings:: Bindings of some keys are changed for the + convenience of editing under Emacs. +* Window Commands:: Commands for moving among windows etc. +* Buffer Commands:: Commands for selecting buffers etc. +* File Commands:: Commands for visiting files etc. +* Misc Commands:: Other useful commands. @end menu @node Undoing, Changing, Differences from Vi, Differences from Vi @@ -693,17 +693,17 @@ VIP. Except for the last section which discusses insert mode, all the commands described in this chapter are to be used in vi mode. @menu -* Numeric Arguments:: Many commands accept numeric arguments -* Important Keys:: Some very important keys. -* Buffers and Windows:: Commands for handling buffers and windows. -* Files:: Commands for handling files. -* Viewing the Buffer:: How you can view the current buffer. -* Mark Commands:: Marking positions in a buffer. -* Motion Commands:: Commands for moving point. -* Searching and Replacing:: Commands for searching and replacing. -* Modifying Commands:: Commands for modifying the buffer. -* Other Vi Commands:: Miscellaneous Commands. -* Commands in Insert Mode:: Commands for entering insert mode. +* Numeric Arguments:: Many commands accept numeric arguments +* Important Keys:: Some very important keys. +* Buffers and Windows:: Commands for handling buffers and windows. +* Files:: Commands for handling files. +* Viewing the Buffer:: How you can view the current buffer. +* Mark Commands:: Marking positions in a buffer. +* Motion Commands:: Commands for moving point. +* Searching and Replacing:: Commands for searching and replacing. +* Modifying Commands:: Commands for modifying the buffer. +* Other Vi Commands:: Miscellaneous Commands. +* Commands in Insert Mode:: Commands for entering insert mode. @end menu @node Numeric Arguments, Important Keys, Vi Commands, Vi Commands @@ -1265,7 +1265,7 @@ vanilla, this command replaces every occurrence of @var{string} with @var{newstring}. If the mode is regular expression, @var{string} is treated as a regular expression and every string matching the regular expression is replaced with @var{newstring} (@code{vip-replace-string}). -@item Q @var{string} RET @var{newstring} +@item Q @var{string} RET @var{newstring} @kindex 121 @kbd{Q} (@code{vip-query-replace}) Same as @kbd{R} except that you will be asked form confirmation before each replacement @@ -1311,10 +1311,10 @@ the region}), and then the enlarged region will be affected by the modifying command. @menu -* Delete Commands:: Commands for deleting text. -* Yank Commands:: Commands for yanking text in Vi's sense. -* Put Back Commands:: Commands for putting back deleted/yanked text. -* Change Commands:: Commands for changing text. +* Delete Commands:: Commands for deleting text. +* Yank Commands:: Commands for yanking text in Vi's sense. +* Put Back Commands:: Commands for putting back deleted/yanked text. +* Change Commands:: Commands for changing text. * Repeating and Undoing Modifications:: @end menu @node Delete Commands, Yank Commands, Modifying Commands, Modifying Commands @@ -1713,7 +1713,7 @@ Several Ex commands can be entered in a line by separating them by a pipe character @samp{|}. @menu -* Ex Command Reference:: Explain all the Ex commands available in VIP. +* Ex Command Reference:: Explain all the Ex commands available in VIP. @end menu @node Ex Command Reference, Customization, Ex Commands, Ex Commands @section Ex Command Reference @@ -1869,8 +1869,8 @@ will also be loaded when VIP is loaded. This file is thus useful for customizing VIP. @menu -* Customizing Constants:: How to change values of constants. -* Customizing Key Bindings:: How to change key bindings. +* Customizing Constants:: How to change values of constants. +* Customizing Key Bindings:: How to change key bindings. @end menu @node Customizing Constants, Customizing Key Bindings, Customization, Customization diff --git a/doc/misc/viper.texi b/doc/misc/viper.texi index 497d1b373e1..2100e652950 100644 --- a/doc/misc/viper.texi +++ b/doc/misc/viper.texi @@ -26,9 +26,9 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* VIPER: (viper). The newest Emacs VI-emulation mode. - (also, A VI Plan for Emacs Rescue - or the VI PERil.) +* VIPER: (viper). The newest Emacs VI-emulation mode. + (also, A VI Plan for Emacs Rescue + or the VI PERil.) @end direntry @finalout @@ -3004,14 +3004,14 @@ reference created by @* @samp{maart@@cs.vu.nl} and others. It can be found on the Vi archives. This reference has been adapted for Viper.@refill @menu -* Groundwork:: Textual Conventions and Viper basics -* Text Handling:: Moving, Editing, Undoing. -* Display:: Scrolling. -* File and Buffer Handling:: Editing, Writing and Quitting. -* Mapping:: Mapping Keys, Keyboard Macros -* Shell Commands:: Accessing Shell Commands, Processing Text -* Options:: Ex options, the @kbd{:set} commands -* Emacs Related Commands:: Meta Keys, Windows +* Groundwork:: Textual Conventions and Viper basics +* Text Handling:: Moving, Editing, Undoing. +* Display:: Scrolling. +* File and Buffer Handling:: Editing, Writing and Quitting. +* Mapping:: Mapping Keys, Keyboard Macros +* Shell Commands:: Accessing Shell Commands, Processing Text +* Options:: Ex options, the @kbd{:set} commands +* Emacs Related Commands:: Meta Keys, Windows * Mouse-bound Commands:: Search and insertion of text @end menu @@ -3230,15 +3230,15 @@ inserts them automatically in front of the Ex command. @section Text Handling @menu -* Move Commands:: Moving, Searching -* Marking:: Textmarkers in Viper and the Emacs Mark. -* Appending Text:: Text insertion, Shifting, Putting -* Editing in Insert State:: Autoindent, Quoting etc. -* Deleting Text:: Deleting -* Changing Text:: Changing, Replacement, Joining -* Search and Replace:: Searches, Query Replace, Pattern Commands -* Yanking:: Yanking, Viewing Registers -* Undoing:: Multiple Undo, Backups +* Move Commands:: Moving, Searching +* Marking:: Textmarkers in Viper and the Emacs Mark. +* Appending Text:: Text insertion, Shifting, Putting +* Editing in Insert State:: Autoindent, Quoting etc. +* Deleting Text:: Deleting +* Changing Text:: Changing, Replacement, Joining +* Search and Replace:: Searches, Query Replace, Pattern Commands +* Yanking:: Yanking, Viewing Registers +* Undoing:: Multiple Undo, Backups @end menu @node Move Commands,Marking,,Text Handling diff --git a/doc/misc/widget.texi b/doc/misc/widget.texi index fc8f3b2ea58..2d95daf36d4 100644 --- a/doc/misc/widget.texi +++ b/doc/misc/widget.texi @@ -8,8 +8,8 @@ @c %**end of header @copying -Copyright @copyright{} 2000, 2001, 2002, 2003, 2004, 2005, -2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright @copyright{} 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, +2008, 2009, 2010 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -27,8 +27,8 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* Widget: (widget). The "widget" package used by the Emacs Customization - facility. +* Widget: (widget). The "widget" package used by the Emacs + Customization facility. @end direntry @contents @@ -338,71 +338,71 @@ Interface}). (remove-overlays) (widget-insert "Here is some documentation.\n\n") (widget-create 'editable-field - :size 13 - :format "Name: %v " ; Text after the field! - "My Name") + :size 13 + :format "Name: %v " ; Text after the field! + "My Name") (widget-create 'menu-choice - :tag "Choose" - :value "This" - :help-echo "Choose me, please!" - :notify (lambda (widget &rest ignore) - (message "%s is a good choice!" - (widget-value widget))) - '(item :tag "This option" :value "This") - '(choice-item "That option") - '(editable-field :menu-tag "No option" "Thus option")) + :tag "Choose" + :value "This" + :help-echo "Choose me, please!" + :notify (lambda (widget &rest ignore) + (message "%s is a good choice!" + (widget-value widget))) + '(item :tag "This option" :value "This") + '(choice-item "That option") + '(editable-field :menu-tag "No option" "Thus option")) (widget-create 'editable-field - :format "Address: %v" - "Some Place\nIn some City\nSome country.") + :format "Address: %v" + "Some Place\nIn some City\nSome country.") (widget-insert "\nSee also ") (widget-create 'link - :notify (lambda (&rest ignore) - (widget-value-set widget-example-repeat - '("En" "To" "Tre")) - (widget-setup)) - "other work") + :notify (lambda (&rest ignore) + (widget-value-set widget-example-repeat + '("En" "To" "Tre")) + (widget-setup)) + "other work") (widget-insert " for more information.\n\nNumbers: count to three below\n") (setq widget-example-repeat - (widget-create 'editable-list - :entry-format "%i %d %v" - :notify (lambda (widget &rest ignore) - (let ((old (widget-get widget - ':example-length)) - (new (length (widget-value widget)))) - (unless (eq old new) - (widget-put widget ':example-length new) - (message "You can count to %d." new)))) - :value '("One" "Eh, two?" "Five!") - '(editable-field :value "three"))) + (widget-create 'editable-list + :entry-format "%i %d %v" + :notify (lambda (widget &rest ignore) + (let ((old (widget-get widget + ':example-length)) + (new (length (widget-value widget)))) + (unless (eq old new) + (widget-put widget ':example-length new) + (message "You can count to %d." new)))) + :value '("One" "Eh, two?" "Five!") + '(editable-field :value "three"))) (widget-insert "\n\nSelect multiple:\n\n") (widget-create 'checkbox t) (widget-insert " This\n") (widget-create 'checkbox nil) (widget-insert " That\n") (widget-create 'checkbox - :notify (lambda (&rest ignore) (message "Tickle")) - t) + :notify (lambda (&rest ignore) (message "Tickle")) + t) (widget-insert " Thus\n\nSelect one:\n\n") (widget-create 'radio-button-choice - :value "One" - :notify (lambda (widget &rest ignore) - (message "You selected %s" - (widget-value widget))) - '(item "One") '(item "Another One.") '(item "A Final One.")) + :value "One" + :notify (lambda (widget &rest ignore) + (message "You selected %s" + (widget-value widget))) + '(item "One") '(item "Another One.") '(item "A Final One.")) (widget-insert "\n") (widget-create 'push-button - :notify (lambda (&rest ignore) - (if (= (length (widget-value widget-example-repeat)) - 3) - (message "Congratulation!") - (error "Three was the count!"))) - "Apply Form") + :notify (lambda (&rest ignore) + (if (= (length (widget-value widget-example-repeat)) + 3) + (message "Congratulation!") + (error "Three was the count!"))) + "Apply Form") (widget-insert " ") (widget-create 'push-button - :notify (lambda (&rest ignore) - (widget-example)) - "Reset Form") + :notify (lambda (&rest ignore) + (widget-example)) + "Reset Form") (widget-insert "\n") (use-local-map widget-keymap) (widget-setup)) diff --git a/doc/misc/woman.texi b/doc/misc/woman.texi index c2de5d88b58..ba772c4b4a1 100644 --- a/doc/misc/woman.texi +++ b/doc/misc/woman.texi @@ -4,7 +4,7 @@ @settitle WoMan: Browse Unix Manual Pages ``W.O. (without) Man'' @c FIXME @c Manual last updated: -@set UPDATED Time-stamp: +@set UPDATED Time-stamp: @c Software version: @set VERSION 0.54 (beta) @afourpaper @@ -37,7 +37,7 @@ developing GNU and promoting software freedom.'' @dircategory Emacs @direntry -* WoMan: (woman). Browse UN*X Manual Pages "W.O. (without) Man". +* WoMan: (woman). Browse UN*X Manual Pages "W.O. (without) Man". @end direntry @finalout diff --git a/etc/ChangeLog b/etc/ChangeLog index 3e8adcb1b27..ee1915245a0 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,21 @@ +2010-07-20 Juanma Barranquero + + * PROBLEMS: Add note about use of backslashes in Windows paths. + +2010-07-19 Juanma Barranquero + + * NEWS: Mention --enable-checking is now supported on Windows. + +2010-07-19 Carsten Dominik + + * refcards/orgcard.tex: Remove the key for the TODO sparse tree + and add the new key. Document new keys for image and entity + display. Document the Org Babel keys. + +2010-06-19 Ken Brown + + * PROBLEMS: Update Cygwin GCC information. (Bug#6458) + 2010-06-12 Glenn Morris * tutorials/TUTORIAL.bg, tutorials/TUTORIAL.es: Fix typos. diff --git a/etc/DEBUG b/etc/DEBUG index b4272929bae..6fd5b412f4c 100644 --- a/etc/DEBUG +++ b/etc/DEBUG @@ -5,9 +5,8 @@ Copyright (C) 1985, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, See the end of the file for license conditions. -[People who debug Emacs on Windows using Microsoft debuggers -should read the Windows-specific section near the end of this -document.] +[People who debug Emacs on Windows using Microsoft debuggers should +read the Windows-specific section near the end of this document.] ** When you debug Emacs with GDB, you should start it in the directory where the executable was made. That directory has a .gdbinit file @@ -50,8 +49,7 @@ On modern POSIX systems, you can override that with this command: handle SIGINT stop nopass After this `handle' command, SIGINT will return control to GDB. If -you want the C-g to cause a QUIT within Emacs as well, omit the -`nopass'. +you want the C-g to cause a QUIT within Emacs as well, omit the `nopass'. A technique that can work when `handle SIGINT' does not is to store the code for some character into the variable stop_character. Thus, @@ -443,10 +441,9 @@ It is necessary to refer to the file `nmout' to convert numeric addresses into symbols and vice versa. It is useful to be running under a window system. -Then, if Emacs becomes hopelessly wedged, you can create -another window to do kill -9 in. kill -ILL is often -useful too, since that may make Emacs dump core or return -to adb. +Then, if Emacs becomes hopelessly wedged, you can create another +window to do kill -9 in. kill -ILL is often useful too, since that +may make Emacs dump core or return to adb. ** Debugging incorrect screen updating. @@ -483,16 +480,14 @@ suitable for Unix and GNU systems, to build such a debugging version: Building Emacs like that activates many assertions which scrutinize display code operation more than Emacs does normally. (To see the code which tests these assertions, look for calls to the `xassert' -macros.) Any assertion that is reported to fail should be -investigated. +macros.) Any assertion that is reported to fail should be investigated. Building with GLYPH_DEBUG defined also defines several helper functions which can help debugging display code. One such function is `dump_glyph_matrix'. If you run Emacs under GDB, you can print the contents of any glyph matrix by just calling that function with the matrix as its argument. For example, the following command will print -the contents of the current matrix of the window whose pointer is in -`w': +the contents of the current matrix of the window whose pointer is in `w': (gdb) p dump_glyph_matrix (w->current_matrix, 2) @@ -621,13 +616,9 @@ Emacs compiled with such packages might not run without some hacking, because Emacs replaces the system's memory allocation functions with its own versions, and because the dumping process might be incompatible with the way these packages use to track allocated -memory. Here are some of the changes you might find necessary -(SYSTEM-NAME and MACHINE-NAME are the names of your OS- and -CPU-specific headers in the subdirectories of `src'): +memory. Here are some of the changes you might find necessary: - - In src/s/SYSTEM-NAME.h add "#define SYSTEM_MALLOC". - - - In src/m/MACHINE-NAME.h add "#define CANNOT_DUMP" + - Edit configure, to set system_malloc and CANNOT_DUMP to "yes". - Configure with a different --prefix= option. If you use GCC, version 2.7.2 is preferred, as some malloc debugging packages diff --git a/etc/NEWS b/etc/NEWS index 122bd27d805..31dd69d5b4c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -41,6 +41,16 @@ lib-src/Makefile by hand in order to use the associated features. ** There is a new configure option --with-crt-dir. This is only useful if your crt*.o files are in a non-standard location. +--- +** Emacs can be compiled against Gtk+ 3.0 if you pass --with-x-toolkit=gtk3 +to configure. Note that other libraries used by Emacs, RSVG and GConf, +also depend on Gtk+. You can disable them with --without-rsvg and +--without-gconf. + +** There is a new configure option --enable-use-lisp-union-type. +This is only useful for Emacs developers to debug certain types of bugs. +These is not a new feature; only the configure flag is new. + * Startup Changes in Emacs 24.1 @@ -144,6 +154,41 @@ loaded, customize `package-load-list'. ** completion-at-point is now an alias for complete-symbol. ** mouse-region-delete-keys has been deleted. + +** Deletion changes + +*** New option `delete-active-region'. +If non-nil, C-d, [delete], and DEL delete the region if it is active +and no prefix argument is given. If set to `kill', these commands +kill instead. + +*** New command `delete-forward-char', bound to C-d and [delete]. +This is meant for interactive use, and obeys `delete-active-region'; +delete-char, meant for Lisp, does not obey `delete-active-region'. + +*** `delete-backward-char' is now a Lisp function. +Apart from obeying `delete-active-region', its behavior is unchanged. +However, the byte compiler now warns if it is called from Lisp; you +should use delete-char with a negative argument instead. + +*** The option `mouse-region-delete-keys' has been deleted. + +** Selection changes. + +The way Emacs interacts with the clipboard and primary selection, by +default, is now similar to other X applications. In particular, kill +and yank use the clipboard, in addition to the primary selection. + +*** `select-active-regions' now defaults to t. + +*** `x-select-enable-clipboard' now defaults to t. + +*** `x-select-enable-primary' now defaults to nil. + +*** `mouse-drag-copy-region' now defaults to nil. + +*** `mouse-2' is now bound to `mouse-yank-primary'. + * Changes in Specialized Modes and Packages in Emacs 24.1 @@ -211,9 +256,9 @@ For example, adding "(diff-mode . ((mode . whitespace)))" to your ** SQL Mode enhancements. -*** Several variables have been marked as safe local variables. -The variables `sql-product', `sql-user', `sql-server', and -`sql-database' can now be safely used as local variables. +*** Several variables have been marked as safe local variables. The +variables `sql-product', `sql-user', `sql-server', `sql-database' and +`sql-port' can now be safely used as local variables. *** Added ability to login with a port on MySQL. The custom variable `sql-port' can be specified for connection to @@ -224,15 +269,69 @@ Each supported product has a custom variable `sql-*-login-params' which is a list of the parameters to be prompted for before a connection is established. +By default, the value of the parameter is simply prompted for. For +`server' and `database', they can be specified in a list as shown +below: + + (server :file ARG) + (database :file ARG) + (server :completion ARG) + (database :completion ARG) + +The ARG when :file is specified is a regexp that will match valid file +names (without the directory portion). Generally these strings will +be of the form ".+\.SUF" where SUF is the desired file suffix. + +When :completion is specified, the ARG corresponds to the PREDICATE +argument to the `completing-read' function. + +*** Added `sql-connection-alist' to record login parameter values. +An alist for recording different username, database and server +values. If there are multiple databases that you connect to the +parameters needed can be stored in this alist. + +For example, the following might be set in the user's init.el: + + (setq sql-connection-alist + '((dev (sql-product 'sqlite) + (sql-database "/home/mmaug/dev.db")) + (prd (sql-product 'oracle) + (sql-user "mmaug") + (sql-database "iprd2a")))) + +This defines two connections named "dev" and "prd". + +*** Added `sql-connect' to use predefined connections. +Sets the login parameters based on the values in the +`sql-connection-alist' and start a SQL interactive session. Any +values specified in the connection will not be prompted for. + +In the example above, if the user were to invoke M-x sql-connect, they +would be prompted for the connection. The user can respond with +either "dev" or "prd". The "dev" connection would connect to the +SQLite database without prompting; the "prd" connection would prompt +for the users password and then connect to the Oracle database. + +**** Added SQL->Start... submenu when connections are defined. +When connections have been defined, There is a submenu available that +allows the user to select one to start a SQLi session. The "Start +SQLi Session" item moves to the "Start..." submenu when cnnections +have been defined. + +**** Added "Save Connection" menu item in SQLi buffers. +When a SQLi session is not started by a connection then +`sql-save-connection' will gather the login params specified for the +session and save them as a new connection. + *** Added option `sql-send-terminator'. When set makes sure that each command sent with `sql-send-*' commands are properly terminated and submitted to the SQL processor. *** Added option `sql-oracle-scan-on'. When set commands sent to Oracle's SQL*Plus are scanned for strings -starting with an ampersand and the user is asked for replacement -text. In general, the SQL*Plus option SCAN should be set OFF under -SQL interactive mode. +starting with an ampersand and the user is asked for replacement text. +In general, the SQL*Plus option SCAN should always be set OFF under +SQL interactive mode and this option used in its place. *** SQL interactive mode will replace tabs with spaces. This prevents the comand interpretter for MySQL and Postgres from @@ -275,6 +374,20 @@ programmer-visible consequences. ** Passing a nil argument to a minor mode function now turns the mode ON unconditionally. + +** During startup, Emacs no longer adds entries for `menu-bar-lines' +and `tool-bar-lines' to `default-frame-alist' and +`initial-frame-alist'. With these alist entries omitted, `make-frame' +checks the value of the variable `menu-bar-mode'/`tool-bar-mode' to +determine whether to create a menu-bar or tool-bar, respectively. +If the alist entries are added, they override the value of +`menu-bar-mode'/`tool-bar-mode'. + +** Regions created by mouse dragging are now normal active regions, +similar to the ones created by shift-selection. In previous Emacs +versions, these regions were delineated by `mouse-drag-overlay', which +has now been removed. + * Lisp changes in Emacs 24.1 @@ -316,6 +429,9 @@ displayed with a "spinning bar". * Changes in Emacs 24.1 on non-free operating systems +** New configure.bat option --enable-checking builds emacs with extra +runtime checks. + ---------------------------------------------------------------------- This file is part of GNU Emacs. diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 8c6a37dbd45..2fc0e29b30f 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -1037,7 +1037,7 @@ into Meta. This is because of the great importance of Meta in Emacs. This happens sometimes when using Metacity. Resizing Emacs or ALT-Tab:bing makes the system unresponsive to the mouse or the keyboard. Killing Emacs -or shifting out from X11 and back again usually cures it (i.e. Ctrl-Alt-F1 +or shifting out from X11 and back again usually cures it (i.e. Ctrl-Alt-F1 and then Alt-F7). A bug for it is here: https://bugs.launchpad.net/ubuntu/+source/metacity/+bug/231034. Note that a permanent fix seems to be to disable "assistive technologies". @@ -1514,7 +1514,7 @@ One way to cure this is to disable flow control on the local host (the one running rlogin, not the one running rlogind) using the stty command, before starting the rlogin process. On many systems, "stty start u stop u" will do this. On some systems, use -"stty -ixon" instead. +"stty -ixon" instead. Some versions of tcsh will prevent even this from working. One way around this is to start another shell before starting rlogin, and @@ -2339,17 +2339,10 @@ files are installed. Then use: (using the location of the 32-bit X libraries on your system). -*** Building the Cygwin port for MS-Windows can fail with some GCC versions +*** Building Emacs for Cygwin can fail with GCC 3 -Building Emacs 22 with Cygwin builds of GCC 3.4.4-1 and 3.4.4-2 is -reported to either fail or cause Emacs to segfault at run time. In -addition, the Cygwin GCC 3.4.4-2 has problems with generating debug -info. Cygwin users are advised not to use these versions of GCC for -compiling Emacs. GCC versions 4.0.3, 4.0.4, 4.1.1, and 4.1.2 -reportedly build a working Cygwin binary of Emacs, so we recommend -these GCC versions. Note that these versions of GCC, 4.0.3, 4.0.4, -4.1.1, and 4.1.2, are currently the _only_ versions known to succeed -in building Emacs (as of v22.1). +As of Emacs 22.1, there have been stability problems with Cygwin +builds of Emacs using GCC 3. Cygwin users are advised to use GCC 4. *** Building the native MS-Windows port fails due to unresolved externals @@ -2440,6 +2433,20 @@ several workarounds for this problem: 2. Install the latest Windows SDK. 3. Replace emacs.ico with an older or edited icon. +*** Building the MS-Windows port complains about unknown escape sequences. + +Errors and warnings can look like this: + + w32.c:1959:27: error: \x used with no following hex digits + w32.c:1959:27: warning: unknown escape sequence '\i' + +This happens when paths using backslashes are passed to the compiler or +linker (via -I and possibly other compiler flags); when these paths are +included in source code, the backslashes are interpreted as escape sequences. +See http://lists.gnu.org/archive/html/emacs-devel/2010-07/msg00995.html + +The fix is to use forward slashes in all paths passed to the compiler. + ** Linking *** Building Emacs with a system compiler fails to link because of an diff --git a/etc/compilation.txt b/etc/compilation.txt index d6a236d243d..2041b7f0acc 100644 --- a/etc/compilation.txt +++ b/etc/compilation.txt @@ -93,6 +93,55 @@ symbol: comma "foo.adb", line 2(11): warning: file name does not match ... "src/swapping.c", line 30.34: 1506-342 (W) "/*" detected in comment. +* Cucumber + +symbol: cucumber + +Feature: This is an example for backtrace. + + Scenario: undefined step # features/cucumber.feature:3 + Given this is undefined # features/cucumber.feature:4 + + Scenario: assertion false (Test::Unit) # features/cucumber.feature:6 + Given this will generate 'assert false' # features/step_definitions/default_steps.rb:1 + is not true. (Test::Unit::AssertionFailedError) + /home/gusev/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/test/unit/assertions.rb:48:in `assert_block' + /home/gusev/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/test/unit/assertions.rb:500:in `_wrap_assertion' + /home/gusev/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/test/unit/assertions.rb:46:in `assert_block' + /home/gusev/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/test/unit/assertions.rb:63:in `assert' + /home/gusev/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/test/unit/assertions.rb:495:in `_wrap_assertion' + /home/gusev/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/test/unit/assertions.rb:61:in `assert' + ./features/step_definitions/default_steps.rb:2:in `/^this will generate 'assert false'$/' + features/cucumber.feature:7:in `Given this will generate 'assert false'' + + Scenario: assertion false (RSpec) # features/cucumber.feature:9 + Given this will generate 'should be_true' # features/step_definitions/default_steps.rb:5 + expected true to be false (Spec::Expectations::ExpectationNotMetError) + ./features/step_definitions/default_steps.rb:6:in `/^this will generate 'should be_true'$/' + features/cucumber.feature:10:in `Given this will generate 'should be_true'' + + Scenario: backtrace in step definition # features/cucumber.feature:12 + Given this will generate backtrace # features/step_definitions/default_steps.rb:9 + (RuntimeError) + ./features/step_definitions/default_steps.rb:10:in `/^this will generate backtrace$/' + features/cucumber.feature:13:in `Given this will generate backtrace' + + Scenario: deeep backtrace in step definition # features/cucumber.feature:15 + Given this will generate deep backtrace # features/step_definitions/default_steps.rb:13 + (RuntimeError) + ./features/step_definitions/default_steps.rb:18:in `deep' + ./features/step_definitions/default_steps.rb:14:in `/^this will generate deep backtrace$/' + features/cucumber.feature:16:in `Given this will generate deep backtrace' + +Failing Scenarios: +cucumber features/cucumber.feature:6 # Scenario: assertion false (Test::Unit) +cucumber features/cucumber.feature:9 # Scenario: assertion false (RSpec) +cucumber features/cucumber.feature:12 # Scenario: backtrace in step definition +cucumber features/cucumber.feature:15 # Scenario: deeep backtrace in step definition + +5 scenarios (4 failed, 1 undefined) +5 steps (4 failed, 1 undefined) +0m0.007s * EDG C/C++ @@ -318,6 +367,51 @@ symbol: php Parse error: parse error, unexpected $ in main.php on line 59 Fatal error: Call to undefined function: mysql_pconnect() in db.inc on line 66 +* Ruby + +symbol: ruby + +plain-exception.rb:7:in `fun': unhandled exception + from plain-exception.rb:3:in `proxy' + from plain-exception.rb:12 + +* Ruby (Test::Unit) + +symbol: ruby-Test::Unit + +Loaded suite examples/test-unit +Started +FFFE +Finished in 0.023173 seconds. + + 1) Failure: +test_a_deep_assert(BacktracesTest) + [examples/test-unit.rb:28:in `here_is_a_deep_assert' + examples/test-unit.rb:19:in `test_a_deep_assert']: + is not true. + + 2) Failure: +test_assert(BacktracesTest) [examples/test-unit.rb:5]: + is not true. + + 3) Failure: +test_assert_raise(BacktracesTest) [examples/test-unit.rb:9]: +Exception raised: +Class: +Message: <""> +---Backtrace--- +examples/test-unit.rb:10:in `test_assert_raise' +examples/test-unit.rb:9:in `test_assert_raise' +--------------- + + 4) Error: +test_backtrace(BacktracesTest): +NoMethodError: undefined method `not_exists' for nil:NilClass + examples/test-unit.rb:24:in `some_function_call_from_nil' + examples/test-unit.rb:15:in `test_backtrace' + +4 tests, 3 assertions, 3 failures, 1 errors + * RXP symbol: rxp @@ -375,11 +469,11 @@ bloofle defined( /users/wolfgang/foo.c(4) ), but never used * GCOV (test coverage program) -symbol: gcov-file gcov-bb-file gcov-never-called-line gcov-called-line +symbol: gcov-file gcov-bb-file gcov-never-called-line gcov-called-line -: 0:Source:foo.c -: 0:Object:foo.bb - -: 1:/* $ gcc -fprofile-arcs -ftest-coverage foo.c + -: 1:/* $ gcc -fprofile-arcs -ftest-coverage foo.c -: 2: $ ./a.out -: 3: $ gcov foo.c -: 4: LANG=C gcov foo.c @@ -393,10 +487,10 @@ symbol: gcov-file gcov-bb-file gcov-never-called-line gcov-called-line 1: 12: r = 1; #####: 13: else if (argc == 2) #####: 14: r = 2; - -: 15: else + -: 15: else #####: 16: r = 0; 1: 17: return r; - -: 18:} + -: 18:} * Podchecker error messages, per Pod::Checker diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex index 89dbb0f01fb..c1f604a64dd 100644 --- a/etc/refcards/orgcard.tex +++ b/etc/refcards/orgcard.tex @@ -1,5 +1,5 @@ % Reference Card for Org Mode -\def\orgversionnumber{6.35i} +\def\orgversionnumber{7.01} \def\versionyear{2010} % latest update \def\year{2010} % latest copyright year @@ -329,7 +329,7 @@ \section{Archiving} \section{Filtering and Sparse Trees} \key{construct a sparse tree by various criteria}{C-c /} -\key{view TODO's in sparse tree}{C-c C-v} +\key{view TODO's in sparse tree}{C-c / t/T} \key{global TODO list in agenda mode}{C-c a t$^1$} \key{time sorted view of current org file}{C-c a L} @@ -442,36 +442,53 @@ \section{Links} \key{find next link}{C-c C-x C-n} \key{find previous link}{C-c C-x C-p} \key{edit code snippet of file at point}{C-c '} +\key{toggle inline display of linked images}{C-c C-x C-v} -{\bf Internal Links} +% {\bf Internal Links} -\key{\kbd{<>}}{\rm target} -\key{\kbd{<<>>}}{\rm radio target$^2$} -\key{\kbd{[[*this text]]}}{\rm find headline} -\metax{\kbd{[[this text]]}}{\rm find target or text in buffer} -\metax{\kbd{[[this text][description]]}}{\rm optional link text} +% \key{\kbd{<>}}{\rm target} +% \key{\kbd{<<>>}}{\rm radio target$^2$} +% \key{\kbd{[[*this text]]}}{\rm find headline} +% \metax{\kbd{[[this text]]}}{\rm find target or text in buffer} +% \metax{\kbd{[[this text][description]]}}{\rm optional link text} -{\bf External Links} +% {\bf External Links} -\key{\kbd{file:/home/dominik/img/mars.jpg}}{\rm file, absolute} -\key{\kbd{file:papers/last.pdf}}{\rm file, relative} -\key{\kbd{file:projects.org::*that text}}{\rm find headline} -\key{\kbd{file:projects.org::find me}}{\rm find trgt/string} -%\key{\kbd{file:projects.org::/regexp/}}{\rm regexp search} -\key{\kbd{http://www.astro.uva.nl/~dominik}}{\rm on the web} -\key{\kbd{mailto:adent@galaxy.net}}{\rm Email address} -\key{\kbd{news:comp.emacs}}{\rm Usenet group} -\key{\kbd{bbdb:Richard Stallman}}{\rm BBDB person} -\key{\kbd{gnus:group}}{\rm GNUS group} -\key{\kbd{gnus:group\#id}}{\rm GNUS message} -\key{\kbd{vm|wl|mhe|rmail:folder}}{\rm Mail folder} -\key{\kbd{vm|wl|mhe|rmail:folder\#id}}{\rm Mail message} -\key{\kbd{info:emacs:Regexps}}{\rm Info file:node} -\key{\kbd{shell:ls *.org}}{\rm shell command} -\key{\kbd{elisp:(calendar)}}{\rm elisp form} -\metax{\kbd{[[external link][description]]}}{\rm optional link text} -%\key{\kbd{vm://myself@some.where.org/folder\#id}}{\rm VM remote} +% \key{\kbd{file:/home/dominik/img/mars.jpg}}{\rm file, absolute} +% \key{\kbd{file:papers/last.pdf}}{\rm file, relative} +% \key{\kbd{file:projects.org::*that text}}{\rm find headline} +% \key{\kbd{file:projects.org::find me}}{\rm find trgt/string} +% %\key{\kbd{file:projects.org::/regexp/}}{\rm regexp search} +% \key{\kbd{http://www.astro.uva.nl/~dominik}}{\rm on the web} +% \key{\kbd{mailto:adent@galaxy.net}}{\rm Email address} +% \key{\kbd{news:comp.emacs}}{\rm Usenet group} +% \key{\kbd{bbdb:Richard Stallman}}{\rm BBDB person} +% \key{\kbd{gnus:group}}{\rm GNUS group} +% \key{\kbd{gnus:group\#id}}{\rm GNUS message} +% \key{\kbd{vm|wl|mhe|rmail:folder}}{\rm Mail folder} +% \key{\kbd{vm|wl|mhe|rmail:folder\#id}}{\rm Mail message} +% \key{\kbd{info:emacs:Regexps}}{\rm Info file:node} +% \key{\kbd{shell:ls *.org}}{\rm shell command} +% \key{\kbd{elisp:(calendar)}}{\rm elisp form} +% \metax{\kbd{[[external link][description]]}}{\rm optional link text} +% %\key{\kbd{vm://myself@some.where.org/folder\#id}}{\rm VM remote} +\section{Working with Code (Babel)} + +\key{execute code block at point}{C-c C-c} +\key{open results of code block at point}{C-c C-o} +\key{view expanded body of code block at point}{C-c C-v v} +\key{go to named code block}{C-c C-v g} +\key{go to named result}{C-c C-v r} +\key{go to the next code block}{C-c C-v n} +\key{go to the previous code block}{C-c C-v p} +\key{execute all code blocks in current buffer}{C-c C-v b} +\key{execute all code blocks in current subtree}{C-c C-v s} +\key{tangle code blocks in current file}{C-c C-v t} +\key{tangle code blocks in supplied file}{C-c C-v f} +\key{ingest all code blocks in supplied file into the Library of Babel}{C-c C-v l} +\key{switch to the session of the current code block}{C-c C-v z} +\key{view sha1 hash of the current code block}{C-c C-v a} % \section{Remember-mode Integration} @@ -690,6 +707,7 @@ \section{Exporting and Publishing} \key{export visible part only}{C-c C-e v} \key{insert template of export options}{C-c C-e t} \key{toggle fixed width for entry or region}{C-c :} +\key{toggle pretty display of scripts, entities}{C-c C-x {\tt\char`\\}} %{\bf HTML formatting} @@ -730,10 +748,8 @@ \section{Exporting and Publishing} {\bf Comments: Text not being exported} -Text before the first headline is not considered part of the document -and is therefore never exported. -Lines starting with \kbd{\#} are comments and are not exported. -Subtrees whose header starts with COMMENT are never exported. +Lines starting with \kbd{\#} and subtrees starting with COMMENT are +never exported. \key{toggle COMMENT keyword on entry}{C-c ;} @@ -749,8 +765,8 @@ \section{Notes} $^2$ After changing a \kbd{\#+KEYWORD} or \kbd{<<>>} line, press \kbd{C-c C-c} with the cursor still in the line to update. -$^3$ Keybinding affected by {\tt org-support-shift-select} and {\tt - org-replace-disputed-keys}. +$^3$ Keybinding affected by {\tt org-support-shift-select} and + {\tt org-replace-disputed-keys}. \copyrightnotice diff --git a/info/dir b/info/dir index 617bfc680bb..ae724d07195 100644 --- a/info/dir +++ b/info/dir @@ -19,75 +19,78 @@ The Info Directory * Menu: -* Info: (info). How to use the documentation browsing system. +* Info: (info). How to use the documentation browsing system. Emacs -* Emacs: (emacs). The extensible self-documenting text editor. -* Emacs FAQ: (efaq). Frequently Asked Questions about Emacs. +* Emacs: (emacs). The extensible self-documenting text editor. +* Emacs FAQ: (efaq). Frequently Asked Questions about Emacs. GNU Emacs Lisp -* Emacs Lisp Intro: (eintr). - A simple introduction to Emacs Lisp programming. -* Elisp: (elisp). The Emacs Lisp Reference Manual. +* Emacs Lisp Intro: (eintr). A simple introduction to Emacs Lisp programming. +* Elisp: (elisp). The Emacs Lisp Reference Manual. Emacs editing modes -* Ada mode: (ada-mode). Emacs mode for editing and compiling Ada code. -* CC Mode: (ccmode). Emacs mode for editing C, C++, Objective-C, - Java, Pike, AWK, and CORBA IDL code. -* IDLWAVE: (idlwave). Major mode and shell for IDL files. +* Ada mode: (ada-mode). Emacs mode for editing and compiling Ada code. +* CC Mode: (ccmode). Emacs mode for editing C, C++, Objective-C, + Java, Pike, AWK, and CORBA IDL code. +* IDLWAVE: (idlwave). Major mode and shell for IDL files. * nXML Mode: (nxml-mode). XML editing mode with RELAX NG support. -* Org Mode: (org). Outline-based notes management and organizer +* Org Mode: (org). Outline-based notes management and organizer Emacs network features -* EUDC: (eudc). An Emacs client for directory servers (LDAP, PH). -* Gnus: (gnus). The newsreader Gnus. -* Mairix: (mairix-el). Emacs interface to the Mairix mail indexer. -* MH-E: (mh-e). Emacs interface to the MH mail system. -* Message: (message). Mail and news composition mode that goes with Gnus. -* Newsticker: (newsticker). A Newsticker for Emacs. -* PGG: (pgg). Emacs interface to various PGP implementations. -* ERC: (erc). Powerful, modular, and extensible IRC client for Emacs. -* Rcirc: (rcirc). Internet Relay Chat (IRC) client. -* SASL: (sasl). The Emacs SASL library. -* SC: (sc). Supercite lets you cite parts of messages you're - replying to, in flexible ways. +* EUDC: (eudc). Emacs client for directory servers (LDAP, PH). +* Gnus: (gnus). The newsreader Gnus. +* Mairix: (mairix-el). Emacs interface to the Mairix mail indexer. +* MH-E: (mh-e). Emacs interface to the MH mail system. +* Message: (message). Mail and news composition mode that + goes with Gnus. +* Newsticker: (newsticker). A Newsticker for Emacs. +* PGG: (pgg). Emacs interface to various PGP implementations. +* ERC: (erc). Powerful and extensible IRC client for Emacs. +* Rcirc: (rcirc). Internet Relay Chat (IRC) client. +* SASL: (sasl). The Emacs SASL library. +* SC: (sc). Supercite lets you cite parts of messages + you're replying to, in flexible ways. * Sieve: (sieve). Managing Sieve scripts in Emacs. -* TRAMP: (tramp). Transparent Remote Access, Multiple Protocol - GNU Emacs remote file access via rsh and rcp. +* TRAMP: (tramp). Transparent Remote Access, Multiple Protocol + GNU Emacs remote file access via rsh and rcp. Emacs misc features -* Autotype: (autotype). Convenient features for text that you enter frequently - in Emacs. -* Calc: (calc). Advanced desk calculator and mathematical tool. -* Dired-X: (dired-x). Dired Extra Features. -* EasyPG Assistant: (epa). An Emacs user interface to GNU Privacy Guard. -* Ebrowse: (ebrowse). A C++ class browser for Emacs. -* EDE: (ede). The Emacs Development Environment. -* Ediff: (ediff). A visual interface for comparing and merging programs. -* EDT: (edt). An Emacs emulation of the EDT editor. -* EIEIO: (eieio). An object system for Emacs Lisp. -* Eshell: (eshell). A command shell implemented in Emacs Lisp. -* Flymake: (flymake). A universal on-the-fly syntax checker. -* Forms: (forms). Emacs package for editing data bases - by filling in forms. -* PCL-CVS: (pcl-cvs). Emacs front-end to CVS. -* RefTeX: (reftex). Emacs support for LaTeX cross-references and citations. -* Remember: (remember). Simple information manager for Emacs. -* Semantic: (semantic). Source code parsing utilities for Emacs. -* SES: (ses). Simple Emacs Spreadsheet -* Speedbar: (speedbar). File/Tag summarizing utility. -* VIP: (vip). An older VI-emulation for Emacs. -* VIPER: (viper). The newest Emacs VI-emulation mode. - (also, A VI Plan for Emacs Rescue - or the VI PERil.) -* WoMan: (woman). Browse UN*X Manual Pages "W.O. (without) Man". +* Autotype: (autotype). Convenient features for text that you enter + frequently in Emacs. +* Calc: (calc). Advanced desk calculator and mathematical tool. +* Dired-X: (dired-x). Dired Extra Features. +* EasyPG Assistant: (epa). An Emacs user interface to GNU Privacy Guard. +* Ebrowse: (ebrowse). A C++ class browser for Emacs. +* EDE: (ede). The Emacs Development Environment. +* Ediff: (ediff). A visual interface for comparing and + merging programs. +* EDT: (edt). An Emacs emulation of the EDT editor. +* EIEIO: (eieio). An object system for Emacs Lisp. +* Eshell: (eshell). A command shell implemented in Emacs Lisp. +* Flymake: (flymake). A universal on-the-fly syntax checker. +* Forms: (forms). Emacs package for editing data bases + by filling in forms. +* PCL-CVS: (pcl-cvs). Emacs front-end to CVS. +* RefTeX: (reftex). Emacs support for LaTeX cross-references + and citations. +* Remember: (remember). Simple information manager for Emacs. +* Semantic: (semantic). Source code parsing utilities for Emacs. +* SES: (ses). Simple Emacs Spreadsheet +* Speedbar: (speedbar). File/Tag summarizing utility. +* VIP: (vip). An older VI-emulation for Emacs. +* VIPER: (viper). The newest Emacs VI-emulation mode. + (also, A VI Plan for Emacs Rescue + or the VI PERil.) +* WoMan: (woman). Browse UN*X Manual Pages "W.O. (without) Man". Emacs lisp libraries -* Auth-source: (auth). A single configuration for multiple applications. -* CL: (cl). Partial Common Lisp support for Emacs Lisp. +* Auth-source: (auth). A single configuration for multiple + applications. +* CL: (cl). Partial Common Lisp support for Emacs Lisp. * D-Bus: (dbus). Using D-Bus in Emacs. -* Emacs MIME: (emacs-mime). Emacs MIME de/composition library. -* URL: (url). URL loading package. -* Widget: (widget). The "widget" package used by the Emacs Customization - facility. -* SMTP: (smtpmail). Emacs library for sending mail via SMTP. +* Emacs MIME: (emacs-mime). Emacs MIME de/composition library. +* URL: (url). URL loading package. +* Widget: (widget). The "widget" package used by the Emacs + Customization facility. +* SMTP: (smtpmail). Emacs library for sending mail via SMTP. diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 079941811c0..1b6a16dd524 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,141 @@ +2010-07-20 Juanma Barranquero + + * emacsclient.c (get_current_dir_name, w32_get_resource) + (w32_getenv, w32_set_user_model_id, w32_window_app, w32_execvp) + (close_winsock, initialize_sockets, w32_find_emacs_process) + (w32_give_focus): + * ntlib.c (getlogin, getuid, getgid, getegid): + Convert definitions to standard C. + +2010-07-12 Andreas Schwab + + * Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS) + (PROFILING_LDFLAGS): Set from substitution. + (BASE_CFLAGS): Add ${C_WARNINGS_SWITCH}. + (ALL_CFLAGS, CPP_CFLAGS): Add ${PROFILING_CFLAGS}. + (LINK_CFLAGS): Add ${PROFILING_LDFLAGS}. + +2010-07-12 Eli Zaretskii + + * makefile.w32-in (lisp2): Change hebrew.el to hebrew.elc (see + 2010-07-12T05:25:46Z!handa@etlken). + +2010-07-11 Andreas Schwab + + * emacsclient.c (set_local_socket): Use strchr, strrchr instead of + index, rindex. + * movemail.c (mail_spool_name, popmail): Likewise. + * pop.c (pop_list): Likewise. + +2010-07-11 Eli Zaretskii + + * makefile.w32-in (obj): Add menu.o, bidi.o, w32uniscribe.o, + and unexw32.o. (Bug#6603) + +2010-07-10 Eli Zaretskii + + * Makefile.in ($(DESTDIR)${archlibdir}): Convert spaces to TABs. + +2010-07-09 Andreas Schwab + + * make-docfile.c (write_c_args): Restructure scanning loop. + +2010-07-09 Dan Nicolaescu + + * make-docfile.c (write_c_args): Deal with type names in DEFUN + arguments. + +2010-07-08 Dan Nicolaescu + + * update-game-score.c (P_): Remove macro. + * ebrowse.c: Remove include guards. + (P_): Remove macro. + +2010-07-07 Andreas Schwab + + * ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by + memcpy, memmove, memset. + * pop.c (pop_retrieve, socket_connection, pop_getline): Likewise. + +2010-07-06 Andreas Schwab + + * movemail.c: Add MAIL_USE_POP around prototypes. + Include if HAVE_STRING_H. + (strerror): Only declare if !HAVE_STRERROR. + (fatal): Make static. + (error): Likewise. + (pfatal_with_name): Likewise. + (pfatal_and_delete). Likewise. + (concat): Likewise. + (xmalloc): Likewise. + (popmail): Likewise. + (pop_retr): Likewise. + (mbx_write): Likewise. + (mbx_delimit_begin): Likewise. + (mbx_delimit_end): Likewise. + +2010-07-04 Dan Nicolaescu + + * fakemail.c (action): Convert function definitions to standard C. + (add_a_stream): + * test-distrib.c (cool_read): + (main): Likewise. + +2010-07-03 Andreas Schwab + + * sorted-doc.c (cmpdoc): Fix signature. + (qsort_compare): Delete. + (main): Remove cast. + +2010-07-03 Juanma Barranquero + + * ebrowse.c (match_qualified_namespace_alias): Check for null pointer. + +2010-07-03 Juanma Barranquero + + Fix prototype warnings. + + * ebrowse.c (match_qualified_namespace_alias): + Pass sym* to find_namespace, not link*. + + * emacsclient.c (send_to_emacs, quote_argument): Arg s is HSOCKET. + + * sorted-doc.c (qsort_compare): New typedef. + (main): Use it to cast cmpdoc. + +2010-07-03 Dan Nicolaescu + + * update-game-score.c: Convert function definitions to standard C. + * sorted-doc.c: + * profile.c: + * pop.c: + * movemail.c: + * make-docfile.c: + * hexl.c: + * fakemail.c: + * etags.c: + * ebrowse.c: + * digest-doc.c: + * b2m.c: Likewise. + +2010-07-02 Dan Nicolaescu + + * make-docfile.c (xmalloc, xrealloc, concat, readline, fatal): + * b2m.c (scan_file, scan_lisp_file, scan_c_file): Convert to + standard C prototypes. + +2010-07-02 Jan Djärv + + * ebrowse.c: Remove P_ and __P. + * etags.c: + * movemail.c: + * pop.c: + * update-game-score.c: Likewise. + +2010-06-24 Juanma Barranquero + + * movemail.c (error): Avoid warning when there are no args. + 2010-06-11 Juanma Barranquero * makefile.w32-in (lisp2): Fix references to vc/vc-hooks.elc @@ -143,8 +281,7 @@ 2010-01-29 Kester Habermann (tiny change) - * etags.c (Fortran_functions): Handle recursive keyword - (Bug#5484). + * etags.c (Fortran_functions): Handle recursive keyword (Bug#5484). 2010-01-11 Glenn Morris diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index 264f14b1d49..9ad3c65afad 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -36,6 +36,9 @@ configuration=@configuration@ EXEEXT=@EXEEXT@ C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ +C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ +PROFILING_CFLAGS = @PROFILING_CFLAGS@ +PROFILING_LDFLAGS = @PROFILING_LDFLAGS@ # Program name transformation. TRANSFORM = @program_transform_name@ @@ -165,12 +168,12 @@ LIBS_SYSTEM = @LIBS_SYSTEM@ # Those files shared with other GNU utilities need HAVE_CONFIG_H # defined before they know they can take advantage of the information # in ../src/config.h. -BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H \ - -I. -I../src -I${srcdir} -I${srcdir}/../src +BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) ${C_WARNINGS_SWITCH} \ + -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src -ALL_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} -LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS} -CPP_CFLAGS = ${BASE_CFLAGS} ${CPPFLAGS} ${CFLAGS} +ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} +LINK_CFLAGS = ${BASE_CFLAGS} ${PROFILING_LDFLAGS} ${LDFLAGS} ${CFLAGS} +CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS} LOADLIBES=$(LIBS_SYSTEM) @@ -245,7 +248,7 @@ $(DESTDIR)${archlibdir}: all chown ${gameuser} $(DESTDIR)${gamedir}; \ chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \ fi - if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \ + if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \ != `(cd ${srcdir} && /bin/pwd)` ]; then \ for file in ${SCRIPTS}; do \ $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \ diff --git a/lib-src/b2m.c b/lib-src/b2m.c index 7de48e6a522..733cd276653 100644 --- a/lib-src/b2m.c +++ b/lib-src/b2m.c @@ -64,12 +64,13 @@ struct linebuffer char *buffer; }; -extern char *strtok(); +extern char *strtok(char *, const char *); -long *xmalloc (), *xrealloc (); -char *concat (); -long readline (); -void fatal (); +long *xmalloc (unsigned int size); +long *xrealloc (char *ptr, unsigned int size); +char *concat (char *s1, char *s2, char *s3); +long readline (struct linebuffer *linebuffer, register FILE *stream); +void fatal (char *message); /* * xnew -- allocate storage. SYNOPSIS: Type *xnew (int n, Type); @@ -90,9 +91,7 @@ struct option longopts[] = extern int optind; int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { logical labels_saved, printing, header, first, last_was_blank_line; time_t ltoday; @@ -219,8 +218,7 @@ main (argc, argv) * concatenate those of s1, s2, s3. */ char * -concat (s1, s2, s3) - char *s1, *s2, *s3; +concat (char *s1, char *s2, char *s3) { int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); char *result = xnew (len1 + len2 + len3 + 1, char); @@ -239,9 +237,7 @@ concat (s1, s2, s3) * which is the length of the line including the newline, if any. */ long -readline (linebuffer, stream) - struct linebuffer *linebuffer; - register FILE *stream; +readline (struct linebuffer *linebuffer, register FILE *stream) { char *buffer = linebuffer->buffer; register char *p = linebuffer->buffer; @@ -291,8 +287,7 @@ readline (linebuffer, stream) * Like malloc but get fatal error if memory is exhausted. */ long * -xmalloc (size) - unsigned int size; +xmalloc (unsigned int size) { long *result = (long *) malloc (size); if (result == NULL) @@ -301,9 +296,7 @@ xmalloc (size) } long * -xrealloc (ptr, size) - char *ptr; - unsigned int size; +xrealloc (char *ptr, unsigned int size) { long *result = (long *) realloc (ptr, size); if (result == NULL) @@ -312,8 +305,7 @@ xrealloc (ptr, size) } void -fatal (message) - char *message; +fatal (char *message) { fprintf (stderr, "%s: %s\n", progname, message); exit (EXIT_FAILURE); diff --git a/lib-src/digest-doc.c b/lib-src/digest-doc.c index d8c6e620a19..b3cb58e6d99 100644 --- a/lib-src/digest-doc.c +++ b/lib-src/digest-doc.c @@ -31,7 +31,7 @@ but in texinfo format and sorted by function/variable name. */ #endif int -main () +main (void) { register int ch; register int notfirst = 0; diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index b51b4aa6965..a9f7ba4f3a7 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c @@ -20,20 +20,14 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -#ifdef HAVE_CONFIG_H #include -#endif - #include #ifdef HAVE_STDLIB_H #include #endif -#ifdef HAVE_STRING_H #include -#endif - #include #include #include "getopt.h" @@ -45,12 +39,6 @@ along with GNU Emacs. If not, see . */ /* Conditionalize function prototypes. */ -#ifdef PROTOTYPES /* From config.h. */ -#define P_(x) x -#else -#define P_(x) () -#endif - /* Value is non-zero if strings X and Y compare equal. */ #define streq(X, Y) (*(X) == *(Y) && strcmp ((X) + 1, (Y) + 1) == 0) @@ -479,62 +467,62 @@ struct search_path *search_path_tail; /* Function prototypes. */ -int yylex P_ ((void)); -void yyparse P_ ((void)); -void re_init_parser P_ ((void)); -char *token_string P_ ((int)); -char *matching_regexp P_ ((void)); -void init_sym P_ ((void)); -struct sym *add_sym P_ ((char *, struct sym *)); -void add_link P_ ((struct sym *, struct sym *)); -void add_member_defn P_ ((struct sym *, char *, char *, - int, unsigned, int, int, int)); -void add_member_decl P_ ((struct sym *, char *, char *, int, - unsigned, int, int, int, int)); -void dump_roots P_ ((FILE *)); -void *xmalloc P_ ((int)); -void xfree P_ ((void *)); -void add_global_defn P_ ((char *, char *, int, unsigned, int, int, int)); -void add_global_decl P_ ((char *, char *, int, unsigned, int, int, int)); -void add_define P_ ((char *, char *, int)); -void mark_inherited_virtual P_ ((void)); -void leave_namespace P_ ((void)); -void enter_namespace P_ ((char *)); -void register_namespace_alias P_ ((char *, struct link *)); -void insert_keyword P_ ((char *, int)); -void re_init_scanner P_ ((void)); -void init_scanner P_ ((void)); -void usage P_ ((int)); -void version P_ ((void)); -void process_file P_ ((char *)); -void add_search_path P_ ((char *)); -FILE *open_file P_ ((char *)); -int process_pp_line P_ ((void)); -int dump_members P_ ((FILE *, struct member *)); -void dump_sym P_ ((FILE *, struct sym *)); -int dump_tree P_ ((FILE *, struct sym *)); -struct member *find_member P_ ((struct sym *, char *, int, int, unsigned)); -struct member *add_member P_ ((struct sym *, char *, int, int, unsigned)); -void mark_virtual P_ ((struct sym *)); -void mark_virtual P_ ((struct sym *)); -struct sym *make_namespace P_ ((char *, struct sym *)); -char *sym_scope P_ ((struct sym *)); -char *sym_scope_1 P_ ((struct sym *)); -int skip_to P_ ((int)); -void skip_matching P_ ((void)); -void member P_ ((struct sym *, int)); -void class_body P_ ((struct sym *, int)); -void class_definition P_ ((struct sym *, int, int, int)); -void declaration P_ ((int)); -unsigned parm_list P_ ((int *)); -char *operator_name P_ ((int *)); -struct sym *parse_classname P_ ((void)); -struct sym *parse_qualified_ident_or_type P_ ((char **)); -void parse_qualified_param_ident_or_type P_ ((char **)); -int globals P_ ((int)); -void yyerror P_ ((char *, char *)); -void usage P_ ((int)) NO_RETURN; -void version P_ (()) NO_RETURN; +int yylex (void); +void yyparse (void); +void re_init_parser (void); +char *token_string (int); +char *matching_regexp (void); +void init_sym (void); +struct sym *add_sym (char *, struct sym *); +void add_link (struct sym *, struct sym *); +void add_member_defn (struct sym *, char *, char *, + int, unsigned, int, int, int); +void add_member_decl (struct sym *, char *, char *, int, + unsigned, int, int, int, int); +void dump_roots (FILE *); +void *xmalloc (int); +void xfree (void *); +void add_global_defn (char *, char *, int, unsigned, int, int, int); +void add_global_decl (char *, char *, int, unsigned, int, int, int); +void add_define (char *, char *, int); +void mark_inherited_virtual (void); +void leave_namespace (void); +void enter_namespace (char *); +void register_namespace_alias (char *, struct link *); +void insert_keyword (char *, int); +void re_init_scanner (void); +void init_scanner (void); +void usage (int); +void version (void); +void process_file (char *); +void add_search_path (char *); +FILE *open_file (char *); +int process_pp_line (void); +int dump_members (FILE *, struct member *); +void dump_sym (FILE *, struct sym *); +int dump_tree (FILE *, struct sym *); +struct member *find_member (struct sym *, char *, int, int, unsigned); +struct member *add_member (struct sym *, char *, int, int, unsigned); +void mark_virtual (struct sym *); +void mark_virtual (struct sym *); +struct sym *make_namespace (char *, struct sym *); +char *sym_scope (struct sym *); +char *sym_scope_1 (struct sym *); +int skip_to (int); +void skip_matching (void); +void member (struct sym *, int); +void class_body (struct sym *, int); +void class_definition (struct sym *, int, int, int); +void declaration (int); +unsigned parm_list (int *); +char *operator_name (int *); +struct sym *parse_classname (void); +struct sym *parse_qualified_ident_or_type (char **); +void parse_qualified_param_ident_or_type (char **); +int globals (int); +void yyerror (char *, char *); +void usage (int) NO_RETURN; +void version (void) NO_RETURN; @@ -546,8 +534,7 @@ void version P_ (()) NO_RETURN; name and line number. */ void -yyerror (format, s) - char *format, *s; +yyerror (char *format, char *s) { fprintf (stderr, "%s:%d: ", filename, yyline); fprintf (stderr, format, s); @@ -559,8 +546,7 @@ yyerror (format, s) available. */ void * -xmalloc (nbytes) - int nbytes; +xmalloc (int nbytes) { void *p = malloc (nbytes); if (p == NULL) @@ -575,9 +561,7 @@ xmalloc (nbytes) /* Like realloc but print an error and exit if out of memory. */ void * -xrealloc (p, sz) - void *p; - int sz; +xrealloc (void *p, int sz) { p = realloc (p, sz); if (p == NULL) @@ -593,8 +577,7 @@ xrealloc (p, sz) available.. If S is null, return null. */ char * -xstrdup (s) - char *s; +xstrdup (char *s) { if (s) s = strcpy (xmalloc (strlen (s) + 1), s); @@ -611,7 +594,7 @@ xstrdup (s) special symbol for globals (`*Globals*'). */ void -init_sym () +init_sym (void) { global_symbols = add_sym (GLOBALS_NAME, NULL); } @@ -625,9 +608,7 @@ init_sym () create a new symbol and set it to default values. */ struct sym * -add_sym (name, nested_in_class) - char *name; - struct sym *nested_in_class; +add_sym (char *name, struct sym *nested_in_class) { struct sym *sym; unsigned h; @@ -654,7 +635,7 @@ add_sym (name, nested_in_class) } sym = (struct sym *) xmalloc (sizeof *sym + strlen (name)); - bzero (sym, sizeof *sym); + memset (sym, 0, sizeof *sym); strcpy (sym->name, name); sym->namesp = scope; sym->next = class_table[h]; @@ -668,8 +649,7 @@ add_sym (name, nested_in_class) /* Add links between superclass SUPER and subclass SUB. */ void -add_link (super, sub) - struct sym *super, *sub; +add_link (struct sym *super, struct sym *sub) { struct link *lnk, *lnk2, *p, *prev; @@ -709,11 +689,7 @@ add_link (super, sub) found or null if not found. */ struct member * -find_member (cls, name, var, sc, hash) - struct sym *cls; - char *name; - int var, sc; - unsigned hash; +find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) { struct member **list; struct member *p; @@ -763,16 +739,7 @@ find_member (cls, name, var, sc, hash) F_* defines). */ void -add_member_decl (cls, name, regexp, pos, hash, var, sc, vis, flags) - struct sym *cls; - char *name; - char *regexp; - int pos; - unsigned hash; - int var; - int sc; - int vis; - int flags; +add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int vis, int flags) { struct member *m; @@ -820,15 +787,7 @@ add_member_decl (cls, name, regexp, pos, hash, var, sc, vis, flags) F_* defines). */ void -add_member_defn (cls, name, regexp, pos, hash, var, sc, flags) - struct sym *cls; - char *name; - char *regexp; - int pos; - unsigned hash; - int var; - int sc; - int flags; +add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) { struct member *m; @@ -870,9 +829,7 @@ add_member_defn (cls, name, regexp, pos, hash, var, sc, flags) if it is non-null. POS is the position in the file. */ void -add_define (name, regexp, pos) - char *name, *regexp; - int pos; +add_define (char *name, char *regexp, int pos) { add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE); add_global_decl (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE); @@ -890,13 +847,7 @@ add_define (name, regexp, pos) F_* defines). */ void -add_global_defn (name, regexp, pos, hash, var, sc, flags) - char *name, *regexp; - int pos; - unsigned hash; - int var; - int sc; - int flags; +add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) { int i; struct sym *sym; @@ -927,13 +878,7 @@ add_global_defn (name, regexp, pos, hash, var, sc, flags) F_* defines). */ void -add_global_decl (name, regexp, pos, hash, var, sc, flags) - char *name, *regexp; - int pos; - unsigned hash; - int var; - int sc; - int flags; +add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) { /* Add declaration only if not already declared. Header files must be processed before source files for this to have the right effect. @@ -972,12 +917,7 @@ add_global_decl (name, regexp, pos, hash, var, sc, flags) Value is a pointer to the member's structure. */ struct member * -add_member (cls, name, var, sc, hash) - struct sym *cls; - char *name; - int var; - int sc; - unsigned hash; +add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) { struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name)); struct member **list; @@ -1048,8 +988,7 @@ add_member (cls, name, var, sc, hash) in base classes. */ void -mark_virtual (r) - struct sym *r; +mark_virtual (struct sym *r) { struct link *p; struct member *m, *m2; @@ -1073,7 +1012,7 @@ mark_virtual (r) are virtual because of a virtual declaration in a base class. */ void -mark_inherited_virtual () +mark_inherited_virtual (void) { struct sym *r; int i; @@ -1088,12 +1027,10 @@ mark_inherited_virtual () /* Create and return a symbol for a namespace with name NAME. */ struct sym * -make_namespace (name, context) - char *name; - struct sym *context; +make_namespace (char *name, struct sym *context) { struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name)); - bzero (s, sizeof *s); + memset (s, 0, sizeof *s); strcpy (s->name, name); s->next = all_namespaces; s->namesp = context; @@ -1105,9 +1042,7 @@ make_namespace (name, context) /* Find the symbol for namespace NAME. If not found, retrun NULL */ struct sym * -check_namespace (name, context) - char *name; - struct sym *context; +check_namespace (char *name, struct sym *context) { struct sym *p = NULL; @@ -1115,18 +1050,16 @@ check_namespace (name, context) { if (streq (p->name, name) && (p->namesp == context)) break; - } + } return p; - } +} /* Find the symbol for namespace NAME. If not found, add a new symbol for NAME to all_namespaces. */ struct sym * -find_namespace (name, context) - char *name; - struct sym *context; +find_namespace (char *name, struct sym *context) { struct sym *p = check_namespace (name, context); @@ -1140,8 +1073,7 @@ find_namespace (name, context) /* Find namespace alias with name NAME. If not found return NULL. */ struct link * -check_namespace_alias (name) - char *name; +check_namespace_alias (char *name) { struct link *p = NULL; struct alias *al; @@ -1165,9 +1097,7 @@ check_namespace_alias (name) /* Register the name NEW_NAME as an alias for namespace list OLD_NAME. */ void -register_namespace_alias (new_name, old_name) - char *new_name; - struct link *old_name; +register_namespace_alias (char *new_name, struct link *old_name) { unsigned h; char *s; @@ -1195,8 +1125,7 @@ register_namespace_alias (new_name, old_name) /* Enter namespace with name NAME. */ void -enter_namespace (name) - char *name; +enter_namespace (char *name) { struct sym *p = find_namespace (name, current_namespace); @@ -1217,7 +1146,7 @@ enter_namespace (name) /* Leave the current namespace. */ void -leave_namespace () +leave_namespace (void) { assert (namespace_sp > 0); current_namespace = namespace_stack[--namespace_sp]; @@ -1259,8 +1188,7 @@ int scope_buffer_len; /* Make sure scope_buffer has enough room to add LEN chars to it. */ void -ensure_scope_buffer_room (len) - int len; +ensure_scope_buffer_room (int len) { if (scope_buffer_len + len >= scope_buffer_size) { @@ -1276,8 +1204,7 @@ ensure_scope_buffer_room (len) scope name constructed. */ char * -sym_scope_1 (p) - struct sym *p; +sym_scope_1 (struct sym *p) { int len; @@ -1311,8 +1238,7 @@ sym_scope_1 (p) as it would appear in a C*+ source file. */ char * -sym_scope (p) - struct sym *p; +sym_scope (struct sym *p) { if (!scope_buffer) { @@ -1334,9 +1260,7 @@ sym_scope (p) list. */ int -dump_members (fp, m) - FILE *fp; - struct member *m; +dump_members (FILE *fp, struct member *m) { int n; @@ -1369,9 +1293,7 @@ dump_members (fp, m) /* Dump class ROOT to stream FP. */ void -dump_sym (fp, root) - FILE *fp; - struct sym *root; +dump_sym (FILE *fp, struct sym *root) { fputs (CLASS_STRUCT, fp); PUTSTR (root->name, fp); @@ -1397,9 +1319,7 @@ dump_sym (fp, root) number of classes written. */ int -dump_tree (fp, root) - FILE *fp; - struct sym *root; +dump_tree (FILE *fp, struct sym *root) { struct link *lk; unsigned n = 0; @@ -1446,8 +1366,7 @@ dump_tree (fp, root) /* Dump the entire class tree to file FP. */ void -dump_roots (fp) - FILE *fp; +dump_roots (FILE *fp) { int i, n = 0; struct sym *r; @@ -1521,7 +1440,7 @@ do { \ input buffer not consumed. */ int -process_pp_line () +process_pp_line (void) { int in_comment = 0, in_string = 0; int c; @@ -1592,7 +1511,7 @@ process_pp_line () /* Value is the next token from the input buffer. */ int -yylex () +yylex (void) { int c; char end_char; @@ -2009,7 +1928,7 @@ static char *matching_regexp_buffer, *matching_regexp_end_buf; shorter than min_regexp. */ char * -matching_regexp () +matching_regexp (void) { char *p; char *s; @@ -2060,8 +1979,7 @@ matching_regexp () /* Return a printable representation of token T. */ char * -token_string (t) - int t; +token_string (int t) { static char b[3]; @@ -2178,7 +2096,7 @@ token_string (t) /* Reinitialize the scanner for a new input file. */ void -re_init_scanner () +re_init_scanner (void) { in = inbuffer; yyline = 1; @@ -2196,9 +2114,7 @@ re_init_scanner () table. */ void -insert_keyword (name, tk) - char *name; - int tk; +insert_keyword (char *name, int tk) { char *s; unsigned h = 0; @@ -2219,7 +2135,7 @@ insert_keyword (name, tk) character class vectors and fills the keyword hash table. */ void -init_scanner () +init_scanner (void) { int i; @@ -2363,8 +2279,7 @@ init_scanner () the current lookahead token after skipping. */ int -skip_to (token) - int token; +skip_to (int token) { while (!LOOKING_AT2 (YYEOF, token)) MATCH (); @@ -2375,7 +2290,7 @@ skip_to (token) angle brackets, curly brackets) matching the current lookahead. */ void -skip_matching () +skip_matching (void) { int open, close, n; @@ -2418,7 +2333,7 @@ skip_matching () } void -skip_initializer () +skip_initializer (void) { for (;;) { @@ -2445,7 +2360,7 @@ skip_initializer () /* Build qualified namespace alias (A::B::c) and return it. */ struct link * -match_qualified_namespace_alias () +match_qualified_namespace_alias (void) { struct link *head = NULL; struct link *cur = NULL; @@ -2458,7 +2373,7 @@ match_qualified_namespace_alias () { case IDENT: tmp = (struct link *) xmalloc (sizeof *cur); - tmp->sym = find_namespace (yytext, cur); + tmp->sym = find_namespace (yytext, cur ? cur->sym : NULL); tmp->next = NULL; if (head) { @@ -2482,7 +2397,7 @@ match_qualified_namespace_alias () /* Re-initialize the parser by resetting the lookahead token. */ void -re_init_parser () +re_init_parser (void) { tk = -1; } @@ -2495,8 +2410,7 @@ re_init_parser () distinguish between overloaded functions. */ unsigned -parm_list (flags) - int *flags; +parm_list (int *flags) { unsigned hash = 0; int type_seen = 0; @@ -2609,7 +2523,7 @@ parm_list (flags) /* Print position info to stdout. */ void -print_info () +print_info (void) { if (info_position >= 0 && BUFFER_POS () <= info_position) if (info_cls) @@ -2624,9 +2538,7 @@ print_info () public). */ void -member (cls, vis) - struct sym *cls; - int vis; +member (struct sym *cls, int vis) { char *id = NULL; int sc = SC_MEMBER; @@ -2835,9 +2747,7 @@ member (cls, vis) union, class). */ void -class_body (cls, tag) - struct sym *cls; - int tag; +class_body (struct sym *cls, int tag) { int vis = tag == CLASS ? PRIVATE : PUBLIC; int temp; @@ -2898,7 +2808,7 @@ class_body (cls, tag) symbol for that class. */ struct sym * -parse_classname () +parse_classname (void) { struct sym *last_class = NULL; @@ -2928,8 +2838,7 @@ parse_classname () a static buffer holding the constructed operator name string. */ char * -operator_name (sc) - int *sc; +operator_name (int *sc) { static int id_size = 0; static char *id = NULL; @@ -3019,8 +2928,7 @@ operator_name (sc) symbol structure for the ident. */ struct sym * -parse_qualified_ident_or_type (last_id) - char **last_id; +parse_qualified_ident_or_type (char **last_id) { struct sym *cls = NULL; char *id = NULL; @@ -3085,8 +2993,7 @@ parse_qualified_ident_or_type (last_id) symbol structure for the ident. */ void -parse_qualified_param_ident_or_type (last_id) - char **last_id; +parse_qualified_param_ident_or_type (char **last_id) { struct sym *cls = NULL; static char *id = NULL; @@ -3128,11 +3035,7 @@ parse_qualified_param_ident_or_type (last_id) Current lookahead is the class name. */ void -class_definition (containing, tag, flags, nested) - struct sym *containing; - int tag; - int flags; - int nested; +class_definition (struct sym *containing, int tag, int flags, int nested) { struct sym *current; struct sym *base_class; @@ -3229,10 +3132,7 @@ class_definition (containing, tag, flags, nested) information about the member (see the F_* defines). */ void -add_declarator (cls, id, flags, sc) - struct sym **cls; - char **id; - int flags, sc; +add_declarator (struct sym **cls, char **id, int flags, int sc) { if (LOOKING_AT2 (';', ',')) { @@ -3275,8 +3175,7 @@ add_declarator (cls, id, flags, sc) /* Parse a declaration. */ void -declaration (flags) - int flags; +declaration (int flags) { char *id = NULL; struct sym *cls = NULL; @@ -3430,8 +3329,7 @@ declaration (flags) otherwise. */ int -globals (start_flags) - int start_flags; +globals (int start_flags) { int anonymous; int class_tk; @@ -3549,7 +3447,7 @@ globals (start_flags) /* Parse the current input file. */ void -yyparse () +yyparse (void) { while (globals (0) == 0) MATCH_IF ('}'); @@ -3565,8 +3463,7 @@ yyparse () input files. */ void -add_search_path (path_list) - char *path_list; +add_search_path (char *path_list) { while (*path_list) { @@ -3601,8 +3498,7 @@ add_search_path (path_list) unchanged file name. */ FILE * -open_file (file) - char *file; +open_file (char *file) { FILE *fp = NULL; static char *buffer; @@ -3661,8 +3557,7 @@ Usage: ebrowse [options] {files}\n\ " void -usage (error) - int error; +usage (int error) { puts (USAGE); exit (error ? EXIT_FAILURE : EXIT_SUCCESS); @@ -3677,7 +3572,7 @@ usage (error) #endif void -version () +version (void) { /* Makes it easier to update automatically. */ char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; @@ -3693,8 +3588,7 @@ version () table. */ void -process_file (file) - char *file; +process_file (char *file) { FILE *fp; @@ -3749,8 +3643,7 @@ process_file (file) is null when EOF is reached. */ char * -read_line (fp) - FILE *fp; +read_line (FILE *fp) { static char *buffer; static int buffer_size; @@ -3786,9 +3679,7 @@ read_line (fp) /* Main entry point. */ int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int i; int any_inputfiles = 0; diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 3172ebb8cd1..bafc7e02720 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -81,7 +81,7 @@ along with GNU Emacs. If not, see . */ #include -char *getenv (), *getwd (); +char *getenv (const char *), *getwd (char *); char *(getcwd) (); #ifdef WINDOWSNT @@ -157,7 +157,7 @@ char *server_file = NULL; /* PID of the Emacs server process. */ int emacs_pid = 0; -void print_help_and_exit () NO_RETURN; +void print_help_and_exit (void) NO_RETURN; struct option longopts[] = { @@ -184,8 +184,7 @@ struct option longopts[] = /* Like malloc but get fatal error if memory is exhausted. */ long * -xmalloc (size) - unsigned int size; +xmalloc (unsigned int size) { long *result = (long *) malloc (size); if (result == NULL) @@ -236,7 +235,7 @@ xstrdup (const char *s) Any other returned value must be freed with free. This is used only when get_current_dir_name is not defined on the system. */ char* -get_current_dir_name () +get_current_dir_name (void) { char *buf; char *pwd; @@ -312,10 +311,7 @@ get_current_dir_name () Return NULL if the variable was not found, or it was empty. This code is based on w32_get_resource (w32.c). */ char * -w32_get_resource (predefined, key, type) - HKEY predefined; - char *key; - LPDWORD type; +w32_get_resource (HKEY predefined, char *key, LPDWORD type) { HKEY hrootkey = NULL; char *result = NULL; @@ -348,8 +344,7 @@ w32_get_resource (predefined, key, type) variables in the registry if they don't appear in the environment. */ char * -w32_getenv (envvar) - char *envvar; +w32_getenv (char *envvar) { char *value; DWORD dwType; @@ -397,7 +392,7 @@ w32_getenv (envvar) } void -w32_set_user_model_id () +w32_set_user_model_id (void) { HMODULE shell; HRESULT (WINAPI * set_user_model) (wchar_t * id); @@ -424,7 +419,7 @@ w32_set_user_model_id () } int -w32_window_app () +w32_window_app (void) { static int window_app = -1; char szTitle[MAX_PATH]; @@ -447,13 +442,11 @@ w32_window_app () This is necessary due to the broken implementation of exec* routines in the Microsoft libraries: they concatenate the arguments together without quoting special characters, and pass the result to CreateProcess, with - predictably bad results. By contrast, Posix execvp passes the arguments + predictably bad results. By contrast, POSIX execvp passes the arguments directly into the argv array of the child process. */ int -w32_execvp (path, argv) - char *path; - char **argv; +w32_execvp (const char *path, char **argv) { int i; @@ -517,9 +510,7 @@ message (int is_error, char *message, ...) The global variable `optind' will say how many arguments we used up. */ void -decode_options (argc, argv) - int argc; - char **argv; +decode_options (int argc, char **argv) { alternate_editor = egetenv ("ALTERNATE_EDITOR"); @@ -645,7 +636,7 @@ an empty string"); void -print_help_and_exit () +print_help_and_exit (void) { /* Spaces and tabs are significant in this message; they're chosen so the message aligns properly both in a tty and in a Windows message box. @@ -732,7 +723,7 @@ main (argc, argv) #define AUTH_KEY_LENGTH 64 #define SEND_BUFFER_SIZE 4096 -extern char *strerror (); +extern char *strerror (int); /* Buffer to accumulate data to send in TCP connections. */ char send_buffer[SEND_BUFFER_SIZE + 1]; @@ -743,8 +734,7 @@ HSOCKET emacs_socket = 0; /* On Windows, the socket library was historically separate from the standard C library, so errors are handled differently. */ void -sock_err_message (function_name) - char *function_name; +sock_err_message (char *function_name) { #ifdef WINDOWSNT char* msg = NULL; @@ -768,9 +758,7 @@ sock_err_message (function_name) - the buffer is full (but this shouldn't happen) Otherwise, we just accumulate it. */ void -send_to_emacs (s, data) - HSOCKET s; - char *data; +send_to_emacs (HSOCKET s, char *data) { while (data) { @@ -807,11 +795,9 @@ send_to_emacs (s, data) any initial -. Change spaces to underscores, too, so that the return value never contains a space. - Does not change the string. Outputs the result to STREAM. */ + Does not change the string. Outputs the result to S. */ void -quote_argument (s, str) - HSOCKET s; - char *str; +quote_argument (HSOCKET s, char *str) { char *copy = (char *) xmalloc (strlen (str) * 2 + 1); char *p, *q; @@ -851,8 +837,7 @@ quote_argument (s, str) modifying the string in place. Returns STR. */ char * -unquote_argument (str) - char *str; +unquote_argument (char *str) { char *p, *q; @@ -883,8 +868,7 @@ unquote_argument (str) int -file_name_absolute_p (filename) - const unsigned char *filename; +file_name_absolute_p (const unsigned char *filename) { /* Sanity check, it shouldn't happen. */ if (! filename) return FALSE; @@ -910,15 +894,15 @@ file_name_absolute_p (filename) #ifdef WINDOWSNT /* Wrapper to make WSACleanup a cdecl, as required by atexit. */ -void -__cdecl close_winsock () +void __cdecl +close_winsock (void) { WSACleanup (); } /* Initialize the WinSock2 library. */ void -initialize_sockets () +initialize_sockets (void) { WSADATA wsaData; @@ -938,9 +922,7 @@ initialize_sockets () * the Emacs server: host, port, pid and authentication string. */ int -get_server_config (server, authentication) - struct sockaddr_in *server; - char *authentication; +get_server_config (struct sockaddr_in *server, char *authentication) { char dotted[32]; char *port; @@ -1005,7 +987,7 @@ get_server_config (server, authentication) } HSOCKET -set_tcp_socket () +set_tcp_socket (void) { HSOCKET s; struct sockaddr_in server; @@ -1119,8 +1101,7 @@ find_tty (char **tty_type, char **tty_name, int noabort) 0 - success: none of the above */ static int -socket_status (socket_name) - char *socket_name; +socket_status (char *socket_name) { struct stat statbfr; @@ -1223,7 +1204,7 @@ init_signals (void) HSOCKET -set_local_socket () +set_local_socket (void) { HSOCKET s; struct sockaddr_un server; @@ -1247,8 +1228,10 @@ set_local_socket () char *server_name = "server"; char *tmpdir; - if (socket_name && !index (socket_name, '/') && !index (socket_name, '\\')) - { /* socket_name is a file name component. */ + if (socket_name && !strchr (socket_name, '/') + && !strchr (socket_name, '\\')) + { + /* socket_name is a file name component. */ server_name = socket_name; socket_name = NULL; default_sock = 1; /* Try both UIDs. */ @@ -1419,9 +1402,7 @@ FARPROC set_fg; /* Pointer to AllowSetForegroundWindow. */ FARPROC get_wc; /* Pointer to RealGetWindowClassA. */ BOOL CALLBACK -w32_find_emacs_process (hWnd, lParam) - HWND hWnd; - LPARAM lParam; +w32_find_emacs_process (HWND hWnd, LPARAM lParam) { DWORD pid; char class[6]; @@ -1449,7 +1430,7 @@ w32_find_emacs_process (hWnd, lParam) * process id = emacs_pid. If found, allow it to grab the focus. */ void -w32_give_focus () +w32_give_focus (void) { HANDLE user32; @@ -1526,9 +1507,7 @@ start_daemon_and_retry_set_socket (void) } int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int i, rl, needlf = 0; char *cwd, *str; diff --git a/lib-src/etags.c b/lib-src/etags.c index 89edc6c1b27..79475fe9922 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -100,15 +100,10 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; # ifndef PTR /* for XEmacs */ # define PTR void * # endif -# ifndef __P /* for XEmacs */ -# define __P(args) args -# endif #else /* no config.h */ # if defined(__STDC__) && (__STDC__ || defined(__SUNPRO_C)) -# define __P(args) args /* use prototypes */ # define PTR void * /* for generic pointers */ # else /* not standard C */ -# define __P(args) () /* no prototypes */ # define const /* remove const for old compilers' sake */ # define PTR long * /* don't use void* */ # endif @@ -158,20 +153,20 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; # include # include # else /* no standard C headers */ - extern char *getenv __P((const char *)); - extern char *strcpy __P((char *, const char *)); - extern char *strncpy __P((char *, const char *, unsigned long)); - extern char *strcat __P((char *, const char *)); - extern char *strncat __P((char *, const char *, unsigned long)); - extern int strcmp __P((const char *, const char *)); - extern int strncmp __P((const char *, const char *, unsigned long)); - extern int system __P((const char *)); - extern unsigned long strlen __P((const char *)); - extern void *malloc __P((unsigned long)); - extern void *realloc __P((void *, unsigned long)); - extern void exit __P((int)); - extern void free __P((void *)); - extern void *memmove __P((void *, const void *, unsigned long)); + extern char *getenv (const char *); + extern char *strcpy (char *, const char *); + extern char *strncpy (char *, const char *, unsigned long); + extern char *strcat (char *, const char *); + extern char *strncat (char *, const char *, unsigned long); + extern int strcmp (const char *, const char *); + extern int strncmp (const char *, const char *, unsigned long); + extern int system (const char *); + extern unsigned long strlen (const char *); + extern void *malloc (unsigned long); + extern void *realloc (void *, unsigned long); + extern void exit (int); + extern void free (void *); + extern void *memmove (void *, const void *, unsigned long); # define EXIT_SUCCESS 0 # define EXIT_FAILURE 1 # endif @@ -273,7 +268,7 @@ If you want regular expression support, you should delete this notice and #define bool int -typedef void Lang_function __P((FILE *)); +typedef void Lang_function (FILE *); typedef struct { @@ -365,87 +360,87 @@ typedef struct regexp /* Many compilers barf on this: Lang_function Ada_funcs; so let's write it this way */ -static void Ada_funcs __P((FILE *)); -static void Asm_labels __P((FILE *)); -static void C_entries __P((int c_ext, FILE *)); -static void default_C_entries __P((FILE *)); -static void plain_C_entries __P((FILE *)); -static void Cjava_entries __P((FILE *)); -static void Cobol_paragraphs __P((FILE *)); -static void Cplusplus_entries __P((FILE *)); -static void Cstar_entries __P((FILE *)); -static void Erlang_functions __P((FILE *)); -static void Forth_words __P((FILE *)); -static void Fortran_functions __P((FILE *)); -static void HTML_labels __P((FILE *)); -static void Lisp_functions __P((FILE *)); -static void Lua_functions __P((FILE *)); -static void Makefile_targets __P((FILE *)); -static void Pascal_functions __P((FILE *)); -static void Perl_functions __P((FILE *)); -static void PHP_functions __P((FILE *)); -static void PS_functions __P((FILE *)); -static void Prolog_functions __P((FILE *)); -static void Python_functions __P((FILE *)); -static void Scheme_functions __P((FILE *)); -static void TeX_commands __P((FILE *)); -static void Texinfo_nodes __P((FILE *)); -static void Yacc_entries __P((FILE *)); -static void just_read_file __P((FILE *)); +static void Ada_funcs (FILE *); +static void Asm_labels (FILE *); +static void C_entries (int c_ext, FILE *); +static void default_C_entries (FILE *); +static void plain_C_entries (FILE *); +static void Cjava_entries (FILE *); +static void Cobol_paragraphs (FILE *); +static void Cplusplus_entries (FILE *); +static void Cstar_entries (FILE *); +static void Erlang_functions (FILE *); +static void Forth_words (FILE *); +static void Fortran_functions (FILE *); +static void HTML_labels (FILE *); +static void Lisp_functions (FILE *); +static void Lua_functions (FILE *); +static void Makefile_targets (FILE *); +static void Pascal_functions (FILE *); +static void Perl_functions (FILE *); +static void PHP_functions (FILE *); +static void PS_functions (FILE *); +static void Prolog_functions (FILE *); +static void Python_functions (FILE *); +static void Scheme_functions (FILE *); +static void TeX_commands (FILE *); +static void Texinfo_nodes (FILE *); +static void Yacc_entries (FILE *); +static void just_read_file (FILE *); -static void print_language_names __P((void)); -static void print_version __P((void)); -static void print_help __P((argument *)); -int main __P((int, char **)); +static void print_language_names (void); +static void print_version (void); +static void print_help (argument *); +int main (int, char **); -static compressor *get_compressor_from_suffix __P((char *, char **)); -static language *get_language_from_langname __P((const char *)); -static language *get_language_from_interpreter __P((char *)); -static language *get_language_from_filename __P((char *, bool)); -static void readline __P((linebuffer *, FILE *)); -static long readline_internal __P((linebuffer *, FILE *)); -static bool nocase_tail __P((char *)); -static void get_tag __P((char *, char **)); +static compressor *get_compressor_from_suffix (char *, char **); +static language *get_language_from_langname (const char *); +static language *get_language_from_interpreter (char *); +static language *get_language_from_filename (char *, bool); +static void readline (linebuffer *, FILE *); +static long readline_internal (linebuffer *, FILE *); +static bool nocase_tail (char *); +static void get_tag (char *, char **); -static void analyse_regex __P((char *)); -static void free_regexps __P((void)); -static void regex_tag_multiline __P((void)); -static void error __P((const char *, const char *)); -static void suggest_asking_for_help __P((void)); -void fatal __P((char *, char *)); -static void pfatal __P((char *)); -static void add_node __P((node *, node **)); +static void analyse_regex (char *); +static void free_regexps (void); +static void regex_tag_multiline (void); +static void error (const char *, const char *); +static void suggest_asking_for_help (void); +void fatal (char *, char *); +static void pfatal (char *); +static void add_node (node *, node **); -static void init __P((void)); -static void process_file_name __P((char *, language *)); -static void process_file __P((FILE *, char *, language *)); -static void find_entries __P((FILE *)); -static void free_tree __P((node *)); -static void free_fdesc __P((fdesc *)); -static void pfnote __P((char *, bool, char *, int, int, long)); -static void make_tag __P((char *, int, bool, char *, int, int, long)); -static void invalidate_nodes __P((fdesc *, node **)); -static void put_entries __P((node *)); +static void init (void); +static void process_file_name (char *, language *); +static void process_file (FILE *, char *, language *); +static void find_entries (FILE *); +static void free_tree (node *); +static void free_fdesc (fdesc *); +static void pfnote (char *, bool, char *, int, int, long); +static void make_tag (char *, int, bool, char *, int, int, long); +static void invalidate_nodes (fdesc *, node **); +static void put_entries (node *); -static char *concat __P((char *, char *, char *)); -static char *skip_spaces __P((char *)); -static char *skip_non_spaces __P((char *)); -static char *savenstr __P((char *, int)); -static char *savestr __P((char *)); -static char *etags_strchr __P((const char *, int)); -static char *etags_strrchr __P((const char *, int)); -static int etags_strcasecmp __P((const char *, const char *)); -static int etags_strncasecmp __P((const char *, const char *, int)); -static char *etags_getcwd __P((void)); -static char *relative_filename __P((char *, char *)); -static char *absolute_filename __P((char *, char *)); -static char *absolute_dirname __P((char *, char *)); -static bool filename_is_absolute __P((char *f)); -static void canonicalize_filename __P((char *)); -static void linebuffer_init __P((linebuffer *)); -static void linebuffer_setlen __P((linebuffer *, int)); -static PTR xmalloc __P((unsigned int)); -static PTR xrealloc __P((char *, unsigned int)); +static char *concat (char *, char *, char *); +static char *skip_spaces (char *); +static char *skip_non_spaces (char *); +static char *savenstr (char *, int); +static char *savestr (char *); +static char *etags_strchr (const char *, int); +static char *etags_strrchr (const char *, int); +static int etags_strcasecmp (const char *, const char *); +static int etags_strncasecmp (const char *, const char *, int); +static char *etags_getcwd (void); +static char *relative_filename (char *, char *); +static char *absolute_filename (char *, char *); +static char *absolute_dirname (char *, char *); +static bool filename_is_absolute (char *f); +static void canonicalize_filename (char *); +static void linebuffer_init (linebuffer *); +static void linebuffer_setlen (linebuffer *, int); +static PTR xmalloc (unsigned int); +static PTR xrealloc (char *, unsigned int); static char searchar = '/'; /* use /.../ searches */ @@ -853,7 +848,7 @@ static language lang_names [] = static void -print_language_names () +print_language_names (void) { language *lang; char **name, **ext; @@ -892,7 +887,7 @@ etags --help --lang=ada."); # define VERSION "17.38.1.4" #endif static void -print_version () +print_version (void) { /* Makes it easier to update automatically. */ char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; @@ -909,8 +904,7 @@ print_version () #endif static void -print_help (argbuffer) - argument *argbuffer; +print_help (argument *argbuffer) { bool help_for_lang = FALSE; @@ -1087,9 +1081,7 @@ Relative ones are stored relative to the output file's directory.\n"); int -main (argc, argv) - int argc; - char *argv[]; +main (int argc, char **argv) { int i; unsigned int nincluded_files; @@ -1414,9 +1406,7 @@ main (argc, argv) * Idea by Vladimir Alexiev (1998) */ static compressor * -get_compressor_from_suffix (file, extptr) - char *file; - char **extptr; +get_compressor_from_suffix (char *file, char **extptr) { compressor *compr; char *slash, *suffix; @@ -1452,8 +1442,7 @@ get_compressor_from_suffix (file, extptr) * Return a language given the name. */ static language * -get_language_from_langname (name) - const char *name; +get_language_from_langname (const char *name) { language *lang; @@ -1475,8 +1464,7 @@ get_language_from_langname (name) * Return a language given the interpreter name. */ static language * -get_language_from_interpreter (interpreter) - char *interpreter; +get_language_from_interpreter (char *interpreter) { language *lang; char **iname; @@ -1498,9 +1486,7 @@ get_language_from_interpreter (interpreter) * Return a language given the file name. */ static language * -get_language_from_filename (file, case_sensitive) - char *file; - bool case_sensitive; +get_language_from_filename (char *file, int case_sensitive) { language *lang; char **name, **ext, *suffix; @@ -1534,9 +1520,7 @@ get_language_from_filename (file, case_sensitive) * This routine is called on each file argument. */ static void -process_file_name (file, lang) - char *file; - language *lang; +process_file_name (char *file, language *lang) { struct stat stat_buf; FILE *inf; @@ -1658,10 +1642,7 @@ process_file_name (file, lang) } static void -process_file (fh, fn, lang) - FILE *fh; - char *fn; - language *lang; +process_file (FILE *fh, char *fn, language *lang) { static const fdesc emptyfdesc; fdesc *fdp; @@ -1738,7 +1719,7 @@ process_file (fh, fn, lang) * of a char is TRUE if it is the string "white", else FALSE. */ static void -init () +init (void) { register char *sp; register int i; @@ -1761,8 +1742,7 @@ init () * which finds the function and type definitions. */ static void -find_entries (inf) - FILE *inf; +find_entries (FILE *inf) { char *cp; language *lang = curfdp->lang; @@ -1920,14 +1900,14 @@ find_entries (inf) * etags.el needs to use the same characters that are in NONAM. */ static void -make_tag (name, namelen, is_func, linestart, linelen, lno, cno) - char *name; /* tag name, or NULL if unnamed */ - int namelen; /* tag length */ - bool is_func; /* tag is a function */ - char *linestart; /* start of the line where tag is */ - int linelen; /* length of the line where tag is */ - int lno; /* line number */ - long cno; /* character number */ +make_tag (char *name, int namelen, int is_func, char *linestart, int linelen, int lno, long int cno) + /* tag name, or NULL if unnamed */ + /* tag length */ + /* tag is a function */ + /* start of the line where tag is */ + /* length of the line where tag is */ + /* line number */ + /* character number */ { bool named = (name != NULL && namelen > 0); @@ -1963,13 +1943,13 @@ make_tag (name, namelen, is_func, linestart, linelen, lno, cno) /* Record a tag. */ static void -pfnote (name, is_func, linestart, linelen, lno, cno) - char *name; /* tag name, or NULL if unnamed */ - bool is_func; /* tag is a function */ - char *linestart; /* start of the line where tag is */ - int linelen; /* length of the line where tag is */ - int lno; /* line number */ - long cno; /* character number */ +pfnote (char *name, int is_func, char *linestart, int linelen, int lno, long int cno) + /* tag name, or NULL if unnamed */ + /* tag is a function */ + /* start of the line where tag is */ + /* length of the line where tag is */ + /* line number */ + /* character number */ { register node *np; @@ -2023,8 +2003,7 @@ pfnote (name, is_func, linestart, linelen, lno, cno) * recurse on left children, iterate on right children. */ static void -free_tree (np) - register node *np; +free_tree (register node *np) { while (np) { @@ -2042,8 +2021,7 @@ free_tree (np) * delete a file description */ static void -free_fdesc (fdp) - register fdesc *fdp; +free_fdesc (register fdesc *fdp) { free (fdp->infname); free (fdp->infabsname); @@ -2063,8 +2041,7 @@ free_fdesc (fdp) * maintain state. */ static void -add_node (np, cur_node_p) - node *np, **cur_node_p; +add_node (node *np, node **cur_node_p) { register int dif; register node *cur_node = *cur_node_p; @@ -2144,9 +2121,7 @@ add_node (np, cur_node_p) * given file description (CTAGS case) or free them (ETAGS case). */ static void -invalidate_nodes (badfdp, npp) - fdesc *badfdp; - node **npp; +invalidate_nodes (fdesc *badfdp, node **npp) { node *np = *npp; @@ -2178,13 +2153,12 @@ invalidate_nodes (badfdp, npp) } -static int total_size_of_entries __P((node *)); -static int number_len __P((long)); +static int total_size_of_entries (node *); +static int number_len (long); /* Length of a non-negative number's decimal representation. */ static int -number_len (num) - long num; +number_len (long int num) { int len = 1; while ((num /= 10) > 0) @@ -2199,8 +2173,7 @@ number_len (num) * but is still supplied for backward compatibility. */ static int -total_size_of_entries (np) - register node *np; +total_size_of_entries (register node *np) { register int total = 0; @@ -2220,8 +2193,7 @@ total_size_of_entries (np) } static void -put_entries (np) - register node *np; +put_entries (register node *np) { register char *sp; static fdesc *fdp = NULL; @@ -2330,9 +2302,9 @@ enum sym_type st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef }; -static unsigned int hash __P((const char *, unsigned int)); -static struct C_stab_entry * in_word_set __P((const char *, unsigned int)); -static enum sym_type C_symtype __P((char *, int, int)); +static unsigned int hash (const char *, unsigned int); +static struct C_stab_entry * in_word_set (const char *, unsigned int); +static enum sym_type C_symtype (char *, int, int); /* Feed stuff between (but not including) %[ and %] lines to: gperf -m 5 @@ -2400,9 +2372,7 @@ inline #endif #endif static unsigned int -hash (str, len) - register const char *str; - register unsigned int len; +hash (register const char *str, register unsigned int len) { static unsigned char asso_values[] = { @@ -2448,9 +2418,7 @@ hash (str, len) } static struct C_stab_entry * -in_word_set (str, len) - register const char *str; - register unsigned int len; +in_word_set (register const char *str, register unsigned int len) { enum { @@ -2516,10 +2484,7 @@ in_word_set (str, len) /*%>*/ static enum sym_type -C_symtype (str, len, c_ext) - char *str; - int len; - int c_ext; +C_symtype (char *str, int len, int c_ext) { register struct C_stab_entry *se = in_word_set (str, len); @@ -2646,9 +2611,9 @@ static struct tok * Variables and functions for dealing with nested structures. * Idea by Mykola Dzyuba (2001) */ -static void pushclass_above __P((int, char *, int)); -static void popclass_above __P((int)); -static void write_classname __P((linebuffer *, char *qualifier)); +static void pushclass_above (int, char *, int); +static void popclass_above (int); +static void write_classname (linebuffer *, char *qualifier); static struct { char **cname; /* nested class names */ @@ -2663,10 +2628,7 @@ static struct { && bracelev == cstack.bracelev[nestlev-1] + 1) static void -pushclass_above (bracelev, str, len) - int bracelev; - char *str; - int len; +pushclass_above (int bracelev, char *str, int len) { int nl; @@ -2685,8 +2647,7 @@ pushclass_above (bracelev, str, len) } static void -popclass_above (bracelev) - int bracelev; +popclass_above (int bracelev) { int nl; @@ -2700,9 +2661,7 @@ popclass_above (bracelev) } static void -write_classname (cn, qualifier) - linebuffer *cn; - char *qualifier; +write_classname (linebuffer *cn, char *qualifier) { int i, len; int qlen = strlen (qualifier); @@ -2736,8 +2695,8 @@ write_classname (cn, qualifier) } -static bool consider_token __P((char *, int, int, int *, int, int, bool *)); -static void make_C_tag __P((bool)); +static bool consider_token (char *, int, int, int *, int, int, bool *); +static void make_C_tag (bool); /* * consider_token () @@ -2757,14 +2716,14 @@ static void make_C_tag __P((bool)); */ static bool -consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var) - register char *str; /* IN: token pointer */ - register int len; /* IN: token length */ - register int c; /* IN: first char after the token */ - int *c_extp; /* IN, OUT: C extensions mask */ - int bracelev; /* IN: brace level */ - int parlev; /* IN: parenthesis level */ - bool *is_func_or_var; /* OUT: function or variable found */ +consider_token (register char *str, register int len, register int c, int *c_extp, int bracelev, int parlev, int *is_func_or_var) + /* IN: token pointer */ + /* IN: token length */ + /* IN: first char after the token */ + /* IN, OUT: C extensions mask */ + /* IN: brace level */ + /* IN: parenthesis level */ + /* OUT: function or variable found */ { /* When structdef is stagseen, scolonseen, or snone with bracelev > 0, structtype is the type of the preceding struct-like keyword, and @@ -3098,8 +3057,7 @@ do { \ static void -make_C_tag (isfun) - bool isfun; +make_C_tag (int isfun) { /* This function is never called when token.valid is FALSE, but we must protect against invalid input or internal errors. */ @@ -3125,9 +3083,9 @@ make_C_tag (isfun) * C syntax and adds them to the list. */ static void -C_entries (c_ext, inf) - int c_ext; /* extension of C */ - FILE *inf; /* input file */ +C_entries (int c_ext, FILE *inf) + /* extension of C */ + /* input file */ { register char c; /* latest char read; '\0' for end of line */ register char *lp; /* pointer one beyond the character `c' */ @@ -3957,48 +3915,42 @@ C_entries (c_ext, inf) * of a global flag. */ static void -default_C_entries (inf) - FILE *inf; +default_C_entries (FILE *inf) { C_entries (cplusplus ? C_PLPL : C_AUTO, inf); } /* Always do plain C. */ static void -plain_C_entries (inf) - FILE *inf; +plain_C_entries (FILE *inf) { C_entries (0, inf); } /* Always do C++. */ static void -Cplusplus_entries (inf) - FILE *inf; +Cplusplus_entries (FILE *inf) { C_entries (C_PLPL, inf); } /* Always do Java. */ static void -Cjava_entries (inf) - FILE *inf; +Cjava_entries (FILE *inf) { C_entries (C_JAVA, inf); } /* Always do C*. */ static void -Cstar_entries (inf) - FILE *inf; +Cstar_entries (FILE *inf) { C_entries (C_STAR, inf); } /* Always do Yacc. */ static void -Yacc_entries (inf) - FILE *inf; +Yacc_entries (FILE *inf) { C_entries (YACC, inf); } @@ -4031,8 +3983,7 @@ Yacc_entries (inf) * matching on files that have no language defined. */ static void -just_read_file (inf) - FILE *inf; +just_read_file (FILE *inf) { register char *dummy; @@ -4043,11 +3994,11 @@ just_read_file (inf) /* Fortran parsing */ -static void F_takeprec __P((void)); -static void F_getit __P((FILE *)); +static void F_takeprec (void); +static void F_getit (FILE *); static void -F_takeprec () +F_takeprec (void) { dbp = skip_spaces (dbp); if (*dbp != '*') @@ -4070,8 +4021,7 @@ F_takeprec () } static void -F_getit (inf) - FILE *inf; +F_getit (FILE *inf) { register char *cp; @@ -4095,8 +4045,7 @@ F_getit (inf) static void -Fortran_functions (inf) - FILE *inf; +Fortran_functions (FILE *inf) { LOOP_ON_INPUT_LINES (inf, lb, dbp) { @@ -4178,14 +4127,12 @@ Fortran_functions (inf) * Philippe Waroquiers (1998) */ -static void Ada_getit __P((FILE *, char *)); +static void Ada_getit (FILE *, char *); /* Once we are positioned after an "interesting" keyword, let's get the real tag value necessary. */ static void -Ada_getit (inf, name_qualifier) - FILE *inf; - char *name_qualifier; +Ada_getit (FILE *inf, char *name_qualifier) { register char *cp; char *name; @@ -4248,8 +4195,7 @@ Ada_getit (inf, name_qualifier) } static void -Ada_funcs (inf) - FILE *inf; +Ada_funcs (FILE *inf) { bool inquote = FALSE; bool skip_till_semicolumn = FALSE; @@ -4362,8 +4308,7 @@ Ada_funcs (inf) * Idea by Bob Weiner, Motorola Inc. (1994) */ static void -Asm_labels (inf) - FILE *inf; +Asm_labels (FILE *inf) { register char *cp; @@ -4395,8 +4340,7 @@ Asm_labels (inf) * Ideas by Kai Grojohann (2001) */ static void -Perl_functions (inf) - FILE *inf; +Perl_functions (FILE *inf) { char *package = savestr ("main"); /* current package name */ register char *cp; @@ -4478,8 +4422,7 @@ Perl_functions (inf) * More ideas by seb bacon (2002) */ static void -Python_functions (inf) - FILE *inf; +Python_functions (FILE *inf) { register char *cp; @@ -4509,8 +4452,7 @@ Python_functions (inf) * Idea by Diez B. Roggisch (2001) */ static void -PHP_functions (inf) - FILE *inf; +PHP_functions (FILE *inf) { register char *cp, *name; bool search_identifier = FALSE; @@ -4589,8 +4531,7 @@ PHP_functions (inf) * Idea by Corny de Souza (1993) */ static void -Cobol_paragraphs (inf) - FILE *inf; +Cobol_paragraphs (FILE *inf) { register char *bp, *ep; @@ -4618,8 +4559,7 @@ Cobol_paragraphs (inf) * Ideas by Assar Westerlund (2001) */ static void -Makefile_targets (inf) - FILE *inf; +Makefile_targets (FILE *inf) { register char *bp; @@ -4654,8 +4594,7 @@ Makefile_targets (inf) * the tag is skipped. */ static void -Pascal_functions (inf) - FILE *inf; +Pascal_functions (FILE *inf) { linebuffer tline; /* mostly copied from C_entries */ long save_lcno; @@ -4832,10 +4771,10 @@ Pascal_functions (inf) * look for (def or (DEF, quote or QUOTE */ -static void L_getit __P((void)); +static void L_getit (void); static void -L_getit () +L_getit (void) { if (*dbp == '\'') /* Skip prefix quote */ dbp++; @@ -4851,8 +4790,7 @@ L_getit () } static void -Lisp_functions (inf) - FILE *inf; +Lisp_functions (FILE *inf) { LOOP_ON_INPUT_LINES (inf, lb, dbp) { @@ -4896,8 +4834,7 @@ Lisp_functions (inf) * "function" and "local function" are tags if they start at column 1. */ static void -Lua_functions (inf) - FILE *inf; +Lua_functions (FILE *inf) { register char *bp; @@ -4923,8 +4860,7 @@ Lua_functions (inf) * Masatake Yamato (1999) */ static void -PS_functions (inf) - FILE *inf; +PS_functions (FILE *inf) { register char *bp, *ep; @@ -4954,8 +4890,7 @@ PS_functions (inf) * Ideas by Eduardo Horvath (2004) */ static void -Forth_words (inf) - FILE *inf; +Forth_words (FILE *inf) { register char *bp; @@ -4991,8 +4926,7 @@ Forth_words (inf) * Original code by Ken Haase (1985?) */ static void -Scheme_functions (inf) - FILE *inf; +Scheme_functions (FILE *inf) { register char *bp; @@ -5032,8 +4966,8 @@ static char *TEX_defenv = "\ :part:appendix:entry:index:def\ :newcommand:renewcommand:newenvironment:renewenvironment"; -static void TEX_mode __P((FILE *)); -static void TEX_decode_env __P((char *, char *)); +static void TEX_mode (FILE *); +static void TEX_decode_env (char *, char *); static char TEX_esc = '\\'; static char TEX_opgrp = '{'; @@ -5043,8 +4977,7 @@ static char TEX_clgrp = '}'; * TeX/LaTeX scanning loop. */ static void -TeX_commands (inf) - FILE *inf; +TeX_commands (FILE *inf) { char *cp; linebuffer *key; @@ -5108,8 +5041,7 @@ TeX_commands (inf) /* Figure out whether TeX's escapechar is '\\' or '!' and set grouping chars accordingly. */ static void -TEX_mode (inf) - FILE *inf; +TEX_mode (FILE *inf) { int c; @@ -5143,9 +5075,7 @@ TEX_mode (inf) /* Read environment and prepend it to the default string. Build token table. */ static void -TEX_decode_env (evarname, defenv) - char *evarname; - char *defenv; +TEX_decode_env (char *evarname, char *defenv) { register char *env, *p; int i, len; @@ -5193,8 +5123,7 @@ TEX_decode_env (evarname, defenv) /* Texinfo support. Dave Love, Mar. 2000. */ static void -Texinfo_nodes (inf) - FILE * inf; +Texinfo_nodes (FILE *inf) { char *cp, *start; LOOP_ON_INPUT_LINES (inf, lb, cp) @@ -5217,8 +5146,7 @@ Texinfo_nodes (inf) * Francesco Potort, 2002. */ static void -HTML_labels (inf) - FILE * inf; +HTML_labels (FILE *inf) { bool getnext = FALSE; /* next text outside of HTML tags is a tag */ bool skiptag = FALSE; /* skip to the end of the current HTML tag */ @@ -5338,13 +5266,12 @@ HTML_labels (inf) * Original code by Sunichirou Sugou (1989) * Rewritten by Anders Lindgren (1996) */ -static int prolog_pr __P((char *, char *)); -static void prolog_skip_comment __P((linebuffer *, FILE *)); -static int prolog_atom __P((char *, int)); +static int prolog_pr (char *, char *); +static void prolog_skip_comment (linebuffer *, FILE *); +static int prolog_atom (char *, int); static void -Prolog_functions (inf) - FILE *inf; +Prolog_functions (FILE *inf) { char *cp, *last; int len; @@ -5380,9 +5307,7 @@ Prolog_functions (inf) static void -prolog_skip_comment (plb, inf) - linebuffer *plb; - FILE *inf; +prolog_skip_comment (linebuffer *plb, FILE *inf) { char *cp; @@ -5408,9 +5333,9 @@ prolog_skip_comment (plb, inf) * header was found. */ static int -prolog_pr (s, last) - char *s; - char *last; /* Name of last clause. */ +prolog_pr (char *s, char *last) + + /* Name of last clause. */ { int pos; int len; @@ -5446,9 +5371,7 @@ prolog_pr (s, last) * Backslash quotes everything. */ static int -prolog_atom (s, pos) - char *s; - int pos; +prolog_atom (char *s, int pos) { int origpos; @@ -5503,13 +5426,12 @@ prolog_atom (s, pos) * Assumes that Erlang functions start at column 0. * Original code by Anders Lindgren (1996) */ -static int erlang_func __P((char *, char *)); -static void erlang_attribute __P((char *)); -static int erlang_atom __P((char *)); +static int erlang_func (char *, char *); +static void erlang_attribute (char *); +static int erlang_atom (char *); static void -Erlang_functions (inf) - FILE *inf; +Erlang_functions (FILE *inf) { char *cp, *last; int len; @@ -5568,9 +5490,9 @@ Erlang_functions (inf) * was found. */ static int -erlang_func (s, last) - char *s; - char *last; /* Name of last clause. */ +erlang_func (char *s, char *last) + + /* Name of last clause. */ { int pos; int len; @@ -5606,8 +5528,7 @@ erlang_func (s, last) * -record(graph, {vtab = notable, cyclic = true}). */ static void -erlang_attribute (s) - char *s; +erlang_attribute (char *s) { char *cp = s; @@ -5627,8 +5548,7 @@ erlang_attribute (s) * Return the number of bytes consumed, or -1 if there was an error. */ static int -erlang_atom (s) - char *s; +erlang_atom (char *s) { int pos = 0; @@ -5652,9 +5572,9 @@ erlang_atom (s) } -static char *scan_separators __P((char *)); -static void add_regex __P((char *, language *)); -static char *substitute __P((char *, char *, struct re_registers *)); +static char *scan_separators (char *); +static void add_regex (char *, language *); +static char *substitute (char *, char *, struct re_registers *); /* * Take a string like "/blah/" and turn it into "blah", verifying @@ -5666,8 +5586,7 @@ static char *substitute __P((char *, char *, struct re_registers *)); * unterminated regexps. */ static char * -scan_separators (name) - char *name; +scan_separators (char *name) { char sep = name[0]; char *copyto = name; @@ -5719,8 +5638,7 @@ scan_separators (name) /* Look at the argument of --regex or --no-regex and do the right thing. Same for each line of a regexp file. */ static void -analyse_regex (regex_arg) - char *regex_arg; +analyse_regex (char *regex_arg) { if (regex_arg == NULL) { @@ -5791,9 +5709,7 @@ analyse_regex (regex_arg) /* Separate the regexp pattern, compile it, and care for optional name and modifiers. */ static void -add_regex (regexp_pattern, lang) - char *regexp_pattern; - language *lang; +add_regex (char *regexp_pattern, language *lang) { static struct re_pattern_buffer zeropattern; char sep, *pat, *name, *modifiers; @@ -5910,9 +5826,7 @@ add_regex (regexp_pattern, lang) * arguments. */ static char * -substitute (in, out, regs) - char *in, *out; - struct re_registers *regs; +substitute (char *in, char *out, struct re_registers *regs) { char *result, *t; int size, dig, diglen; @@ -5959,7 +5873,7 @@ substitute (in, out, regs) /* Deallocate all regexps. */ static void -free_regexps () +free_regexps (void) { regexp *rp; while (p_head != NULL) @@ -5981,7 +5895,7 @@ free_regexps () * Idea by Ben Wing (2002). */ static void -regex_tag_multiline () +regex_tag_multiline (void) { char *buffer = filebuf.buffer; regexp *rp; @@ -6058,8 +5972,7 @@ regex_tag_multiline () static bool -nocase_tail (cp) - char *cp; +nocase_tail (char *cp) { register int len = 0; @@ -6074,9 +5987,7 @@ nocase_tail (cp) } static void -get_tag (bp, namepp) - register char *bp; - char **namepp; +get_tag (register char *bp, char **namepp) { register char *cp = bp; @@ -6107,9 +6018,7 @@ get_tag (bp, namepp) * appended to `filebuf'. */ static long -readline_internal (lbp, stream) - linebuffer *lbp; - register FILE *stream; +readline_internal (linebuffer *lbp, register FILE *stream) { char *buffer = lbp->buffer; register char *p = lbp->buffer; @@ -6187,9 +6096,7 @@ readline_internal (lbp, stream) * directives. */ static void -readline (lbp, stream) - linebuffer *lbp; - FILE *stream; +readline (linebuffer *lbp, FILE *stream) { long result; @@ -6382,8 +6289,7 @@ readline (lbp, stream) * with xnew where the string CP has been copied. */ static char * -savestr (cp) - char *cp; +savestr (char *cp) { return savenstr (cp, strlen (cp)); } @@ -6393,9 +6299,7 @@ savestr (cp) * the string CP has been copied for at most the first LEN characters. */ static char * -savenstr (cp, len) - char *cp; - int len; +savenstr (char *cp, int len) { register char *dp; @@ -6412,9 +6316,7 @@ savenstr (cp, len) * Identical to POSIX strrchr, included for portability. */ static char * -etags_strrchr (sp, c) - register const char *sp; - register int c; +etags_strrchr (register const char *sp, register int c) { register const char *r; @@ -6434,9 +6336,7 @@ etags_strrchr (sp, c) * Identical to POSIX strchr, included for portability. */ static char * -etags_strchr (sp, c) - register const char *sp; - register int c; +etags_strchr (register const char *sp, register int c) { do { @@ -6452,9 +6352,7 @@ etags_strchr (sp, c) * Same as BSD's strcasecmp, included for portability. */ static int -etags_strcasecmp (s1, s2) - register const char *s1; - register const char *s2; +etags_strcasecmp (register const char *s1, register const char *s2) { while (*s1 != '\0' && (ISALPHA (*s1) && ISALPHA (*s2) @@ -6474,10 +6372,7 @@ etags_strcasecmp (s1, s2) * Same as BSD's strncasecmp, included for portability. */ static int -etags_strncasecmp (s1, s2, n) - register const char *s1; - register const char *s2; - register int n; +etags_strncasecmp (register const char *s1, register const char *s2, register int n) { while (*s1 != '\0' && n-- > 0 && (ISALPHA (*s1) && ISALPHA (*s2) @@ -6495,8 +6390,7 @@ etags_strncasecmp (s1, s2, n) /* Skip spaces (end of string is not space), return new pointer. */ static char * -skip_spaces (cp) - char *cp; +skip_spaces (char *cp) { while (iswhite (*cp)) cp++; @@ -6505,8 +6399,7 @@ skip_spaces (cp) /* Skip non spaces, except end of string, return new pointer. */ static char * -skip_non_spaces (cp) - char *cp; +skip_non_spaces (char *cp) { while (*cp != '\0' && !iswhite (*cp)) cp++; @@ -6515,23 +6408,21 @@ skip_non_spaces (cp) /* Print error message and exit. */ void -fatal (s1, s2) - char *s1, *s2; +fatal (char *s1, char *s2) { error (s1, s2); exit (EXIT_FAILURE); } static void -pfatal (s1) - char *s1; +pfatal (char *s1) { perror (s1); exit (EXIT_FAILURE); } static void -suggest_asking_for_help () +suggest_asking_for_help (void) { fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", progname, NO_LONG_OPTIONS ? "-h" : "--help"); @@ -6540,8 +6431,7 @@ suggest_asking_for_help () /* Print error message. `s1' is printf control string, `s2' is arg for it. */ static void -error (s1, s2) - const char *s1, *s2; +error (const char *s1, const char *s2) { fprintf (stderr, "%s: ", progname); fprintf (stderr, s1, s2); @@ -6551,8 +6441,7 @@ error (s1, s2) /* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */ static char * -concat (s1, s2, s3) - char *s1, *s2, *s3; +concat (char *s1, char *s2, char *s3) { int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); char *result = xnew (len1 + len2 + len3 + 1, char); @@ -6569,7 +6458,7 @@ concat (s1, s2, s3) /* Does the same work as the system V getcwd, but does not need to guess the buffer size in advance. */ static char * -etags_getcwd () +etags_getcwd (void) { #ifdef HAVE_GETCWD int bufsize = 200; @@ -6619,8 +6508,7 @@ etags_getcwd () /* Return a newly allocated string containing the file name of FILE relative to the absolute directory DIR (which should end with a slash). */ static char * -relative_filename (file, dir) - char *file, *dir; +relative_filename (char *file, char *dir) { char *fp, *dp, *afn, *res; int i; @@ -6659,8 +6547,7 @@ relative_filename (file, dir) /* Return a newly allocated string containing the absolute file name of FILE given DIR (which should end with a slash). */ static char * -absolute_filename (file, dir) - char *file, *dir; +absolute_filename (char *file, char *dir) { char *slashp, *cp, *res; @@ -6733,8 +6620,7 @@ absolute_filename (file, dir) file name of dir where FILE resides given DIR (which should end with a slash). */ static char * -absolute_dirname (file, dir) - char *file, *dir; +absolute_dirname (char *file, char *dir) { char *slashp, *res; char save; @@ -6753,8 +6639,7 @@ absolute_dirname (file, dir) /* Whether the argument string is an absolute file name. The argument string must have been canonicalized with canonicalize_filename. */ static bool -filename_is_absolute (fn) - char *fn; +filename_is_absolute (char *fn) { return (fn[0] == '/' #ifdef DOS_NT @@ -6766,8 +6651,7 @@ filename_is_absolute (fn) /* Upcase DOS drive letter and collapse separators into single slashes. Works in place. */ static void -canonicalize_filename (fn) - register char *fn; +canonicalize_filename (register char *fn) { register char* cp; char sep = '/'; @@ -6796,8 +6680,7 @@ canonicalize_filename (fn) /* Initialize a linebuffer for use. */ static void -linebuffer_init (lbp) - linebuffer *lbp; +linebuffer_init (linebuffer *lbp) { lbp->size = (DEBUG) ? 3 : 200; lbp->buffer = xnew (lbp->size, char); @@ -6807,9 +6690,7 @@ linebuffer_init (lbp) /* Set the minimum size of a string contained in a linebuffer. */ static void -linebuffer_setlen (lbp, toksize) - linebuffer *lbp; - int toksize; +linebuffer_setlen (linebuffer *lbp, int toksize) { while (lbp->size <= toksize) { @@ -6821,8 +6702,7 @@ linebuffer_setlen (lbp, toksize) /* Like malloc but get fatal error if memory is exhausted. */ static PTR -xmalloc (size) - unsigned int size; +xmalloc (unsigned int size) { PTR result = (PTR) malloc (size); if (result == NULL) @@ -6831,9 +6711,7 @@ xmalloc (size) } static PTR -xrealloc (ptr, size) - char *ptr; - unsigned int size; +xrealloc (char *ptr, unsigned int size) { PTR result = (PTR) realloc (ptr, size); if (result == NULL) diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c index f98fb749476..f4d978b7d11 100644 --- a/lib-src/fakemail.c +++ b/lib-src/fakemail.c @@ -100,7 +100,7 @@ typedef struct header_record *header; struct stream_record { FILE *handle; - int (*action)(); + int (*action)(FILE *); struct stream_record *rest_streams; }; typedef struct stream_record *stream_list; @@ -147,8 +147,8 @@ static line_list file_preface; static stream_list the_streams; static boolean no_problems = true; -extern FILE *popen (); -extern int fclose (), pclose (); +extern FILE *popen (const char *, const char *); +extern int fclose (FILE *), pclose (FILE *); #ifdef CURRENT_USER extern struct passwd *getpwuid (); @@ -164,8 +164,7 @@ static struct passwd *my_entry; /* Print error message. `s1' is printf control string, `s2' is arg for it. */ static void -error (s1, s2) - char *s1, *s2; +error (char *s1, char *s2) { printf ("%s: ", my_name); printf (s1, s2); @@ -176,8 +175,7 @@ error (s1, s2) /* Print error message and exit. */ static void -fatal (s1) - char *s1; +fatal (char *s1) { error ("%s", s1); exit (EXIT_FAILURE); @@ -186,8 +184,7 @@ fatal (s1) /* Like malloc but get fatal error if memory is exhausted. */ static long * -xmalloc (size) - int size; +xmalloc (int size) { long *result = (long *) malloc (((unsigned) size)); if (result == ((long *) NULL)) @@ -196,9 +193,7 @@ xmalloc (size) } static long * -xrealloc (ptr, size) - long *ptr; - int size; +xrealloc (long int *ptr, int size) { long *result = (long *) realloc (ptr, ((unsigned) size)); if (result == ((long *) NULL)) @@ -209,8 +204,7 @@ xrealloc (ptr, size) /* Initialize a linebuffer for use */ void -init_linebuffer (linebuffer) - struct linebuffer *linebuffer; +init_linebuffer (struct linebuffer *linebuffer) { linebuffer->size = INITIAL_LINE_SIZE; linebuffer->buffer = ((char *) xmalloc (INITIAL_LINE_SIZE)); @@ -220,9 +214,7 @@ init_linebuffer (linebuffer) Return the length of the line. */ long -readline (linebuffer, stream) - struct linebuffer *linebuffer; - FILE *stream; +readline (struct linebuffer *linebuffer, FILE *stream) { char *buffer = linebuffer->buffer; char *p = linebuffer->buffer; @@ -257,9 +249,7 @@ readline (linebuffer, stream) If there is no keyword, return NULL and don't alter *REST. */ char * -get_keyword (field, rest) - register char *field; - char **rest; +get_keyword (register char *field, char **rest) { static char keyword[KEYWORD_SIZE]; register char *ptr; @@ -284,8 +274,7 @@ get_keyword (field, rest) /* Nonzero if the string FIELD starts with a colon-terminated keyword. */ boolean -has_keyword (field) - char *field; +has_keyword (char *field) { char *ignored; return (get_keyword (field, &ignored) != ((char *) NULL)); @@ -302,9 +291,7 @@ has_keyword (field) the caller has to make it big enough. */ char * -add_field (the_list, field, where) - line_list the_list; - register char *field, *where; +add_field (line_list the_list, register char *field, register char *where) { register char c; while (true) @@ -360,7 +347,7 @@ add_field (the_list, field, where) } line_list -make_file_preface () +make_file_preface (void) { char *the_string, *temp; long idiotic_interface; @@ -404,9 +391,7 @@ make_file_preface () } void -write_line_list (the_list, the_stream) - register line_list the_list; - FILE *the_stream; +write_line_list (register line_list the_list, FILE *the_stream) { for ( ; the_list != ((line_list) NULL) ; @@ -419,7 +404,7 @@ write_line_list (the_list, the_stream) } int -close_the_streams () +close_the_streams (void) { register stream_list rem; for (rem = the_streams; @@ -432,9 +417,7 @@ close_the_streams () } void -add_a_stream (the_stream, closing_action) - FILE *the_stream; - int (*closing_action)(); +add_a_stream (FILE *the_stream, int (*closing_action) (FILE *)) { stream_list old = the_streams; the_streams = new_stream (); @@ -445,8 +428,7 @@ add_a_stream (the_stream, closing_action) } int -my_fclose (the_file) - FILE *the_file; +my_fclose (FILE *the_file) { putc ('\n', the_file); fflush (the_file); @@ -454,8 +436,7 @@ my_fclose (the_file) } boolean -open_a_file (name) - char *name; +open_a_file (char *name) { FILE *the_stream = fopen (name, "a"); if (the_stream != ((FILE *) NULL)) @@ -470,8 +451,7 @@ open_a_file (name) } void -put_string (s) - char *s; +put_string (char *s) { register stream_list rem; for (rem = the_streams; @@ -482,8 +462,7 @@ put_string (s) } void -put_line (string) - char *string; +put_line (char *string) { register stream_list rem; for (rem = the_streams; @@ -543,9 +522,7 @@ put_line (string) Call open_a_file for each file. */ void -setup_files (the_list, field) - register line_list the_list; - register char *field; +setup_files (register line_list the_list, register char *field) { register char *start; register char c; @@ -581,8 +558,7 @@ setup_files (the_list, field) The result says how big to make the buffer to pass to parse_header. */ int -args_size (the_header) - header the_header; +args_size (header the_header) { register header old = the_header; register line_list rem; @@ -613,9 +589,7 @@ args_size (the_header) Also, if the header has any FCC fields, call setup_files for each one. */ void -parse_header (the_header, where) - header the_header; - register char *where; +parse_header (header the_header, register char *where) { register header old = the_header; do @@ -647,7 +621,7 @@ parse_header (the_header, where) Continuation lines are grouped in the headers they continue. */ header -read_header () +read_header (void) { register header the_header = ((header) NULL); register line_list *next_line = ((line_list *) NULL); @@ -701,8 +675,7 @@ read_header () } void -write_header (the_header) - header the_header; +write_header (header the_header) { register header old = the_header; do @@ -719,9 +692,7 @@ write_header (the_header) } int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { char *command_line; header the_header; @@ -731,7 +702,7 @@ main (argc, argv) register int size; FILE *the_pipe; - extern char *getenv (); + extern char *getenv (const char *); mail_program_name = getenv ("FAKEMAILER"); if (!(mail_program_name && *mail_program_name)) diff --git a/lib-src/hexl.c b/lib-src/hexl.c index 91fadd81f5a..d730cac6814 100644 --- a/lib-src/hexl.c +++ b/lib-src/hexl.c @@ -49,12 +49,10 @@ int base = DEFAULT_BASE, un_flag = FALSE, iso_flag = FALSE, endian = 1; int group_by = DEFAULT_GROUPING; char *progname; -void usage(); +void usage(void); int -main (argc, argv) - int argc; - char *argv[]; +main (int argc, char **argv) { register long address; char string[18]; @@ -278,7 +276,7 @@ main (argc, argv) } void -usage () +usage (void) { fprintf (stderr, "usage: %s [-de] [-iso]\n", progname); exit (EXIT_FAILURE); diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index eb15342ca5b..51c30f91d8f 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -67,9 +67,9 @@ along with GNU Emacs. If not, see . */ #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP) #endif -int scan_file (); -int scan_lisp_file (); -int scan_c_file (); +int scan_file (char *filename); +int scan_lisp_file (char *filename, char *mode); +int scan_c_file (char *filename, char *mode); #ifdef MSDOS /* s/msdos.h defines this as sys_chdir, but we're not linking with the @@ -91,8 +91,7 @@ char *progname; /* VARARGS1 */ void -error (s1, s2) - char *s1, *s2; +error (char *s1, char *s2) { fprintf (stderr, "%s: ", progname); fprintf (stderr, s1, s2); @@ -103,8 +102,7 @@ error (s1, s2) /* VARARGS1 */ void -fatal (s1, s2) - char *s1, *s2; +fatal (char *s1, char *s2) { error (s1, s2); exit (EXIT_FAILURE); @@ -113,8 +111,7 @@ fatal (s1, s2) /* Like malloc but get fatal error if memory is exhausted. */ void * -xmalloc (size) - unsigned int size; +xmalloc (unsigned int size) { void *result = (void *) malloc (size); if (result == NULL) @@ -123,9 +120,7 @@ xmalloc (size) } int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int i; int err_count = 0; @@ -187,8 +182,7 @@ main (argc, argv) /* Add a source file name boundary marker in the output file. */ void -put_filename (filename) - char *filename; +put_filename (char *filename) { char *tmp; @@ -207,8 +201,7 @@ put_filename (filename) /* Return 1 if file is not found, 0 if it is found. */ int -scan_file (filename) - char *filename; +scan_file (char *filename) { int len = strlen (filename); @@ -251,9 +244,7 @@ struct rcsoc_state spaces are output first. */ static INLINE void -put_char (ch, state) - int ch; - struct rcsoc_state *state; +put_char (int ch, struct rcsoc_state *state) { int out_ch; do @@ -286,9 +277,7 @@ put_char (ch, state) keyword, but were in fact not. */ static void -scan_keyword_or_put_char (ch, state) - int ch; - struct rcsoc_state *state; +scan_keyword_or_put_char (int ch, struct rcsoc_state *state) { if (state->keyword && *state->cur_keyword_ptr == ch @@ -359,11 +348,7 @@ scan_keyword_or_put_char (ch, state) true if any were encountered. */ int -read_c_string_or_comment (infile, printflag, comment, saw_usage) - FILE *infile; - int printflag; - int *saw_usage; - int comment; +read_c_string_or_comment (FILE *infile, int printflag, int comment, int *saw_usage) { register int c; struct rcsoc_state state; @@ -451,15 +436,12 @@ read_c_string_or_comment (infile, printflag, comment, saw_usage) MINARGS and MAXARGS are the minimum and maximum number of arguments. */ void -write_c_args (out, func, buf, minargs, maxargs) - FILE *out; - char *func, *buf; - int minargs, maxargs; +write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs) { register char *p; int in_ident = 0; - int just_spaced = 0; - int need_space = 1; + char *ident_start; + int ident_length; fprintf (out, "(fn"); @@ -469,9 +451,8 @@ write_c_args (out, func, buf, minargs, maxargs) for (p = buf; *p; p++) { char c = *p; - int ident_start = 0; - /* Notice when we start printing a new identifier. */ + /* Notice when a new identifier starts. */ if ((('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') || ('0' <= c && c <= '9') @@ -481,55 +462,50 @@ write_c_args (out, func, buf, minargs, maxargs) if (!in_ident) { in_ident = 1; - ident_start = 1; - - if (need_space) - putc (' ', out); - - if (minargs == 0 && maxargs > 0) - fprintf (out, "&optional "); - just_spaced = 1; - - minargs--; - maxargs--; + ident_start = p; } else - in_ident = 0; + { + in_ident = 0; + ident_length = p - ident_start; + } } - /* Print the C argument list as it would appear in lisp: - print underscores as hyphens, and print commas and newlines - as spaces. Collapse adjacent spaces into one. */ - if (c == '_') - c = '-'; - else if (c == ',' || c == '\n') - c = ' '; - - /* In C code, `default' is a reserved word, so we spell it - `defalt'; unmangle that here. */ - if (ident_start - && strncmp (p, "defalt", 6) == 0 - && ! (('A' <= p[6] && p[6] <= 'Z') - || ('a' <= p[6] && p[6] <= 'z') - || ('0' <= p[6] && p[6] <= '9') - || p[6] == '_')) + /* Found the end of an argument, write out the last seen + identifier. */ + if (c == ',' || c == ')') { - fprintf (out, "DEFAULT"); - p += 5; - in_ident = 0; - just_spaced = 0; - } - else if (c != ' ' || !just_spaced) - { - if (c >= 'a' && c <= 'z') - /* Upcase the letter. */ - c += 'A' - 'a'; - putc (c, out); - } + if (strncmp (ident_start, "void", ident_length) == 0) + continue; - just_spaced = c == ' '; - need_space = 0; + putc (' ', out); + + if (minargs == 0 && maxargs > 0) + fprintf (out, "&optional "); + + minargs--; + maxargs--; + + /* In C code, `default' is a reserved word, so we spell it + `defalt'; unmangle that here. */ + if (strncmp (ident_start, "defalt", ident_length) == 0) + fprintf (out, "DEFAULT"); + else + while (ident_length-- > 0) + { + c = *ident_start++; + if (c >= 'a' && c <= 'z') + /* Upcase the letter. */ + c += 'A' - 'a'; + else if (c == '_') + /* Print underscore as hyphen. */ + c = '-'; + putc (c, out); + } + } } + + putc (')', out); } /* Read through a c file. If a .o file is named, @@ -538,8 +514,7 @@ write_c_args (out, func, buf, minargs, maxargs) Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */ int -scan_c_file (filename, mode) - char *filename, *mode; +scan_c_file (char *filename, char *mode) { FILE *infile; register int c; @@ -815,8 +790,7 @@ scan_c_file (filename, mode) */ void -skip_white (infile) - FILE *infile; +skip_white (FILE *infile) { char c = ' '; while (c == ' ' || c == '\t' || c == '\n' || c == '\r') @@ -825,9 +799,7 @@ skip_white (infile) } void -read_lisp_symbol (infile, buffer) - FILE *infile; - char *buffer; +read_lisp_symbol (FILE *infile, char *buffer) { char c; char *fillp = buffer; @@ -855,8 +827,7 @@ read_lisp_symbol (infile, buffer) } int -scan_lisp_file (filename, mode) - char *filename, *mode; +scan_lisp_file (char *filename, char *mode) { FILE *infile; register int c; diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in index cad3b838208..72a04ecff89 100644 --- a/lib-src/makefile.w32-in +++ b/lib-src/makefile.w32-in @@ -143,11 +143,11 @@ $(BLD)/ctags.$(O): ctags.c # obj = dosfns.o msdos.o \ xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ - fontset.o \ + fontset.o menu.o \ w32.o w32console.o w32fns.o w32heap.o w32inevt.o \ w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \ - font.o w32font.o \ - dispnew.o frame.o scroll.o xdisp.o window.o \ + font.o w32font.o w32uniscribe.o \ + dispnew.o frame.o scroll.o xdisp.o window.o bidi.o \ charset.o coding.o category.o ccl.o character.o chartab.o \ cm.o term.o terminal.o xfaces.o \ emacs.o keyboard.o macros.o keymap.o sysdep.o \ @@ -157,7 +157,7 @@ obj = dosfns.o msdos.o \ alloc.o data.o doc.o editfns.o callint.o \ eval.o floatfns.o fns.o print.o lread.o \ syntax.o bytecode.o \ - process.o callproc.o \ + process.o callproc.o unexw32.o \ region-cache.o sound.o atimer.o \ doprnt.o strftime.o intervals.o textprop.o composite.o md5.o @@ -247,7 +247,7 @@ lisp2 = \ $(lispsource)language/slovak.el \ $(lispsource)language/romanian.el \ $(lispsource)language/greek.el \ - $(lispsource)language/hebrew.el \ + $(lispsource)language/hebrew.elc \ $(lispsource)language/japanese.el \ $(lispsource)language/korean.el \ $(lispsource)language/lao.el \ diff --git a/lib-src/movemail.c b/lib-src/movemail.c index ea307241351..541edf545df 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -69,6 +69,9 @@ along with GNU Emacs. If not, see . */ #ifdef HAVE_FCNTL_H #include #endif +#ifdef HAVE_STRING_H +#include +#endif #include "syswait.h" #ifdef MAIL_USE_POP #include "pop.h" @@ -140,33 +143,29 @@ static char *mail_spool_name (); #endif #endif -char *strerror (); -#ifdef HAVE_INDEX -extern char *index __P ((const char *, int)); -#endif -#ifdef HAVE_RINDEX -extern char *rindex __P((const char *, int)); +#ifndef HAVE_STRERROR +char *strerror (int); #endif -void fatal (); -void error (); -void pfatal_with_name (); -void pfatal_and_delete (); -char *concat (); -long *xmalloc (); -int popmail (); -int pop_retr (); -int mbx_write (); -int mbx_delimit_begin (); -int mbx_delimit_end (); +static void fatal (char *s1, char *s2, char *s3); +static void error (char *s1, char *s2, char *s3); +static void pfatal_with_name (char *name); +static void pfatal_and_delete (char *name); +static char *concat (char *s1, char *s2, char *s3); +static long *xmalloc (unsigned int size); +#ifdef MAIL_USE_POP +static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order); +static int pop_retr (popserver server, int msgno, FILE *arg); +static int mbx_write (char *line, int len, FILE *mbf); +static int mbx_delimit_begin (FILE *mbf); +static int mbx_delimit_end (FILE *mbf); +#endif /* Nonzero means this is name of a lock file to delete on fatal error. */ char *delete_lockname; int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { char *inname, *outname; int indesc, outdesc; @@ -559,7 +558,7 @@ mail_spool_name (inname) char *indir, *fname; int status; - if (! (fname = rindex (inname, '/'))) + if (! (fname = strrchr (inname, '/'))) return NULL; fname++; @@ -589,9 +588,8 @@ mail_spool_name (inname) /* Print error message and exit. */ -void -fatal (s1, s2, s3) - char *s1, *s2, *s3; +static void +fatal (char *s1, char *s2, char *s3) { if (delete_lockname) unlink (delete_lockname); @@ -602,9 +600,8 @@ fatal (s1, s2, s3) /* Print error message. `s1' is printf control string, `s2' and `s3' are args for it or null. */ -void -error (s1, s2, s3) - char *s1, *s2, *s3; +static void +error (char *s1, char *s2, char *s3) { fprintf (stderr, "movemail: "); if (s3) @@ -612,20 +609,18 @@ error (s1, s2, s3) else if (s2) fprintf (stderr, s1, s2); else - fprintf (stderr, s1); + fprintf (stderr, "%s", s1); fprintf (stderr, "\n"); } -void -pfatal_with_name (name) - char *name; +static void +pfatal_with_name (char *name) { fatal ("%s for %s", strerror (errno), name); } -void -pfatal_and_delete (name) - char *name; +static void +pfatal_and_delete (char *name) { char *s = strerror (errno); unlink (name); @@ -634,9 +629,8 @@ pfatal_and_delete (name) /* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */ -char * -concat (s1, s2, s3) - char *s1, *s2, *s3; +static char * +concat (char *s1, char *s2, char *s3) { int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); char *result = (char *) xmalloc (len1 + len2 + len3 + 1); @@ -651,9 +645,8 @@ concat (s1, s2, s3) /* Like malloc but get fatal error if memory is exhausted. */ -long * -xmalloc (size) - unsigned size; +static long * +xmalloc (unsigned int size) { long *result = (long *) malloc (size); if (!result) @@ -702,25 +695,20 @@ char Errmsg[200]; /* POP errors, at least, can exceed * Return a value suitable for passing to `exit'. */ -int -popmail (mailbox, outfile, preserve, password, reverse_order) - char *mailbox; - char *outfile; - int preserve; - char *password; - int reverse_order; +static int +popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order) { int nmsgs, nbytes; register int i; int mbfi; FILE *mbf; - char *getenv (); + char *getenv (const char *); popserver server; int start, end, increment; char *user, *hostname; user = mailbox; - if ((hostname = index(mailbox, ':'))) + if ((hostname = strchr (mailbox, ':'))) *hostname++ = '\0'; server = pop_open (hostname, user, password, POP_NO_GETPASS); @@ -833,13 +821,9 @@ popmail (mailbox, outfile, preserve, password, reverse_order) return EXIT_SUCCESS; } -int -pop_retr (server, msgno, arg) - popserver server; - int msgno; - FILE *arg; +static int +pop_retr (popserver server, int msgno, FILE *arg) { - extern char *strerror (); char *line; int ret; @@ -884,11 +868,8 @@ pop_retr (server, msgno, arg) && (a[3] == 'm') \ && (a[4] == ' ')) -int -mbx_write (line, len, mbf) - char *line; - int len; - FILE *mbf; +static int +mbx_write (char *line, int len, FILE *mbf) { #ifdef MOVEMAIL_QUOTE_POP_FROM_LINES if (IS_FROM_LINE (line)) @@ -911,9 +892,8 @@ mbx_write (line, len, mbf) return (OK); } -int -mbx_delimit_begin (mbf) - FILE *mbf; +static int +mbx_delimit_begin (FILE *mbf) { time_t now; struct tm *ltime; @@ -929,9 +909,8 @@ mbx_delimit_begin (mbf) return (OK); } -int -mbx_delimit_end (mbf) - FILE *mbf; +static int +mbx_delimit_end (FILE *mbf) { if (putc ('\n', mbf) == EOF) return (NOTOK); diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c index c815f32d51d..c24b35d9a19 100644 --- a/lib-src/ntlib.c +++ b/lib-src/ntlib.c @@ -38,7 +38,7 @@ along with GNU Emacs. If not, see . would necessitate including windows.h in the files that used it. This is much easier. */ void -sleep(unsigned long seconds) +sleep (unsigned long seconds) { Sleep (seconds * 1000); } @@ -56,7 +56,7 @@ static HANDLE getppid_parent; static int getppid_ppid; int -getppid(void) +getppid (void) { char *ppid; DWORD result; @@ -64,7 +64,7 @@ getppid(void) ppid = getenv ("EM_PARENT_PROCESS_ID"); if (!ppid) { - printf("no pid.\n"); + printf ("no pid.\n"); return 0; } else @@ -74,11 +74,11 @@ getppid(void) if (!getppid_parent) { - getppid_parent = OpenProcess (SYNCHRONIZE, FALSE, atoi(ppid)); + getppid_parent = OpenProcess (SYNCHRONIZE, FALSE, atoi (ppid)); if (!getppid_parent) { printf ("Failed to open handle to parent process: %d\n", - GetLastError()); + GetLastError ()); exit (1); } } @@ -94,13 +94,13 @@ getppid(void) return 1; case WAIT_FAILED: default: - printf ("Checking parent status failed: %d\n", GetLastError()); + printf ("Checking parent status failed: %d\n", GetLastError ()); exit (1); } } char * -getlogin () +getlogin (void) { static char user_name[256]; DWORD length = sizeof (user_name); @@ -120,19 +120,19 @@ cuserid (char * s) } unsigned -getuid () +getuid (void) { return 0; } unsigned -getgid () +getgid (void) { return 0; } unsigned -getegid () +getegid (void) { return 0; } @@ -219,7 +219,7 @@ sys_ctime (const time_t *t) } FILE * -sys_fopen(const char * path, const char * mode) +sys_fopen (const char * path, const char * mode) { return fopen (path, mode); } diff --git a/lib-src/pop.c b/lib-src/pop.c index 64488e7e3ea..26a992fa0b0 100644 --- a/lib-src/pop.c +++ b/lib-src/pop.c @@ -108,24 +108,16 @@ extern int h_errno; #endif #endif -#ifndef __P -# ifdef __STDC__ -# define __P(a) a -# else -# define __P(a) () -# endif /* __STDC__ */ -#endif /* ! __P */ - -static int socket_connection __P((char *, int)); -static int pop_getline __P((popserver, char **)); -static int sendline __P((popserver, char *)); -static int fullwrite __P((int, char *, int)); -static int getok __P((popserver)); +static int socket_connection (char *, int); +static int pop_getline (popserver, char **); +static int sendline (popserver, char *); +static int fullwrite (int, char *, int); +static int getok (popserver); #if 0 -static int gettermination __P((popserver)); +static int gettermination (popserver); #endif -static void pop_trash __P((popserver)); -static char *find_crlf __P((char *, int)); +static void pop_trash (popserver); +static char *find_crlf (char *, int); #define ERROR_MAX 160 /* a pretty arbitrary size, but needs to be bigger than the original @@ -174,11 +166,7 @@ int pop_debug = 0; * explanation of the error. */ popserver -pop_open (host, username, password, flags) - char *host; - char *username; - char *password; - int flags; +pop_open (char *host, char *username, char *password, int flags) { int sock; popserver server; @@ -345,10 +333,7 @@ pop_open (host, username, password, flags) * connection impossible. */ int -pop_stat (server, count, size) - popserver server; - int *count; - int *size; +pop_stat (popserver server, int *count, int *size) { char *fromserver; char *end_ptr; @@ -421,11 +406,7 @@ pop_stat (server, count, size) * connection impossible. */ int -pop_list (server, message, IDs, sizes) - popserver server; - int message; - int **IDs; - int **sizes; +pop_list (popserver server, int message, int **IDs, int **sizes) { int how_many, i; char *fromserver; @@ -484,7 +465,7 @@ pop_list (server, message, IDs, sizes) return (-1); } (*IDs)[0] = atoi (&fromserver[4]); - fromserver = index (&fromserver[4], ' '); + fromserver = strchr (&fromserver[4], ' '); if (! fromserver) { strcpy (pop_error, @@ -515,7 +496,7 @@ pop_list (server, message, IDs, sizes) return (-1); } (*IDs)[i] = atoi (fromserver); - fromserver = index (fromserver, ' '); + fromserver = strchr (fromserver, ' '); if (! fromserver) { strcpy (pop_error, @@ -567,11 +548,7 @@ pop_list (server, message, IDs, sizes) * Side effects: May kill connection on error. */ int -pop_retrieve (server, message, markfrom, msg_buf) - popserver server; - int message; - int markfrom; - char **msg_buf; +pop_retrieve (popserver server, int message, int markfrom, char **msg_buf) { int *IDs, *sizes, bufsize, fromcount = 0, cp = 0; char *ptr, *fromserver; @@ -635,7 +612,7 @@ pop_retrieve (server, message, markfrom, msg_buf) } ptr[cp++] = '>'; } - bcopy (fromserver, &ptr[cp], ret); + memcpy (&ptr[cp], fromserver, ret); cp += ret; ptr[cp++] = '\n'; } @@ -645,10 +622,7 @@ pop_retrieve (server, message, markfrom, msg_buf) } int -pop_retrieve_first (server, message, response) - popserver server; - int message; - char **response; +pop_retrieve_first (popserver server, int message, char **response) { sprintf (pop_error, "RETR %d", message); return (pop_multi_first (server, pop_error, response)); @@ -663,25 +637,19 @@ pop_retrieve_first (server, message, response) */ int -pop_retrieve_next (server, line) - popserver server; - char **line; +pop_retrieve_next (popserver server, char **line) { return (pop_multi_next (server, line)); } int -pop_retrieve_flush (server) - popserver server; +pop_retrieve_flush (popserver server) { return (pop_multi_flush (server)); } int -pop_top_first (server, message, lines, response) - popserver server; - int message, lines; - char **response; +pop_top_first (popserver server, int message, int lines, char **response) { sprintf (pop_error, "TOP %d %d", message, lines); return (pop_multi_first (server, pop_error, response)); @@ -696,25 +664,19 @@ pop_top_first (server, message, lines, response) */ int -pop_top_next (server, line) - popserver server; - char **line; +pop_top_next (popserver server, char **line) { return (pop_multi_next (server, line)); } int -pop_top_flush (server) - popserver server; +pop_top_flush (popserver server) { return (pop_multi_flush (server)); } int -pop_multi_first (server, command, response) - popserver server; - char *command; - char **response; +pop_multi_first (popserver server, char *command, char **response) { if (server->in_multi) { @@ -757,9 +719,7 @@ pop_multi_first (server, command, response) 0, LINE is set to null. */ int -pop_multi_next (server, line) - popserver server; - char **line; +pop_multi_next (popserver server, char **line) { char *fromserver; int ret; @@ -797,8 +757,7 @@ pop_multi_next (server, line) } int -pop_multi_flush (server) - popserver server; +pop_multi_flush (popserver server) { char *line; int ret; @@ -829,9 +788,7 @@ pop_multi_flush (server) * otherwise. */ int -pop_delete (server, message) - popserver server; - int message; +pop_delete (popserver server, int message) { if (server->in_multi) { @@ -861,8 +818,7 @@ pop_delete (server, message) * Side effects: Closes connection on error. */ int -pop_noop (server) - popserver server; +pop_noop (popserver server) { if (server->in_multi) { @@ -891,8 +847,7 @@ pop_noop (server) * Side effects: Closes the connection on error. */ int -pop_last (server) - popserver server; +pop_last (popserver server) { char *fromserver; @@ -949,8 +904,7 @@ pop_last (server) * Side effects: Closes the connection on error. */ int -pop_reset (server) - popserver server; +pop_reset (popserver server) { if (pop_retrieve_flush (server)) { @@ -978,8 +932,7 @@ pop_reset (server) * function is called, even if an error occurs. */ int -pop_quit (server) - popserver server; +pop_quit (popserver server) { int ret = 0; @@ -1023,9 +976,7 @@ static int have_winsock = 0; * into pop_error. */ static int -socket_connection (host, flags) - char *host; - int flags; +socket_connection (char *host, int flags) { #ifdef HAVE_GETADDRINFO struct addrinfo *res, *it; @@ -1069,7 +1020,7 @@ socket_connection (host, flags) } #endif - bzero ((char *) &addr, sizeof (addr)); + memset (&addr, 0, sizeof (addr)); addr.sin_family = AF_INET; /** "kpop" service is never used: look for 20060515 to see why **/ @@ -1145,8 +1096,7 @@ socket_connection (host, flags) if (it->ai_addrlen == sizeof (addr)) { struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr; - bcopy (&in_a->sin_addr, (char *) &addr.sin_addr, - sizeof (addr.sin_addr)); + memcpy (&addr.sin_addr, &in_a->sin_addr, sizeof (addr.sin_addr)); if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr))) break; } @@ -1174,8 +1124,7 @@ socket_connection (host, flags) while (*hostent->h_addr_list) { - bcopy (*hostent->h_addr_list, (char *) &addr.sin_addr, - hostent->h_length); + memcpy (&addr.sin_addr, *hostent->h_addr_list, hostent->h_length); if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr))) break; hostent->h_addr_list++; @@ -1335,9 +1284,7 @@ socket_connection (host, flags) * THE RETURNED LINE MAY CONTAIN EMBEDDED NULLS! */ static int -pop_getline (server, line) - popserver server; - char **line; +pop_getline (popserver server, char **line) { #define GETLINE_ERROR "Error reading from server: " @@ -1369,8 +1316,8 @@ pop_getline (server, line) } else { - bcopy (server->buffer + server->buffer_index, - server->buffer, server->data); + memmove (server->buffer, server->buffer + server->buffer_index, + server->data); /* Record the fact that we've searched the data already in the buffer for a CRLF, so that when we search below, we don't have to search the same data twice. There's a "- @@ -1467,9 +1414,7 @@ pop_getline (server, line) * Side effects: Closes the connection on error. */ static int -sendline (server, line) - popserver server; - char *line; +sendline (popserver server, char *line) { #define SENDLINE_ERROR "Error writing to POP server: " int ret; @@ -1516,10 +1461,7 @@ sendline (server, line) * Return value: Same as write. Pop_error is not set. */ static int -fullwrite (fd, buf, nbytes) - int fd; - char *buf; - int nbytes; +fullwrite (int fd, char *buf, int nbytes) { char *cp; int ret = 0; @@ -1549,8 +1491,7 @@ fullwrite (fd, buf, nbytes) * Side effects: On failure, may make the connection unusable. */ static int -getok (server) - popserver server; +getok (popserver server) { char *fromline; @@ -1621,8 +1562,7 @@ gettermination (server) * since the last pop_reset) may be lost. */ void -pop_close (server) - popserver server; +pop_close (popserver server) { pop_trash (server); free ((char *) server); @@ -1638,8 +1578,7 @@ pop_close (server) * pop_close or pop_quit after this function has been called. */ static void -pop_trash (server) - popserver server; +pop_trash (popserver server) { if (server->file >= 0) { @@ -1671,9 +1610,7 @@ pop_trash (server) null, or 0 if it does not contain one. */ static char * -find_crlf (in_string, len) - char *in_string; - int len; +find_crlf (char *in_string, int len) { while (len--) { diff --git a/lib-src/profile.c b/lib-src/profile.c index 0347350a799..37653e63c49 100644 --- a/lib-src/profile.c +++ b/lib-src/profile.c @@ -40,7 +40,7 @@ static char time_string[30]; /* Reset the stopwatch to zero. */ void -reset_watch () +reset_watch (void) { EMACS_GET_TIME (TV1); watch_not_started = 0; @@ -51,7 +51,7 @@ reset_watch () If reset_watch was not called yet, exit. */ char * -get_time () +get_time (void) { if (watch_not_started) exit (EXIT_FAILURE); /* call reset_watch first ! */ @@ -79,7 +79,7 @@ gettimeofday (tp, tzp) #endif int -main () +main (void) { int c; while ((c = getchar ()) != EOF) diff --git a/lib-src/sorted-doc.c b/lib-src/sorted-doc.c index ce58529193a..595633b76d8 100644 --- a/lib-src/sorted-doc.c +++ b/lib-src/sorted-doc.c @@ -65,8 +65,7 @@ struct docstr /* Allocated thing for an entry. */ /* Print error message. `s1' is printf control string, `s2' is arg for it. */ void -error (s1, s2) - char *s1, *s2; +error (char *s1, char *s2) { fprintf (stderr, "sorted-doc: "); fprintf (stderr, s1, s2); @@ -76,8 +75,7 @@ error (s1, s2) /* Print error message and exit. */ void -fatal (s1, s2) - char *s1, *s2; +fatal (char *s1, char *s2) { error (s1, s2); exit (EXIT_FAILURE); @@ -86,8 +84,7 @@ fatal (s1, s2) /* Like malloc but get fatal error if memory is exhausted. */ char * -xmalloc (size) - int size; +xmalloc (int size) { char *result = malloc ((unsigned)size); if (result == NULL) @@ -96,8 +93,7 @@ xmalloc (size) } char * -xstrdup (str) - char * str; +xstrdup (char *str) { char *buf = xmalloc (strlen (str) + 1); (void) strcpy (buf, str); @@ -107,16 +103,15 @@ xstrdup (str) /* Comparison function for qsort to call. */ int -cmpdoc (a, b) - DOCSTR **a; - DOCSTR **b; +cmpdoc (const void *va, const void *vb) { + DOCSTR *const *a = va; + DOCSTR *const *b = vb; register int val = strcmp ((*a)->name, (*b)->name); if (val) return val; return (*a)->type - (*b)->type; } - enum state { WAITING, BEG_NAME, NAME_GET, BEG_DESC, DESC_GET @@ -128,7 +123,7 @@ char *states[] = }; int -main () +main (void) { register DOCSTR *dp = NULL; /* allocated DOCSTR */ register LINE *lp = NULL; /* allocated line */ diff --git a/lib-src/test-distrib.c b/lib-src/test-distrib.c index a6c7c187f8a..880bd115882 100644 --- a/lib-src/test-distrib.c +++ b/lib-src/test-distrib.c @@ -52,10 +52,7 @@ char buf[300]; /* Like `read' but keeps trying until it gets SIZE bytes or reaches eof. */ int -cool_read (fd, buf, size) - int fd; - char *buf; - int size; +cool_read (int fd, char *buf, int size) { int num, sofar = 0; @@ -70,9 +67,7 @@ cool_read (fd, buf, size) } int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int fd; diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c index 24fd45f72d3..a96422a09a9 100644 --- a/lib-src/update-game-score.c +++ b/lib-src/update-game-score.c @@ -64,21 +64,13 @@ extern int optind, opterr; #define MAX_SCORES 200 #define MAX_DATA_LEN 1024 -/* Declare the prototype for a general external function. */ -#if defined (PROTOTYPES) || defined (WINDOWSNT) -#define P_(proto) proto -#else -#define P_(proto) () -#endif - #ifndef HAVE_DIFFTIME /* OK on POSIX (time_t is arithmetic type) modulo overflow in subtraction. */ #define difftime(t1, t0) (double)((t1) - (t0)) #endif int -usage (err) - int err; +usage (int err) { fprintf (stdout, "Usage: update-game-score [-m MAX ] [ -r ] game/scorefile SCORE DATA\n"); fprintf (stdout, " update-game-score -h\n"); @@ -89,8 +81,8 @@ usage (err) exit (err); } -int lock_file P_ ((const char *filename, void **state)); -int unlock_file P_ ((const char *filename, void *state)); +int lock_file (const char *filename, void **state); +int unlock_file (const char *filename, void *state); struct score_entry { @@ -99,25 +91,24 @@ struct score_entry char *data; }; -int read_scores P_ ((const char *filename, struct score_entry **scores, - int *count)); -int push_score P_ ((struct score_entry **scores, int *count, - int newscore, char *username, char *newdata)); -void sort_scores P_ ((struct score_entry *scores, int count, int reverse)); -int write_scores P_ ((const char *filename, const struct score_entry *scores, - int count)); +int read_scores (const char *filename, struct score_entry **scores, + int *count); +int push_score (struct score_entry **scores, int *count, + int newscore, char *username, char *newdata); +void sort_scores (struct score_entry *scores, int count, int reverse); +int write_scores (const char *filename, const struct score_entry *scores, + int count); -void lose P_ ((const char *msg)) NO_RETURN; +void lose (const char *msg) NO_RETURN; void -lose (msg) - const char *msg; +lose (const char *msg) { fprintf (stderr, "%s\n", msg); exit (EXIT_FAILURE); } -void lose_syserr P_ ((const char *msg)) NO_RETURN; +void lose_syserr (const char *msg) NO_RETURN; /* Taken from sysdep.c. */ #ifndef HAVE_STRERROR @@ -137,15 +128,14 @@ strerror (errnum) #endif /* ! HAVE_STRERROR */ void -lose_syserr (msg) - const char *msg; +lose_syserr (const char *msg) { fprintf (stderr, "%s: %s\n", msg, strerror (errno)); exit (EXIT_FAILURE); } char * -get_user_id P_ ((void)) +get_user_id (void) { char *name; struct passwd *buf = getpwuid (getuid ()); @@ -166,9 +156,7 @@ get_user_id P_ ((void)) } char * -get_prefix (running_suid, user_prefix) - int running_suid; - char *user_prefix; +get_prefix (int running_suid, char *user_prefix) { if (!running_suid && user_prefix == NULL) lose ("Not using a shared game directory, and no prefix given."); @@ -184,9 +172,7 @@ get_prefix (running_suid, user_prefix) } int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int c, running_suid; void *lockstate; @@ -273,9 +259,7 @@ main (argc, argv) } int -read_score (f, score) - FILE *f; - struct score_entry *score; +read_score (FILE *f, struct score_entry *score) { int c; if (feof (f)) @@ -359,10 +343,7 @@ read_score (f, score) } int -read_scores (filename, scores, count) - const char *filename; - struct score_entry **scores; - int *count; +read_scores (const char *filename, struct score_entry **scores, int *count) { int readval, scorecount, cursize; struct score_entry *ret; @@ -395,9 +376,7 @@ read_scores (filename, scores, count) } int -score_compare (a, b) - const void *a; - const void *b; +score_compare (const void *a, const void *b) { const struct score_entry *sa = (const struct score_entry *) a; const struct score_entry *sb = (const struct score_entry *) b; @@ -405,9 +384,7 @@ score_compare (a, b) } int -score_compare_reverse (a, b) - const void *a; - const void *b; +score_compare_reverse (const void *a, const void *b) { const struct score_entry *sa = (const struct score_entry *) a; const struct score_entry *sb = (const struct score_entry *) b; @@ -415,11 +392,7 @@ score_compare_reverse (a, b) } int -push_score (scores, count, newscore, username, newdata) - struct score_entry **scores; - int *count; int newscore; - char *username; - char *newdata; +push_score (struct score_entry **scores, int *count, int newscore, char *username, char *newdata) { struct score_entry *newscores = (struct score_entry *) realloc (*scores, @@ -435,20 +408,14 @@ push_score (scores, count, newscore, username, newdata) } void -sort_scores (scores, count, reverse) - struct score_entry *scores; - int count; - int reverse; +sort_scores (struct score_entry *scores, int count, int reverse) { qsort (scores, count, sizeof (struct score_entry), reverse ? score_compare_reverse : score_compare); } int -write_scores (filename, scores, count) - const char *filename; - const struct score_entry * scores; - int count; +write_scores (const char *filename, const struct score_entry *scores, int count) { FILE *f; int i; @@ -477,9 +444,7 @@ write_scores (filename, scores, count) } int -lock_file (filename, state) - const char *filename; - void **state; +lock_file (const char *filename, void **state) { int fd; struct stat buf; @@ -520,9 +485,7 @@ lock_file (filename, state) } int -unlock_file (filename, state) - const char *filename; - void *state; +unlock_file (const char *filename, void *state) { char *lockpath = (char *) state; int ret = unlink (lockpath); diff --git a/lisp/ChangeLog.trunk b/lisp/ChangeLog.trunk index 730cf65c8d5..3ee371f06b2 100644 --- a/lisp/ChangeLog.trunk +++ b/lisp/ChangeLog.trunk @@ -1,3 +1,641 @@ +2010-07-23 Juanma Barranquero + + * custom.el (custom-declare-variable): Give a clearer error message + when the docstring is missing (bug#6476). + +2010-07-22 Michael R. Mauger + + * progmodes/sql.el: Version 2.4. Improved Login prompting. + (sql-login-params): New widget definition. + (sql-oracle-login-params, sql-mysql-login-params) + (sql-solid-login-params, sql-sybase-login-params) + (sql-informix-login-params, sql-ingres-login-params) + (sql-ms-login-params, sql-postgres-login-params) + (sql-interbase-login-params, sql-db2-login-params) + (sql-linter-login-params): Use it. + (sql-sqlite-login-params): Use it; Define "database" parameter as + a file name. + (sql-sqlite-program): Change to "sqlite3" + (sql-comint-sqlite): Make sure database name is complete. + (sql-for-each-login): New function. + (sql-connect, sql-save-connection): Use it. + (sql-get-login-ext): New function. + (sql-get-login): Use it. + (sql-make-alternate-buffer-name): Handle :file parameters. + +2010-07-22 Juanma Barranquero + + * dired.el (dired-no-confirm): Document value t and fix defcustom to + accept it (bug#6597). Suggested by Drew Adams . + +2010-07-22 Teemu Likonen (tiny change) + + * dired.el (dired-mode-map): Use command remapping (bug#6632). + +2010-07-22 Lawrence Mitchell + + * term/vt100.el (vt100-wide-mode): Fix :init-value keyword (bug#6620). + +2010-07-21 Michael Albinus + + * net/tramp.el (tramp-get-ls-command) + (tramp-get-ls-command-with-dired): Run tests on "/dev/null" + instead of "/". + +2010-07-20 Michael R. Mauger + + * progmodes/sql.el: Version 2.3. + (sql-connection-alist): Changed keys from symbols to strings; + enhanced the widget definition. + (sql-mode-menu): Added submenu to select connections. + (sql-interactive-mode-menu): Added "Save Connection" item. + (sql-add-product): Fixed menu item. + (sql-get-product-feature): Improved error handling. + (sql--alt-buffer-part, sql--alt-if-not-empty): Removed. + (sql-make-alternate-buffer-name): Simplified. + (sql-product-interactive): Handle missing product. + (sql-connect): Support string keys, minor improvements. + (sql-save-connection): New function. + (sql-connection-menu-filter): New function. + +2010-07-20 Michael Albinus + + * net/tramp.el (tramp-file-name-handler): Trace 'quit. + (tramp-open-connection-setup-interactive-shell): Apply + workaround for IRIX64 bug. Move argument of last + `tramp-send-command' where it belongs to. + +2010-07-20 Michael Albinus + + * net/tramp.el (tramp-perl-file-attributes) + (tramp-perl-directory-files-and-attributes): Don't pass "$3". + (tramp-maybe-open-connection): Use `async-args' and `gw-args' in + front of `login-args'. + +2010-07-19 Juanma Barranquero + + * time.el (display-time-world-mode): Define with `define-derived-mode'. + Set `show-trailing-whitespace' to nil. + (display-time-world-display): Simplify. + +2010-07-18 Alan Mackenzie + + Enhance `c-file-style' in file/directory local variables. + * progmodes/cc-mode.el (c-count-cfss): New function. + (c-before-hack-hook): Call `c-set-style' differently according to + whether c-file-style was set in file or directory local + variables. + +2010-07-18 Michael R. Mauger + + * progmodes/sql.el: Version 2.2. + (sql-product, sql-user, sql-database, sql-server, sql-port): Use + defcustom :safe keyword rather than putting safe-local-variable + property. + (sql-password): Use defcustom :risky keyword rather than putting + risky-local-variable property. + (sql-oracle-login-params, sql-sqlite-login-params) + (sql-solid-login-params, sql-sybase-login-params) + (sql-informix-login-params, sql-ingres-login-params) + (sql-ms-login-params, sql-postgres-login-params) + (sql-interbase-login-params, sql-db2-login-params) + (sql-linter-login-params): Add `port' option + (sql-get-product-feature): Added NO-INDIRECT parameter. + (sql-comint-oracle, sql-comint-sybase) + (sql-comint-informix, sql-comint-sqlite, sql-comint-mysql) + (sql-comint-solid, sql-comint-ingres, sql-comint-ms) + (sql-comint-postgres, sql-comint-interbase, sql-comint-db2) + (sql-comint-linter): Renamed sql-connect-* functions to + sql-comint-*. + (sql-product-alist, sql-mode-menu): Renamed as above and + :sqli-connect-func to :sqli-comint-func. + (sql-connection): New variable + (sql-interactive-mode): Set it. + (sql-connection-alist): New variable. + (sql-connect): New function. + (sql--alt-buffer-part, sql--alt-if-not-empty) + (sql-make-alternate-buffer-name): Improved alternative buffer name. + +2010-07-17 Thierry Volpiatto + + * image-mode.el (image-bookmark-make-record): Do not set context + in an image (Bug#6650). + +2010-07-17 Chong Yidong + + * simple.el (select-active-region): New function. + (push-mark-command, set-mark, activate-mark) + (handle-shift-selection): Use it. + (deactivate-mark): Don't check for size of region. + + * mouse.el (mouse-drag-track): Use select-active-region. + +2010-07-17 Michael Albinus + + * net/tramp.el (tramp-get-ls-command-with-dired): Make test for + "--dired" stronger. + +2010-07-17 Chong Yidong + + * term/x-win.el (x-select-enable-primary): Change default to nil. + (x-select-enable-clipboard): Add :version keyword. + + * mouse.el (mouse-drag-copy-region): + * simple.el (select-active-regions): Likewise. + +2010-07-16 Reiner Steib + + * vc/vc.el (vc-coding-system-inherit-eol): New defvar. + (vc-coding-system-for-diff): Use it to decide whether to inherit + from the file the EOL format for reading the diffs of that file. + (Bug#4451) + +2010-07-16 Eli Zaretskii + + * mail/rmailmm.el (rmail-mime-save): Make the temp buffer + unibyte, so compressed attachments are not compressed again. + +2010-07-16 Michael Albinus + + * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired + "/bin/sh" but `tramp-remote-sh' from `tramp-methods'. + (tramp-find-shell): Simplify setting connection property. + (tramp-get-ls-command): Make test for "--color=never" stronger. + +2010-07-15 Simon South + + * progmodes/delphi.el (delphi-previous-indent-of): Indent case + blocks within record declarations (i.e. variant parts) correctly. + +2010-07-15 Simon South + + * progmodes/delphi.el (delphi-token-at): Give newlines precedence + over literal tokens when parsing so newlines aren't "absorbed" by + single-line comments. Corrects the indentation of case blocks + that have a comment on the first line. + +2010-07-14 Karl Fogel + + * bookmark.el (bookmark-load-hook): Fix doc string as suggested + by Drew Adams (Bug#5504). + +2010-07-14 Jan Djärv + + * xt-mouse.el (xterm-mouse-event-read): Fix for characters > 127 + now that Unicode is used (Bug#6594). + +2010-07-14 Chong Yidong + + * term/x-win.el (x-select-enable-clipboard): Default to t. + (x-initialize-window-system): Don't overwrite Paste menu item. + + * simple.el (select-active-regions): Default to t. + (push-mark-command): Don't overwrite primary with empty string. + + * mouse.el: Bind mouse-2 to mouse-yank-primary. + (mouse-drag-copy-region): Default to nil. + + * menu-bar.el (menu-bar-enable-clipboard): Don't overwrite + Cut/Copy/Paste menu bar items. + +2010-07-13 Thierry Volpiatto + + Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975). + Patch applied by Karl Fogel. + + * bookmark.el (bookmark-set): Don't set `bookmark-yank-point' + and `bookmark-current-buffer' if they have been already set in + another buffer (e.g gnus-art). + +2010-07-13 Karl Fogel + Thierry Volpiatto + + Preparation for setting bookmarks in Gnus article buffers (Bug#5975). + + * bookmark.el (bookmark-make-record-default): Allow unneeded + information to be omitted from the record. + + Adjust declarations and calls: + + * info.el (bookmark-make-record-default): Adjust declaration. + (Info-bookmark-make-record): Adjust call. + + * woman.el (bookmark-make-record-default): Adjust declaration. + (woman-bookmark-make-record): Adjust call. + + * man.el (bookmark-make-record-default): Adjust declaration. + (Man-bookmark-make-record): Adjust call. + + * image-mode.el (bookmark-make-record-default): Adjust declaration. + + * doc-view.el (bookmark-make-record-default): Adjust declaration. + +2010-07-13 Karl Fogel + + * bookmark.el (bookmark-show-annotation): Use `when' instead of `if'. + This is also from Thierry Volpiatto's patch in bug #6444. However, + because it was extraneous to the functional change in that patch, + and causes a re-indendation, I am committing it separately. + +2010-07-13 Thierry Volpiatto + + * bookmark.el (bookmark-show-annotation): Ensure annotations show, + e.g. in Info bookmarks, by using `switch-to-buffer-other-window'. + Patch applied by Karl Fogel (Bug#6444). + +2010-07-13 Chong Yidong + + * frame.el (make-frame): Fix typo in 2010-06-30 change (Bug#6625). + +2010-07-13 Adrian Robert + + * term/ns-win.el: Bind M-~ to 'ns-prev-frame (due to Matthew + Dempsky; bug#5084). Remove incorrect binding for S-tab. + (ns-alternatives-map): Change S-tab binding to backtab + (bug#6616). + + * simple.el (normal-erase-is-backspace-setup-frame): Set mode on + under ns. + +2010-07-12 Andreas Schwab + + * language/tai-viet.el ("TaiViet"): Try to fix re-encoding bugs. + (Bug#5806) + + * language/tv-util.el (tai-viet-re): Remove format. + +2010-07-12 Kenichi Handa + + * language/hebrew.el: Remove no-byte-compile declaration. + Change coding: tag to utf-8. Register hebrew-shape-gstring in + composition-function-table for 3-character looking back. + (hebrew-font-get-precomposed): New function. + (hebrew-shape-gstring): Utilize precomposed glyphs if available. + +2010-07-11 Chong Yidong + + * mouse.el (mouse-drag-track): Handle select-active-regions + (Bug#6612). + +2010-07-11 Magnus Henoch + + * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Do not pass + empty argument to gvfs-copy. + +2010-07-10 Glenn Morris + + * calendar/calendar.el (calendar-week-end-day): New function. + * calendar/cal-tex.el (cal-tex-cursor-month): Remove unused vars. + Respect calendar-week-start-day. (Bug#6606) + (cal-tex-insert-day-names, cal-tex-insert-blank-days) + (cal-tex-insert-blank-days-at-end): Respect calendar-week-start-day. + (cal-tex-first-blank-p, cal-tex-last-blank-p): Simplify, and + respect calendar-week-start-day. + +2010-07-10 Chong Yidong + + * simple.el (use-region-p): Doc fix (Bug#6607). + +2010-07-10 Aleksei Gusev (tiny change) + + * progmodes/compile.el (compilation-error-regexp-alist-alist): Add + regexps for cucumber and ruby. + +2010-07-08 Daiki Ueno + + * epa-file.el (epa-file-error, epa-file--find-file-not-found-function) + (epa-file-insert-file-contents): Hack to prevent + find-file from opening empty buffer when decryptin failed + (bug#6568). + +2010-07-07 Agustín Martín + + * textmodes/ispell.el (ispell-alternate-dictionary): + Use file-readable-p. + Return nil if no word-list is found at default locations. + (ispell-complete-word-dict): Default to nil. + (ispell-command-loop): Use 'word-list' when using lookup-words. + (lookup-words): Use ispell-complete-word-dict or + ispell-alternate-dictionary. Check for word-list availability + and handle errors if needed with better messages (Bug#6539). + (ispell-complete-word): Use ispell-complete-word-dict or + ispell-alternate-dictionary. + +2010-07-07 Christoph Scholtes + + * progmodes/python.el (python-font-lock-keywords): Add Python 2.7 + builtins (BufferError, BytesWarning, WindowsError; callables + bin, bytearray, bytes, format, memoryview, next, print; __package__). + +2010-07-07 Glenn Morris + + * play/zone.el (top-level): Do not require timer, tabify, or cl. + (zone-shift-left): Ignore intangibility, and any errors from + forward-char. + (zone-shift-right): Remove no-op end-of-line. Ignore intangibility. + (zone-pgm-putz-with-case): Use upcase-region rather than inserting, + deleting, and copying text properties. + (zone-line-specs, zone-pgm-stress): Check forward-line exit status. + (zone-pgm-rotate): Handle odd buffers like that of gomoku, where getting + to point-max is hard. + (zone-fret, zone-fill-out-screen): Replace cl's do with dotimes. + (zone-fill-out-screen): Ignore intangibility. + +2010-07-05 Chong Yidong + + * menu-bar.el (menu-bar-mode): + * tool-bar.el (tool-bar-mode): Replace default-frame-alist element + if it has been set. + + * mouse.el (mouse-drag-track): Call mouse-start-end to handle + word/line selection (Bug#6565). + +2010-07-04 Juanma Barranquero + + * net/dbus.el (dbus-send-signal): Declare function. + +2010-07-04 Michael Albinus + + * net/dbus.el: Implement signal "PropertiesChanged" (from D-Bus 1.3.1). + (dbus-register-property): New optional argument EMITS-SIGNAL. + (dbus-property-handler): Send signal "PropertiesChanged" if requested. + +2010-07-03 Chong Yidong + + * mouse.el (mouse-drag-overlay): Variable deleted. + (mouse-move-drag-overlay, mouse-show-mark): Functions deleted. + (mouse--remap-link-click-p): New function. + (mouse-drag-track): Handle dragging by using temporary Transient + Mark mode, instead of a special overlay. + (mouse-kill-ring-save, mouse-save-then-kill): Don't call + mouse-show-mark. + + * mouse-sel.el (mouse-sel-selection-alist): mouse-drag-overlay + deleted. + +2010-07-02 Juri Linkov + + * autoinsert.el (auto-insert-alist): Fix readability + by using dotted pair notation for lambda. + +2010-07-02 Juri Linkov + + * faces.el (read-face-name): Rename arg `string-describing-default' + to `default'. Doc fix. Display the default value in quotes + in the prompt. With empty input, return the `default' arg, + unless the default value is a string (in which case return nil). + (describe-face): Replace the string `default' arg of `read-face-name' + with the symbol `default'. + +2010-07-02 Chong Yidong + + * emulation/viper-cmd.el (viper-delete-backward-char) + (viper-del-backward-char-in-insert) + (viper-del-backward-char-in-replace, viper-change) + (viper-backward-indent): Replace delete-backward-char with + delete-char (Bug#6552). + +2010-07-01 Chong Yidong + + * ruler-mode.el (ruler--save-header-line-format): Fix typos. + +2010-06-30 Chong Yidong + + * frame.el (make-frame): Add default-frame-alist to the PARAMETERS + argument passed to frame-creation-function (Bug#5378). + + * faces.el (x-handle-named-frame-geometry) + (x-handle-reverse-video, x-create-frame-with-faces) + (face-set-after-frame-default, tty-create-frame-with-faces): Don't + separately consult default-frame-alist. It is now passed as the + PARAMETER argument. + +2010-06-30 Andreas Schwab + + * startup.el (command-line): Don't call tool-bar-setup in a + tty-only build. + +2010-06-30 Chong Yidong + + * ruler-mode.el (ruler--save-header-line-format): New fun. + (ruler-mode): Use it as a setter function, so as not to overwrite + ruler-mode-header-line-format-old if Ruler mode is on (Bug#5370). + +2010-06-29 Chong Yidong + + * vc/vc.el (vc-deduce-backend): New fun. Handle diff buffers. + (vc-root-diff, vc-print-root-log, vc-log-incoming) + (vc-log-outgoing): Use it. + (vc-diff-internal): Set diff-vc-backend. + + * vc/diff-mode.el (diff-vc-backend): New var. + +2010-06-28 Jan Djärv + + * dynamic-setting.el (font-setting-change-default-font): Remove + call to message. + +2010-06-28 Kenichi Handa + + * international/quail.el (quail-insert-kbd-layout): Fix the + showing of untranslated characters. + +2010-06-28 Chong Yidong + + * simple.el (delete-active-region): New option. + (delete-backward-char): Implement in Lisp. + (delete-forward-char): New command. + + * mouse.el (mouse-region-delete-keys): Deleted. + (mouse-show-mark): Simplify. + + * bindings.el (global-map): Bind delete and DEL, the former to + delete-forward-char. + +2010-06-27 Lennart Borgman + + * progmodes/ruby-mode.el (ruby-mode-map): Don't bind TAB. + (ruby-mode): Bind indent-line-function (Bug#5119). + +2010-06-27 Chong Yidong + + * startup.el (command-line): Recognize "0" X resource value. + +2010-06-27 Chong Yidong + + * startup.el (command-line): Use X resources to set the value of + menu-bar-mode and tool-bar-mode, before calling frame-initialize. + + * menu-bar.el (menu-bar-mode): + * tool-bar.el (tool-bar-mode): Don't change default-frame-alist. + Set init-value to t. + + * frame.el (frame-notice-user-settings): Don't change + default-frame-alist based on menu-bar-mode and tool-bar-mode, or + vice versa (Bug#2249). + +2010-06-26 Eli Zaretskii + + * w32-fns.el (w32-convert-standard-filename): Doc fix. + +2010-06-25 Agustín Martín + + * textmodes/flyspell.el (flyspell-check-previous-highlighted-word): + Make sure `flyspell-word' re-checks word after function run (Bug#6504). + + * textmodes/ispell.el (ispell-init-process): Make sure ispell and + default directories are expanded (Bug#6143). + +2010-06-24 Juri Linkov + + * minibuffer.el (completions-format): Change default from nil to + `horizontal'. Remove `nil' value from :type. Doc fix. (Bug#6459) + +2010-06-24 Juri Linkov + + * vc/vc.el (vc-diff-internal): Set `revert-buffer-function' + buffer-locally to lambda that re-runs the vc diff command. + (Bug#6447) + +2010-06-24 Chong Yidong + + * kmacro.el (kmacro-call-macro): Don't issue hint message if the + echo area is in use (Bug#3412). + +2010-06-22 Glenn Morris + + * textmodes/texinfmt.el (texinfo-format-region) + (texinfo-raise-lower-sections, texinfo-format-separate-node) + (texinfo-itemize-item, texinfo-multitable-item, texinfo-alias) + (texinfo-format-option, texinfo-noindent): + Use line-beginning-position and line-end-position. + + * calc/calc-aent.el, calc/calc-ext.el, calc/calc-lang.el: + * calc/calc-store.el, calc/calc-units.el, calc/calc.el: + * calc/calccomp.el: Add explicit utf-8 coding cookies to files with + utf-8 characters. + +2010-06-21 Karl Fogel + + * play/zone.el (zone-fall-through-ws): Fix next-line -> + forward-line fallout. + +2010-07-06 Chong Yidong + + * mouse.el (mouse-appearance-menu): Add docstring. + + * help.el (describe-key): Print up-event using key-description. + +2010-07-03 Michael Albinus + + * net/zeroconf.el (zeroconf-resolve-service) + (zeroconf-service-resolver-handler): Use + `dbus-byte-array-to-string'. + (zeroconf-publish-service): Use `dbus-string-to-byte-array'. + +2010-07-03 Jan Moringen + + * net/zeroconf.el (zeroconf-service-remove-hook): New defun. + +2010-06-30 Dan Nicolaescu + + Avoid displaying files with a nil state in vc-dir. + * vc/vc-dir.el (vc-dir-update): Obey the noinsert argument in all + cases that cause insertion. + (vc-dir-resynch-file): Tell vc-dir-update to avoid inserting files + with a nil state. + +2010-06-30 Chong Yidong + + * xml.el (xml-parse-region): Avoid infloop (Bug#5281). + +2010-06-29 Leo + + * emacs-lisp/rx.el (rx): Doc fix. (Bug#6537) + +2010-06-27 Oleksandr Gavenko (tiny change) + + * generic-x.el (bat-generic-mode): Fix regexp for command line + switches (Bug#5719). + +2010-06-27 Masatake YAMATO + + * htmlfontify.el (hfy-face-attr-for-class): Use append instead + of nconc to avoid pure storage error (Bug#6239). + +2010-06-27 Christoph (tiny change) + + * bookmark.el (bookmark-bmenu-2-window, bookmark-bmenu-other-window) + (bookmark-bmenu-other-window-with-mouse): Remove unnecessary + bindings of bookmark-automatically-show-annotations (Bug#6515). + +2010-06-25 Eli Zaretskii + + * arc-mode.el (archive-zip-extract): Don't quote the file name on + MS-Windows and MS-DOS. (Bug#6467, Bug#6144) + +2010-06-24 Štěpán Němec (tiny change) + + * comint.el (make-comint, make-comint-in-buffer): Mention return + value in the docstrings. (Bug#6498) + +2010-06-24 Yoni Rabkin + + * bs.el (bs-mode-font-lock-keywords): Remove "by" from Dired pattern, + since it is not present when using some non-default switches. + +2010-06-23 Karl Fogel + + * simple.el (compose-mail): Fix doc string to refer to + `compose-mail-user-agent-warnings', instead of to the + nonexistent `compose-mail-check-user-agent'. + +2010-06-21 Alan Mackenzie + + Fix an indentation bug: + + * progmodes/cc-mode.el (c-common-init): Initialise c-new-BEG/END. + (c-neutralize-syntax-in-and-mark-CPP): c-new-BEG/END: Take account + of existing values. + + * progmodes/cc-engine.el (c-clear-<-pair-props-if-match-after) + (c-clear->-pair-props-if-match-before): now return t when they've + cleared properties, nil otherwise. + (c-before-change-check-<>-operators): Set c-new-beg/end correctly + by taking account of the existing value. + + * progmodes/cc-defs.el + (c-clear-char-property-with-value-function): Fix this to clear the + property rather than overwriting it with nil. + +2010-06-20 Chong Yidong + + * emacs-lisp/package.el (package-print-package): Add link to + package description via describe-package. + (describe-package-1): List package requirements. Add button to + perform installation. + (package-menu-describe-package): New command. + + * help-mode.el (help-package): New button type. + +2010-06-19 Chong Yidong + + * emacs-lisp/package.el: Move package-list-packages binding to + menu-bar.el. + (describe-package, describe-package-1, package--dir): New funs. + (package-activate-1): Use package--dir. + + * emacs-lisp/package-x.el (gnus-article-buffer): Require package. + + * help-mode.el (help-package-def): New button type. + + * menu-bar.el: Move package-list-packages binding here from + package.el. + +2010-06-19 Gustav Hållberg (tiny change) + + * descr-text.el (describe-char): Avoid trailing whitespace. (Bug#6423) + 2010-06-18 Stefan Monnier * emacs-lisp/edebug.el (edebug-read-list): @@ -23,8 +661,8 @@ 2010-06-17 Agustín Martín - * ispell.el (ispell-aspell-find-dictionary): Fix regexp for - languages like Portuguese with pt_{BR,PT} and no plain pt. + * textmodes/ispell.el (ispell-aspell-find-dictionary): Fix regexp + for languages like Portuguese with pt_{BR,PT} and no plain pt. 2010-06-17 Juanma Barranquero @@ -61,6 +699,67 @@ * emacs-lisp/package.el: New file. +2010-06-22 Dan Nicolaescu + + Fix vc-annotate for renamed files when using Git. + * vc-git.el (vc-git-find-revision): Deal with empty results from + ls-files. Doe not pass the object as a file name to cat-file, it + is not a file name. + (vc-git-annotate-command): Pass the file name using -- to avoid + ambiguity with the revision. + (vc-git-previous-revision): Pass a relative file name. + +2010-06-22 Glenn Morris + + * progmodes/js.el (js-mode-map): Use standard capitalization and + ellipses for menu entries. + + * wid-edit.el (widget-complete): Doc fix. + +2010-06-22 Jürgen Hötzel (tiny change) + + * wid-edit.el (widget-complete): Fix typo in 2009-12-02 change. + +2010-06-22 Dan Nicolaescu + + Fix annotating other revisions for renamed files in vc-annotate. + * vc-annotate.el (vc-annotate): Add an optional argument for the + VC backend. Use it when non-nil. + (vc-annotate-warp-revision): Pass the VC backend to vc-annotate. + (Bug#6487) + + Fix vc-annotate-show-changeset-diff-revision-at-line for git. + * vc-annotate.el (vc-annotate-show-diff-revision-at-line-internal): + Do not pass the file name to the 'previous-revision call when we + don't want a file diff. (Bug#6489) + +2010-06-21 Dan Nicolaescu + + Fix finding revisions for renamed files in vc-annotate. + * vc.el (vc-find-revision): Add an optional argument for + the VC backend. Use it when non-nil. + * vc-annotate.el (vc-annotate-find-revision-at-line): Pass the VC + backend to vc-find-revision. (Bug#6487) + +2010-06-21 Dan Nicolaescu + + Fix reading file names in Git annotate buffers. + * vc-git.el (vc-git-annotate-extract-revision-at-line): Remove + trailing whitespace. Suggested by Eric Hanchrow. (Bug#6481) + +2010-06-20 Alan Mackenzie + + * progmodes/cc-mode.el (c-before-hack-hook): When the mode is set + in file local variables, set it first. + +2010-06-19 Glenn Morris + + * descr-text.el (describe-char-unicode-data): Insert separating + space when needed. (Bug#6422) + + * progmodes/idlwave.el (idlwave-action-and-binding): + Fix typo in 2009-12-03 change. (Bug#6450) + 2010-06-17 Stefan Monnier * emacs-lisp/macroexp.el (macroexpand-all-1): Put back special @@ -68,7 +767,7 @@ 2010-06-16 Jay Belanger - * calc/calc-poly.el: (math-accum-factors): Make sure that + * calc/calc-poly.el (math-accum-factors): Make sure that constants aren't distributed after they are factored out. 2010-06-16 Juri Linkov @@ -76,6 +775,8 @@ * facemenu.el (list-colors-display): Call `pop-to-buffer' before `list-colors-print'. (Bug#6332) + * subr.el (read-quoted-char): Fix up last change (bug#6290). + 2010-06-16 Stefan Monnier * emacs-lisp/macroexp.el (macroexpand-all-1): Don't handle `lambda' @@ -118,7 +819,7 @@ 2010-06-16 Agustín Martín - * ispell.el (ispell-dictionary-base-alist): Fix + * textmodes/ispell.el (ispell-dictionary-base-alist): Fix portuguese casechars/not-casechars for missing 'çÇ'. Suggested by Rolando Pereira (bug#6434). @@ -446,8 +1147,7 @@ 2010-06-03 Chong Yidong - * net/rcirc.el (rcirc-nickname<, rcirc-sort-nicknames-join): Doc - fix. + * net/rcirc.el (rcirc-nickname<, rcirc-sort-nicknames-join): Doc fix. 2010-06-03 Stefan Monnier @@ -821,12 +1521,12 @@ (rcirc-user-name-history): Add variable. 2010-05-25 Ryan Yeske - Jonathan Rockway + Jonathan Rockway * net/rcirc.el (rcirc-server-alist): Add :pass. (rcirc): When prompting for connection parameters, also prompt for username and password. - (rcirc-connect): Take a PASS argument. If PASS is non-nil, send + (rcirc-connect): Take a PASS argument. If PASS is non-nil, send value to server when connecting. 2010-05-25 Stefan Monnier @@ -1208,8 +1908,8 @@ 2010-05-13 Agustín Martín - * ispell.el (ispell-init-process): Do not kill ispell process - everytime when spellchecking from the minibuffer (bug#6143). + * textmodes/ispell.el (ispell-init-process): Do not kill ispell + process everytime when spellchecking from the minibuffer (bug#6143). 2010-05-13 Stefan Monnier @@ -1870,8 +2570,8 @@ 2010-04-27 Agustín Martín - * ispell.el (ispell-init-process): Fix personal dictionary condition - in default directory check. + * textmodes/ispell.el (ispell-init-process): Fix personal dictionary + condition in default directory check. (ispell-init-process,ispell-kill-ispell,kill-buffer-hook): Kill ispell process when killing its associated buffer. @@ -3904,7 +4604,7 @@ 2010-02-03 Michael Albinus * net/ange-ftp.el (ange-ftp-insert-directory): Parse directory - also in case of (and (not full) (not wildcard)). This is needed, + also in case of (and (not full) (not wildcard)). This is needed when dired is called with a list of files, which are not in `default-directory'. (Bug#5478) @@ -10393,7 +11093,7 @@ * textmodes/fill.el: Convert to utf-8 encoding. (fill-french-nobreak-p): Remove redundant » and « inherited from our - pre-unicode days. + pre-Unicode days. * add-log.el (change-log-fill-forward-paragraph): New function. (change-log-mode): Use it so fill-region DTRT. diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index fb6155dfd41..6dda7b2e40b 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -1811,10 +1811,13 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." (t (archive-extract-by-stdout archive - ;; unzip expands wildcards in NAME, so we need to quote it. + ;; unzip expands wildcards in NAME, so we need to quote it. But + ;; not on DOS/Windows, since that fails extraction on those + ;; systems, and file names with wildcards in zip archives don't + ;; work there anyway. ;; FIXME: Does pkunzip need similar treatment? - ;; (7z doesn't need to quote wildcards) - (if (equal (car archive-zip-extract) "unzip") + (if (and (not (memq system-type '(windows-nt ms-dos))) + (equal (car archive-zip-extract) "unzip")) (shell-quote-argument name) name) archive-zip-extract)))) diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el index b3a594d31d4..9a8001875e0 100644 --- a/lisp/autoinsert.el +++ b/lisp/autoinsert.el @@ -126,10 +126,10 @@ If this contains a %s, that will be replaced by the matching rule." _ "\n\\begin{document}\n" _ "\n\\end{document}") - (("/bin/.*[^/]\\'" . "Shell-Script mode magic number") - lambda () + (("/bin/.*[^/]\\'" . "Shell-Script mode magic number") . + (lambda () (if (eq major-mode (default-value 'major-mode)) - (sh-mode))) + (sh-mode)))) (ada-mode . ada-header) diff --git a/lisp/bindings.el b/lisp/bindings.el index f9d3e75cf6e..4eab37edf46 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -822,6 +822,9 @@ if `inhibit-field-text-motion' is non-nil." (setq i (1+ i)))) (define-key global-map [?\C-\M--] 'negative-argument) +(define-key global-map "\177" 'delete-backward-char) +(define-key global-map "\C-d" 'delete-forward-char) + (define-key global-map "\C-k" 'kill-line) (define-key global-map "\C-w" 'kill-region) (define-key esc-map "w" 'kill-ring-save) diff --git a/lisp/bookmark.el b/lisp/bookmark.el index cfc7d7af5c8..0eec76f4da7 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -528,26 +528,36 @@ old one." (setq bookmark-current-bookmark stripped-name) (bookmark-bmenu-surreptitiously-rebuild-list))) -(defun bookmark-make-record-default (&optional point-only) +(defun bookmark-make-record-default (&optional no-file no-context posn) "Return the record describing the location of a new bookmark. -Must be at the correct position in the buffer in which the bookmark is -being set. -If POINT-ONLY is non-nil, then only return the subset of the -record that pertains to the location within the buffer." - `(,@(unless point-only `((filename . ,(bookmark-buffer-file-name)))) - (front-context-string - . ,(if (>= (- (point-max) (point)) bookmark-search-size) - (buffer-substring-no-properties - (point) - (+ (point) bookmark-search-size)) - nil)) - (rear-context-string - . ,(if (>= (- (point) (point-min)) bookmark-search-size) - (buffer-substring-no-properties - (point) - (- (point) bookmark-search-size)) - nil)) - (position . ,(point)))) +Point should be at the buffer in which the bookmark is being set, +and normally should be at the position where the bookmark is desired, +but see the optional arguments for other possibilities. + +If NO-FILE is non-nil, then only return the subset of the +record that pertains to the location within the buffer, leaving off +the part that records the filename. + +If NO-CONTEXT is non-nil, do not include the front- and rear-context +strings in the record -- the position is enough. + +If POSN is non-nil, record POSN as the point instead of `(point)'." + `(,@(unless no-file `((filename . ,(bookmark-buffer-file-name)))) + ,@(unless no-context `((front-context-string + . ,(if (>= (- (point-max) (point)) + bookmark-search-size) + (buffer-substring-no-properties + (point) + (+ (point) bookmark-search-size)) + nil)))) + ,@(unless no-context `((rear-context-string + . ,(if (>= (- (point) (point-min)) + bookmark-search-size) + (buffer-substring-no-properties + (point) + (- (point) bookmark-search-size)) + nil)))) + (position . ,(or posn (point))))) ;;; File format stuff @@ -773,27 +783,34 @@ Use \\[bookmark-delete] to remove bookmarks (you give it a name and it removes only the first instance of a bookmark with that name from the list of bookmarks.)" (interactive (list nil current-prefix-arg)) - (let* ((record (bookmark-make-record)) - (default (car record))) + (unwind-protect + (let* ((record (bookmark-make-record)) + (default (car record))) - (bookmark-maybe-load-default-file) + (bookmark-maybe-load-default-file) + ;; Don't set `bookmark-yank-point' and `bookmark-current-buffer' + ;; if they have been already set in another buffer. (e.g gnus-art). + (unless (and bookmark-yank-point + bookmark-current-buffer) + (setq bookmark-yank-point (point)) + (setq bookmark-current-buffer (current-buffer))) - (setq bookmark-yank-point (point)) - (setq bookmark-current-buffer (current-buffer)) + (let ((str + (or name + (read-from-minibuffer + (format "Set bookmark (%s): " default) + nil + bookmark-minibuffer-read-name-map + nil nil default)))) + (and (string-equal str "") (setq str default)) + (bookmark-store str (cdr record) no-overwrite) - (let ((str - (or name - (read-from-minibuffer - (format "Set bookmark (%s): " default) - nil - bookmark-minibuffer-read-name-map - nil nil default)))) - (and (string-equal str "") (setq str default)) - (bookmark-store str (cdr record) no-overwrite) + ;; Ask for an annotation buffer for this bookmark + (when bookmark-use-annotations + (bookmark-edit-annotation str)))) + (setq bookmark-yank-point nil) + (setq bookmark-current-buffer nil))) - ;; Ask for an annotation buffer for this bookmark - (when bookmark-use-annotations - (bookmark-edit-annotation str))))) (defun bookmark-kill-line (&optional newline-too) "Kill from point to end of line. @@ -1733,15 +1750,15 @@ last full line, move to the last full line. The return value is undefined." "Display the annotation for bookmark named BOOKMARK in a buffer, if an annotation exists." (let ((annotation (bookmark-get-annotation bookmark))) - (if (and annotation (not (string-equal annotation ""))) - (save-excursion - (let ((old-buf (current-buffer))) - (pop-to-buffer (get-buffer-create "*Bookmark Annotation*") t) - (delete-region (point-min) (point-max)) - ;; (insert (concat "Annotation for bookmark '" bookmark "':\n\n")) - (insert annotation) - (goto-char (point-min)) - (pop-to-buffer old-buf)))))) + (when (and annotation (not (string-equal annotation ""))) + (save-excursion + (let ((old-buf (current-buffer))) + (pop-to-buffer (get-buffer-create "*Bookmark Annotation*") t) + (delete-region (point-min) (point-max)) + ;; (insert (concat "Annotation for bookmark '" bookmark "':\n\n")) + (insert annotation) + (goto-char (point-min)) + (switch-to-buffer-other-window old-buf)))))) (defun bookmark-show-all-annotations () @@ -1860,8 +1877,7 @@ With a prefix arg, prompts for a file to save them in." (pop-up-windows t)) (delete-other-windows) (switch-to-buffer (other-buffer)) - (let ((bookmark-automatically-show-annotations nil)) ;FIXME: needed? - (bookmark--jump-via bmrk 'pop-to-buffer)) + (bookmark--jump-via bmrk 'pop-to-buffer) (bury-buffer menu))) @@ -1875,8 +1891,7 @@ With a prefix arg, prompts for a file to save them in." "Select this line's bookmark in other window, leaving bookmark menu visible." (interactive) (let ((bookmark (bookmark-bmenu-bookmark))) - (let ((bookmark-automatically-show-annotations t)) ;FIXME: needed? - (bookmark--jump-via bookmark 'switch-to-buffer-other-window)))) + (bookmark--jump-via bookmark 'switch-to-buffer-other-window))) (defun bookmark-bmenu-switch-other-window () @@ -1887,8 +1902,7 @@ The current window remains selected." (pop-up-windows t) same-window-buffer-names same-window-regexps) - (let ((bookmark-automatically-show-annotations t)) ;FIXME: needed? - (bookmark--jump-via bookmark 'display-buffer)))) + (bookmark--jump-via bookmark 'display-buffer))) (defun bookmark-bmenu-other-window-with-mouse (event) "Select bookmark at the mouse pointer in other window, leaving bookmark menu visible." @@ -2182,7 +2196,7 @@ strings returned are not." ;; Load Hook (defvar bookmark-load-hook nil - "Hook run at the end of loading bookmark.") + "Hook run at the end of loading library `bookmark.el'.") ;; Exit Hook, called from kill-emacs-hook (defvar bookmark-exit-hook nil diff --git a/lisp/bs.el b/lisp/bs.el index 3fa91b49178..0ce7670201d 100644 --- a/lisp/bs.el +++ b/lisp/bs.el @@ -195,7 +195,7 @@ return a string representing the column's value." 'font-lock-constant-face 'font-lock-comment-face)) ;; Dired-Buffers - '("^..\\(.*Dired by .*\\)$" 1 font-lock-function-name-face) + '("^..\\(.*Dired .*\\)$" 1 font-lock-function-name-face) ;; the star for modified buffers '("^.\\(\\*\\) +[^\\*]" 1 font-lock-comment-face)) "Default font lock expressions for Buffer Selection Menu.") diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el index 77a02b58c73..30f15f04905 100644 --- a/lisp/calc/calc-aent.el +++ b/lisp/calc/calc-aent.el @@ -1,7 +1,7 @@ ;;; calc-aent.el --- algebraic entry functions for Calc -;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, 2005, +;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; Author: Dave Gillespie ;; Maintainer: Jay Belanger @@ -609,9 +609,9 @@ in Calc algebraic input.") (setq math-exp-str (math-remove-percentsigns math-exp-str))) (if calc-language-input-filter (setq math-exp-str (funcall calc-language-input-filter math-exp-str))) - (while (setq math-exp-token + (while (setq math-exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" math-exp-str)) - (setq math-exp-str + (setq math-exp-str (concat (substring math-exp-str 0 math-exp-token) "\\dots" (substring math-exp-str (+ math-exp-token 2))))) (math-build-parse-table) @@ -712,7 +712,7 @@ in Calc algebraic input.") (math-read-token))) ((and (memq ch calc-user-token-chars) (let ((case-fold-search nil)) - (eq (string-match + (eq (string-match calc-user-tokens math-exp-str math-exp-pos) math-exp-pos))) (setq math-exp-token 'punc @@ -722,7 +722,7 @@ in Calc algebraic input.") (and (>= ch ?A) (<= ch ?Z)) (and (>= ch ?α) (<= ch ?ω)) (and (>= ch ?Α) (<= ch ?Ω))) - (string-match + (string-match (cond ((and (memq calc-language calc-lang-allow-underscores) (memq calc-language calc-lang-allow-percentsigns)) @@ -745,7 +745,7 @@ in Calc algebraic input.") (eq (string-match "_\\.?[0-9]" math-exp-str math-exp-pos) math-exp-pos) (or (eq math-exp-pos 0) - (and (not (memq calc-language + (and (not (memq calc-language calc-lang-allow-underscores)) (eq (string-match "[^])}\"a-zA-Zα-ωΑ-Ω0-9'$]_" math-exp-str (1- math-exp-pos)) @@ -757,7 +757,7 @@ in Calc algebraic input.") (setq math-exp-token 'number math-expr-data (math-match-substring math-exp-str 0) math-exp-pos (match-end 0))) - ((and (setq adfn + ((and (setq adfn (assq ch (get calc-language 'math-lang-read-symbol))) (eval (nth 1 adfn))) (eval (nth 2 adfn))) @@ -810,8 +810,8 @@ in Calc algebraic input.") (defun math-read-expr-level (exp-prec &optional exp-term) (let* ((math-expr-opers (math-expr-ops)) - (x (math-read-factor)) - (first t) + (x (math-read-factor)) + (first t) op op2) (while (and (or (and calc-user-parse-table (setq op (calc-check-user-syntax x exp-prec)) @@ -832,8 +832,8 @@ in Calc algebraic input.") (memq math-exp-token '(symbol number dollar hash)) (equal math-expr-data "(") (and (equal math-expr-data "[") - (not (equal - (get calc-language + (not (equal + (get calc-language 'math-function-open) "[")) (not (and math-exp-keep-spaces (eq (car-safe x) 'vec))))) @@ -1141,8 +1141,8 @@ If the current Calc language does not use placeholders, return nil." (eq math-exp-token 'end))) (throw 'syntax "Expected `)'")) (math-read-token) - (if (and (memq calc-language - calc-lang-parens-are-subscripts) + (if (and (memq calc-language + calc-lang-parens-are-subscripts) args (require 'calc-ext) (let ((calc-matrix-mode 'scalar)) @@ -1184,7 +1184,7 @@ If the current Calc language does not use placeholders, return nil." (substring (symbol-name (cdr v)) 4)) (cdr v)))))) - (while (and (memq calc-language + (while (and (memq calc-language calc-lang-brackets-are-subscripts) (equal math-expr-data "[")) (math-read-token) @@ -1284,6 +1284,7 @@ If the current Calc language does not use placeholders, return nil." (provide 'calc-aent) ;; Local variables: +;; coding: utf-8 ;; generated-autoload-file: "calc-loaddefs.el" ;; End: diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index 17dc9293237..18e63655ecf 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -1,7 +1,7 @@ ;;; calc-ext.el --- various extension functions for Calc -;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, 2005, +;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; Author: David Gillespie ;; Maintainer: Jay Belanger @@ -960,7 +960,7 @@ math-read-brackets math-reduce-cols math-reduce-vec math-transpose) ("calc-yank" calc-alg-edit calc-clean-newlines calc-do-grab-rectangle calc-do-grab-region calc-finish-stack-edit -calc-copy-to-register calc-insert-register +calc-copy-to-register calc-insert-register calc-append-to-register calc-prepend-to-register calc-force-refresh calc-locate-cursor-element calc-show-edit-buffer) @@ -989,7 +989,7 @@ calc-floor calc-idiv calc-increment calc-mant-part calc-max calc-min calc-round calc-scale-float calc-sign calc-trunc calc-xpon-part) ("calc-bin" calc-and calc-binary-radix calc-clip calc-twos-complement-mode -calc-decimal-radix calc-diff calc-hex-radix calc-leading-zeros +calc-decimal-radix calc-diff calc-hex-radix calc-leading-zeros calc-lshift-arith calc-lshift-binary calc-not calc-octal-radix calc-or calc-radix calc-rotate-binary calc-rshift-arith calc-rshift-binary calc-word-size calc-xor) @@ -1415,7 +1415,7 @@ calc-kill calc-kill-region calc-yank)))) (with-current-buffer calc-main-buffer calc-option-flag) calc-option-flag)) - (msg + (msg (cond ((and opt-flag hyp-flag) "Option Inverse Hyperbolic...") (hyp-flag "Inverse Hyperbolic...") @@ -1505,8 +1505,8 @@ calc-kill calc-kill-region calc-yank)))) (with-current-buffer calc-main-buffer calc-option-flag) calc-option-flag)) - (msg - (cond + (msg + (cond ((and opt-flag inv-flag) "Option Inverse Hyperbolic...") (opt-flag "Option Hyperbolic...") (inv-flag "Inverse Hyperbolic...") @@ -1537,8 +1537,8 @@ calc-kill calc-kill-region calc-yank)))) (with-current-buffer calc-main-buffer calc-hyperbolic-flag) calc-hyperbolic-flag)) - (msg - (cond + (msg + (cond ((and hyp-flag inv-flag) "Option Inverse Hyperbolic...") (hyp-flag "Option Hyperbolic...") (inv-flag "Option Inverse...") @@ -1702,8 +1702,8 @@ calc-kill calc-kill-region calc-yank)))) (defun calc-execute-extended-command (n) (interactive "P") (let* ((prompt (concat (calc-num-prefix-name n) "M-x ")) - (cmd (intern - (completing-read prompt obarray 'commandp t "calc-" + (cmd (intern + (completing-read prompt obarray 'commandp t "calc-" 'calc-extended-command-history)))) (setq prefix-arg n) (command-execute cmd))) @@ -3500,5 +3500,9 @@ A key may contain additional specs for Inverse, Hyperbolic, and Inv+Hyp.") (provide 'calc-ext) +;; Local variables: +;; coding: utf-8 +;; End: + ;; arch-tag: 1814ba7f-a390-49dc-9e25-a5adc205e97e ;;; calc-ext.el ends here diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el index 0ebf1a18fef..f461c47aafd 100644 --- a/lisp/calc/calc-lang.el +++ b/lisp/calc/calc-lang.el @@ -1,7 +1,7 @@ ;;; calc-lang.el --- calc language functions -;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, 2005, +;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; Author: David Gillespie ;; Maintainer: Jay Belanger @@ -335,7 +335,7 @@ (add-to-list 'calc-lang-allow-underscores 'fortran) (add-to-list 'calc-lang-parens-are-subscripts 'fortran) -;; The next few variables are local to math-read-exprs in calc-aent.el +;; The next few variables are local to math-read-exprs in calc-aent.el ;; and math-read-expr in calc-ext.el, but are set in functions they call. (defvar math-exp-token) @@ -379,12 +379,12 @@ ((= n 1) (message "TeX language mode with \\hbox{func}(\\hbox{var})")) ((> n 1) - (message + (message "TeX language mode with \\hbox{func}(\\hbox{var}) and multiline matrices")) ((= n -1) (message "TeX language mode with \\func(\\hbox{var})")) ((< n -1) - (message + (message "TeX language mode with \\func(\\hbox{var}) and multiline matrices"))))) (defun calc-latex-language (n) @@ -399,12 +399,12 @@ ((= n 1) (message "LaTeX language mode with \\text{func}(\\text{var})")) ((> n 1) - (message + (message "LaTeX language mode with \\text{func}(\\text{var}) and multiline matrices")) ((= n -1) (message "LaTeX language mode with \\func(\\text{var})")) ((< n -1) - (message + (message "LaTeX language mode with \\func(\\text{var}) and multiline matrices"))))) (put 'tex 'math-lang-name "TeX") @@ -498,7 +498,7 @@ (intv . math-compose-tex-intv))) (put 'tex 'math-variable-table - '( + '( ;; The Greek letters ( \\alpha . var-alpha ) ( \\beta . var-beta ) @@ -630,7 +630,7 @@ (defun math-compose-tex-matrix (a &optional ltx) (if (cdr a) - (cons (append (math-compose-vector (cdr (car a)) " & " 0) + (cons (append (math-compose-vector (cdr (car a)) " & " 0) (if ltx '(" \\\\ ") '(" \\cr "))) (math-compose-tex-matrix (cdr a) ltx)) (list (math-compose-vector (cdr (car a)) " & " 0)))) @@ -722,7 +722,7 @@ (setq left "{" right "}")) (t (setq left calc-function-open right calc-function-close))) - (list 'horiz func + (list 'horiz func left (math-compose-vector (cdr a) ", " 0) right))) @@ -866,7 +866,7 @@ (and right (setq math-exp-str (copy-sequence math-exp-str)) (aset math-exp-str right ?\])))))))))) - + (defun math-latex-parse-frac (f val) (let (numer denom) (setq numer (car (math-read-expr-list))) @@ -988,7 +988,7 @@ (cdr (math-transpose a))) '("}"))))) -(put 'eqn 'math-var-formatter +(put 'eqn 'math-var-formatter (function (lambda (a prec) (let (v) @@ -1011,7 +1011,7 @@ (intern (substring (symbol-name (nth 2 a)) 0 -1)))) prec) (symbol-name (nth 1 a)))))))) - + (defconst math-eqn-special-funcs '( calcFunc-log calcFunc-ln calcFunc-exp @@ -1022,7 +1022,7 @@ calcFunc-arcsin calcFunc-arccos calcFunc-arctan calcFunc-arcsinh calcFunc-arccosh calcFunc-arctanh)) -(put 'eqn 'math-func-formatter +(put 'eqn 'math-func-formatter (function (lambda (func a) (let (left right) @@ -1035,8 +1035,8 @@ (not (math-tex-expr-is-flat (nth 1 a)))) (setq left "{left ( " right " right )}")) - - ((and + + ((and (memq (car a) math-eqn-special-funcs) (= (length a) 2) (or (Math-realp (nth 1 a)) @@ -1069,7 +1069,7 @@ ("above" punc ","))) (put 'eqn 'math-lang-adjust-words - (function + (function (lambda () (let ((code (assoc math-expr-data math-eqn-ignore-words))) (cond ((null code)) @@ -1189,21 +1189,21 @@ ( Gamma . var-gamma))) (put 'yacas 'math-parse-table - '((("Deriv(" 0 ")" 0) + '((("Deriv(" 0 ")" 0) calcFunc-deriv (var ArgB var-ArgB) (var ArgA var-ArgA)) - (("D(" 0 ")" 0) + (("D(" 0 ")" 0) calcFunc-deriv (var ArgB var-ArgB) (var ArgA var-ArgA)) - (("Integrate(" 0 ")" 0) + (("Integrate(" 0 ")" 0) calcFunc-integ (var ArgB var-ArgB)(var ArgA var-ArgA)) - (("Integrate(" 0 "," 0 "," 0 ")" 0) - calcFunc-integ (var ArgD var-ArgD) (var ArgA var-ArgA) + (("Integrate(" 0 "," 0 "," 0 ")" 0) + calcFunc-integ (var ArgD var-ArgD) (var ArgA var-ArgA) (var ArgB var-ArgB) (var ArgC var-ArgC)) - (("Subst(" 0 "," 0 ")" 0) - calcFunc-subst (var ArgC var-ArgC) (var ArgA var-ArgA) + (("Subst(" 0 "," 0 ")" 0) + calcFunc-subst (var ArgC var-ArgC) (var ArgA var-ArgA) (var ArgB var-ArgB)) - (("Taylor(" 0 "," 0 "," 0 ")" 0) - calcFunc-taylor (var ArgD var-ArgD) - (calcFunc-eq (var ArgA var-ArgA) (var ArgB var-ArgB)) + (("Taylor(" 0 "," 0 "," 0 ")" 0) + calcFunc-taylor (var ArgD var-ArgD) + (calcFunc-eq (var ArgA var-ArgA) (var ArgB var-ArgB)) (var ArgC var-ArgC)))) (put 'yacas 'math-oper-table @@ -1356,7 +1356,7 @@ (math-compose-expr (nth 2 a) -1) (if (not (nth 3 a)) ")" - (concat + (concat "," (math-compose-expr (nth 3 a) -1) "," @@ -1393,7 +1393,7 @@ '(("+" + 100 100) ("-" - 100 134) ("*" * 120 120) - ("." * 130 129) + ("." * 130 129) ("/" / 120 120) ("u-" neg -1 180) ("u+" ident -1 180) @@ -1494,9 +1494,9 @@ (nth 3 args)))) (put 'maxima 'math-parse-table - '((("if" 0 "then" 0 "else" 0) - calcFunc-if - (var ArgA var-ArgA) + '((("if" 0 "then" 0 "else" 0) + calcFunc-if + (var ArgA var-ArgA) (var ArgB var-ArgB) (var ArgC var-ArgC)))) @@ -1572,7 +1572,7 @@ (lambda (a) (list 'horiz "matrix(" - (math-compose-vector (cdr a) + (math-compose-vector (cdr a) (concat math-comp-comma " ") math-comp-vector-prec) ")")))) @@ -1734,7 +1734,7 @@ order to Calc's." (nth 0 args)))) (put 'giac 'math-parse-table - '((("set" 0) + '((("set" 0) calcFunc-rdup (var ArgA var-ArgA)))) @@ -1748,7 +1748,7 @@ order to Calc's." "Compose the arguments to a Calc function in reverse order. This is used for various language modes which have functions in reverse order to Calc's." - (list 'horiz (nth 1 fn) + (list 'horiz (nth 1 fn) "(" (math-compose-expr (nth 2 a) 0) "," @@ -1770,7 +1770,7 @@ order to Calc's." (list 'horiz (math-compose-expr (nth 1 a) 1000) "[" - (math-compose-expr + (math-compose-expr (calc-normalize (list '- (nth 2 a) 1)) 0) "]"))))) @@ -2001,7 +2001,7 @@ order to Calc's." (list 'horiz "matrix(" math-comp-left-bracket - (math-compose-vector (cdr a) + (math-compose-vector (cdr a) (concat math-comp-comma " ") math-comp-vector-prec) math-comp-right-bracket @@ -2044,9 +2044,9 @@ order to Calc's." (defvar math-read-big-baseline) (defvar math-read-big-h2) -;; The variables math-rb-h1, math-rb-h2, math-rb-v1 and math-rb-v2 -;; are local to math-read-big-rec, but are used by math-read-big-char, -;; math-read-big-emptyp and math-read-big-balance which are called by +;; The variables math-rb-h1, math-rb-h2, math-rb-v1 and math-rb-v2 +;; are local to math-read-big-rec, but are used by math-read-big-char, +;; math-read-big-emptyp and math-read-big-balance which are called by ;; math-read-big-rec. ;; math-rb-h2 is also local to math-read-big-bigp in calc-ext.el, ;; which calls math-read-big-balance. @@ -2055,40 +2055,40 @@ order to Calc's." (defvar math-rb-v1) (defvar math-rb-v2) -(defun math-read-big-rec (math-rb-h1 math-rb-v1 math-rb-h2 math-rb-v2 +(defun math-read-big-rec (math-rb-h1 math-rb-v1 math-rb-h2 math-rb-v2 &optional baseline prec short) (or prec (setq prec 0)) ;; Clip whitespace above or below. - (while (and (< math-rb-v1 math-rb-v2) + (while (and (< math-rb-v1 math-rb-v2) (math-read-big-emptyp math-rb-h1 math-rb-v1 math-rb-h2 (1+ math-rb-v1))) (setq math-rb-v1 (1+ math-rb-v1))) - (while (and (< math-rb-v1 math-rb-v2) + (while (and (< math-rb-v1 math-rb-v2) (math-read-big-emptyp math-rb-h1 (1- math-rb-v2) math-rb-h2 math-rb-v2)) (setq math-rb-v2 (1- math-rb-v2))) ;; If formula is a single line high, normal parser can handle it. (if (<= math-rb-v2 (1+ math-rb-v1)) (if (or (<= math-rb-v2 math-rb-v1) - (> math-rb-h1 (length (setq math-rb-v2 + (> math-rb-h1 (length (setq math-rb-v2 (nth math-rb-v1 math-read-big-lines))))) (math-read-big-error math-rb-h1 math-rb-v1) (setq math-read-big-baseline math-rb-v1 math-read-big-h2 math-rb-h2 math-rb-v2 (nth math-rb-v1 math-read-big-lines) - math-rb-h2 (math-read-expr - (substring math-rb-v2 math-rb-h1 + math-rb-h2 (math-read-expr + (substring math-rb-v2 math-rb-h1 (min math-rb-h2 (length math-rb-v2))))) (if (eq (car-safe math-rb-h2) 'error) - (math-read-big-error (+ math-rb-h1 (nth 1 math-rb-h2)) + (math-read-big-error (+ math-rb-h1 (nth 1 math-rb-h2)) math-rb-v1 (nth 2 math-rb-h2)) math-rb-h2)) ;; Clip whitespace at left or right. - (while (and (< math-rb-h1 math-rb-h2) + (while (and (< math-rb-h1 math-rb-h2) (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) math-rb-v2)) (setq math-rb-h1 (1+ math-rb-h1))) - (while (and (< math-rb-h1 math-rb-h2) + (while (and (< math-rb-h1 math-rb-h2) (math-read-big-emptyp (1- math-rb-h2) math-rb-v1 math-rb-h2 math-rb-v2)) (setq math-rb-h2 (1- math-rb-h2))) @@ -2107,7 +2107,7 @@ order to Calc's." (/= (aref line math-rb-h1) ?\ ) (if (and (= (aref line math-rb-h1) ?\-) ;; Make sure it's not a minus sign. - (or (and (< (1+ math-rb-h1) len) + (or (and (< (1+ math-rb-h1) len) (= (aref line (1+ math-rb-h1)) ?\-)) (/= (math-read-big-char math-rb-h1 (1- v)) ?\ ) (/= (math-read-big-char math-rb-h1 (1+ v)) ?\ ))) @@ -2166,7 +2166,7 @@ order to Calc's." ;; Binomial coefficient. ((and (= other-char ?\() (= (math-read-big-char (1+ math-rb-h1) v) ?\ ) - (= (string-match "( *)" (nth v math-read-big-lines) + (= (string-match "( *)" (nth v math-read-big-lines) math-rb-h1) math-rb-h1)) (setq h (match-end 0)) (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) v nil t) @@ -2180,7 +2180,7 @@ order to Calc's." ;; Minus sign. ((= other-char ?\-) - (setq p (list 'neg (math-read-big-rec (1+ math-rb-h1) math-rb-v1 + (setq p (list 'neg (math-read-big-rec (1+ math-rb-h1) math-rb-v1 math-rb-h2 math-rb-v2 v 250 t)) v math-read-big-baseline h math-read-big-h2)) @@ -2199,10 +2199,10 @@ order to Calc's." (if (= sep ?\]) (math-read-big-error (1- h) v "Expected `)'")) (if (= sep ?\)) - (setq p (math-read-big-rec + (setq p (math-read-big-rec (1+ math-rb-h1) math-rb-v1 (1- h) math-rb-v2 v)) (setq hmid (math-read-big-balance h v "(") - p (list p + p (list p (math-read-big-rec h math-rb-v1 (1- hmid) math-rb-v2 v)) h hmid) (cond ((= sep ?\.) @@ -2347,7 +2347,7 @@ order to Calc's." (math-read-big-emptyp math-rb-h1 math-rb-v1 h v nil t) (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t))) - ;; Now left term is bounded by math-rb-h1, math-rb-v1, h, math-rb-v2; + ;; Now left term is bounded by math-rb-h1, math-rb-v1, h, math-rb-v2; ;; baseline = v. (if baseline (or (= v baseline) @@ -2389,12 +2389,12 @@ order to Calc's." (cond ((eq (nth 3 widest) -1) (setq p (list (nth 1 widest) p))) ((equal (car widest) "?") - (let ((y (math-read-big-rec h math-rb-v1 math-rb-h2 + (let ((y (math-read-big-rec h math-rb-v1 math-rb-h2 math-rb-v2 baseline nil t))) (or (= (math-read-big-char math-read-big-h2 baseline) ?\:) (math-read-big-error math-read-big-h2 baseline "Expected `:'")) (setq p (list (nth 1 widest) p y - (math-read-big-rec + (math-read-big-rec (1+ math-read-big-h2) math-rb-v1 math-rb-h2 math-rb-v2 baseline (nth 3 widest) t)) h math-read-big-h2))) @@ -2483,5 +2483,9 @@ order to Calc's." (provide 'calc-lang) +;; Local variables: +;; coding: utf-8 +;; End: + ;; arch-tag: 483bfe15-f290-4fef-bb7d-ce65be687f2e ;;; calc-lang.el ends here diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el index 8f73e71b0f9..b82ed08c557 100644 --- a/lisp/calc/calc-store.el +++ b/lisp/calc/calc-store.el @@ -1,7 +1,7 @@ ;;; calc-store.el --- value storage functions for Calc -;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, 2005, +;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; Author: David Gillespie ;; Maintainer: Jay Belanger @@ -197,8 +197,8 @@ (minibuffer-completion-predicate (lambda (x) (boundp (intern (concat "var-" x))))) (minibuffer-completion-confirm t)) - (read-from-minibuffer - prompt nil calc-var-name-map nil + (read-from-minibuffer + prompt nil calc-var-name-map nil 'calc-read-var-name-history))))) (setq calc-aborted-prefix "") (and (not (equal var "var-")) @@ -677,5 +677,9 @@ (provide 'calc-store) +;; Local variables: +;; coding: utf-8 +;; End: + ;; arch-tag: 2fbfec82-a521-42ca-bcd8-4f254ae6313e ;;; calc-store.el ends here diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el index 6881db3fb12..a88e87dffbc 100644 --- a/lisp/calc/calc-units.el +++ b/lisp/calc/calc-units.el @@ -1,7 +1,7 @@ ;;; calc-units.el --- unit conversion functions for Calc -;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, 2005, +;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; Author: David Gillespie ;; Maintainer: Jay Belanger @@ -323,7 +323,7 @@ that the combined units table will be rebuilt.") ( ?c (^ 10 -2) "Centi" ) ( ?m (^ 10 -3) "Milli" ) ( ?u (^ 10 -6) "Micro" ) - ( ?μ (^ 10 -6) "Micro" ) + ( ?μ (^ 10 -6) "Micro" ) ( ?n (^ 10 -9) "Nano" ) ( ?p (^ 10 -12) "Pico" ) ( ?f (^ 10 -15) "Femto" ) @@ -1548,5 +1548,9 @@ If EXPR is nil, return nil." (provide 'calc-units) +;; Local variables: +;; coding: utf-8 +;; End: + ;; arch-tag: e993314f-3adc-4191-be61-4ef8874881c4 ;;; calc-units.el ends here diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 587e376245b..7ea371dd16e 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -419,7 +419,7 @@ in normal mode." :group 'calc :type 'boolean) -(defcustom calc-undo-length +(defcustom calc-undo-length 100 "The number of undo steps that will be preserved when Calc is quit." :group 'calc @@ -1233,7 +1233,7 @@ the trail buffer." ;; Eventually, prompt user with a list of buffers using embedded mode. (when (and info-list - (yes-or-no-p + (yes-or-no-p (concat "This Calc stack is being used for embedded mode. Kill anyway?"))) (while info-list (with-current-buffer (car (car info-list)) @@ -3409,7 +3409,7 @@ largest Emacs integer.") (Math-lessp a math-half-2-word-size)) (and (Math-integer-negp a) (require 'calc-ext) - (let ((comparison + (let ((comparison (math-compare (Math-integer-neg a) math-half-2-word-size))) (or (= comparison 0) (= comparison -1)))))) @@ -3553,7 +3553,7 @@ largest Emacs integer.") (math-normalize (save-match-data (cond - + ;; Integers (most common case) ((string-match "\\` *\\([0-9]+\\) *\\'" s) (let ((digs (math-match-substring s 1))) @@ -3565,22 +3565,22 @@ largest Emacs integer.") (if (<= (length digs) (* 2 math-bignum-digit-length)) (string-to-number digs) (cons 'bigpos (math-read-bignum digs)))))) - + ;; Clean up the string if necessary ((string-match "\\`\\(.*\\)[ \t\n]+\\([^\001]*\\)\\'" s) (math-read-number (concat (math-match-substring s 1) (math-match-substring s 2)))) - + ;; Plus and minus signs ((string-match "^[-_+]\\(.*\\)$" s) (let ((val (math-read-number (math-match-substring s 1)))) (and val (if (eq (aref s 0) ?+) val (math-neg val))))) - + ;; Forms that require extensions module ((string-match "[^-+0-9eE.]" s) (require 'calc-ext) (math-read-number-fancy s)) - + ;; Decimal point ((string-match "^\\([0-9]*\\)\\.\\([0-9]*\\)$" s) (let ((int (math-match-substring s 1)) @@ -3593,7 +3593,7 @@ largest Emacs integer.") (list 'float (math-add (math-scale-int int flen) frac) (- flen))))))) - + ;; "e" notation ((string-match "^\\(.*\\)[eE]\\([-+]?[0-9]+\\)$" s) (let ((mant (math-match-substring s 1)) @@ -3604,7 +3604,7 @@ largest Emacs integer.") (and mant exp (Math-realp mant) (> exp -4000000) (< exp 4000000) (let ((mant (math-float mant))) (list 'float (nth 1 mant) (+ (nth 2 mant) exp))))))) - + ;; Syntax error! (t nil))))) @@ -3797,7 +3797,7 @@ See Info node `(calc)Defining Functions'." (setq unread-command-event nil) (setq unread-command-events nil))) -(defcalcmodevar math-2-word-size +(defcalcmodevar math-2-word-size (math-read-number-simple "4294967296") "Two to the power of `calc-word-size'.") @@ -3814,5 +3814,9 @@ See Info node `(calc)Defining Functions'." (provide 'calc) +;; Local variables: +;; coding: utf-8 +;; End: + ;; arch-tag: 0c3b170c-4ce6-4eaf-8d9b-5834d1fe938f ;;; calc.el ends here diff --git a/lisp/calc/calccomp.el b/lisp/calc/calccomp.el index c8efded9270..7aeb31c7719 100644 --- a/lisp/calc/calccomp.el +++ b/lisp/calc/calccomp.el @@ -1,7 +1,7 @@ ;;; calccomp.el --- composition functions for Calc -;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, 2005, +;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; Author: David Gillespie ;; Maintainer: Jay Belanger @@ -50,19 +50,19 @@ ;;; ;;; (tag X C) Composition C corresponds to sub-expression X -;; math-comp-just and math-comp-comma-spc are local to -;; math-compose-expr, but are used by math-compose-matrix, which is +;; math-comp-just and math-comp-comma-spc are local to +;; math-compose-expr, but are used by math-compose-matrix, which is ;; called by math-compose-expr (defvar math-comp-just) (defvar math-comp-comma-spc) -;; math-comp-vector-prec is local to math-compose-expr, but is used by -;; math-compose-matrix and math-compose-rows, which are called by +;; math-comp-vector-prec is local to math-compose-expr, but is used by +;; math-compose-matrix and math-compose-rows, which are called by ;; math-compose-expr. (defvar math-comp-vector-prec) -;; math-comp-left-bracket, math-comp-right-bracket and math-comp-comma are -;; local to math-compose-expr, but are used by math-compose-rows, which is +;; math-comp-left-bracket, math-comp-right-bracket and math-comp-comma are +;; local to math-compose-expr, but are used by math-compose-rows, which is ;; called by math-compose-expr. (defvar math-comp-left-bracket) (defvar math-comp-right-bracket) @@ -100,7 +100,7 @@ (list 'tag a (math-compose-expr a prec)))) ((and (not (consp a)) (not (integerp a))) (concat "'" (prin1-to-string a))) - ((setq spfn (assq (car-safe a) + ((setq spfn (assq (car-safe a) (get calc-language 'math-special-function-table))) (setq spfn (cdr spfn)) (if (consp spfn) @@ -111,12 +111,12 @@ (and (nth 1 calc-frac-format) (Math-integerp a))) (if (and calc-language - (not (memq calc-language + (not (memq calc-language '(flat big unform)))) (let ((aa (math-adjust-fraction a)) (calc-frac-format nil)) (math-compose-expr (list '/ - (if (memq calc-language + (if (memq calc-language calc-lang-slash-idiv) (math-float (nth 1 aa)) (nth 1 aa)) @@ -281,22 +281,22 @@ (cdr a) (if full rows 3) t))))) (if (or calc-full-vectors (< (length a) 7)) - (if (and + (if (and (setq spfn (get calc-language 'math-matrix-formatter)) (math-matrixp a)) (funcall spfn a) (list 'horiz math-comp-left-bracket - (math-compose-vector (cdr a) + (math-compose-vector (cdr a) (concat math-comp-comma " ") math-comp-vector-prec) math-comp-right-bracket)) (list 'horiz math-comp-left-bracket (math-compose-vector (list (nth 1 a) (nth 2 a) (nth 3 a)) - (concat math-comp-comma " ") + (concat math-comp-comma " ") math-comp-vector-prec) - math-comp-comma + math-comp-comma (if (setq spfn (get calc-language 'math-dots)) (concat " " spfn) " ...") @@ -869,7 +869,7 @@ math-comp-vector-prec) (if (= col cols) "" - (concat + (concat math-comp-comma-spc " "))))) a))) res))) @@ -880,7 +880,7 @@ (if (<= count 0) (if (< count 0) (math-compose-rows (cdr a) -1 nil) - (cons (concat + (cons (concat (let ((mdots (get calc-language 'math-dots))) (if mdots (concat " " mdots) @@ -1119,7 +1119,7 @@ (if (memq prec '(196 201)) ")" ""))))) ;; The variables math-svo-c, math-svo-wid and math-svo-off are local -;; to math-stack-value-offset in calc.el, but are used by +;; to math-stack-value-offset in calc.el, but are used by ;; math-stack-value-offset-fancy, which is called by math-stack-value-offset.. (defvar math-svo-c) (defvar math-svo-wid) @@ -1195,11 +1195,11 @@ ;;; of the formula. ;; The variables math-comp-full-width, math-comp-highlight, math-comp-word, -;; math-comp-level, math-comp-margin and math-comp-buf are local to -;; math-comp-to-string-flat, but are used by math-comp-to-string-flat-term, +;; math-comp-level, math-comp-margin and math-comp-buf are local to +;; math-comp-to-string-flat, but are used by math-comp-to-string-flat-term, ;; which is called by math-comp-to-string-flat. -;; math-comp-highlight and math-comp-buf are also local to -;; math-comp-simplify-term and math-comp-simplify respectively, but are used +;; math-comp-highlight and math-comp-buf are also local to +;; math-comp-simplify-term and math-comp-simplify respectively, but are used ;; by math-comp-add-string. (defvar math-comp-full-width) (defvar math-comp-highlight) @@ -1244,7 +1244,7 @@ (cond ((not (consp c)) (if math-comp-highlight (setq c (math-comp-highlight-string c))) - (setq math-comp-word (if (= (length math-comp-word) 0) c + (setq math-comp-word (if (= (length math-comp-word) 0) c (concat math-comp-word c)) math-comp-pos (+ math-comp-pos (length c)))) @@ -1347,8 +1347,8 @@ ;; The variable math-comp-sel-tag is local to calc-find-selected-part -;; in calc-sel.el, but is used by math-comp-sel-flat-term and -;; math-comp-add-string-sel, which are called (indirectly) by +;; in calc-sel.el, but is used by math-comp-sel-flat-term and +;; math-comp-add-string-sel, which are called (indirectly) by ;; calc-find-selected-part. (defvar math-comp-sel-tag) @@ -1668,5 +1668,9 @@ (provide 'calccomp) +;; Local variables: +;; coding: utf-8 +;; End: + ;; arch-tag: 7c45d10a-a286-4dab-af49-7ae8989fbf78 ;;; calccomp.el ends here diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el index bbddc1ff38c..46fb0869787 100644 --- a/lisp/calendar/cal-tex.el +++ b/lisp/calendar/cal-tex.el @@ -1,7 +1,7 @@ ;;; cal-tex.el --- calendar functions for printing calendars with LaTeX -;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +;; 2009, 2010 Free Software Foundation, Inc. ;; Author: Steve Fisk ;; Edward M. Reingold @@ -507,6 +507,7 @@ indicates a buffer position to use instead of point." (year (calendar-extract-year date)) (end-month month) (end-year year) + ;; FIXME -landscape sets cal-tex-which-days? (d1 (calendar-absolute-from-gregorian (list month 1 year))) (d2 (progn (calendar-increment-month end-month end-year (1- n)) @@ -515,8 +516,7 @@ indicates a buffer position to use instead of point." (calendar-last-day-of-month end-month end-year) end-year)))) (diary-list (if cal-tex-diary (cal-tex-list-diary-entries d1 d2))) - (holidays (if cal-tex-holidays (cal-tex-list-holidays d1 d2))) - other-month other-year) + (holidays (if cal-tex-holidays (cal-tex-list-holidays d1 d2)))) (cal-tex-insert-preamble (cal-tex-number-weeks month year n) nil "12pt") (if (> n 1) (cal-tex-cmd cal-tex-cal-multi-month) @@ -526,14 +526,12 @@ indicates a buffer position to use instead of point." (cal-tex-nl ".2cm") (cal-tex-insert-blank-days month year cal-tex-day-prefix) (dotimes (idummy n) - (setq other-month month - other-year year) (cal-tex-insert-days month year diary-list holidays cal-tex-day-prefix) - (when (= 6 (mod (calendar-absolute-from-gregorian - (list month - (calendar-last-day-of-month month year) - year)) - 7)) ; last day of month was Saturday + (when (= (calendar-week-end-day) + (calendar-day-of-week + (list month + (calendar-last-day-of-month month year) + year))) ; last day of month was last day of week (cal-tex-hfill) (cal-tex-nl)) (calendar-increment-month month year 1)) @@ -570,13 +568,14 @@ are included. Each day is formatted using format DAY-FORMAT." (defun cal-tex-insert-day-names () "Insert the names of the days at top of a monthly calendar." - (dotimes (i 7) - (if (memq i cal-tex-which-days) - (insert (format cal-tex-day-name-format - (cal-tex-LaTeXify-string - (aref calendar-day-name-array - (mod (+ calendar-week-start-day i) 7)))))) - (cal-tex-comment))) + (let (j) + (dotimes (i 7) + (if (memq (setq j (mod (+ calendar-week-start-day i) 7)) + cal-tex-which-days) + (insert (format cal-tex-day-name-format + (cal-tex-LaTeXify-string + (aref calendar-day-name-array j))))) + (cal-tex-comment)))) (defun cal-tex-insert-month-header (n month year end-month end-year) "Create a title for a calendar. @@ -603,7 +602,7 @@ blank, no days are inserted." calendar-week-start-day) 7))) (dotimes (i blank-days) - (if (memq i cal-tex-which-days) + (if (memq (mod (+ calendar-week-start-day i) 7) cal-tex-which-days) (insert (format day-format " " " ") "{}{}{}{}%\n")))))) (defun cal-tex-insert-blank-days-at-end (month year day-format) @@ -619,38 +618,37 @@ The entry is formatted using DAY-FORMAT." 7)) (i blank-days)) (while (<= (setq i (1+ i)) 6) - (if (memq i cal-tex-which-days) + (if (memq (mod (+ calendar-week-start-day i) 7) cal-tex-which-days) (insert (format day-format "" "") "{}{}{}{}%\n")))))) (defun cal-tex-first-blank-p (month year) "Determine if any days of the first week will be printed. Return t if there will there be any days of the first week printed in the calendar starting in MONTH YEAR." - (let (any-days the-saturday) ; the day of week of 1st Saturday - (dotimes (i 7) - (if (= 6 (calendar-day-of-week (list month (1+ i) year))) - (setq the-saturday (1+ i)))) - (dotimes (i the-saturday) - (if (memq (calendar-day-of-week (list month (1+ i) year)) - cal-tex-which-days) - (setq any-days t))) - any-days)) + ;; Check days 1-7 of the month, until we find the last day of the week. + (catch 'found + (let (dow) + (dotimes (i 7) + (if (memq (setq dow (calendar-day-of-week (list month (1+ i) year))) + cal-tex-which-days) + (throw 'found t) + (if (= dow (calendar-week-end-day)) (throw 'found nil))))))) (defun cal-tex-last-blank-p (month year) "Determine if any days of the last week will be printed. Return t if there will there be any days of the last week printed in the calendar starting in MONTH YEAR." - (let* ((last-day (calendar-last-day-of-month month year)) - (i (- last-day 7)) - any-days the-sunday) ; the day of week of last Sunday - (while (<= (setq i (1+ i)) last-day) - (if (zerop (calendar-day-of-week (list month i year))) - (setq the-sunday i))) - (setq i (1- the-sunday)) - (while (<= (setq i (1+ i)) last-day) - (if (memq (calendar-day-of-week (list month i year)) cal-tex-which-days) - (setq any-days t))) - any-days)) + ;; Check backwards from the last day of the month, until we find the + ;; start of the last week in the month. + (catch 'found + (let ((last-day (calendar-last-day-of-month month year)) + day dow) + (dotimes (i 7) + (if (memq (setq dow (calendar-day-of-week + (list month (- last-day i) year))) + cal-tex-which-days) + (throw 'found t) + (if (= dow calendar-week-start-day) (throw 'found nil))))))) (defun cal-tex-number-weeks (month year n) "Determine the number of weeks in a range of dates. @@ -1499,7 +1497,7 @@ Optional string COLSEP gives the column separation (default \"1mm\")." (- (calendar-day-of-week (list month 1 year)) calendar-week-start-day) 7)) - (last (calendar-last-day-of-month month year)) + (last( calendar-last-day-of-month month year)) (str (concat "\\def\\" name "{\\hbox to" width "{%\n" "\\vbox to" height "{%\n" "\\vfil \\hbox to" width "{%\n" diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index d92942d003f..418f740bb83 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -2226,6 +2226,10 @@ DATE is a list of the form (month day year). A negative year is interpreted as BC; -1 being 1 BC, and so on." (mod (calendar-absolute-from-gregorian date) 7)) +(defun calendar-week-end-day () + "Return the index (0 for Sunday, etc.) of the last day of the week." + (mod (+ calendar-week-start-day 6) 7)) + (defun calendar-unmark () "Delete all diary/holiday marks/highlighting from the calendar." (interactive) diff --git a/lisp/comint.el b/lisp/comint.el index b097baad189..071537ffd89 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -701,7 +701,9 @@ a running process in that buffer, it is not restarted. Optional fourth arg STARTFILE is the name of a file, whose contents are sent to the process as its initial input. -If PROGRAM is a string, any more args are arguments to PROGRAM." +If PROGRAM is a string, any more args are arguments to PROGRAM. + +Returns the (possibly newly created) process buffer." (or (fboundp 'start-file-process) (error "Multi-processing is not supported for this system")) (setq buffer (get-buffer-create (or buffer (concat "*" name "*")))) @@ -725,7 +727,9 @@ a running process in that buffer, it is not restarted. Optional third arg STARTFILE is the name of a file, whose contents are sent to the process as its initial input. -If PROGRAM is a string, any more args are arguments to PROGRAM." +If PROGRAM is a string, any more args are arguments to PROGRAM. + +Returns the (possibly newly created) process buffer." (apply #'make-comint-in-buffer name nil program startfile switches)) ;;;###autoload diff --git a/lisp/custom.el b/lisp/custom.el index 726f70492b3..273c67dc66d 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -143,7 +143,9 @@ set to nil, as the value is no longer rogue." (when (get symbol 'force-value) (put symbol 'force-value nil)) (when doc - (put symbol 'variable-documentation doc)) + (if (keywordp doc) + (error "Doc string is missing") + (put symbol 'variable-documentation doc))) (let ((initialize 'custom-initialize-reset) (requests nil)) (unless (memq :group args) diff --git a/lisp/descr-text.el b/lisp/descr-text.el index 218f2a51d7f..93c69e0eea5 100644 --- a/lisp/descr-text.el +++ b/lisp/descr-text.el @@ -301,7 +301,7 @@ This function is semi-obsolete. Use `get-char-code-property'." (lambda (arg) (string (string-to-number arg 16))) parts " ")) - (concat info parts)))) + (concat info (if info " ") parts)))) (list "Decimal digit value" (nth 5 fields)) (list "Digit value" @@ -618,7 +618,7 @@ as well as widgets, buttons, overlays, and text properties." ,@(if (not eight-bit-p) (let ((unicodedata (describe-char-unicode-data char))) (if unicodedata - (cons (list "Unicode data" " ") unicodedata)))))) + (cons (list "Unicode data" "") unicodedata)))))) (setq max-width (apply 'max (mapcar (lambda (x) (if (cadr x) (length (car x)) 0)) item-list))) @@ -642,7 +642,8 @@ as well as widgets, buttons, overlays, and text properties." (window-width)) (insert "\n") (indent-to (1+ max-width))) - (insert " " clm))) + (unless (zerop (length clm)) + (insert " " clm)))) (insert "\n")))) (when overlays diff --git a/lisp/dired.el b/lisp/dired.el index 4fe804dd46d..8184587b01b 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1380,10 +1380,8 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." (define-key map ">" 'dired-next-dirline) (define-key map "^" 'dired-up-directory) (define-key map " " 'dired-next-line) - (define-key map "\C-n" 'dired-next-line) - (define-key map "\C-p" 'dired-previous-line) - (define-key map [down] 'dired-next-line) - (define-key map [up] 'dired-previous-line) + (define-key map [remap next-line] 'dired-next-line) + (define-key map [remap previous-line] 'dired-previous-line) ;; hiding (define-key map "$" 'dired-hide-subdir) (define-key map "\M-$" 'dired-hide-all) @@ -1393,7 +1391,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." (define-key map (kbd "M-s f C-s") 'dired-isearch-filenames) (define-key map (kbd "M-s f M-C-s") 'dired-isearch-filenames-regexp) ;; misc - (define-key map "\C-x\C-q" 'dired-toggle-read-only) + (define-key map [remap toggle-read-only] 'dired-toggle-read-only) (define-key map "?" 'dired-summary) (define-key map "\177" 'dired-unmark-backward) (define-key map [remap undo] 'dired-undo) @@ -2765,17 +2763,19 @@ name, or the marker and a count of marked files." (fit-window-to-buffer (get-buffer-window buf) nil 1))) (defcustom dired-no-confirm nil - "A list of symbols for commands Dired should not confirm. + "A list of symbols for commands Dired should not confirm, or t. Command symbols are `byte-compile', `chgrp', `chmod', `chown', `compress', `copy', `delete', `hardlink', `load', `move', `print', `shell', `symlink', -`touch' and `uncompress'." +`touch' and `uncompress'. +If t, confirmation is never needed." :group 'dired - :type '(set (const byte-compile) (const chgrp) - (const chmod) (const chown) (const compress) - (const copy) (const delete) (const hardlink) - (const load) (const move) (const print) - (const shell) (const symlink) (const touch) - (const uncompress))) + :type '(choice (const :tag "Confirmation never needed" t) + (set (const byte-compile) (const chgrp) + (const chmod) (const chown) (const compress) + (const copy) (const delete) (const hardlink) + (const load) (const move) (const print) + (const shell) (const symlink) (const touch) + (const uncompress)))) (defun dired-mark-pop-up (bufname op-symbol files function &rest args) "Return FUNCTION's result on ARGS after showing which files are marked. diff --git a/lisp/dnd.el b/lisp/dnd.el index c064aa9897a..d7cbb641bab 100644 --- a/lisp/dnd.el +++ b/lisp/dnd.el @@ -1,8 +1,9 @@ -;;; dnd.el --- drag and drop support. +;;; dnd.el --- drag and drop support. -*- coding: utf-8 -*- -;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 +;; Free Software Foundation, Inc. -;; Author: Jan Dj,Ad(Brv +;; Author: Jan Djärv ;; Maintainer: FSF ;; Keywords: window, drag, drop diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 528d5979ce1..4f183f4b9dc 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1349,8 +1349,8 @@ See the command `doc-view-mode' for more information on this mode." ;;;; Bookmark integration -(declare-function bookmark-make-record-default "bookmark" - (&optional point-only)) +(declare-function bookmark-make-record-default + "bookmark" (&optional no-file no-context posn)) (declare-function bookmark-prop-get "bookmark" (bookmark prop)) (declare-function bookmark-default-handler "bookmark" (bmk)) diff --git a/lisp/dynamic-setting.el b/lisp/dynamic-setting.el index 37a95999562..f61a0078e17 100644 --- a/lisp/dynamic-setting.el +++ b/lisp/dynamic-setting.el @@ -65,7 +65,6 @@ current form for the frame (i.e. hinting or somesuch changed)." frame-font))) (if font-to-set (progn - (message "setting %s" font-to-set) (set-frame-parameter f 'font-parameter font-to-set) (set-face-attribute 'default f :width 'normal diff --git a/lisp/emacs-lisp/package-x.el b/lisp/emacs-lisp/package-x.el index c2d85aa574a..21bd7960d89 100644 --- a/lisp/emacs-lisp/package-x.el +++ b/lisp/emacs-lisp/package-x.el @@ -31,6 +31,9 @@ ;;; Code: +(require 'package) +(defvar gnus-article-buffer) + ;; Note that this only works if you have the password, which you ;; probably don't :-). (defvar package-archive-upload-base nil diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 54a2ba610ca..c6035442313 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -211,7 +211,6 @@ If VERSION is nil, the package is not loaded (it is \"disabled\")." :version "24.1") (defvar Info-directory-list) -(defvar gnus-article-buffer) (declare-function info-initialize "info" ()) (declare-function url-http-parse-response "url-http" ()) (declare-function lm-header "lisp-mnt" (header)) @@ -423,33 +422,35 @@ updates `package-alist' and `package-obsolete-alist'." "Extract the kind of download from an archive package description vector." (aref desc 3)) -(defun package-activate-1 (package pkg-vec) - (let* ((pkg-name (symbol-name package)) - (pkg-ver-str (package-version-join (package-desc-vers pkg-vec))) +(defun package--dir (name version-string) + (let* ((subdir (concat name "-" version-string)) (dir-list (cons package-user-dir package-directory-list)) - (pkg-dir)) + pkg-dir) (while dir-list - (let ((subdir (expand-file-name (concat pkg-name "-" pkg-ver-str) - (car dir-list)))) - (if (file-directory-p subdir) - (progn - (setq pkg-dir subdir) - (setq dir-list nil)) + (let ((subdir-full (expand-file-name subdir (car dir-list)))) + (if (file-directory-p subdir-full) + (setq pkg-dir subdir-full + dir-list nil) (setq dir-list (cdr dir-list))))) + pkg-dir)) + +(defun package-activate-1 (package pkg-vec) + (let* ((name (symbol-name package)) + (version-str (package-version-join (package-desc-vers pkg-vec))) + (pkg-dir (package--dir name version-str))) (unless pkg-dir (error "Internal error: could not find directory for %s-%s" - pkg-name pkg-ver-str)) + name version-str)) + ;; Add info node. (if (file-exists-p (expand-file-name "dir" pkg-dir)) (progn ;; FIXME: not the friendliest, but simple. (require 'info) (info-initialize) (setq Info-directory-list (cons pkg-dir Info-directory-list)))) + ;; Add to load path, add autoloads, and activate the package. (setq load-path (cons pkg-dir load-path)) - ;; Load the autoloads and activate the package. - (load (expand-file-name (concat (symbol-name package) "-autoloads") - pkg-dir) - nil t) + (load (expand-file-name (concat name "-autoloads") pkg-dir) nil t) (setq package-activated-list (cons package package-activated-list)) ;; Don't return nil. t)) @@ -474,8 +475,7 @@ Return nil if the package could not be activated." (let* ((pkg-desc (assq package package-alist)) (this-version (package-desc-vers (cdr pkg-desc))) (req-list (package-desc-reqs (cdr pkg-desc))) - ;; If the package was never activated, we want to do it - ;; now. + ;; If the package was never activated, do it now. (keep-going (or (not (memq package package-activated-list)) (package-version-compare this-version version '>)))) (while (and req-list keep-going) @@ -1037,13 +1037,114 @@ The variable `package-load-list' controls which packages to load." package-alist)) +;;;; Package description buffer. +;;;###autoload +(defun describe-package (package) + "Display the full documentation of PACKAGE (a symbol)." + (interactive + (let* ((packages (append (mapcar 'car package-alist) + (mapcar 'car package-archive-contents))) + (guess (function-called-at-point)) + val) + (unless (memq guess packages) + (setq guess nil)) + (setq packages (mapcar 'symbol-name packages)) + (setq val + (completing-read (if guess + (format "Describe package (default %s): " + guess) + "Describe package: ") + packages nil t nil nil guess)) + (list (if (equal val "") + guess + (intern val))))) + (if (or (null package) (null (symbolp package))) + (message "You did not specify a package") + (help-setup-xref (list #'describe-package package) + (called-interactively-p 'interactive)) + (with-help-window (help-buffer) + (with-current-buffer standard-output + (describe-package-1 package))))) + +(defun describe-package-1 (package) + (let ((desc (cdr (assq package package-alist))) + reqs version installable) + (prin1 package) + (princ " is ") + (cond + (desc + ;; This package is loaded (i.e. in `package-alist'). + (let (pkg-dir) + (setq version (package-version-join (package-desc-vers desc))) + (if (assq package package--builtins) + (princ "a built-in package.\n\n") + (setq pkg-dir (package--dir (symbol-name package) version)) + (if pkg-dir + (progn + (insert "a package installed in `") + (help-insert-xref-button (file-name-as-directory pkg-dir) + 'help-package-def pkg-dir) + (insert "'.\n\n")) + ;; This normally does not happen. + (insert "a deleted package.\n\n") + (setq version nil))))) + (t + ;; An uninstalled package. + (setq desc (cdr (assq package package-archive-contents)) + version (package-version-join (package-desc-vers desc)) + installable t) + (insert "an installable package.\n\n"))) + (if version + (insert " Version: " version "\n")) + (setq reqs (package-desc-reqs desc)) + (when reqs + (insert " Requires: ") + (let ((first t) + name vers text) + (dolist (req reqs) + (setq name (car req) + vers (cadr req) + text (format "%s-%s" (symbol-name name) + (package-version-join vers))) + (cond (first (setq first nil)) + ((>= (+ 2 (current-column) (length text)) + (window-width)) + (insert ",\n ")) + (t (insert ", "))) + (help-insert-xref-button text 'help-package name)) + (insert "\n"))) + (insert " Description: " (package-desc-doc desc) "\n") + ;; Todo: button for uninstalling a package. + (when installable + (let ((button-text (if (display-graphic-p) + "Install" + "[Install]")) + (button-face (if (display-graphic-p) + '(:box (:line-width 2 :color "dark grey") + :background "light grey" + :foreground "black") + 'link))) + (insert "\n") + (insert-text-button button-text + 'face button-face + 'follow-link t + 'package-symbol package + 'action (lambda (button) + (package-install + (button-get button 'package-symbol)) + (revert-buffer nil t) + (goto-char (point-min)))) + (insert "\n"))))) + + ;;;; Package menu mode. (defvar package-menu-mode-map (let ((map (make-keymap)) (menu-map (make-sparse-keymap "Package"))) (suppress-keymap map) + (define-key map "\C-m" 'package-menu-describe-package) (define-key map "q" 'quit-window) (define-key map "n" 'next-line) (define-key map "p" 'previous-line) @@ -1145,6 +1246,14 @@ available for download." (interactive) (package-list-packages-internal)) +(defun package-menu-describe-package () + "Describe the package in the current line." + (interactive) + (let ((name (package-menu-get-package))) + (if name + (describe-package (intern name)) + (message "No package on this line")))) + (defun package-menu-mark-internal (what) (unless (eobp) (let ((buffer-read-only nil)) @@ -1223,7 +1332,7 @@ For larger packages, shows the README file." (save-excursion (beginning-of-line) (if (looking-at ". \\([^ \t]*\\)") - (match-string 1)))) + (match-string-no-properties 1)))) ;; Return the version of the package on the current line. (defun package-menu-get-version () @@ -1279,14 +1388,20 @@ Emacs." (t ; obsolete, but also the default. 'font-lock-warning-face)))) (insert (propertize " " 'font-lock-face face)) - (insert (propertize (symbol-name package) 'font-lock-face face)) + (insert-text-button (symbol-name package) + 'face 'link + 'follow-link t + 'package-symbol package + 'action (lambda (button) + (describe-package + (button-get button 'package-symbol)))) (indent-to 20 1) (insert (propertize (package-version-join version) 'font-lock-face face)) - (indent-to 30 1) + (indent-to 32 1) (insert (propertize key 'font-lock-face face)) ;; FIXME: this 'when' is bogus... (when desc - (indent-to 41 1) + (indent-to 43 1) (insert (propertize desc 'font-lock-face face))) (insert "\n"))) @@ -1443,11 +1558,6 @@ The list is displayed in a buffer named `*Packages*'." (interactive) (package--list-packages)) -;; Make it appear on the menu. -(define-key-after menu-bar-options-menu [package] - '(menu-item "Manage Packages" package-list-packages - :help "Install or uninstall additional Emacs packages")) - (provide 'package) ;;; package.el ends here diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index 5d04494ecb6..85fe3514b01 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -1053,9 +1053,6 @@ CHAR like `and', but makes the match accessible with `match-end', `match-beginning', and `match-string'. -`(group SEXP1 SEXP2 ...)' - another name for `submatch'. - `(or SEXP1 SEXP2 ...)' `(| SEXP1 SEXP2 ...)' matches anything that matches SEXP1 or SEXP2, etc. If all diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el index c2ac7e3b3d0..f6749cd9e97 100644 --- a/lisp/emulation/cua-base.el +++ b/lisp/emulation/cua-base.el @@ -4,7 +4,7 @@ ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; Author: Kim F. Storm -;; Keywords: keyboard emulation convenience cua +;; Keywords: keyboard emulations convenience cua ;; This file is part of GNU Emacs. diff --git a/lisp/emulation/pc-select.el b/lisp/emulation/pc-select.el index 529ba290cb8..857f94cb5f5 100644 --- a/lisp/emulation/pc-select.el +++ b/lisp/emulation/pc-select.el @@ -6,7 +6,7 @@ ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; Author: Michael Staats -;; Keywords: convenience emulation +;; Keywords: convenience emulations ;; Created: 26 Sep 1995 ;; This file is part of GNU Emacs. diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 8c216d9aca6..602b442a045 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -4247,7 +4247,7 @@ Null string will repeat previous search." (setq viper-use-register nil))) (if (and (bolp) viper-ex-style-editing) (ding)) - (delete-backward-char val t))) + (delete-char (- val) t))) (defun viper-del-backward-char-in-insert () @@ -4256,7 +4256,7 @@ Null string will repeat previous search." (if (and viper-ex-style-editing (bolp)) (beep 1) ;; don't put on kill ring - (delete-backward-char 1 nil))) + (delete-char -1 nil))) (defun viper-del-backward-char-in-replace () @@ -4269,14 +4269,14 @@ cursor move past the beginning of line." (cond (viper-delete-backwards-in-replace (cond ((not (bolp)) ;; don't put on kill ring - (delete-backward-char 1 nil)) + (delete-char -1 nil)) (viper-ex-style-editing (beep 1)) ((bobp) (beep 1)) (t ;; don't put on kill ring - (delete-backward-char 1 nil)))) + (delete-char -1 nil)))) (viper-ex-style-editing (if (bolp) (beep 1) @@ -4344,7 +4344,7 @@ cursor move past the beginning of line." (insert-before-markers "@") ; put placeholder after the TAB (untabify (viper-replace-start) (point)) ;; del @, don't put on kill ring - (delete-backward-char 1) + (delete-char -1) (viper-set-replace-overlay-glyphs viper-replace-region-start-delimiter @@ -4622,7 +4622,7 @@ One can use `` and '' to temporarily jump 1 step back." (progn (if (eq ?^ (preceding-char)) (setq viper-preserve-indent t)) - (delete-backward-char 1) + (delete-char -1) (setq p (point)) (setq indent nil))) (save-excursion diff --git a/lisp/epa-file.el b/lisp/epa-file.el index 2bbb0aa6455..5870f23bf13 100644 --- a/lisp/epa-file.el +++ b/lisp/epa-file.el @@ -101,6 +101,14 @@ way." (insert (epa-file--decode-coding-string string (or coding-system-for-read 'undecided))))) +(defvar epa-file-error nil) +(defun epa-file--find-file-not-found-function () + (let ((error epa-file-error)) + (save-window-excursion + (kill-buffer)) + (signal 'file-error + (cons "Opening input file" (cdr error))))) + (defvar last-coding-system-used) (defun epa-file-insert-file-contents (file &optional visit beg end replace) (barf-if-buffer-read-only) @@ -131,6 +139,15 @@ way." (error (if (setq entry (assoc file epa-file-passphrase-alist)) (setcdr entry nil)) + ;; Hack to prevent find-file from opening empty buffer + ;; when decryption failed (bug#6568). See the place + ;; where `find-file-not-found-functions' are called in + ;; `find-file-noselect-1'. + (make-local-variable 'epa-file-error) + (setq epa-file-error error) + (add-hook 'find-file-not-found-functions + 'epa-file--find-file-not-found-function + nil t) (signal 'file-error (cons "Opening input file" (cdr error))))) (make-local-variable 'epa-file-encrypt-to) diff --git a/lisp/faces.el b/lisp/faces.el index 900e96ed048..83c7c8b2a0f 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -915,13 +915,14 @@ of the default face. Value is FACE." ;;; Interactively modifying faces. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun read-face-name (prompt &optional string-describing-default multiple) +(defun read-face-name (prompt &optional default multiple) "Read a face, defaulting to the face or faces on the char after point. If it has the property `read-face-name', that overrides the `face' property. PROMPT should be a string that describes what the caller will do with the face; it should not end in a space. -STRING-DESCRIBING-DEFAULT should describe what default the caller will use if -the user just types RET; you can omit it. +The optional argument DEFAULT provides the value to display in the +minibuffer prompt that is returned if the user just types RET +unless DEFAULT is a string (in which case nil is returned). If MULTIPLE is non-nil, return a list of faces (possibly only one). Otherwise, return a single face." (let ((faceprop (or (get-char-property (point) 'read-face-name) @@ -960,10 +961,10 @@ Otherwise, return a single face." (let* ((input ;; Read the input. (completing-read-multiple - (if (or faces string-describing-default) - (format "%s (default %s): " prompt + (if (or faces default) + (format "%s (default `%s'): " prompt (if faces (mapconcat 'symbol-name faces ",") - string-describing-default)) + default)) (format "%s: " prompt)) (completion-table-in-turn nonaliasfaces aliasfaces) nil t nil 'face-name-history @@ -971,7 +972,7 @@ Otherwise, return a single face." ;; Canonicalize the output. (output (cond ((or (equal input "") (equal input '(""))) - faces) + (or faces (unless (stringp default) default))) ((stringp input) (mapcar 'intern (split-string input ", *" t))) ((listp input) @@ -1334,7 +1335,7 @@ and FRAME defaults to the selected frame. If the optional argument FRAME is given, report on face FACE in that frame. If FRAME is t, report on the defaults for face FACE (for new frames). If FRAME is omitted or nil, use the selected frame." - (interactive (list (read-face-name "Describe face" "= `default' face" t))) + (interactive (list (read-face-name "Describe face" 'default t))) (let* ((attrs '((:family . "Family") (:foundry . "Foundry") (:width . "Width") @@ -1948,8 +1949,7 @@ according to the `background-mode' and `display-type' frame parameters." "Add geometry parameters for a named frame to parameter list PARAMETERS. Value is the new parameter list." ;; Note that `x-resource-name' has a global meaning. - (let ((x-resource-name (or (cdr (assq 'name parameters)) - (cdr (assq 'name default-frame-alist))))) + (let ((x-resource-name (cdr (assq 'name parameters)))) (when x-resource-name ;; Before checking X resources, we must have an X connection. (or (window-system) @@ -1960,7 +1960,7 @@ Value is the new parameter list." (and (setq res-geometry (x-get-resource "geometry" "Geometry")) (setq parsed (x-parse-geometry res-geometry)) (setq parameters - (append parameters default-frame-alist parsed + (append parameters parsed ;; If the resource specifies a position, ;; take note of that. (if (or (assq 'top parsed) (assq 'left parsed)) @@ -1972,7 +1972,6 @@ Value is the new parameter list." "Handle the reverse-video frame parameter and X resource. `x-create-frame' does not handle this one." (when (cdr (or (assq 'reverse parameters) - (assq 'reverse default-frame-alist) (let ((resource (x-get-resource "reverseVideo" "ReverseVideo"))) (if resource @@ -1998,13 +1997,10 @@ Value is the new parameter list." (declare-function x-setup-function-keys "term/x-win" (frame)) (defun x-create-frame-with-faces (&optional parameters) - "Create a frame from optional frame parameters PARAMETERS. -Parameters not specified by PARAMETERS are taken from -`default-frame-alist'. If PARAMETERS specify a frame name, -handle X geometry resources for that name. If either PARAMETERS -or `default-frame-alist' contains a `reverse' parameter, or -the X resource ``reverseVideo'' is present, handle that. -Value is the new frame created." + "Create and return a frame with frame parameters PARAMETERS. +If PARAMETERS specify a frame name, handle X geometry resources +for that name. If PARAMETERS includes a `reverse' parameter, or +the X resource ``reverseVideo'' is present, handle that." (setq parameters (x-handle-named-frame-geometry parameters)) (let* ((params (copy-tree parameters)) (visibility-spec (assq 'visibility parameters)) @@ -2035,7 +2031,7 @@ Value is the new frame created." Calculate the face definitions using the face specs, custom theme settings, X resources, and `face-new-frame-defaults'. Finally, apply any relevant face attributes found amongst the -frame parameters in PARAMETERS and `default-frame-alist'." +frame parameters in PARAMETERS." (dolist (face (nreverse (face-list))) ;Why reverse? --Stef (condition-case () (progn @@ -2061,16 +2057,14 @@ frame parameters in PARAMETERS and `default-frame-alist'." (mouse-color mouse :background)))) (dolist (param face-params) (let* ((param-name (nth 0 param)) - (value (cdr (or (assq param-name parameters) - (assq param-name default-frame-alist))))) + (value (cdr (assq param-name parameters)))) (if value (set-face-attribute (nth 1 param) frame (nth 2 param) value)))))) (defun tty-handle-reverse-video (frame parameters) "Handle the reverse-video frame parameter for terminal frames." - (when (cdr (or (assq 'reverse parameters) - (assq 'reverse default-frame-alist))) + (when (cdr (assq 'reverse parameters)) (let* ((params (frame-parameters frame)) (bg (cdr (assq 'foreground-color params))) (fg (cdr (assq 'background-color params)))) @@ -2086,11 +2080,8 @@ frame parameters in PARAMETERS and `default-frame-alist'." (defun tty-create-frame-with-faces (&optional parameters) - "Create a frame from optional frame parameters PARAMETERS. -Parameters not specified by PARAMETERS are taken from -`default-frame-alist'. If either PARAMETERS or `default-frame-alist' -contains a `reverse' parameter, handle that. Value is the new frame -created." + "Create and return a frame from optional frame parameters PARAMETERS. +If PARAMETERS contains a `reverse' parameter, handle that." (let ((frame (make-terminal-frame parameters)) success) (unwind-protect diff --git a/lisp/frame.el b/lisp/frame.el index 7456db4021c..534d6a2b4e7 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -39,13 +39,6 @@ as its argument.") (defvar window-system-default-frame-alist nil "Alist of window-system dependent default frame parameters. -You can set this in your init file; for example, - - ;; Disable menubar and toolbar on the console, but enable them under X. - (setq window-system-default-frame-alist - '((x (menu-bar-lines . 1) (tool-bar-lines . 1)) - (nil (menu-bar-lines . 0) (tool-bar-lines . 0)))) - Parameters specified here supersede the values given in `default-frame-alist'.") @@ -287,36 +280,6 @@ and (cdr ARGS) as second." React to settings of `initial-frame-alist', `window-system-default-frame-alist' and `default-frame-alist' there (in decreasing order of priority)." - ;; Make menu-bar-mode and default-frame-alist consistent. - (when (boundp 'menu-bar-mode) - (let ((default (assq 'menu-bar-lines default-frame-alist))) - (if default - (setq menu-bar-mode (not (eq (cdr default) 0))) - (setq default-frame-alist - (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0)) - default-frame-alist))))) - - ;; Make tool-bar-mode and default-frame-alist consistent. Don't do - ;; it in batch mode since that would leave a tool-bar-lines - ;; parameter in default-frame-alist in a dumped Emacs, which is not - ;; what we want. - (when (and (boundp 'tool-bar-mode) - (not noninteractive)) - (let ((default (assq 'tool-bar-lines default-frame-alist))) - (if default - (setq tool-bar-mode (not (eq (cdr default) 0))) - ;; If Emacs was started on a tty, changing default-frame-alist - ;; would disable the toolbar on X frames created later. We - ;; want to keep the default of showing a toolbar under X even - ;; in this case. - ;; - ;; If the user explicitly called `tool-bar-mode' in .emacs, - ;; then default-frame-alist is already changed anyway. - (when initial-window-system - (setq default-frame-alist - (cons (cons 'tool-bar-lines (if tool-bar-mode 1 0)) - default-frame-alist)))))) - ;; Creating and deleting frames may shift the selected frame around, ;; and thus the current buffer. Protect against that. We don't ;; want to use save-excursion here, because that may also try to set @@ -720,15 +683,17 @@ The functions are run with one arg, the newly created frame.") (defun make-frame (&optional parameters) "Return a newly created frame displaying the current buffer. -Optional argument PARAMETERS is an alist of parameters for the new frame. -Each element of PARAMETERS should have the form (NAME . VALUE), for example: +Optional argument PARAMETERS is an alist of frame parameters for +the new frame. Each element of PARAMETERS should have the +form (NAME . VALUE), for example: (name . STRING) The frame should be named STRING. (width . NUMBER) The frame should be NUMBER characters in width. (height . NUMBER) The frame should be NUMBER text lines high. -You cannot specify either `width' or `height', you must use neither or both. +You cannot specify either `width' or `height', you must specify +neither or both. (minibuffer . t) The frame should have a minibuffer. (minibuffer . nil) The frame should have no minibuffer. @@ -740,15 +705,17 @@ You cannot specify either `width' or `height', you must use neither or both. (terminal . TERMINAL) The frame should use the terminal object TERMINAL. -Before the frame is created (via `frame-creation-function-alist'), functions on the -hook `before-make-frame-hook' are run. After the frame is created, functions -on `after-make-frame-functions' are run with one arg, the newly created frame. +In addition, any parameter specified in `default-frame-alist', +but not present in PARAMETERS, is applied. -This function itself does not make the new frame the selected frame. -The previously selected frame remains selected. However, the -window system may select the new frame for its own reasons, for -instance if the frame appears under the mouse pointer and your -setup is for focus to follow the pointer." +Before creating the frame (via `frame-creation-function-alist'), +this function runs the hook `before-make-frame-hook'. After +creating the frame, it runs the hook `after-make-frame-functions' +with one arg, the newly created frame. + +On graphical displays, this function does not itself make the new +frame the selected frame. However, the window system may select +the new frame according to its own rules." (interactive) (let* ((w (cond ((assq 'terminal parameters) @@ -763,14 +730,21 @@ setup is for focus to follow the pointer." (t window-system))) (frame-creation-function (cdr (assq w frame-creation-function-alist))) (oldframe (selected-frame)) + (params parameters) frame) (unless frame-creation-function (error "Don't know how to create a frame on window system %s" w)) + ;; Add parameters from `window-system-default-frame-alist'. + (dolist (p (cdr (assq w window-system-default-frame-alist))) + (unless (assq (car p) params) + (push p params))) + ;; Add parameters from `default-frame-alist'. + (dolist (p default-frame-alist) + (unless (assq (car p) params) + (push p params))) + ;; Now make the frame. (run-hooks 'before-make-frame-hook) - (setq frame - (funcall frame-creation-function - (append parameters - (cdr (assq w window-system-default-frame-alist))))) + (setq frame (funcall frame-creation-function params)) (normal-erase-is-backspace-setup-frame frame) ;; Inherit the original frame's parameters. (dolist (param frame-inherited-parameters) diff --git a/lisp/generic-x.el b/lisp/generic-x.el index a96ab5cbbe9..0083989c75a 100644 --- a/lisp/generic-x.el +++ b/lisp/generic-x.el @@ -508,8 +508,7 @@ like an INI file. You can add this hook to `find-file-hook'." '("^[ \t]*\\(:\\sw+\\)" 1 font-lock-function-name-face t) '("\\(%\\sw+%\\)" 1 font-lock-variable-name-face t) '("\\(%[0-9]\\)" 1 font-lock-variable-name-face t) - '("\\(/[^/ \"\t\n]+\\)" 1 font-lock-type-face) - '("[\t ]+\\([+-][^\t\n\" ]+\\)" 1 font-lock-type-face) + '("[\t ]+\\([+-/][^\t\n\" ]+\\)" 1 font-lock-type-face) '("[ \t\n|]\\<\\([gG][oO][tT][oO]\\)\\>[ \t]*\\(\\sw+\\)?" (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t)) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index e50bdb58575..2a2011e8843 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,49 @@ +2010-07-21 Daiki Ueno + + * mml.el (mml-parse-1): Collect "certfile" attributes in "<#secure>" + tag (Bug#6654). + +2010-07-20 Katsumi Yamaoka + + * gnus-sum.el (gnus-summary-bookmark-make-record): Bookmark position in + the article buffer, not the summary buffer. + +2010-07-15 Katsumi Yamaoka + + * gnus-sum.el (gnus-summary-bookmark-make-record): Make it work for + Emacs 23 as well. + +2010-07-13 Thierry Volpiatto + + Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975). + Patch applied by Karl Fogel. + + * gnus-sum.el (gnus-summary-bookmark-make-record): Set + `bookmark-yank-point' and `bookmark-current-buffer' to allow C-w. + +2010-07-13 Thierry Volpiatto + + Allow bookmarks to be set from Gnus Article buffers (Bug #5975). + Patch applied (with minor tweaks) by Karl Fogel. Note this leaves + C-w still not working correctly from Article buffers; Thierry's + patch to fix that will be applied after this. + + * gnus-art.el (bookmark-make-record-function): New local variable. + + * gnus-sum.el (gnus-summary-bookmark-make-record): Allow setting from + article buffer. + (gnus-summary-bookmark-jump): Maybe jump to article buffer. + +2010-07-13 Karl Fogel + + * gnus-sum.el (bookmark-make-record-default): Adjust declaration, based + on changes in bookmark.el. + +2010-06-22 Mark A. Hershberger + + * mm-url.el (mm-url-encode-multipart-form-data): New function to handle + the *other* type of HTML form submission. + 2010-06-15 Michael Albinus * auth-source.el (auth-source-pick): If choice does not contain a @@ -69,7 +115,7 @@ 2010-05-12 Andreas Seltenreich * gnus-sum.el (gnus-summary-read-group-1): Don't jump to next group - when catching the `C-g'. Reported by: "Leo" + when catching the `C-g'. Reported by "Leo". 2010-05-12 Katsumi Yamaoka @@ -203,7 +249,7 @@ * mml.el (mml-generate-mime-1,mml-compute-boundary-1): Update 'mml handles on recursive mml-to-mime translation and check them for - boundary delimiter collisions. Reported by: Greg Troxel. + boundary delimiter collisions. Reported by Greg Troxel. 2010-04-27 Katsumi Yamaoka @@ -351,7 +397,7 @@ (nnimap-retrieve-groups, nnimap-verify-uidvalidity) (nnimap-update-unseen): Significantly improved speed of Gnus startup with many imap folders. This is done by caching the group status from - the imap server persistently in a group parameter `imap-status'. (This + the imap server persistently in a group parameter `imap-status'. (This was cached before too if `nnimap-retrieve-groups-asynchronous' was set, but not persistently, so every Gnus startup was still very slow.) @@ -476,7 +522,7 @@ * nneething.el (mailcap): Require mailcap. - * nnheader.el: (declare-function): Add compatibility stub. + * nnheader.el (declare-function): Add compatibility stub. (message-remove-header): Declare rather than autoload. (nnheader-replace-header): Require message. diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 6b20fa678d0..51be4517a77 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -4452,6 +4452,8 @@ commands: (make-local-variable 'gnus-article-image-alist) (make-local-variable 'gnus-article-charset) (make-local-variable 'gnus-article-ignored-charsets) + (set (make-local-variable 'bookmark-make-record-function) + 'gnus-summary-bookmark-make-record) ;; Prevent Emacs 22 from displaying non-break space with `nobreak-space' ;; face. (set (make-local-variable 'nobreak-char-display) nil) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 98a0556d499..93024e07280 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -12621,25 +12621,37 @@ If ALL is a number, fetch this number of articles." (gnus-summary-position-point))) ;;; Bookmark support for Gnus. -(declare-function bookmark-make-record-default "bookmark" (&optional pos-only)) +(declare-function bookmark-make-record-default + "bookmark" (&optional no-file no-context posn)) (declare-function bookmark-prop-get "bookmark" (bookmark prop)) (declare-function bookmark-default-handler "bookmark" (bmk)) (declare-function bookmark-get-bookmark-record "bookmark" (bmk)) (defun gnus-summary-bookmark-make-record () "Make a bookmark entry for a Gnus summary buffer." - (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current) - (error "Please retry from the Gnus summary buffer")) ;[1] - (let* ((subject (elt (gnus-summary-article-header) 1)) - (grp (car gnus-article-current)) - (art (cdr gnus-article-current)) - (head (gnus-summary-article-header art)) - (id (mail-header-id head))) - `(,subject - ,@(bookmark-make-record-default 'point-only) - (location . ,(format "Gnus %s:%d:%s" grp art id)) - (group . ,grp) (article . ,art) - (message-id . ,id) (handler . gnus-summary-bookmark-jump)))) + (let (pos buf) + (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current) + (save-restriction ; FIXME is it necessary to widen? + (widen) (setq pos (point))) ; Set position in gnus-article buffer. + (setq buf "art") ; We are recording bookmark from article buffer. + (setq bookmark-yank-point (point)) + (setq bookmark-current-buffer (current-buffer)) + (gnus-article-show-summary)) ; Go back in summary buffer. + ;; We are now recording bookmark from summary buffer. + (unless buf (setq buf "sum")) + (let* ((subject (elt (gnus-summary-article-header) 1)) + (grp (car gnus-article-current)) + (art (cdr gnus-article-current)) + (head (gnus-summary-article-header art)) + (id (mail-header-id head))) + `(,subject + ,@(condition-case nil + (bookmark-make-record-default 'no-file 'no-context pos) + (wrong-number-of-arguments + (bookmark-make-record-default 'point-only))) + (location . ,(format "Gnus-%s %s:%d:%s" buf grp art id)) + (group . ,grp) (article . ,art) + (message-id . ,id) (handler . gnus-summary-bookmark-jump))))) ;;;###autoload (defun gnus-summary-bookmark-jump (bookmark) @@ -12647,10 +12659,18 @@ If ALL is a number, fetch this number of articles." BOOKMARK is a bookmark name or a bookmark record." (let ((group (bookmark-prop-get bookmark 'group)) (article (bookmark-prop-get bookmark 'article)) - (id (bookmark-prop-get bookmark 'message-id))) + (id (bookmark-prop-get bookmark 'message-id)) + (buf (car (split-string (bookmark-prop-get bookmark 'location))))) (gnus-fetch-group group (list article)) (gnus-summary-insert-cached-articles) (gnus-summary-goto-article id nil 'force) + ;; FIXME we have to wait article buffer is ready (only large buffer) + ;; Is there a better solution to know that? + ;; If we don't wait `bookmark-default-handler' will have no chance + ;; to set position. However there is no error, just wrong pos. + (sit-for 1) + (when (string= buf "Gnus-art") + (other-window 1)) (bookmark-default-handler `("" (buffer . ,(current-buffer)) diff --git a/lisp/gnus/mm-url.el b/lisp/gnus/mm-url.el index c5a8d9f7fdc..c72f520d60a 100644 --- a/lisp/gnus/mm-url.el +++ b/lisp/gnus/mm-url.el @@ -418,6 +418,48 @@ spaces. Die Die Die." (mm-url-form-encode-xwfu (cdr data)))) pairs "&")) +(defun mm-url-encode-multipart-form-data (pairs &optional boundary) + "Return PAIRS encoded in multipart/form-data." + ;; RFC1867 + + ;; Get a good boundary + (unless boundary + (setq boundary (mml-compute-boundary '()))) + + (concat + + ;; Start with the boundary + "--" boundary "\r\n" + + ;; Create name value pairs + (mapconcat + 'identity + ;; Delete any returned items that are empty + (delq nil + (mapcar (lambda (data) + (when (car data) + ;; For each pair + (concat + + ;; Encode the name + "Content-Disposition: form-data; name=\"" + (car data) "\"\r\n" + "Content-Type: text/plain; charset=utf-8\r\n" + "Content-Transfer-Encoding: binary\r\n\r\n" + + (cond ((stringp (cdr data)) + (cdr data)) + ((integerp (cdr data)) + (int-to-string (cdr data)))) + + "\r\n"))) + pairs)) + ;; use the boundary as a separator + (concat "--" boundary "\r\n")) + + ;; put a boundary at the end. + "--" boundary "--\r\n")) + (defun mm-url-fetch-form (url pairs) "Fetch a form from URL with PAIRS as the data using the POST method." (mm-url-load-url) diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index 170bc69fe3a..2ebd7996d77 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -228,7 +228,10 @@ part. This is for the internal use, you should never modify the value.") (let* (secure-mode (taginfo (mml-read-tag)) (keyfile (cdr (assq 'keyfile taginfo))) - (certfile (cdr (assq 'certfile taginfo))) + (certfiles (delq nil (mapcar (lambda (tag) + (if (eq (car-safe tag) 'certfile) + (cdr tag))) + taginfo))) (recipients (cdr (assq 'recipients taginfo))) (sender (cdr (assq 'sender taginfo))) (location (cdr (assq 'tag-location taginfo))) @@ -254,8 +257,10 @@ part. This is for the internal use, you should never modify the value.") ,@tags ,(if keyfile "keyfile") ,keyfile - ,(if certfile "certfile") - ,certfile + ,@(apply #'append + (mapcar (lambda (certfile) + (list "certfile" certfile)) + certfiles)) ,(if recipients "recipients") ,recipients ,(if sender "sender") diff --git a/lisp/help-mode.el b/lisp/help-mode.el index c478bf6d16c..7a7a1ddaf79 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -244,6 +244,16 @@ The format is (FUNCTION ARGS...).") (message "Unable to find location in file")))) 'help-echo (purecopy "mouse-2, RET: find face's definition")) +(define-button-type 'help-package + :supertype 'help-xref + 'help-function 'describe-package + 'help-echo (purecopy "mouse-2, RET: Describe package")) + +(define-button-type 'help-package-def + :supertype 'help-xref + 'help-function (lambda (file) (dired file)) + 'help-echo (purecopy "mouse-2, RET: visit package directory")) + ;;;###autoload (defun help-mode () diff --git a/lisp/help.el b/lisp/help.el index 899547aa0a1..9434201797e 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -768,9 +768,10 @@ temporarily enables it to allow getting help on disabled items and buttons." ----------------- up-event %s---------------- -<%S>%s%s runs the command %S, which is " +%s%s%s runs the command %S, which is " (if mouse-1-tricky "(short click) " "") - ev-type mouse-msg + (key-description (vector up-event)) + mouse-msg (if mouse-1-remapped " is remapped to , which" "") defn-up)) diff --git a/lisp/hl-line.el b/lisp/hl-line.el index 755ff696453..9a791076002 100644 --- a/lisp/hl-line.el +++ b/lisp/hl-line.el @@ -1,12 +1,12 @@ ;;; hl-line.el --- highlight the current line -;; Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, +;; 2008, 2009, 2010 Free Software Foundation, Inc. ;; Author: Dave Love ;; Maintainer: FSF ;; Created: 1998-09-13 -;; Keywords: faces, frames, emulation +;; Keywords: faces, frames, emulations ;; This file is part of GNU Emacs. diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index 12e54972461..035b6d384e7 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -926,7 +926,7 @@ See also `hfy-display-class' for details of valid values for CLASS." new-spec))))) (if (or (memq :inherit face-spec) (eq 'default face)) face-spec - (nconc face-spec (list :inherit 'default))) )) + (append face-spec (list :inherit 'default))))) ;; construct an assoc of (css-tag-name . css-tag-value) pairs ;; from a face or assoc of face attributes: diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 585d82e9beb..e202aca63b0 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -516,15 +516,15 @@ the image file and `image-mode' showing the image as an image." ;;; Support for bookmark.el -(declare-function bookmark-make-record-default "bookmark" - (&optional point-only)) +(declare-function bookmark-make-record-default + "bookmark" (&optional no-file no-context posn)) (declare-function bookmark-prop-get "bookmark" (bookmark prop)) (declare-function bookmark-default-handler "bookmark" (bmk)) (defun image-bookmark-make-record () - (nconc (bookmark-make-record-default) - `((image-type . ,image-type) - (handler . image-bookmark-jump)))) + `(,@(bookmark-make-record-default nil 'no-context 0) + (image-type . ,image-type) + (handler . image-bookmark-jump))) ;;;###autoload (defun image-bookmark-jump (bmk) diff --git a/lisp/info.el b/lisp/info.el index 9a30f63fff0..65b9492e351 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -4901,7 +4901,8 @@ BUFFER is the buffer speedbar is requesting buttons for." '(Info-mode . Info-restore-desktop-buffer)) ;;;; Bookmark support -(declare-function bookmark-make-record-default "bookmark" (&optional pos-only)) +(declare-function bookmark-make-record-default + "bookmark" (&optional no-file no-context posn)) (declare-function bookmark-prop-get "bookmark" (bookmark prop)) (declare-function bookmark-default-handler "bookmark" (bmk)) (declare-function bookmark-get-bookmark-record "bookmark" (bmk)) @@ -4910,7 +4911,7 @@ BUFFER is the buffer speedbar is requesting buttons for." "This implements the `bookmark-make-record-function' type (which see) for Info nodes." `(,Info-current-node - ,@(bookmark-make-record-default 'point-only) + ,@(bookmark-make-record-default 'no-file) (filename . ,Info-current-file) (info-node . ,Info-current-node) (handler . Info-bookmark-jump))) diff --git a/lisp/international/quail.el b/lisp/international/quail.el index 9959b275943..621f314bf70 100644 --- a/lisp/international/quail.el +++ b/lisp/international/quail.el @@ -811,7 +811,7 @@ The format of KBD-LAYOUT is the same as `quail-keyboard-layout'." (setq translation (aref (cdr translation) 0)) (setq translation " "))) (setq done-list (cons translation done-list))) - (setq translation ch)) + (setq translation (aref kbd-layout i))) (aset layout i translation)) (setq i (1+ i))) diff --git a/lisp/kmacro.el b/lisp/kmacro.el index c2bedf35339..439c7383223 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -642,11 +642,13 @@ others, use \\[kmacro-name-last-macro]." kmacro-call-repeat-key))) (setq repeat-key-str (format-kbd-macro (vector repeat-key) nil)) (while repeat-key - (message "(Type %s to repeat macro%s)" - repeat-key-str - (if (and kmacro-call-repeat-with-arg - arg (> arg 1)) - (format " %d times" arg) "")) + ;; Issue a hint to the user, if the echo area isn't in use. + (unless (current-message) + (message "(Type %s to repeat macro%s)" + repeat-key-str + (if (and kmacro-call-repeat-with-arg + arg (> arg 1)) + (format " %d times" arg) ""))) (if (equal repeat-key (read-event)) (progn (clear-this-command-keys t) diff --git a/lisp/language/hebrew.el b/lisp/language/hebrew.el index f024251c60b..89a22d2d238 100644 --- a/lisp/language/hebrew.el +++ b/lisp/language/hebrew.el @@ -1,4 +1,4 @@ -;;; hebrew.el --- support for Hebrew -*- coding: iso-2022-7bit; no-byte-compile: t -*- +;;; hebrew.el --- support for Hebrew -*- coding: utf-8 -*- ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 ;; Free Software Foundation, Inc. @@ -59,7 +59,7 @@ (nonascii-translation . iso-8859-8) (input-method . "hebrew") (unibyte-display . hebrew-iso-8bit) - (sample-text . "Hebrew ,Hylem(B") + (sample-text . "Hebrew שלום") (documentation . "Bidirectional editing is supported."))) (set-language-info-alist @@ -85,33 +85,167 @@ Bidirectional editing is supported."))) :mime-charset 'cp862) (define-coding-system-alias 'ibm862 'cp862) -;; Composition function for hebrew. +;; Return a nested alist of Hebrew character sequences vs the +;; corresponding glyph of FONT-OBJECT. +(defun hebrew-font-get-precomposed (font-object) + (let ((precomposed (font-get font-object 'hebrew-precomposed)) + ;; Vector of Hebrew precomposed charaters. + (chars [#xFB2A #xFB2B #xFB2C #xFB2D #xFB2E #xFB2F #xFB30 #xFB31 + #xFB32 #xFB33 #xFB34 #xFB35 #xFB36 #xFB38 #xFB39 #xFB3A + #xFB3B #xFB3C #xFB3E #xFB40 #xFB41 #xFB43 #xFB44 #xFB46 + #xFB47 #xFB48 #xFB49 #xFB4A #xFB4B #xFB4C #xFB4D #xFB4E]) + ;; Vector of decomposition character sequences corresponding + ;; to the above vector. + (decomposed + [[#x05E9 #x05C1] + [#x05E9 #x05C2] + [#x05E9 #x05BC #x05C1] + [#x05E9 #x05BC #x05C2] + [#x05D0 #x05B7] + [#x05D0 #x05B8] + [#x05D0 #x05BC] + [#x05D1 #x05BC] + [#x05D2 #x05BC] + [#x05D3 #x05BC] + [#x05D4 #x05BC] + [#x05D5 #x05BC] + [#x05D6 #x05BC] + [#x05D8 #x05BC] + [#x05D9 #x05BC] + [#x05DA #x05BC] + [#x05DB #x05BC] + [#x05DC #x05BC] + [#x05DE #x05BC] + [#x05E0 #x05BC] + [#x05E1 #x05BC] + [#x05E3 #x05BC] + [#x05E4 #x05BC] + [#x05E6 #x05BC] + [#x05E7 #x05BC] + [#x05E8 #x05BC] + [#x05E9 #x05BC] + [#x05EA #x05BC] + [#x05D5 #x05B9] + [#x05D1 #x05BF] + [#x05DB #x05BF] + [#x05E4 #x05BF]])) + (unless precomposed + (setq precomposed (list t)) + (let ((gvec (font-get-glyphs font-object 0 (length chars) chars))) + (dotimes (i (length chars)) + (if (aref gvec i) + (set-nested-alist (aref decomposed i) (aref gvec i) + precomposed)))) + ;; Cache the result in FONT-OBJECT's property. + (font-put font-object 'hebrew-precomposed precomposed)) + precomposed)) + +;; Composition function for hebrew. GSTRING is made of a Hebrew base +;; character followed by Hebrew diacritical marks, or is made of +;; single Hebrew diacritical mark. Adjust GSTRING to display that +;; sequence properly. The basic strategy is: +;; +;; (1) If there's single diacritical, add padding space to the left +;; and right of the glyph. +;; +;; (2) If the font has OpenType features for Hebrew, ask the OTF +;; driver the whole work. +;; +;; (3) If the font has precomposed glyphs, use them as far as +;; possible. Adjust the remaining glyphs artificially. + (defun hebrew-shape-gstring (gstring) - (setq gstring (font-shape-gstring gstring)) - (let ((header (lgstring-header gstring)) - (nchars (lgstring-char-len gstring)) - (nglyphs (lgstring-glyph-len gstring)) - (base-width (lglyph-width (lgstring-glyph gstring 0)))) - (while (and (> nglyphs 1) - (not (lgstring-glyph gstring (1- nglyphs)))) - (setq nglyphs (1- nglyphs))) - (while (> nglyphs 1) - (setq nglyphs (1- nglyphs)) - (let* ((glyph (lgstring-glyph gstring nglyphs)) - (adjust (and glyph (lglyph-adjustment glyph)))) - (if adjust - (setq nglyphs 0) - (if (>= (lglyph-lbearing glyph) 0) - (lglyph-set-adjustment glyph (- base-width) 0 0)))))) - gstring) + (let* ((font (lgstring-font gstring)) + (otf (font-get font :otf)) + (nchars (lgstring-char-len gstring)) + header nglyphs base-width glyph precomposed val idx) + (cond + ((= nchars 1) + ;; Independent diacritical mark. Add padding space to left or + ;; right so that the glyph doesn't overlap with the surrounding + ;; chars. + (setq glyph (lgstring-glyph gstring 0)) + (let ((width (lglyph-width glyph)) + bearing) + (if (< (setq bearing (lglyph-lbearing glyph)) 0) + (lglyph-set-adjustment glyph bearing 0 (- width bearing))) + (if (> (setq bearing (lglyph-rbearing glyph)) width) + (lglyph-set-adjustment glyph 0 0 bearing)))) + + ((or (assq 'hebr (car otf)) (assq 'hebr (cdr otf))) + ;; FONT has OpenType features for Hebrew. + (font-shape-gstring gstring)) + + (t + ;; FONT doesn't have OpenType features for Hebrew. + ;; Try a precomposed glyph. + ;; Now GSTRING is in this form: + ;; [[FONT CHAR1 CHAR2 ... CHARn] nil GLYPH1 GLYPH2 ... GLYPHn nil ...] + (setq precomposed (hebrew-font-get-precomposed font) + header (lgstring-header gstring) + val (lookup-nested-alist header precomposed nil 1)) + (if (and (consp val) (vectorp (car val))) + ;; All characters can be displayed by a single precomposed glyph. + ;; Reform GSTRING to [HEADER nil PRECOMPOSED-GLYPH nil ...] + (let ((glyph (copy-sequence (car val)))) + (lglyph-set-from-to glyph 0 (1- nchars)) + (lgstring-set-glyph gstring 0 glyph) + (lgstring-set-glyph gstring 1 nil)) + (if (and (integerp val) (> val 2) + (setq glyph (lookup-nested-alist header precomposed val 1)) + (consp glyph) (vectorp (car glyph))) + ;; The first (1- VAL) characters can be displayed by a + ;; precomposed glyph. Provided that VAL is 3, the first + ;; two glyphs should be replaced by the precomposed glyph. + ;; In that case, reform GSTRING to: + ;; [HEADER nil PRECOMPOSED-GLYPH GLYPH3 ... GLYPHn nil ...] + (let* ((ncmp (1- val)) ; number of composed glyphs + (diff (1- ncmp))) ; number of reduced glyphs + (setq glyph (copy-sequence (car glyph))) + (lglyph-set-from-to glyph 0 (1- nchars)) + (lgstring-set-glyph gstring 0 glyph) + (setq idx ncmp) + (while (< idx nchars) + (setq glyph (lgstring-glyph gstring idx)) + (lglyph-set-from-to glyph 0 (1- nchars)) + (lgstring-set-glyph gstring (- idx diff) glyph) + (setq idx (1+ idx))) + (lgstring-set-glyph gstring (- idx diff) nil) + (setq idx (- ncmp diff) + nglyphs (- nchars diff))) + (setq glyph (lgstring-glyph gstring 0)) + (lglyph-set-from-to glyph 0 (1- nchars)) + (setq idx 1 nglyphs nchars)) + ;; Now IDX is an index to the first non-precomposed glyph. + ;; Adjust positions of the remaining glyphs artificially. + (setq base-width (lglyph-width (lgstring-glyph gstring 0))) + (while (< idx nglyphs) + (setq glyph (lgstring-glyph gstring idx)) + (lglyph-set-from-to glyph 0 (1- nchars)) + (if (>= (lglyph-lbearing glyph) (lglyph-width glyph)) + ;; It seems that this glyph is designed to be rendered + ;; before the base glyph. + (lglyph-set-adjustment glyph (- base-width) 0 0) + (if (>= (lglyph-lbearing glyph) 0) + ;; Align the horizontal center of this glyph to the + ;; horizontal center of the base glyph. + (let ((width (- (lglyph-rbearing glyph) + (lglyph-lbearing glyph)))) + (lglyph-set-adjustment glyph + (- (/ (- base-width width) 2) + (lglyph-lbearing glyph) + base-width) 0 0)))) + (setq idx (1+ idx)))))) + gstring)) (let ((pattern1 "[\u05D0-\u05F2][\u0591-\u05BF\u05C1-\u05C5\u05C7]+") (pattern2 "[\u05D0-\u05F2]\u200D[\u0591-\u05BF\u05C1-\u05C5\u05C7]+")) (set-char-table-range composition-function-table '(#x591 . #x5C7) - (list (vector pattern2 2 'hebrew-shape-gstring) + (list (vector pattern2 3 'hebrew-shape-gstring) + (vector pattern2 2 'hebrew-shape-gstring) (vector pattern1 1 'hebrew-shape-gstring) - ["[\u0591-\u05C7]" 0 font-shape-gstring])) + [nil 0 hebrew-shape-gstring])) (set-char-table-range composition-function-table #x5C0 nil) (set-char-table-range diff --git a/lisp/language/tai-viet.el b/lisp/language/tai-viet.el index 1423d298d27..25ac901a642 100644 --- a/lisp/language/tai-viet.el +++ b/lisp/language/tai-viet.el @@ -37,7 +37,7 @@ (coding-system utf-8) (coding-priority utf-8) (input-method . "tai-sonla") - (sample-text . "TaiViet (ꪁꪫꪱꪣ ꪽꪕ)\t\tꪅꪰꪙ꫃ ꪨꪮ꫃ ꪁꪫꪱ / ꪅꪾ ꪨ� ꪁꪫꪱ") + (sample-text . "TaiViet (ꪁꪫꪱꪣ ꪼꪕ)\t\tꪅꪰꪙꫂ ꪨꪮꫂ ꪁꪫꪱ / ꪅꪽ ꪨꪷ ꪁꪫꪱ") (documentation . "\ TaiViet refers to the Tai language used by Tai people in Vietnam, and also refers to the script used for this language. @@ -45,15 +45,15 @@ Both the script and language have the same origin as that of Thai language/script used in Thailand, but now they differ from each other in a significant way (especially the scripts are). -The language name is spelled as \"ꪁꪫꪱꪣ ꪽꪕ\", and the script name is -spelled as \"ꪎ� ꪽꪕ\" in the modern form, \"ꪎꪴ ꪽꪕ\" in the traditional -from. +The language name is spelled as \"ꪁꪫꪱꪣ ꪼꪕ\", and the script name is +spelled as \"ꪎ ꪼꪕ\" in the modern form, \"ꪎꪳ ꪼꪕ\" in the traditional +form. As the proposal for TaiViet script to the Unicode is still on the progress, we use the Private Use Area for TaiViet characters (U+F000..U+F07E). A TaiViet font encoded accordingly is available at this web page: - http://www.m17n.org/TaiViet/ + http://www.m17n.org/viettai/ "))) (provide 'tai-viet) diff --git a/lisp/language/tv-util.el b/lisp/language/tv-util.el index 842366dacbc..67ed6327971 100644 --- a/lisp/language/tv-util.el +++ b/lisp/language/tv-util.el @@ -24,8 +24,7 @@ ;;; Code ;; Regexp matching with a sequence of Tai Viet characters. -(defconst tai-viet-re - (format "[\xaa80-\xaac2\xaadb-\xaadf-]+")) +(defconst tai-viet-re "[\xaa80-\xaac2\xaadb-\xaadf]+") ;; Char-table of information about glyph type of Tai Viet characters. (defconst tai-viet-glyph-info diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 630c729703b..fbf5c534a28 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -4291,7 +4291,7 @@ With prefix argument N moves forward N messages with these labels. ;;;*** -;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "93033f2136fcd111e2b52a116ff4cf29") +;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "4a7502b4aeb3bd5f2111b48cc6512924") ;;; Generated autoloads from rmailmm.el (autoload 'rmail-mime "rmailmm" "\ diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index 415bc20cf50..e8ca11ee349 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -112,6 +112,10 @@ automatically display the image in the buffer." (file-name-as-directory filename)))) (with-temp-buffer (set-buffer-file-coding-system 'no-conversion) + ;; Needed e.g. by jka-compr, so if the attachment is a compressed + ;; file, the magic signature compares equal with the unibyte + ;; signature string recorded in jka-compr-compression-info-list. + (set-buffer-multibyte nil) (insert data) (write-region nil nil filename nil nil nil t)))) diff --git a/lisp/man.el b/lisp/man.el index f448795c1cb..88d1aa7c604 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1674,7 +1674,8 @@ Specify which REFERENCE to use; default is based on word at point." complete-path)) ;;; Bookmark Man Support -(declare-function bookmark-make-record-default "bookmark" (&optional pos-only)) +(declare-function bookmark-make-record-default + "bookmark" (&optional no-file no-context posn)) (declare-function bookmark-prop-get "bookmark" (bookmark prop)) (declare-function bookmark-default-handler "bookmark" (bmk)) (declare-function bookmark-get-bookmark-record "bookmark" (bmk)) @@ -1691,7 +1692,7 @@ Uses `Man-name-local-regexp'." (defun Man-bookmark-make-record () "Make a bookmark entry for a Man buffer." `(,(Man-default-bookmark-title) - ,@(bookmark-make-record-default 'point-only) + ,@(bookmark-make-record-default 'no-file) (location . ,(concat "man " Man-arguments)) (man-args . ,Man-arguments) (handler . Man-bookmark-jump))) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 2d5b6d51aa6..2c75a8822f3 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -526,17 +526,6 @@ "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard. Do the same for the keys of the same name." (interactive) - ;; We can't use constant list structure here because it becomes pure, - ;; and because it gets modified with cache data. - (define-key menu-bar-edit-menu [paste] - (cons "Paste" (cons "Paste text from clipboard" 'clipboard-yank))) - (define-key menu-bar-edit-menu [copy] - (cons "Copy" (cons "Copy text in region to the clipboard" - 'clipboard-kill-ring-save))) - (define-key menu-bar-edit-menu [cut] - (cons "Cut" (cons "Delete text in region and copy it to the clipboard" - 'clipboard-kill-region))) - ;; These are Sun server keysyms for the Cut, Copy and Paste keys ;; (also for XFree86 on Sun keyboard): (define-key global-map [f20] 'clipboard-kill-region) @@ -703,6 +692,10 @@ by \"Save Options\" in Custom buffers.") (when need-save (custom-save-all)))) +(define-key menu-bar-options-menu [package] + '(menu-item "Manage Emacs Packages" package-list-packages + :help "Install or uninstall additional Emacs packages")) + (define-key menu-bar-options-menu [save] `(menu-item ,(purecopy "Save Options") menu-bar-options-save :help ,(purecopy "Save options set from the menu above"))) @@ -1920,36 +1913,33 @@ Buffers menu is regenerated." `(menu-item ,(purecopy "Previous History Item") previous-history-element :help ,(purecopy "Put previous minibuffer history element in the minibuffer")))) -;;;###autoload -;; This comment is taken from tool-bar.el near -;; (put 'tool-bar-mode ...) -;; We want to pretend the menu bar by standard is on, as this will make -;; customize consider disabling the menu bar a customization, and save -;; that. We could do this for real by setting :init-value below, but -;; that would overwrite disabling the tool bar from X resources. -(put 'menu-bar-mode 'standard-value '(t)) - (define-minor-mode menu-bar-mode "Toggle display of a menu bar on each frame. This command applies to all frames that exist and frames to be created in the future. With a numeric argument, if the argument is positive, turn on menu bars; otherwise, turn off menu bars." - :init-value nil + :init-value t :global t :group 'frames - ;; Make menu-bar-mode and default-frame-alist consistent. - (modify-all-frames-parameters (list (cons 'menu-bar-lines - (if menu-bar-mode 1 0)))) - + ;; Turn the menu-bars on all frames on or off. + (let ((val (if menu-bar-mode 1 0))) + (dolist (frame (frame-list)) + (set-frame-parameter frame 'menu-bar-lines val)) + ;; If the user has given `default-frame-alist' a `menu-bar-lines' + ;; parameter, replace it. + (if (assq 'menu-bar-lines default-frame-alist) + (setq default-frame-alist + (cons (cons 'menu-bar-lines val) + (assq-delete-all 'menu-bar-lines + default-frame-alist))))) ;; Make the message appear when Emacs is idle. We can not call message ;; directly. The minor-mode message "Menu-bar mode disabled" comes ;; after this function returns, overwriting any message we do here. (when (and (called-interactively-p 'interactive) (not menu-bar-mode)) (run-with-idle-timer 0 nil 'message - "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear.")) - menu-bar-mode) + "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear."))) (defun toggle-menu-bar-mode-from-frame (&optional arg) "Toggle menu bar on or off, based on the status of the current frame. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 646b773caf2..3f22099bfd1 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -891,13 +891,13 @@ Return nil if there is no valid completion, else t." (defface completions-annotations '((t :inherit italic)) "Face to use for annotations in the *Completions* buffer.") -(defcustom completions-format nil +(defcustom completions-format 'horizontal "Define the appearance and sorting of completions. If the value is `vertical', display completions sorted vertically in columns in the *Completions* buffer. -If the value is `horizontal' or nil, display completions sorted +If the value is `horizontal', display completions sorted horizontally in alphabetical order, rather than down the screen." - :type '(choice (const nil) (const horizontal) (const vertical)) + :type '(choice (const horizontal) (const vertical)) :group 'minibuffer :version "23.2") diff --git a/lisp/mouse-sel.el b/lisp/mouse-sel.el index d7f4c9bd222..bd3054a5b94 100644 --- a/lisp/mouse-sel.el +++ b/lisp/mouse-sel.el @@ -129,11 +129,6 @@ ;; that the X primary selection is used. Under other windowing systems, ;; alternate functions are used, which simply store the selection value ;; in a variable. -;; -;; * You can change the selection highlight face by altering the properties -;; of mouse-drag-overlay, eg. -;; -;; (overlay-put mouse-drag-overlay 'face 'bold) ;;; Code: @@ -293,8 +288,7 @@ primary selection and region." (overlay-put mouse-secondary-overlay 'face 'secondary-selection)) (defconst mouse-sel-selection-alist - '((PRIMARY mouse-drag-overlay mouse-sel-primary-thing) - (SECONDARY mouse-secondary-overlay mouse-sel-secondary-thing)) + '((SECONDARY mouse-secondary-overlay mouse-sel-secondary-thing)) "Alist associating selections with variables. Each element is of the form: diff --git a/lisp/mouse.el b/lisp/mouse.el index d1abb7dd4b1..87cca4044b8 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -41,10 +41,10 @@ :type 'boolean :group 'mouse) -(defcustom mouse-drag-copy-region t +(defcustom mouse-drag-copy-region nil "If non-nil, mouse drag copies region to kill-ring." :type 'boolean - :version "22.1" + :version "24.1" :group 'mouse) (defcustom mouse-1-click-follows-link 450 @@ -772,13 +772,6 @@ Upon exit, point is at the far edge of the newly visible text." (or (eq window (selected-window)) (goto-char opoint)))) -;; Create an overlay and immediately delete it, to get "overlay in no buffer". -(defconst mouse-drag-overlay - (let ((ol (make-overlay (point-min) (point-min)))) - (delete-overlay ol) - (overlay-put ol 'face 'region) - ol)) - (defvar mouse-selection-click-count 0) (defvar mouse-selection-click-count-buffer nil) @@ -905,31 +898,16 @@ at the same position." "mouse-1" (substring msg 7))))))) msg) -(defun mouse-move-drag-overlay (ol start end mode) - (unless (= start end) - ;; Go to START first, so that when we move to END, if it's in the middle - ;; of intangible text, point jumps in the direction away from START. - ;; Don't do it if START=END otherwise a single click risks selecting - ;; a region if it's on intangible text. This exception was originally - ;; only applied on entry to mouse-drag-region, which had the problem - ;; that a tiny move during a single-click would cause the intangible - ;; text to be selected. - (goto-char start) - (goto-char end) - (setq end (point))) - (let ((range (mouse-start-end start end mode))) - (move-overlay ol (car range) (nth 1 range)))) - (defun mouse-drag-track (start-event &optional do-mouse-drag-region-post-process) "Track mouse drags by highlighting area between point and cursor. -The region will be defined with mark and point, and the overlay -will be deleted after return. DO-MOUSE-DRAG-REGION-POST-PROCESS -should only be used by mouse-drag-region." +The region will be defined with mark and point. +DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by +`mouse-drag-region'." (mouse-minibuffer-check start-event) (setq mouse-selection-click-count-buffer (current-buffer)) ;; We must call deactivate-mark before repositioning point. - ;; Otherwise, for select-active-regions non-nil, we get the wrong + ;; Otherwise, for `select-active-regions' non-nil, we get the wrong ;; selection if the user drags a region, clicks elsewhere to ;; reposition point, then middle-clicks to paste the selection. (deactivate-mark) @@ -959,171 +937,148 @@ should only be used by mouse-drag-region." ;; intangible text. (mouse-on-link-p start-posn))) (click-count (1- (event-click-count start-event))) - (remap-double-click (and on-link - (eq mouse-1-click-follows-link 'double) - (= click-count 1))) ;; Suppress automatic hscrolling, because that is a nuisance ;; when setting point near the right fringe (but see below). (automatic-hscrolling-saved automatic-hscrolling) - (automatic-hscrolling nil)) + (automatic-hscrolling nil) + event end end-point) + (setq mouse-selection-click-count click-count) ;; In case the down click is in the middle of some intangible text, ;; use the end of that text, and put it in START-POINT. (if (< (point) start-point) (goto-char start-point)) (setq start-point (point)) - (if remap-double-click ;; Don't expand mouse overlay in links - (setq click-count 0)) - (mouse-move-drag-overlay mouse-drag-overlay start-point start-point - click-count) - (overlay-put mouse-drag-overlay 'window start-window) - (let (event end end-point last-end-point) - (track-mouse - (while (progn - (setq event (read-event)) - (or (mouse-movement-p event) - (memq (car-safe event) '(switch-frame select-window)))) - (if (memq (car-safe event) '(switch-frame select-window)) - nil - ;; Automatic hscrolling did not occur during the call to - ;; `read-event'; but if the user subsequently drags the - ;; mouse, go ahead and hscroll. - (let ((automatic-hscrolling automatic-hscrolling-saved)) - (redisplay)) - (setq end (event-end event) - end-point (posn-point end)) - (if (numberp end-point) - (setq last-end-point end-point)) - (cond - ;; Are we moving within the original window? - ((and (eq (posn-window end) start-window) + ;; Activate the region, using `mouse-start-end' to determine where + ;; to put point and mark (e.g., double-click will select a word). + (setq transient-mark-mode + (if (eq transient-mark-mode 'lambda) + '(only) + (cons 'only transient-mark-mode))) + (let ((range (mouse-start-end start-point start-point click-count)) + ;; Prevent `push-mark' from clobbering the primary selection + ;; if the user clicks without dragging. + (select-active-regions nil)) + (goto-char (nth 0 range)) + (push-mark nil t t) + (goto-char (nth 1 range))) + + ;; Track the mouse until we get a non-movement event. + (track-mouse + (while (progn + (setq event (read-event)) + (or (mouse-movement-p event) + (memq (car-safe event) '(switch-frame select-window)))) + (unless (memq (car-safe event) '(switch-frame select-window)) + ;; Automatic hscrolling did not occur during the call to + ;; `read-event'; but if the user subsequently drags the + ;; mouse, go ahead and hscroll. + (let ((automatic-hscrolling automatic-hscrolling-saved)) + (redisplay)) + (setq end (event-end event) + end-point (posn-point end)) + (if (and (eq (posn-window end) start-window) (integer-or-marker-p end-point)) - (mouse-move-drag-overlay mouse-drag-overlay start-point end-point click-count)) + ;; If moving in the original window, move point by going + ;; to start first, so that if end is in intangible text, + ;; point jumps away from start. Don't do it if + ;; start=end, or a single click would select a region if + ;; it's on intangible text. + (unless (= start-point end-point) + (goto-char start-point) + (goto-char end-point)) + (let ((mouse-row (cdr (cdr (mouse-position))))) + (cond + ((null mouse-row)) + ((< mouse-row top) + (mouse-scroll-subr start-window (- mouse-row top) + nil start-point)) + ((>= mouse-row bottom) + (mouse-scroll-subr start-window (1+ (- mouse-row bottom)) + nil start-point)))))))) - (t - (let ((mouse-row (cdr (cdr (mouse-position))))) - (cond - ((null mouse-row)) - ((< mouse-row top) - (mouse-scroll-subr start-window (- mouse-row top) - mouse-drag-overlay start-point)) - ((>= mouse-row bottom) - (mouse-scroll-subr start-window (1+ (- mouse-row bottom)) - mouse-drag-overlay start-point))))))))) - - ;; In case we did not get a mouse-motion event - ;; for the final move of the mouse before a drag event - ;; pretend that we did get one. - (when (and (memq 'drag (event-modifiers (car-safe event))) - (setq end (event-end event) - end-point (posn-point end)) + ;; Handle the terminating event if possible. + (when (consp event) + ;; Ensure that point is on the end of the last event. + (when (and (setq end-point (posn-point (event-end event))) (eq (posn-window end) start-window) - (integer-or-marker-p end-point)) - (mouse-move-drag-overlay mouse-drag-overlay start-point end-point click-count)) + (integer-or-marker-p end-point) + (/= start-point end-point)) + (goto-char start-point) + (goto-char end-point)) + ;; Find its binding. + (let* ((fun (key-binding (vector (car event)))) + (do-multi-click (and (> (event-click-count event) 0) + (functionp fun) + (not (memq fun '(mouse-set-point + mouse-set-region)))))) + (if (and (/= (mark) (point)) + (not do-multi-click)) - ;; Handle the terminating event - (if (consp event) - (let* ((fun (key-binding (vector (car event)))) - (do-multi-click (and (> (event-click-count event) 0) - (functionp fun) - (not (memq fun - '(mouse-set-point - mouse-set-region)))))) - ;; Run the binding of the terminating up-event, if possible. - (if (and (not (= (overlay-start mouse-drag-overlay) - (overlay-end mouse-drag-overlay))) - (not do-multi-click)) - (let* ((stop-point - (if (numberp (posn-point (event-end event))) - (posn-point (event-end event)) - last-end-point)) - ;; The end that comes from where we ended the drag. - ;; Point goes here. - (region-termination - (if (and stop-point (< stop-point start-point)) - (overlay-start mouse-drag-overlay) - (overlay-end mouse-drag-overlay))) - ;; The end that comes from where we started the drag. - ;; Mark goes there. - (region-commencement - (- (+ (overlay-end mouse-drag-overlay) - (overlay-start mouse-drag-overlay)) - region-termination)) - last-command this-command) - ;; We copy the region before setting the mark so - ;; that `select-active-regions' can override - ;; `copy-region-as-kill'. - (and mouse-drag-copy-region - do-mouse-drag-region-post-process - (let (deactivate-mark) - (copy-region-as-kill region-commencement - region-termination))) - (push-mark region-commencement t t) - (goto-char region-termination) - (if (not do-mouse-drag-region-post-process) - ;; Skip all post-event handling, return immediately. - (delete-overlay mouse-drag-overlay) - (let ((buffer (current-buffer))) - (mouse-show-mark) - ;; mouse-show-mark can call read-event, - ;; and that means the Emacs server could switch buffers - ;; under us. If that happened, - ;; avoid trying to use the region. - (and (mark t) mark-active - (eq buffer (current-buffer)) - (mouse-set-region-1))))) - ;; Run the binding of the terminating up-event. - ;; If a multiple click is not bound to mouse-set-point, - ;; cancel the effects of mouse-move-drag-overlay to - ;; avoid producing wrong results. - (if do-multi-click (goto-char start-point)) - (delete-overlay mouse-drag-overlay) - (when (and (functionp fun) - (= start-hscroll (window-hscroll start-window)) - ;; Don't run the up-event handler if the - ;; window start changed in a redisplay after - ;; the mouse-set-point for the down-mouse - ;; event at the beginning of this function. - ;; When the window start has changed, the - ;; up-mouse event will contain a different - ;; position due to the new window contents, - ;; and point is set again. - (or end-point - (= (window-start start-window) - start-window-start))) - (when (and on-link - (or (not end-point) (= end-point start-point)) - (consp event) - (or remap-double-click - (and - (not (eq mouse-1-click-follows-link 'double)) - (= click-count 0) - (= (event-click-count event) 1) - (or (not (integerp mouse-1-click-follows-link)) - (let ((t0 (posn-timestamp (event-start start-event))) - (t1 (posn-timestamp (event-end event)))) - (and (integerp t0) (integerp t1) - (if (> mouse-1-click-follows-link 0) - (<= (- t1 t0) mouse-1-click-follows-link) - (< (- t0 t1) mouse-1-click-follows-link)))))))) - ;; If we rebind to mouse-2, reselect previous selected window, - ;; so that the mouse-2 event runs in the same - ;; situation as if user had clicked it directly. - ;; Fixes the bug reported by juri@jurta.org on 2005-12-27. - (if (or (vectorp on-link) (stringp on-link)) - (setq event (aref on-link 0)) - (select-window original-window) - (setcar event 'mouse-2) - ;; If this mouse click has never been done by - ;; the user, it doesn't have the necessary - ;; property to be interpreted correctly. - (put 'mouse-2 'event-kind 'mouse-click))) - (push event unread-command-events)))) + ;; If point has moved, finish the drag. + (let* (last-command this-command) + ;; Copy the region so that `select-active-regions' can + ;; override `copy-region-as-kill'. + (and mouse-drag-copy-region + do-mouse-drag-region-post-process + (let (deactivate-mark) + (copy-region-as-kill (mark) (point)))) + ;; For `select-active-regions' non-nil, ensure that + ;; further alterations of the region (e.g. via + ;; shift-selection) continue to update PRIMARY. + (select-active-region)) + + ;; If point hasn't moved, run the binding of the + ;; terminating up-event. + (if do-multi-click + (goto-char start-point) + (let (select-active-regions) + (deactivate-mark))) + (when (and (functionp fun) + (= start-hscroll (window-hscroll start-window)) + ;; Don't run the up-event handler if the window + ;; start changed in a redisplay after the + ;; mouse-set-point for the down-mouse event at + ;; the beginning of this function. When the + ;; window start has changed, the up-mouse event + ;; contains a different position due to the new + ;; window contents, and point is set again. + (or end-point + (= (window-start start-window) + start-window-start))) + (when (and on-link + (= start-point (point)) + (mouse--remap-link-click-p start-event event)) + ;; If we rebind to mouse-2, reselect previous selected + ;; window, so that the mouse-2 event runs in the same + ;; situation as if user had clicked it directly. Fixes + ;; the bug reported by juri@jurta.org on 2005-12-27. + (if (or (vectorp on-link) (stringp on-link)) + (setq event (aref on-link 0)) + (select-window original-window) + (setcar event 'mouse-2) + ;; If this mouse click has never been done by the + ;; user, it doesn't have the necessary property to be + ;; interpreted correctly. + (put 'mouse-2 'event-kind 'mouse-click))) + (push event unread-command-events))))))) + +(defun mouse--remap-link-click-p (start-event end-event) + (or (and (eq mouse-1-click-follows-link 'double) + (= (event-click-count start-event) 2)) + (and + (not (eq mouse-1-click-follows-link 'double)) + (= (event-click-count start-event) 1) + (= (event-click-count end-event) 1) + (or (not (integerp mouse-1-click-follows-link)) + (let ((t0 (posn-timestamp (event-start start-event))) + (t1 (posn-timestamp (event-end end-event)))) + (and (integerp t0) (integerp t1) + (if (> mouse-1-click-follows-link 0) + (<= (- t1 t0) mouse-1-click-follows-link) + (< (- t0 t1) mouse-1-click-follows-link)))))))) - ;; Case where the end-event is not a cons cell (it's just a boring - ;; char-key-press). - (delete-overlay mouse-drag-overlay))))) ;; Commands to handle xterm-style multiple clicks. (defun mouse-skip-word (dir) @@ -1263,74 +1218,6 @@ If MODE is 2 then do the same for lines." ;; Momentarily show where the mark is, if highlighting doesn't show it. -(defcustom mouse-region-delete-keys '([delete] [deletechar] [backspace]) - "List of keys that should cause the mouse region to be deleted." - :group 'mouse - :type '(repeat key-sequence)) - -(defun mouse-show-mark () - (let ((inhibit-quit t) - (echo-keystrokes 0) - event events key ignore - (x-lost-selection-functions - (when (boundp 'x-lost-selection-functions) - (copy-sequence x-lost-selection-functions)))) - (add-hook 'x-lost-selection-functions - (lambda (seltype) - (when (eq seltype 'PRIMARY) - (setq ignore t) - (throw 'mouse-show-mark t)))) - (if transient-mark-mode - (delete-overlay mouse-drag-overlay) - (move-overlay mouse-drag-overlay (point) (mark t))) - (catch 'mouse-show-mark - ;; In this loop, execute scroll bar and switch-frame events. - ;; Should we similarly handle `select-window' events? --Stef - ;; Also ignore down-events that are undefined. - (while (progn (setq event (read-event)) - (setq events (append events (list event))) - (setq key (apply 'vector events)) - (or (and (consp event) - (eq (car event) 'switch-frame)) - (and (consp event) - (eq (posn-point (event-end event)) - 'vertical-scroll-bar)) - (and (memq 'down (event-modifiers event)) - (not (key-binding key)) - (not (mouse-undouble-last-event events)) - (not (member key mouse-region-delete-keys))))) - (and (consp event) - (or (eq (car event) 'switch-frame) - (eq (posn-point (event-end event)) - 'vertical-scroll-bar)) - (let ((keys (vector 'vertical-scroll-bar event))) - (and (key-binding keys) - (progn - (call-interactively (key-binding keys) - nil keys) - (setq events nil))))))) - ;; If we lost the selection, just turn off the highlighting. - (unless ignore - ;; For certain special keys, delete the region. - (if (member key mouse-region-delete-keys) - (progn - ;; Since notionally this is a separate command, - ;; run all the hooks that would be run if it were - ;; executed separately. - (run-hooks 'post-command-hook) - (setq last-command this-command) - (setq this-original-command 'delete-region) - (setq this-command (or (command-remapping this-original-command) - this-original-command)) - (run-hooks 'pre-command-hook) - (call-interactively this-command)) - ;; Otherwise, unread the key so it gets executed normally. - (setq unread-command-events - (nconc events unread-command-events)))) - (setq quit-flag nil) - (unless transient-mark-mode - (delete-overlay mouse-drag-overlay)))) - (defun mouse-set-mark (click) "Set mark at the position clicked on with the mouse. Display cursor at that position for a second. @@ -1404,8 +1291,7 @@ This does not delete the region; it acts like \\[kill-ring-save]." (interactive "e") (mouse-set-mark-fast click) (let (this-command last-command) - (kill-ring-save (point) (mark t))) - (mouse-show-mark)) + (kill-ring-save (point) (mark t)))) ;; This function used to delete the text between point and the mouse ;; whenever it was equal to the front of the kill ring, but some @@ -1495,8 +1381,7 @@ If you do this twice in the same position, the selection is killed." (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-show-mark)) + (list (car kill-ring) (point) click-posn))) ;; If we click this button again without moving it, ;; that time kill. (mouse-save-then-kill-delete-region (mark) (point)) @@ -1540,7 +1425,6 @@ If you do this twice in the same position, the selection is killed." (goto-char before-scroll)) (exchange-point-and-mark) ;Why??? --Stef (kill-new (buffer-substring (point) (mark t)))) - (mouse-show-mark) (mouse-set-region-1) (setq mouse-save-then-kill-posn (list (car kill-ring) (point) click-posn))))))) @@ -2483,6 +2367,7 @@ choose a font." (declare-function font-face-attributes "font.c" (font &optional frame)) (defun mouse-appearance-menu (event) + "Show a menu for changing the default face in the current buffer." (interactive "@e") (require 'face-remap) (when (display-multi-font-p) @@ -2556,7 +2441,7 @@ choose a font." (global-set-key [left-fringe mouse-1] 'mouse-set-point) (global-set-key [right-fringe mouse-1] 'mouse-set-point) -(global-set-key [mouse-2] 'mouse-yank-at-click) +(global-set-key [mouse-2] 'mouse-yank-primary) ;; Allow yanking also when the corresponding cursor is "in the fringe". (global-set-key [right-fringe mouse-2] 'mouse-yank-at-click) (global-set-key [left-fringe mouse-2] 'mouse-yank-at-click) diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index 46cbb723d76..870bd2e313d 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -39,6 +39,7 @@ (declare-function dbus-method-error-internal "dbusbind.c") (declare-function dbus-register-signal "dbusbind.c") (declare-function dbus-register-method "dbusbind.c") +(declare-function dbus-send-signal "dbusbind.c") (defvar dbus-debug) (defvar dbus-registered-objects-table) @@ -869,7 +870,7 @@ name of the property, and its value. If there are no properties, (add-to-list 'result (cons (car dict) (caadr dict)) 'append))))) (defun dbus-register-property - (bus service path interface property access value) + (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'. @@ -892,7 +893,9 @@ can be changed by `dbus-set-property'. The interface \"org.freedesktop.DBus.Properties\" is added to PATH, including a default handler for the \"Get\", \"GetAll\" and -\"Set\" methods of this interface." +\"Set\" methods of this interface. When EMITS-SIGNAL is non-nil, +the signal \"PropertiesChanged\" is sent when the property is +changed by `dbus-set-property'." (unless (member access '(:read :readwrite)) (signal 'dbus-error (list "Access type invalid" access))) @@ -911,10 +914,23 @@ PATH, including a default handler for the \"Get\", \"GetAll\" and (dbus-register-method bus service path dbus-interface-properties "Set" 'dbus-property-handler) + ;; Send the PropertiesChanged signal. + (when emits-signal + (dbus-send-signal + bus service path dbus-interface-properties "PropertiesChanged" + (list (list :dict-entry property (list :variant value))) + '(:array))) + ;; Create a hash table entry. We use nil for the unique name, ;; because the property might be accessed from anybody. (let ((key (list bus interface property)) - (val (list (list nil service path (cons access value))))) + (val + (list + (list + nil service path + (cons + (if emits-signal (list access :emits-signal) (list access)) + value))))) (puthash key val dbus-registered-objects-table) ;; Return the object. @@ -924,6 +940,7 @@ PATH, including a default handler for the \"Get\", \"GetAll\" and "Default handler for the \"org.freedesktop.DBus.Properties\" interface. It will be registered for all objects created by `dbus-register-object'." (let ((bus (dbus-event-bus-name last-input-event)) + (service (dbus-event-service-name last-input-event)) (path (dbus-event-path-name last-input-event)) (method (dbus-event-member-name last-input-event)) (interface (car args)) @@ -931,25 +948,40 @@ It will be registered for all objects created by `dbus-register-object'." (cond ;; "Get" returns a variant. ((string-equal method "Get") - (let ((val (gethash (list bus interface property) - dbus-registered-objects-table))) - (when (string-equal path (nth 2 (car val))) - (list (list :variant (cdar (last (car val)))))))) + (let ((entry (gethash (list bus interface property) + dbus-registered-objects-table))) + (when (string-equal path (nth 2 (car entry))) + (list (list :variant (cdar (last (car entry)))))))) ;; "Set" expects a variant. ((string-equal method "Set") - (let ((val (gethash (list bus interface property) - dbus-registered-objects-table))) - (unless (consp (car (last (car val)))) + (let* ((value (caar (cddr args))) + (entry (gethash (list bus interface property) + dbus-registered-objects-table)) + ;; The value of the hash table is a list; in case of + ;; properties it contains just one element (UNAME SERVICE + ;; PATH OBJECT). OBJECT is a cons cell of a list, which + ;; contains a list of annotations (like :read, + ;; :read-write, :emits-signal), and the value of the + ;; property. + (object (car (last (car entry))))) + (unless (consp object) (signal 'dbus-error (list "Property not registered at path" property path))) - (unless (equal (caar (last (car val))) :readwrite) + (unless (member :readwrite (car object)) (signal 'dbus-error (list "Property not writable at path" property path))) (puthash (list bus interface property) - (list (append (butlast (car val)) - (list (cons :readwrite (caar (cddr args)))))) + (list (append (butlast (car entry)) + (list (cons (car object) value)))) dbus-registered-objects-table) + ;; Send the "PropertiesChanged" signal. + (when (member :emits-signal (car object)) + (dbus-send-signal + bus service path dbus-interface-properties "PropertiesChanged" + (list (list :dict-entry property (list :variant value))) + '(:array))) + ;; Return empty reply. :ignore)) ;; "GetAll" returns "a{sv}". diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index a984dd37fd8..202eaf59835 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -551,11 +551,14 @@ is no information where to trace the message.") (tramp-message v 4 "`copy-file' failed, trying `gvfs-copy'") (unless (zerop - (tramp-gvfs-send-command - v "gvfs-copy" - (if (or keep-date preserve-uid-gid) "--preserve" "") - (tramp-gvfs-url-file-name filename) - (tramp-gvfs-url-file-name newname))) + (let ((args + (append (if (or keep-date preserve-uid-gid) + (list "--preserve") + nil) + (list + (tramp-gvfs-url-file-name filename) + (tramp-gvfs-url-file-name newname))))) + (apply 'tramp-gvfs-send-command v "gvfs-copy" args))) ;; Propagate the error. (tramp-error v (car err) "%s" (cdr err))))))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 8e9ca34f16b..1c9a7015bf2 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1037,6 +1037,7 @@ The default value is to use the same value as `tramp-rsh-end-of-line'." ;; Solaris: /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin ;; GNU/Linux (Debian, Suse): /bin:/usr/bin ;; FreeBSD: /usr/bin:/bin:/usr/sbin:/sbin: - beware trailing ":"! +;; IRIX64: /usr/bin (defcustom tramp-remote-path '(tramp-default-remote-path "/usr/sbin" "/usr/local/bin" "/local/bin" "/local/freeware/bin" "/local/gnu/bin" @@ -1786,7 +1787,7 @@ printf( $stat[2], $stat[1] >> 16 & 0xffff, $stat[1] & 0xffff -);' \"$1\" \"$2\" \"$3\" 2>/dev/null" +);' \"$1\" \"$2\" 2>/dev/null" "Perl script to produce output suitable for use with `file-attributes' on the remote file system. Escape sequence %s is replaced with name of Perl binary. @@ -1839,7 +1840,7 @@ for($i = 0; $i < $n; $i++) $stat[0] >> 16 & 0xffff, $stat[0] & 0xffff); } -printf(\")\\n\");' \"$1\" \"$2\" \"$3\" 2>/dev/null" +printf(\")\\n\");' \"$1\" \"$2\" 2>/dev/null" "Perl script implementing `directory-files-attributes' as Lisp `read'able output. Escape sequence %s is replaced with name of Perl binary. @@ -4683,7 +4684,12 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1." (let* ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command)) ;; We cannot use `shell-file-name' and `shell-command-switch', ;; they are variables of the local host. - (args (list "/bin/sh" "-c" (substring command 0 asynchronous))) + (args (list + (tramp-get-method-parameter + (tramp-file-name-method + (tramp-dissect-file-name default-directory)) + 'tramp-remote-sh) + "-c" (substring command 0 asynchronous))) current-buffer-p (output-buffer (cond @@ -5559,12 +5565,23 @@ Falls back to normal file name handler if no Tramp file name handler exists." (if foreign (condition-case err (apply foreign operation args) + + ;; Trace that somebody has interrupted the + ;; operation. + (quit + (let (tramp-message-show-message) + (tramp-message + v 1 "Interrupt received in operation %s" + (append (list operation) args))) + ;; Propagate the quit signal. + (signal (car err) (cdr err))) + + ;; When we are in completion mode, some failed + ;; operations shall return at least a default value + ;; in order to give the user a chance to correct the + ;; file name in the minibuffer. (error (cond - ;; When we are in completion mode, some failed - ;; operations shall return at least a default - ;; value in order to give the user a chance to - ;; correct the file name in the minibuffer. ((and completion (zerop (length localname)) (memq operation '(file-exists-p file-directory-p))) t) @@ -5574,6 +5591,7 @@ Falls back to normal file name handler if no Tramp file name handler exists." filename) ;; Propagate the error. (t (signal (car err) (cdr err)))))) + ;; Nothing to do for us. (tramp-run-real-handler operation args))))) @@ -6619,12 +6637,10 @@ file exists and nonzero exit status otherwise." (t (tramp-message vec 5 "Remote `%s' groks tilde expansion, good" - (tramp-get-method-parameter - (tramp-file-name-method vec) 'tramp-remote-sh)) - (tramp-set-connection-property - vec "remote-shell" - (tramp-get-method-parameter - (tramp-file-name-method vec) 'tramp-remote-sh)))))))) + (tramp-set-connection-property + vec "remote-shell" + (tramp-get-method-parameter + (tramp-file-name-method vec) 'tramp-remote-sh))))))))) ;; ------------------------------------------------------------ ;; -- Functions for establishing connection -- @@ -7029,6 +7045,12 @@ process to set up. VEC specifies the connection." ;; Disable unexpected output. (tramp-send-command vec "mesg n; biff n" t) + ;; IRIX64 bash expands "!" even when in single quotes. This + ;; destroys our shell functions, we must disable it. See + ;; . + (when (string-match "^IRIX64" (tramp-get-connection-property vec "uname" "")) + (tramp-send-command vec "set +H" t)) + ;; Set the environment. (tramp-message vec 5 "Setting default environment") @@ -7044,7 +7066,7 @@ process to set up. VEC specifies the connection." (setq env (cdr env))) (when unset (tramp-send-command - vec (format "unset %s" (mapconcat 'identity unset " "))))) t) + vec (format "unset %s" (mapconcat 'identity unset " ")) t)))) ;; CCC: We should either implement a Perl version of base64 encoding ;; and decoding. Then we just use that in the last item. The other @@ -7529,11 +7551,11 @@ connection if a previous connection has died for some reason." ;; Add arguments for asynchrononous processes. (when (and process-name async-args) - (setq login-args (append login-args async-args))) + (setq login-args (append async-args login-args))) ;; Add gateway arguments if necessary. (when (and gw gw-args) - (setq login-args (append login-args gw-args))) + (setq login-args (append gw-args login-args))) ;; Check for port number. Until now, there's no need ;; for handling like method, user, host. @@ -8316,10 +8338,14 @@ necessary only. This function will be used in file name completion." ;; Check parameters. On busybox, "ls" output coloring is ;; enabled by default sometimes. So we try to disable it ;; when possible. $LS_COLORING is not supported there. + ;; Some "ls" versions are sensible wrt the order of + ;; arguments, they fail when "-al" is after the + ;; "--color=never" argument (for example on FreeBSD). (when (zerop (tramp-send-command-and-check vec (format "%s -lnd /" result))) (when (zerop (tramp-send-command-and-check - vec (format "%s --color=never /" result))) + vec (format + "%s --color=never -al /dev/null" result))) (setq result (concat result " --color=never"))) (throw 'ls-found result)) (setq dl (cdr dl)))))) @@ -8329,8 +8355,12 @@ necessary only. This function will be used in file name completion." (save-match-data (with-connection-property vec "ls-dired" (tramp-message vec 5 "Checking, whether `ls --dired' works") + ;; Some "ls" versions are sensible wrt the order of arguments, + ;; they fail when "-al" is after the "--dired" argument (for + ;; example on FreeBSD). (zerop (tramp-send-command-and-check - vec (format "%s --dired /" (tramp-get-ls-command vec))))))) + vec (format "%s --dired -al /dev/null" + (tramp-get-ls-command vec))))))) (defun tramp-get-test-command (vec) (with-connection-property vec "test" @@ -8848,7 +8878,6 @@ Only works for Bourne-like shells." ;; by the files in that directory. Add this here. ;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman) ;; * Make ffap.el grok Tramp filenames. (Eli Tziperman) -;; * Case-insensitive filename completion. (Norbert Goevert.) ;; * Don't use globbing for directories with many files, as this is ;; likely to produce long command lines, and some shells choke on ;; long command lines. @@ -8930,7 +8959,6 @@ Only works for Bourne-like shells." ;; without built-in uuencode/uudecode. ;; * Let `shell-dynamic-complete-*' and `comint-dynamic-complete' work ;; on remote hosts. -;; * Use secrets.el for password handling. ;; * Load ~/.emacs_SHELLNAME on the remote host for `shell'. ;; Functions for file-name-handler-alist: diff --git a/lisp/net/zeroconf.el b/lisp/net/zeroconf.el index b0b98fc57f3..e49a45c8a48 100644 --- a/lisp/net/zeroconf.el +++ b/lisp/net/zeroconf.el @@ -336,6 +336,23 @@ The attributes of SERVICE can be retrieved via the functions (puthash type l-hook zeroconf-service-removed-hooks-hash))) (t (error "EVENT must be either `:new' or `:removed'")))) +(defun zeroconf-service-remove-hook (type event function) + "Remove FUNCTION from the hook of service type TYPE. + +EVENT must be either :new or :removed and has to match the event +type used when registering FUNCTION." + (let* ((table (cond + ((equal event :new) + zeroconf-service-added-hooks-hash) + ((equal event :removed) + zeroconf-service-removed-hooks-hash) + (t (error "EVENT must be either `:new' or `:removed'")))) + (l-hook (gethash type table nil))) + (remove-hook 'l-hook function) + (if l-hook + (puthash type l-hook table) + (remhash type table)))) + (defun zeroconf-get-host () "Returns the local host name as string." (dbus-call-method @@ -407,7 +424,7 @@ TYPE. The resulting list has the format (elt (nth 9 result))) ;; TXT. ;; The TXT field has the signature "aay". Transform to "as". (while elt - (setcar elt (apply 'string (car elt))) + (setcar elt (dbus-byte-array-to-string (car elt))) (setq elt (cdr elt))) (when nil ;; We discard it, no use so far. @@ -599,7 +616,7 @@ DOMAIN is nil, the local domain is used." ;; The "TXT" field has the signature "aay". Transform to "as". (let ((elt (nth 9 val))) (while elt - (setcar elt (apply 'string (car elt))) + (setcar elt (dbus-byte-array-to-string (car elt))) (setq elt (cdr elt)))) (when zeroconf-debug (message "zeroconf-service-resolver-handler: %s %S" @@ -641,11 +658,7 @@ For the description of arguments, see `zeroconf-resolved-services-hash'." ;; The TXT field has the signature "as". Transform to "aay". (dolist (elt txt) - (let (args) - (add-to-list - 'result - (dolist (elt1 (string-to-list elt) (append '(:array) args)) - (setq args (append args (list :byte elt1))))))) + (add-to-list 'result (dbus-string-to-byte-array elt))) ;; Add the service. (dbus-call-method diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index 35007edfe15..436cdbd846f 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog @@ -1,3 +1,1234 @@ +2010-07-19 Eric Schulte + + * ob-C.el: New file. + * ob-R.el: New file. + * ob-asymptote.el: New file. + * ob-clojure.el: New file. + * ob-comint.el: New file. + * ob-css.el: New file. + * ob-ditaa.el: New file. + * ob-dot.el: New file. + * ob-emacs-lisp.el: New file. + * ob-eval.el: New file. + * ob-exp.el: New file. + * ob-gnuplot.el: New file. + * ob-haskell.el: New file. + * ob-keys.el: New file. + * ob-latex.el: New file. + * ob-lob.el: New file. + * ob-matlab.el: New file. + * ob-mscgen.el: New file. + * ob-ocaml.el: New file. + * ob-octave.el: New file. + * ob-perl.el: New file. + * ob-python.el: New file. + * ob-ref.el: New file. + * ob-ruby.el: New file. + * ob-sass.el: New file. + * ob-screen.el: New file. + * ob-sh.el: New file. + * ob-sql.el: New file. + * ob-sqlite.el: New file. + * ob-table.el: New file. + * ob-tangle.el: New file. + * ob.el: New file. + +2010-07-19 Carsten Dominik + + * org-mks.el: New file. + * org-capture.el: New file. + +2010-07-19 Christian Egli + + * org-taskjuggler.el: New file. + +2010-07-19 Matt Lundin + + * org-agenda.el (org-search-view): Fix inclusion of agenda-archives + in org-agenda-text-search-extra-files. + +2010-07-19 David Maus + + * org-list.el (org-list-send-list): Locally bind variable `txt'. + +2010-07-19 Eric Schulte + + * org.el (org-reload): Now also reloading babel files. + +2010-07-19 Carsten Dominik + + * org-capture.el (org-capture-set-plist): Make sure txt is a string + before calling `string-match'. + (org-capture-templates): Fix customization type. + +2010-07-19 Carsten Dominik + + * org-latex.el (org-export-latex-preprocess): Make a special case + for \nbsp. + (org-latex-entities): Remove the entry for \nbsp. + (org-latex-entities-exceptions): Variable removed. + +2010-07-19 Carsten Dominik + + * org-capture.el (org-capture-refile): Do not try to manipulate + bookmark list. + + * org.el (org-refile): Use the correct bookmark here. + +2010-07-19 Carsten Dominik + + * org-list.el (org-list-send-list): Parse list from its true beginning. + + * org.el (org-ctrl-c-ctrl-c): Maybe send the list when at a list item. + +2010-07-19 Carsten Dominik + + * org.el (org-insert-link): Correctly determine if we should use + a relative path. + +2010-07-19 Nicolas Goaziou + + * org-list.el (org-list-radio-list-templates): Fix templates. + +2010-07-19 Nicolas Goaziou + + * org-list.el (org-list-send-list): Regexp defining the start of + a radio list is now on par with the one used for radio tables. + +2010-07-19 Carsten Dominik + + * org-entities.el (org-entities-help): Add a headline for + the user-defined entities. + +2010-07-19 Dirk-Jan C. Binnema (tiny change) + + * org-agenda.el (org-agenda-action): Document capture key and add it + to the prompt. + +2010-07-19 Eric Schulte + + * org-latex.el (org-export-latex-listings-langs): Add (sqlite "SQL"). + +2010-07-19 Carsten Dominik + + * org-latex.el (org-export-latex-first-lines): Do not mark + meta lines for removal. Do not remove BABEL config lines during export. + +2010-07-19 David Maus + + * org-capture.el (org-capture): Check if + `org-capture-link-is-already-stored' is bound before evaluating. + +2010-07-19 Eric Schulte + + * org.el: Add autoload for org-babel-do-load-languages. + +2010-07-19 Eric Schulte + + * org-src.el (org-src-lang-modes): Add sqlite to sql-mode. + +2010-07-19 David Maus + + * org-feed.el: Change indentation to match coding style + guideline. + +2010-07-19 David Maus + + * org-feed.el (org-feed-unescape, org-feed-parse-atom-feed): Load XML + library if necessary. + +2010-07-19 Carsten Dominik + + * org-beamer.el (org-beamer-amend-header): Standardize the + header cookie for the beamer extra stuff. + +2010-07-19 Carsten Dominik + + * org-beamer.el (org-beamer-amend-header): Put extra header + last in header. + +2010-07-19 David Maus + + * org-exp-blocks.el (org-export-blocks-format-ditaa) + (org-export-blocks-format-dot): Remove text properties of body before + calculating cache hash. + +2010-07-19 Carsten Dominik + + * org-latex.el (org-export-latex-tabular-environment): New option. + (org-export-latex-tables): Use `org-export-latex-tabular-environment'. + +2010-07-19 Carsten Dominik + + * org-compat.el (org-version-check): New function. + + * org-indent.el (org-indent-mode): Check for exact emacs version. + +2010-07-19 Carsten Dominik + + * org-capture.el (org-capture-templates): Allow the template + to come from a file or function call. + (org-capture-place-entry): Get the template from file or function. + +2010-07-19 David Maus + + * org-agenda.el (org-agenda-bulk-action): Don't create marker for + position if target is entire file. + +2010-07-19 Carsten Dominik + + * org.el (org-autoload): Autoload a few more org-table functions. + +2010-07-19 Eric Schulte + + * org.el (org-babel-load-languages): Add ob-mscgen. + +2010-07-19 Eric Schulte + + * org-latex.el (org-export-latex-tables): Format string now + matches options. + +2010-07-19 Eric Schulte + + * org.el (org-babel-load-languages): This variable controls which + languages will be loaded by org-babel. It is customizable through + the customize interface. + +2010-07-19 Eric Schulte + + * org-latex.el (org-export-latex-format-image): Update number of + arguments to allow for an optional short-name. + +2010-07-19 Carsten Dominik + + * org-indent.el (org-indent-mode): Refuse to turn on prior to Emacs 23.2. + +2010-07-19 Carsten Dominik + + * org-capture.el (org-capture-set-target-location): Store + exact positions for file+regexp and file+function targets. + (org-capture-place-entry, org-capture-place-item) + (org-capture-place-table-line, org-capture-place-plain-text): Respect + exact positions. + (org-capture-finalize): Make sure we are at the beginning of a line + when fixing the empty lines after the entry. + +2010-07-19 Carsten Dominik + + * org.el (org-entry-get-with-inheritance): New argument LITERAL-NIL. + (org-entry-get): Pass `literal-nil' into + `org-entry-get-with-inheritance'. + (org-todo): React to nil values of the LOGGING property. + +2010-07-19 Carsten Dominik + + * org.el (org-default-notes-file): Update docstring. + +2010-07-19 Carsten Dominik + + * org.el (org-link-frame-setup): Use `org-gnus-no-new-news' as default. + +2010-07-19 Eric Schulte + + * org-exp.el (org-export-attach-captions-and-attributes): Add + a shortname attribute to caption strings under the symbol name + org-caption-shortn. + +2010-07-19 Carsten Dominik + + * org.el (org-switchb): Rename from `org-iswitchb'. Improve + docstring. + (org-iswitchb): New alias. + (org-ido-switchb): Make alias point to `org-switchb'. + +2010-07-19 Carsten Dominik + + * org-capture.el (org-capture-fill-template): Respect + time-of-day preference in template prompt. + +2010-07-19 David Maus + + * org-feed.el (org-feed-unescape): Remove superfluous lambda. + +2010-07-19 David Maus + + * org-wl.el (org-wl-disable-folder-check): New customization + variable. + (org-wl-open): Disable folder check depending on + `org-wl-disable-folder-check'. + +2010-07-19 Carsten Dominik + + * org-capture.el (org-capture-set-target-location): Fix + file+function interpretation. + +2010-07-19 David Maus + + * org-feed.el (org-feed-parse-rss-entry): Unescape rss element + content. + +2010-07-19 David Maus + + * org-feed.el (xml-entity-alist): Declare variable + `xml-entity-alist' for byte compiler. + +2010-07-19 David Maus + + * org-feed.el (org-feed-unescape): New function. Unescape + protected entities. + (org-feed-parse-atom-entry): Use function for atom:content + type text and html. + +2010-07-19 David Maus + + * org-feed.el (org-feed-parse-rss-feed): Ignore case of rss + element names. + +2010-07-19 Bernt Hansen + + * org.el (org-time-string-to-absolute): Ignore cyclic repeater + when displaying items on todays agenda date. + +2010-07-19 Carsten Dominik + + * org-agenda.el (org-agenda-get-progress): Avoid reusing previous + value of EXTRA. + +2010-07-19 Carsten Dominik + + * org-publish.el (org-publish-initialize-cache): Make + timestamp directory, the entire path to it. + +2010-07-19 Carsten Dominik + + * org-exp.el (org-export-handle-comments): Make sure to check + for protection in the comment line, and not in the line after it. + +2010-07-19 Carsten Dominik + + * org-html.el (org-export-html-preprocess): Call org-format-latex, + possibly with a protect-only argument. + + * org.el (org-format-latex): New argument PROTECT-ONLY. + +2010-07-19 Eric Schulte + + * org-exp.el (org-export-handle-table-metalines): This function + removes table specific meta-lines, now that we aren't wiping + everything that looks remotely like a comment at the end of the + export process we have to be sure to catch all of the specific lines + in org-exp.el. + +2010-07-19 Nicolas Goaziou + + * org-exp.el (org-export-select-backend-specific-text): Properly + get rid of #+Backend and #+ATTR_Backend specifics to backends not + matching the one we're exporting to. + +2010-07-19 Eric Schulte + + * Makefile (lisp/org-install.el): Replace babel files in + construction of org-install.el. + +2010-07-19 Eric Schulte + + * org-table.el (orgtbl-to-generic): Add the :remove-newlines + option which will strip newline characters from the text of table + cells and replace then with "\n". + +2010-07-19 Carsten Dominik + + * org.el (org-confirm-shell-link-function): + (org-confirm-elisp-link-function): Limit the values that can be set by + file variables. + +2010-07-19 Carsten Dominik + + * org.el (org-compute-latex-and-specials-regexp): Deal with + string elements by discarding them. + +2010-07-19 Carsten Dominik + + * org.el (org-iswitchb): Make sure to use at least iswitchb. + +2010-07-19 Carsten Dominik + + * org-capture.el (org-capture-position-for-last-stored) + (org-capture-bookmark-last-stored-position): New functions. + (org-capture-place-table-line): Better error catching. + (org-capture-place-item): + (org-capture-place-entry): + (org-capture-place-plain-text): Call + `org-capture-position-for-last-stored'. + (org-capture-finalize): Just call + `org-capture-bookmark-last-stored-position'. + +2010-07-19 Eric Schulte + + * org-exp.el (org-export-mark-blockquote-verse-center): Fix + small bug, now grabbing match data before overwritten by looking-at + this fixes a problem with remainders of #+end_quote lines appearing + in exported output. + +2010-07-19 David Maus + + * org.el (org-link-frame-setup): Add customization option for + Wanderlust. + +2010-07-19 Eric Schulte + + * org-latex.el (org-export-latex-fixed-width): Now check + org-example rather than org-protected on verbatim export, because by + default all ": " prefixed lines are marked protected. + +2010-07-19 Eric Schulte + + * org-latex.el (org-export-latex-fixed-width): Check for + protection before wrapping ": " lines as verbatim. + +2010-07-19 Eric Schulte + + * org-exp.el (org-export-handle-comments): Check for protection + before removing comments. + +2010-07-19 Carsten Dominik + + * org-entities.el (org-entities): Restructure the list. + (org-entities-help): Turn the help output into a buffer + in Org-mode, so that it becomes easier to find a symbol + in the structure. + (org-entities-create-table): Deal with new structure. + +2010-07-19 David Maus + + * org-agenda.el (org-write-agenda): Use backquotes to expand + `flet' at compile time. + +2010-07-19 Carsten Dominik + + * org.el (org-entry-properties): Make sure that standard property + names are used even if the user has customized time keywords. + +2010-07-19 Carsten Dominik + + * org-macs.el (org-not-nil): Return the value if not interpreted + as nil. + + * org.el (org-entry-get): + (org-entry-get-with-inheritance): Interpret the value "nil" + as nil for properties. + +2010-07-19 Carsten Dominik + + * org.el (org-switch-to-buffer-other-window): Return the buffer. + +2010-07-19 Carsten Dominik + + * org-macs.el (org-not-nil): New function. + + * org.el (org-block-todo-from-children-or-siblings-or-parent): + Use `org-not-nil' to interpret a property value of nil. + +2010-07-19 Carsten Dominik + + * org.el (org-truely-invisible-p): New function. + (org-beginning-of-line): Use `org-truely-invisible-p'. + +2010-07-19 Carsten Dominik + + * org-agenda.el (org-agenda-get-timestamps): No errors + while getting TODO state. + (org-agenda-highlight-todo): No error when no keyword has + been matched. + +2010-07-19 Carsten Dominik + + * org.el (org-timestamp-change): New optional argument UPDOWN. + Use this to identify calls from org-timestamp-up/down, so that we can + skip by rounding minutes in this case. + (org-timestamp-up): + (org-timestamp-down): + (org-timestamp-up-day): + (org-timestamp-down-day): Call org-timestamp-change with the + updown argument. + +2010-07-19 Carsten Dominik + + * org-agenda.el (org-agenda-action): Make `c' key call org-capture. + + * org-capture.el: New file. + + * org-compat.el (org-get-x-clipboard): Function moved here from + remember.el. + + * org-mks.el: New file. + + * org.el (org-set-regexps-and-options): Allow statistic cookies as + part of complex headlines. + (org-find-olp): New argument THIS-BUFFER. When set, assume that the + OLP does not contain a file name. + +2010-07-19 Carsten Dominik + + * org.el (org-mode): Set `comment-start' instead of changing the + syntax of the `#' character. + +2010-07-19 Carsten Dominik + + * org-exp.el (org-export-format-source-code-or-example): Mark examples + by a property. + + * org-html.el (org-export-html-close-lists-maybe): Check if raw + HTML stuff was actually made from an example. + +2010-07-19 Eric Schulte + + * Makefile (LISPF): Let's not compile files that won't often be used. + +2010-07-19 Bastien Guerry + + * org-latex.el: Items are no longer skipped when their first line + ends on a protected element. + + * org-list.el: Protected environments looking like lists are not + exported anymore. + +2010-07-19 Eric Schulte + + * org-exp-blocks.el (org-export-blocks-preprocess): + Cleanup trailing newline after block. + +2010-07-19 Bastien Guerry + + * org-exp.el: Comment regexp now matches documentation. No more + protection check when deleting comments before export. + +2010-07-19 Bastien Guerry + + * org-exp.el (org-export-preprocess-string): + Now using `org-export-handle-include-files-recurse' to resolve + included files. + +2010-07-19 Bastien Guerry + + * org-agenda.el (org-agenda-get-deadlines): + (org-agenda-get-scheduled): + * org.el (org-time-string-to-seconds): + For deadline and scheduled agenda display ignore the cyclic repeater + when calculating how many days late the task is. If you have a weekly + task and miss the date the agenda view will show more than a week late + now instead of resetting on the cyclic repeating date. This makes it + much more obvious when you missed a repeating task after the repeater. + +2010-07-19 Bastien Guerry + + * org-exp.el (org-export-mark-blockquote-verse-center): + Consider environments that end at eob. + +2010-07-19 Mikael Fornius + + * org.el (org-raise-scripts): Do not fontify sub/superscripts of text + with face `org-special-keyword'. Make property keys as :LAST_REPEAT: + display correctly. + +2010-07-19 Mikael Fornius + + * org.el (org-at-property-p): Use save-match-data macro instead of let. + +2010-07-19 Mikael Fornius + + * org.el (test): Remove unused test function. + +2010-07-19 Eric Schulte + + * org-exp-blocks.el (org-export-blocks-preprocess): Fix typo. + +2010-07-19 Eric Schulte + + * org-exp-blocks.el (org-export-blocks-postblock-hook): Add + documentation to and turn into a defcustom. + +2010-07-19 Eric Schulte + + * org-exp.el (org-get-file-contents): By un-setting prefix1 to "" + instead of to nil we avoid errors when :prefix1 is defined, but + prefix is not. + +2010-07-19 Nicolas Goaziou + + * org-latex.el (org-export-latex-preprocess): Environments coming + from latex backend specific instructions (#+LaTeX) are already + protected and won't be treated as normal environments. + +2010-07-19 Bastien Guerry + + * org-timer.el (org-timer-set-timer): Fix typo in the docstring. + +2010-07-19 Bastien Guerry + + * org-timer.el (org-timer-set-timer): Use a prefix argument. + See the docstring of the function. + +2010-07-19 Bastien Guerry + + * org-timer.el (org-timer-set-timer): Fix bug about cancelling + timers. + +2010-07-19 David Maus + + * org-w3m.el (org-w3m-copy-for-org-mode) + (org-w3m-get-next-link-start, org-w3m-get-prev-link-start): + Get text property directly, not using macro `w3m-anchor'. + +2010-07-19 Carsten Dominik + + * org.el (org-emph-re): Document the match groups. + +2010-07-19 Bernt Hansen + + * org-clock.el (org-clock-in): Set `org-clock-clocking-in' to + t before calling `org-clock-out', so that that function can + know its call context. + +2010-07-19 Bastien Guerry + + * org-timer.el (org-timer-default-timer): New variable. + (org-timer-set-timer): Use the new variable. Also offer the + possibility to replace the current timer by a new one. + +2010-07-19 Carsten Dominik + + * org.el (org-kill-note-or-show-branches): Hide subtree before + exposing the headings. + +2010-07-19 Carsten Dominik + + * org.el (org-add-planning-info): Remove the empty line also + if there is no whitespace at all in there. + + * org-table.el (org-table-align): Fix alignment of strings + with invisible characters. + +2010-07-19 David Maus + + * org.el (org-refile-cache-get): Return empty list of targets + when cache was cleared. + (org-clone-subtree-with-time-shift): Maybe create ID property + in cloned subtrees. + (org-clone-delete-id): New customization variable. + (org-clone-subtree-with-time-shift): Use customization + variable `org-clone-delete-id'. + (org-clone-subtree-with-time-shift): Remove empty property + drawer in cloned subtrees. + +2010-07-19 Carsten Dominik + + * org.el (org-refile-use-cache): New option. + (org-refile-cache, org-refile-markers): New variable. + (org-refile-marker, org-refile-cache-clear) + (org-refile-cache-check-set, org-refile-cache-put) + (org-refile-cache-get): New function. + (org-get-refile-targets): Use the refile cache. + + * org-clock.el (org-clock-sum): Don't include running clock if + the time block is wrong. + +2010-07-19 John Wiegley + + * org-clock.el (org-clock-clock-in, org-clock-in): Add + parameter `start-time'. + (org-clock-resolve-clock): Add parameter `clock-out-time'. + If set, and resolve-to is a past time, then the clock out + event occurs at `clock-out-time' rather than at `resolve-to'. + In this case, `resolve-to' becomes the clock in time. + (org-clock-jump-to-current-clock): Create new global command + to reveal the current clock. + (org-clock-resolve): Add new commands g/G and j/J, and a + help window describing all commands and their meaning. + (org-clock-resolve-expert): New customization variable. + (org-find-open-clocks): Fix a bug that caused discovered + clocks not to match up with the currently active clock. + (org-resolve-clocks): Change the argument + `also-non-dangling-p' to `only-dangling-p', since due to a bug + this was the default behavior all along. + +2010-07-19 David Maus + + * org-id.el (org-id-uuid): New function. Return string with + random (version 4) UUID. + (org-id-method): Make 'uuid the new default value. + (org-id-new): Use `org-id-uuid' if call to uuidgen program + does not return a UUID. + +2010-07-19 Carsten Dominik + + * org-latex.el (org-export-latex-format-image): Add support + for multicolumn figures in LaTeX. + +2010-07-19 David Maus + + * org.el (org-clone-subtree-with-time-shift): Remove ID + property of original subtree in cloned subtrees. + +2010-07-19 Carsten Dominik + + * org-exp.el (org-export-format-source-code-or-example): + XEmacs compatibility. + + * org-latex.el (org-export-latex-tables): Accept comma in + align string. + + * org-docbook.el (org-export-docbook-xslt-stylesheet): New option. + (org-export-docbook-xslt-proc-command): Fix docstring. + (org-export-docbook-xsl-fo-proc-command): Fix docstring. + (org-export-as-docbook-pdf): Improve + formatting of the xslt command. + + * org-exp.el (org-infile-export-plist): Check for XSLT setting. + + * org.el (org-file-contents): Improve error message. + (org-set-regexps-and-options): Remove spaces at both ends. + +2010-07-19 Carsten Dominik + + * org-docbook.el (org-export-as-docbook-pdf): Improve + formatting of the xslt command. + +2010-07-19 Sebastian Rose + + * org-publish.el (org-publish-cache): Use one big hashmap for + each project defined in `org-publish-project-alist'. + (initialize-files-alist): Function removed. + (org-publish-validate-link): Function removed. + (org-publish-get-base-files): Add variable `sitemap-requested' + to avoid sorting where possible. + (org-publish-get-files): Function removed. + (org-publish-get-project-from-filename): Make independent of + file list. + (org-publish-file): New argument NO-CACHE. + +2010-07-19 Carsten Dominik + + * org.el (org-beginning-of-defun, org-end-of-defun): New + functions. + (org-mode): Install the `org-beginning-of-defun' and + `org-end-of-defun' functions. + (org-pretty-entities): New option. + (org-toggle-pretty-entities): New command. + (org-fontify-entities): New function. + (org-startup-options): New keywords for pretty entities. + (org-set-font-lock-defaults): Call the pretty entities + function. + + * org-latex.el (org-export-latex-keywords-maybe): Protect the + TODO markup. + +2010-07-19 Mikael Fornius + + * org-habit.el (org-habit-build-graph): Help-echo date when + mouse is over stars. + +2010-07-19 Jan Böker + + * org.el (org-file-apps): Improve docstring to reflect + grouping matches. + +2010-07-19 Carsten Dominik + + * org.el (org-set-startup-visibility): Fix empty line display. + + * org-latex.el (org-export-latex-links): Use the formatting + function of the link type, if it is available. + + * org-table.el (org-table-get-remote-range): Return to + original buffer when retrieving remote reference. + + * org.el (org-display-inline-images): Do the entire buffer, + not just the narrowed region. Clear the cache. + (org-display-inline-images): Match mode file paths. + +2010-07-19 David Maus + + * org-wl.el (org-wl-store-link-folder): Don't throw error when + called on WL folder group. + +2010-07-19 Carsten Dominik + + * org.el (org-replace-escapes): Make sure the cdr is not nil. + (org-read-date): Make `M-v' and `C-v' scroll the popup calendar. + (org-mode): Revert comment syntax changes. + +2010-07-19 Carsten Dominik + + * org.el (org-sparse-tree): Make `C-c / t' search for all TODO + keywords, and `C-c / T' for a specific one. + +2010-07-19 Carsten Dominik + + * org.el (org-mode): Fix comment syntax settings. + + * org-src.el (org-edit-src-allow-write-back-p): Define + variable. + + * org.el (org-inline-image-overlays): New variable. + (org-toggle-inline-images, org-display-inline-images) + (org-remove-inline-images): New commands. + (org-mode-map): Define a key for `org-toggle-inline-images'. + +2010-07-19 David Maus + + * org-wl.el (org-wl-message-field): New function. Return + content of header field in message entity. + (org-wl-store-link): Call `org-wl-store-link-folder' or + `org-wl-store-link-message' depending on major-mode. + (org-wl-store-link-folder): New function. Store link to + Wanderlust folder. + (org-wl-store-link-message): New function. Store link to + Wanderlust message. + (org-wl-store-link-message): Store link to message while + visiting message. + (org-wl-open): Don't try to jump to message when opening a + folder link. + +2010-07-19 David Maus + + * org.el (org-replace-escapes): Avoid infinite loop when + replace string contains escape sequence it replaces. + +2010-07-19 Carsten Dominik + + * org-crypt.el (org-crypt-key-for-heading): Use symmetric + encryption when now key is set. + +2010-07-19 Carsten Dominik + + * org-table.el (org-table-recalculate-buffer-tables) + (org-table-iterate-buffer-tables): New commands. + + * org.el (org-check-for-hidden): When there is a region, skip + the check. + +2010-07-19 Dan Davison + + * org-src.el (org-edit-src-code): allow-write-back-p had + erroneously been omitted from let binding. + +2010-07-19 Carsten Dominik + + * org-agenda.el (org-sorting-choice): New sorting type alpha. + (org-cmp-alpha): New defsubst. + (org-em): New defsubst. + (org-entries-lessp): Only compute needed comparisons. + +2010-07-19 Carsten Dominik + + * org-html.el (org-format-org-table-html): Test all columns + for number content. + +2010-07-19 Carsten Dominik + + * org-latex.el (org-export-latex-treat-sub-super-char): Make + sure parenthesis matching is consistent. + + * org-table.el (org-table-colgroup-line-p) + (org-table-cookie-line-p): New functions. + + * org-exp.el (org-table-clean-before-export): Better tests for + colgroup and cookie lines. + +2010-07-19 Carsten Dominik + + * org-agenda.el (org-agenda-goto): Push a mark before changing + the position. + + * org-footnote.el (org-footnote): New group. + (org-footnote-section) + (org-footnote-tag-for-non-org-mode-files): Fix typos. + + * org-list.el (org-end-of-item-text-before-children): Also do + the right thing at the end of a file. + + * org.el (org-set-packages-alist, org-get-packages-alist): New + function. + (org-export-latex-default-packages-alist) + (org-export-latex-packages-alist): Add extra flag to + each package, indicating if it should be used for snippets. + (org-create-formula-image): Add the snippet argument. + (org-splice-latex-header): New argument SNIPPET-P, pass it + through to `org-latex-packages-to-string'. + (org-latex-packages-to-string): New argument SNIPPET-P. + + * org-latex.el (org-export-latex-make-header): Add the snippet + argument. + + * org-docbook.el (org-export-as-docbook): Implement ordered + lists starting at some offset. + +2010-07-19 Carsten Dominik + + * org.el (org-link-types, org-open-at-point): Add doi links. + + * org-ascii.el (org-export-ascii-preprocess): Remove list + startcounter cookies. + + * org-list.el (org-renumber-ordered-list): Respect counter + start values. + + * org-latex.el (org-export-latex-lists): Accept ordered list + item offset cookie. + + * org-html.el (org-export-as-html): Accept ordered list + item offset cookie. + + * org-indent.el (org-indent-mode): Turn off `indent-tabs-mode' + which messes up alignment of tags. + +2010-07-19 Carsten Dominik + + * org-clock.el (org-clock-cancel, org-clock-out): Make sure + the modeline display is removed. + + * org-exp.el (org-export-format-drawer-function): Fix + docstring. + + * org-agenda.el (org-agenda-refile): New optional argument + NO-UPDATE. + (org-agenda-refile): Call `org-agenda-redo' unless NO-UPDATE + is set. + (org-agenda-bulk-action): Call the refile command with updates + suppressed - but arrange for `org-agenda-redo' to be called at + the end. + + * org.el (org-mode): Make table mapping quiet. + (org-table-map-tables): New optional argument QUIETLY. + + * org-ascii.el (org-export-ascii-preprocess): Make table + mapping quiet. + + * org-html.el (org-export-as-html, org-html-level-start): Change + XHTML IDs to not use dots. + + * org-exp.el (org-export-define-heading-targets): Change + XHTML IDs to not use dots. + + * org-docbook.el (org-export-docbook-level-start): Change + XHTML IDs to not use dots. + + * org-latex.el (org-export-as-latex): Make sure that the + result buffer is in latex-mode. + + * org.el (org-shiftup-final-hook, org-shiftdown-final-hook) + (org-shiftleft-final-hook, org-shiftright-final-hook): New + hooks. + +2010-07-19 Carsten Dominik + + * org-table.el (org-table-justify-field-maybe): Make sure that + inserting a value does not turn a line into a hline. + +2010-07-19 Carsten Dominik + + * org-clock.el (org-clock-sum): New argument HEADLINE-FILTER. + (org-clock-sum): Add property to selected headlines. + (org-dblock-write:clocktable): Make tags matcher. + + * org.el (org-set-autofill-regexps): XEmacs compatibility. + + * org-latex.el (org-export-latex-set-initial-vars): Allow "-" + in latex class definitions. + + * org.el (org-shiftup-hook, org-shiftdown-hook) + (org-shiftleft-hook, org-shiftright-hook): New hooks. + + * org-entities.el (org-entities): Use \land and \lor for logical + operators. + + * org.el (org-shiftmetaleft, org-shiftmetaright): Call the subtree + indentation commands. + (org-hidden-tree-error): New defsubst. + (org-metaleft, org-metaright): Check for hidden stuff and throw an + error. + (org-check-for-hidden): New function. + + * org-list.el (org-item-re): New function. + (org-at-item-p): Use `org-item-re'. + (org-end-of-item-text-before-children): New function. + (org-outdent-item, org-indent-item): Arrange for leaving the + subtree alone. + (org-outdent-item-tree, org-indent-item-tree): New argument + NO-SUBTREE. + (org-indent-item-tree): Use `org-end-of-item-text-before-children' + to find the end for processing while ignoring the subtree. + + * org-publish.el (org-publish-sitemap-sort-alphabetically) + (org-publish-sitemap-sort-folders) + (org-publish-sitemap-sort-ignore-case): New options. + +2010-07-19 Carsten Dominik + + * org-publish.el (org-publish-compare-directory-files): Fix sorting. + + * org-compat.el (org-get-x-clipboard-compat): Use (featurep 'xemacs). + + * org-publish.el (org-publish-project-alist): Update docstring. + (org-publish-file-title-cache): New variable. + (org-publish-initialize-files-alist): Initialize + `org-publish-initialize-files-alist' to nil. + (org-publish-sort-directory-files): New function. + (org-publish-projects): Access the new properties. + (org-publish-find-title): Use the file title cache. + (org-publish-find-title): Build the file title cache. + (org-publish-get-base-files-1): Sort files. + (org-publish-aux-preprocess): Do not throw an error when before + the first headline. Allow an empty target, meaning to link just + to the file. + (org-publish-index-generate-theindex.inc): Check if there is + actually a target and only then add it to the link. + (org-publish-projects): Fix a remaining issue with the last commit. + + * org-html.el (org-export-as-html): Treat verse as open/close + paragraph. + (org-export-html-close-lists-maybe): Allow to splice raw HTML into + and out of lists. + +2010-07-19 Dan Davison + + * org-src.el (org-edit-src-code): Allow the org-src edit buffer to + be used in a read-only mode. + (org-edit-src-code): Different message in read-only mode. + +2010-07-19 Carsten Dominik + + * org-src.el (org-edit-src-find-region-and-lang): Test for + table.el as late as possible. + + * org-colview-xemacs.el: Make sure this file is never loaded into + Emacs. Remove all tests for XEmacs. + + * org-colview.el: Make sure this file is never loaded into XEmacs. + + * org-agenda.el (org-highlight, org-unhighlight): Use direct + overlay calls. + + * org.el (org-key): Apply the translations defined in + `org-xemacs-key-equivalents'. + + * org-mouse.el (org-mode-hook): Use `org-defkey'. + + * org-compat.el (org-xemacs-key-equivalents): New constant. + +2010-07-19 Carsten Dominik + + * org-inlinetask.el (org-inlinetask-defaut-state): New option. + (org-inlinetask-insert-task): Use `org-inlinetask-defaut-state'. + Obey `org-odd-levels-only'. + + * org-compat.el (org-find-overlays): Use overlays-in/at. + + * org.el (org-remove-empty-overlays-at) + (org-outline-overlay-data, org-hide-block-toggle) + (org-format-latex, org-context): Use overlays-in/at. + + * org-src.el (org-edit-src-exit): Use overlays-in/at. + + * org-agenda.el (org-agenda-mark-clocking-task) + (org-agenda-fontify-priorities, org-agenda-dim-blocked-tasks) + (org-agenda-entry-text-hide) + (org-agenda-fix-tags-filter-overlays-at) + (org-agenda-bulk-remove-overlays): Use overlays-in/at. + + * org-compat.el (org-overlays-at): Function removed. + (org-overlays-in): Function removed. + +2010-07-19 Bastien Guerry + + * org-clock.el (org-clock-set-current): Just return the headline + itself, strip the TODO keyword, the priority cookie and the tags. + +2010-07-19 Carsten Dominik + + * org-compat.el (org-xemacs-without-invisibility): New macro. + (org-xemacs-without-invisibility): New macro. + (org-indent-to-column, org-indent-line-to, org-move-to-column): + Redefine using the macro `org-xemacs-without-invisibility'. + + * org.el (org-mode, org-org-menu): Use `add-to-invisibility-spec'. + + * org-table.el (orgtbl-mode): Use `add-to-invisibility-spec'. + + * org-compat.el (org-make-overlay, org-delete-overlay) + (org-overlay-start, org-overlay-end, org-overlay-put) + (org-overlay-get, org-overlay-move, org-overlay-buffer): Functions + removed. + (org-add-to-invisibility-spec): Function removed. + + * org-html.el (org-export-as-html-and-open): Add argument to + kill-buffer. + + * org-habit.el (require): `calendar' is now required already by + org.el on top level. + + * org-clock.el (require): `calendar' is now required already by + org.el on top level. + + * org-agenda.el (require, org-timeline, org-agenda-list) + (org-todo-list, org-agenda-to-appt): `calendar' is now required + already by org.el on top level. + + * org.el (org-export-latex-fix-inputenc): Declare function. + + * org-agenda.el (org-agenda-goto-calendar): Do not bind obsolete + variables. + + * org.el (calendar): Require calendar now on top level in org.el + and define aliases to new variables when needed. + (org-read-date, org-goto-calendar): Do not bind obsolete + variables. + + * org-clock.el (org-clock-out, org-clock-cancel): Get rid of + compilation warning, add comment that this cannot be done with + `with-current-buffer'. + + * org-wl.el (org-wl-open): Use `with-current-buffer'. + + * org.el (overlay, org-remove-empty-overlays-at) + (org-outline-overlay-data, org-set-outline-overlay-data) + (org-show-block-all, org-hide-block-toggle) + (org-highlight-new-match, org-remove-occur-highlights) + (org-tags-overlay, org-fast-tag-selection, org-date-ovl) + (org-read-date, org-read-date-display, org-eval-in-calendar) + (org-format-latex, org-context) + (org-speedbar-restriction-lock-overlay) + (org-speedbar-set-agenda-restriction): Use the normal overlay API. + + * org-table.el (org-table-add-rectangle-overlay) + (org-table-remove-rectangle-highlight) + (org-table-overlay-coordinates) + (org-table-toggle-coordinate-overlays): Use the normal overlay + API. + + * org-src.el (org-edit-src-code, org-edit-fixed-width-region) + (org-edit-src-exit, org-src-mode-configure-edit-buffer): Use the + normal overlay API. + + * org-colview.el (org-columns-new-overlay) + (org-columns-display-here, org-columns-remove-overlays) + (org-columns-edit-value, org-columns-next-allowed-value) + (org-columns-update): Use the normal overlay API. + + * org-clock.el (org-clock-out, org-clock-cancel) + (org-clock-put-overlay, org-clock-remove-overlays): Use the normal + overlay API. + + * org-agenda.el (org-agenda-mark-filtered-text) + (org-agenda-mark-clocking-task, org-agenda-fontify-priorities) + (org-agenda-dim-blocked-tasks, org-agenda-entry-text-show-here) + (org-agenda-entry-text-hide) + (org-agenda-restriction-lock-overlay) + (org-agenda-set-restriction-lock) + (org-agenda-filter-by-tag-hide-line) + (org-agenda-fix-tags-filter-overlays-at) + (org-agenda-filter-by-tag-show-all, org-hl) + (org-agenda-goto-calendar, org-agenda-bulk-mark) + (org-agenda-bulk-remove-overlays): Use the normal overlay API. + + * org-freemind.el (org-freemind-from-org-mode-node) + (org-freemind-from-org-mode, ) + (org-freemind-from-org-sparse-tree, org-freemind-to-org-mode): Use + interactive-p instead of called-interactively, because this is + backward compatible with older Emacsen I still support.. + +2010-07-19 Carsten Dominik + + * org-exp.el (org-export-define-heading-targets): Fix bug in + regexp finding ID and CUSTOM_ID properties. + +2010-07-19 Carsten Dominik + + * org-footnote.el (org-footnote-goto-previous-reference): Rename + from `org-footnote-goto-next-reference'. + + * org.el (org-auto-repeat-maybe): Only record LAST_REPEAT if + org-log-repeat is non-nil, or if there is clocking data in the + entry. + + * org-crypt.el (org-encrypt-entry): Improve mapping behavior. + +2010-07-19 Carsten Dominik + + * org.el (org-align-all-tags): New command. + +2010-07-19 David Maus + + * org-wl.el (org-wl-link-remove-filter): New customizable + variable. If non-nil, filter conditions are stripped when storing + link to message in filter folder. + (org-wl-shimbun-prefer-web-links): New customizable variable. If + non-nil, links to shimbun messages are created as web links to + message source. + (org-wl-nntp-prefer-web-links): New customizable variable. If + non-nil, links to nntp message are created as web links to gmane + or googlegroups. + (org-wl-namazu-default-index): New customizable variable. + Directory of namazu search index that should be used as default + when opening a link in a search folder. + (org-wl-folder-types): New constant. Wanderlust folder type + indicators. + (org-wl-folder-type): New function. Return type of Wanderlust + folder. + (org-wl-store-link): Create web links for shimbun or nntp messages + and strip filter conditions depending on customizable variables. + (org-wl-open): Open namazu search folder for message when called + with prefix. + +2010-07-19 Carsten Dominik + + * org.el (org-remove-if, org-remove-if-not): New functions. + (org-open-file): Use internal remove-if functions. + +2010-07-19 Jan Böcker + + * org.el (org-file-apps-entry-match-against-dlink-p): New function. + (org-file-apps-ex): Remove variable. + (org-open-file): Integrate org-file-apps-ex functionality back + into org-file-apps, and decide whether to match a regexp against + the link or the filename using org-file-apps-entry-uses-grouping-p. + +2010-07-19 Jan Böcker + + * org.el (org-file-apps-ex): New variable. + (org-open-file): Before considering org-file-apps, first match the + regexps from org-file-apps-ex against the whole link. See + docstring of org-file-apps-ex. + +2010-07-19 Carsten Dominik + + * org.el (org-export-latex-default-packages-alist): Remove + microtype package. + (org-todo-repeat-to-state): New variable. + (org-auto-repeat-maybe): Allow user-selected target states. + (org-default-properties): Add the new property REPEAT_TO_STATE. + +2010-07-19 Carsten Dominik + + * org-mobile.el (org-mobile-check-setup): Make sure that there is + a binary to compute checksums. + +2010-06-26 Carsten Dominik + + * org-agenda.el (org-agenda-goto-calendar): Do not bind obsolete + variables. + + * org.el (calendar): Require calendar now on top level in org.el + and define aliases to new variables when needed. + (org-read-date, org-goto-calendar): Do not bind obsolete + variables. + +2010-06-22 Glenn Morris + + * org-entities.el: Add explicit utf-8 coding cookie to file with + utf-8 characters. + 2010-05-26 Stefan Monnier * org.el (org-file-complete-link): Avoid (expand-file-name "."). @@ -34,7 +1265,7 @@ * org-entities.el (org-entities-user): Fix typo. - * org.el (org-prepare-agenda-buffers): Uniquify TODO keywords + * org.el (org-prepare-agenda-buffers): Uniquify TODO keywords. * org-entities.el (org-entities-user): Improve docstring. @@ -158,14 +1389,14 @@ (org-emphasis-alist): Change Customize group variable name (org-emphasis-regexp-components): Change Customize group variable name - (org-modules): Remove mention of org-R + (org-modules): Remove mention of org-R. - * org-faces.el (org-faces): Change Customize group variable name + * org-faces.el (org-faces): Change Customize group variable name. 2010-04-10 Carsten Dominik * org-agenda.el (org-diary-last-run-time): New variable. - (org-diary): prepare agenda buffers only if last call was some + (org-diary): Prepare agenda buffers only if last call was some time ago. * org-html.el (org-export-html-preprocess): Replace \ref macros @@ -183,7 +1414,7 @@ 2010-04-10 Dan Davison - * org.el (org-hidden-keywords): New customizable variable. This is + * org.el (org-hidden-keywords): New customizable variable. This is a list of symbols specifying which of the special keywords #+DATE, #+AUTHOR, #+EMAIL and #+TITLE should be hidden by font lock. (org-fontify-meta-lines-and-blocks): Changes to font-lock code @@ -191,7 +1422,8 @@ * org-faces.el (org-document-title): New face for #+TITLE lines (org-document-info): New face for #+DATE, #+AUTHOR, #+EMAIL lines - (org-document-info-keyword): New face for #+DATE, #+AUTHOR, #+EMAIL keywords + (org-document-info-keyword): New face for #+DATE, #+AUTHOR, #+EMAIL + keywords. 2010-04-10 Carsten Dominik @@ -214,7 +1446,7 @@ * org-exp.el (org-export-author-info, org-export-email-info): Fix docstrings. - * org-beamer.el (org-beamer-select-environment): Renamed from + * org-beamer.el (org-beamer-select-environment): Rename from `org-beamer-set-environment-tag'. Improve docstring. * org-freemind.el (org-freemind-write-mm-buffer): Fix another @@ -291,7 +1523,7 @@ * org-src.el (org-edit-src-exit): When returning from code edit buffer, if code block is hidden, leave point at start of - #+begin_src line + #+begin_src line. 2010-04-10 Carsten Dominik @@ -365,18 +1597,18 @@ (org-set-autofill-regexps): Store a backup of `adaptive-fill-regexp'. (org-adaptive-fill-function): Fix filling of comments and ordered - lists. If there is no other match, till try adaptive fill. + lists. If there is no other match, till try adaptive fill. 2010-04-10 John Wiegley - * org-agenda.el (org-agenda-include-deadlines): Added new + * org-agenda.el (org-agenda-include-deadlines): Add new customization variable to determine whether unscheduled tasks should appear in the agenda solely because of their deadline. Default to true, which was the previous behavior (it just wasn't configurable). (org-agenda-mode-map, org-agenda-view-mode-dispatch): Bind ! in the agenda to show/hide deadline tasks. - (org-agenda-menu): Added menu option for show/hide deadlines. + (org-agenda-menu): Add menu option for show/hide deadlines. (org-agenda-list): Make the agenda list sensitive to the value of `org-agenda-include-deadlines'. (org-agenda-toggle-deadlines): New function to toggle the value of @@ -544,9 +1776,9 @@ 2010-04-10 Bastien Guerry - * org-timer.el (org-timer-current-timer): Renamed from + * org-timer.el (org-timer-current-timer): Rename from `org-timer-last-timer'. - (org-timer-timer1, org-timer-timer2, org-timer-timer3): Removed. + (org-timer-timer1, org-timer-timer2, org-timer-timer3): Remove. (org-timer-cancel-timer, org-timer-show-remaining-time) (org-timer-set-timer): Update to use only one timer. @@ -666,7 +1898,7 @@ 2010-04-10 Dan Davison - * org-src.el (org-edit-src-exit): Widen before exiting edit buffers + * org-src.el (org-edit-src-exit): Widen before exiting edit buffers. 2010-04-10 Carsten Dominik @@ -725,7 +1957,7 @@ * org-mac-message.el (org-mac-message-insert-flagged): Call `org-insert-heading' with the INVISIBLE-OK argument. - * org.el (org-insert-heading): New argument INVISIBLE-OK. + * org.el (org-insert-heading): New argument INVISIBLE-OK. * org-agenda.el (org-agenda-view-mode-dispatch): Improve the prompt message. @@ -753,8 +1985,8 @@ 2010-04-10 Mikael Fornius * org.el (org-assign-fast-keys): Prefer keys used in keyword name - when assigning. Begin using numerical characters when all in name - is used up. This is to spare alphanumeric characters for better + when assigning. Begin using numerical characters when all in name + is used up. This is to spare alphanumeric characters for better match with other keywords. 2010-04-10 Carsten Dominik @@ -806,7 +2038,7 @@ * org-agenda.el (org-agenda-diary-entry-in-org-file): Make sure org-datetree.el is loaded. - * org-datetree.el: autoload `org-datetree-find-day-create' + * org-datetree.el: Autoload `org-datetree-find-day-create'. * org-latex.el (org-export-latex-hyperref-format): New option. (org-export-latex-links): Use `org-export-latex-hyperref-format'. @@ -1138,12 +2370,12 @@ * org-colview-xemacs.el (org-columns-edit-value): Use org-unrestricted property. - * org-colview.el (org-columns-edit-value): Use + * org-colview.el (org-columns-edit-value): Use org-unrestricted property. * org.el (org-compute-property-at-point): Set org-unrestricted text property if the list contains ":ETC". - (org-insert-property-drawer): Use + (org-insert-property-drawer): Use org-unrestricted property. * org-exp.el @@ -1652,16 +2884,15 @@ 2009-11-13 Dan Davison - * org-exp.el (org-export-format-source-code-or-example): restrict + * org-exp.el (org-export-format-source-code-or-example): Restrict scope of preserve-indentp to the let binding. - (org-src): require org-src, since org-src-preserve-indentation is used. + (org-src): Require org-src, since org-src-preserve-indentation is used. 2009-11-13 Carsten Dominik * org-timer.el (org-timer-set-timer): Set variables org-timer-timer[123] correctly. - * org-mobile.el (org-mobile-files-alist): Make it work when `agenda-archives' is included in `org-agenda-text-search-extra-files'. @@ -1724,7 +2955,7 @@ 2009-11-13 James TD Smith - * org-colview-xemacs.el: Add in changes from org-colview.el + * org-colview-xemacs.el: Add in changes from org-colview.el. 2009-11-13 Dan Davison @@ -1931,7 +3162,7 @@ called with either `org-scheduled-string' or `org-deadline-string'. - * org-clock.el (org-clock-auto-clock-resolution): Renamed + * org-clock.el (org-clock-auto-clock-resolution): Rename from `org-clock-disable-clock-resolution', since negatives don't sound good in customization variables. (org-clock-in): Don't use the auto-resolution logic if the user is @@ -1973,14 +3204,14 @@ more general. (org-habit-parse-todo): Parse the new ".+N/N" style repeater. - * org-agenda.el (org-agenda-get-deadlines): Removed all mention of + * org-agenda.el (org-agenda-get-deadlines): Remove all mention of habits, since they don't use DEADLINE anymore. * org.el (org-repeat-re, org-display-custom-time) - (org-timestamp-change): Extended to support the new ".+N/N" + (org-timestamp-change): Extend to support the new ".+N/N" syntax, used for habits. - * org-clock.el (org-clock-resolve-clock): Fixed an incorrect + * org-clock.el (org-clock-resolve-clock): Fix an incorrect variable reference. * org-agenda.el (org-agenda-set-mode-name): Show Habit in the @@ -2014,7 +3245,7 @@ * org.el (org-file-tags): Fix docstring. (org-get-buffer-tags): Add the #+FILETAGS tags. - ("ecb"): Maks ecb show context after jumping into an Org file. + ("ecb"): Make ecb show context after jumping into an Org file. 2009-11-13 John Wiegley @@ -2045,11 +3276,11 @@ (org-agenda-get-scheduled): Display consistency graphs when outputting habits into the agenda. The graphs are always relative to the current time. - (org-format-agenda-item): Added new parameter `habitp', which + (org-format-agenda-item): Add new parameter `habitp', which indicates whether we are formatting a habit or not. Do not display "extra" leading information if habitp is true. - * org.el (org-repeat-re): Improved regexp to include .+ and ++ + * org.el (org-repeat-re): Improve regexp to include .+ and ++ leaders for repeat strings. (org-get-repeat): Now takes a string parameter `tagline', so the caller can obtain the SCHEDULED repeat, or the DEADLINE repeat. @@ -2067,7 +3298,7 @@ * org.el (org-files-list): Don't attempt to return a file name for Org buffers which have no associated file. - * org-agenda.el (org-agenda-do-action): Fixed a typo. + * org-agenda.el (org-agenda-do-action): Fix a typo. 2009-11-13 Carsten Dominik @@ -2089,7 +3320,7 @@ * org-clock.el (org-clock-resolve, org-resolve-clocks) (org-emacs-idle-seconds): Use `org-float-time' instead of - `time-to-seconds' + `time-to-seconds'. 2009-11-13 Carsten Dominik @@ -2258,7 +3489,7 @@ * org-exp.el (org-export-select-backend-specific-text): Remove the region markers. - * org-inlinetask.el (org-inlinetask-export-handler): fix bug for + * org-inlinetask.el (org-inlinetask-export-handler): Fix bug for tasks without content. * org-clock.el: Make sure the clock-in target position does not @@ -2547,7 +3778,7 @@ 2009-10-01 Bastien Guerry - * org.el (org-check-agenda-file): Use a more explicit message + * org.el (org-check-agenda-file): Use a more explicit message. 2009-10-01 Carsten Dominik @@ -3075,7 +4306,7 @@ * org-faces.el (org-agenda-clocking): New face. * org-agenda.el (org-agenda-mark-clocking-task): New function. - (org-finalize-agenda): call `org-agenda-mark-clocking-task'. + (org-finalize-agenda): Call `org-agenda-mark-clocking-task'. * org.el (org-modules): Add org-track.el. @@ -4044,7 +5275,7 @@ 2009-08-06 Carsten Dominik - * org-icalendar.el (org-icalendar-include-todo): New allowedvalue + * org-icalendar.el (org-icalendar-include-todo): New allowed value `unblocked'. (org-print-icalendar-entries): Respect the new value of `org-icalendar-include-todo'. @@ -4475,7 +5706,7 @@ * org.el (org-emphasis-regexp-components): Allow braces in emphasis pre and post match. - * org-footnote.el (org-footnote-normalize): When only dorting, do + * org-footnote.el (org-footnote-normalize): When only sorting, do not insert inline notes at the end. * org.el (org-require-autoloaded-modules): Add org-docbook.el. @@ -4909,9 +6140,9 @@ (org-export-latex-fontify): Catch error when org-emph-alist has entries that are not defined for LaTeX export. - * org-export-latex.el: renamed to org-latex.el. + * org-export-latex.el: Rename to org-latex.el. - * org-latex.el: renamed from org-export-latex.el. + * org-latex.el: Rename from org-export-latex.el. * org.el (orgstruct++-mode): New function. (turn-on-orgstruct++): Call `orgstruct++-mode'. @@ -5994,7 +7225,7 @@ * org-list.el (org-list-two-spaces-after-bullet-regexp): New option. - (org-fix-bullet-type): respect + (org-fix-bullet-type): Respect `org-list-two-spaces-after-bullet-regexp'. * org-clock.el (org-clock-load): Clean up the code. @@ -6371,7 +7602,7 @@ * org-agenda.el (org-agenda-remove-marked-text): New function. (org-agenda-mark-filtered-text) (org-agenda-unmark-filtered-text): New functions. - (org-write-agenda): Remove fltered text. + (org-write-agenda): Remove filtered text. * org.el (org-make-tags-matcher): Give access to TODO "property" without speed penalty. @@ -6468,7 +7699,7 @@ * org.el (org-insert-heading-respect-content): Force heading creation. - (org-insert-heading): keep the folding state of the heading before + (org-insert-heading): Keep the folding state of the heading before the inserted one. 2008-10-26 Carsten Dominik @@ -6751,7 +7982,7 @@ * org.el (org-add-log-setup): Skip over drawers (properties, clocks etc) when adding notes. - * org-agenda.el (org-agenda-get-closed): show durations of clocked + * org-agenda.el (org-agenda-get-closed): Show durations of clocked items as well as the start and end times. * org-compat.el (org-get-x-clipboard-compat): Add a compat @@ -6777,7 +8008,7 @@ 2008-10-12 Bastien Guerry - * org-export-latex.el (org-export-latex-tables): protect exported + * org-export-latex.el (org-export-latex-tables): Protect exported tables from further special chars conversion. (org-export-latex-preprocess): Preserve LaTeX environments. (org-list-parse-list): Parse descriptive lists. diff --git a/lisp/org/ob-C.el b/lisp/org/ob-C.el new file mode 100644 index 00000000000..086079f9082 --- /dev/null +++ b/lisp/org/ob-C.el @@ -0,0 +1,198 @@ +;;; ob-C.el --- org-babel functions for C and similar languages + +;; Copyright (C) 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating C code. +;; +;; very limited implementation: +;; - currently only support :results output +;; - not much in the way of error feedback + +;;; Code: +(require 'ob) +(require 'ob-eval) +(require 'org) +(require 'cc-mode) + +(declare-function org-entry-get "org" + (pom property &optional inherit literal-nil)) + +(add-to-list 'org-babel-tangle-lang-exts '("c++" . "cpp")) + +(defvar org-babel-default-header-args:C '()) + +(defvar org-babel-C-compiler "gcc" + "Command used to compile a C source code file into an + executable.") + +(defvar org-babel-c++-compiler "g++" + "Command used to compile a c++ source code file into an + executable.") + +(defvar org-babel-c-variant nil + "Internal variable used to hold which type of C (e.g. C or C++) +is currently being evaluated.") + +(defun org-babel-execute:cpp (body params) + "Execute BODY according to PARAMS. This function calls +`org-babel-execute:C'." + (org-babel-execute:C body params)) + +(defun org-babel-execute:c++ (body params) + "Execute a block of C++ code with org-babel. This function is +called by `org-babel-execute-src-block'." + (let ((org-babel-c-variant 'cpp)) (org-babel-C-execute body params))) + +(defun org-babel-expand-body:c++ (body params &optional processed-params) + "Expand a block of C++ code with org-babel according to it's +header arguments (calls `org-babel-C-expand')." + (let ((org-babel-c-variant 'cpp)) (org-babel-C-expand body params processed-params))) + +(defun org-babel-execute:C (body params) + "Execute a block of C code with org-babel. This function is +called by `org-babel-execute-src-block'." + (let ((org-babel-c-variant 'c)) (org-babel-C-execute body params))) + +(defun org-babel-expand-body:c (body params &optional processed-params) + "Expand a block of C code with org-babel according to it's +header arguments (calls `org-babel-C-expand')." + (let ((org-babel-c-variant 'c)) (org-babel-C-expand body params processed-params))) + +(defun org-babel-C-execute (body params) + "This function should only be called by `org-babel-execute:C' +or `org-babel-execute:c++'." + (let* ((processed-params (org-babel-process-params params)) + (tmp-src-file (make-temp-file "org-babel-C-src" nil + (cond + ((equal org-babel-c-variant 'c) ".c") + ((equal org-babel-c-variant 'cpp) ".cpp")))) + (tmp-bin-file (make-temp-file "org-babel-C-bin")) + (tmp-out-file (make-temp-file "org-babel-C-out")) + (cmdline (cdr (assoc :cmdline params))) + (flags (cdr (assoc :flags params))) + (full-body (org-babel-C-expand body params)) + (compile + (progn + (with-temp-file tmp-src-file (insert full-body)) + (org-babel-eval + (format "%s -o %s %s %s" + (cond + ((equal org-babel-c-variant 'c) org-babel-C-compiler) + ((equal org-babel-c-variant 'cpp) org-babel-c++-compiler)) + tmp-bin-file + (mapconcat 'identity + (if (listp flags) flags (list flags)) " ") + tmp-src-file) "")))) + ((lambda (results) + (org-babel-reassemble-table + (if (member "vector" (nth 2 processed-params)) + (let ((tmp-file (make-temp-file "ob-c"))) + (with-temp-file tmp-file (insert results)) + (org-babel-import-elisp-from-file tmp-file)) + (org-babel-read results)) + (org-babel-pick-name + (nth 4 processed-params) (cdr (assoc :colnames params))) + (org-babel-pick-name + (nth 5 processed-params) (cdr (assoc :rownames params))))) + (org-babel-trim + (org-babel-eval + (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) ""))))) + +(defun org-babel-C-expand (body params &optional processed-params) + "Expand a block of C or C++ code with org-babel according to +it's header arguments." + (let ((vars (nth 1 (or processed-params + (org-babel-process-params params)))) + (main-p (not (string= (cdr (assoc :main params)) "no"))) + (includes (or (cdr (assoc :includes params)) + (org-babel-read (org-entry-get nil "includes" t)))) + (defines (org-babel-read + (or (cdr (assoc :defines params)) + (org-babel-read (org-entry-get nil "defines" t)))))) + (org-babel-trim + (mapconcat 'identity + (list + ;; includes + (mapconcat + (lambda (inc) (format "#include %s" inc)) + (if (listp includes) includes (list includes)) "\n") + ;; defines + (mapconcat + (lambda (inc) (format "#define %s" inc)) + (if (listp defines) defines (list defines)) "\n") + ;; variables + (mapconcat 'org-babel-C-var-to-C vars "\n") + ;; body + (if main-p + (org-babel-C-ensure-main-wrap body) + body) "\n") "\n")))) + +(defun org-babel-C-ensure-main-wrap (body) + "Wrap body in a \"main\" function call if none exists." + (if (string-match "^[ \t]*[intvod]+[ \t]*main[ \t]*(.*)" body) + body + (format "int main() {\n%s\n}\n" body))) + +(defun org-babel-prep-session:C (session params) + "This function does nothing as C is a compiled language with no +support for sessions" + (error "C is a compiled languages -- no support for sessions")) + +(defun org-babel-load-session:C (session body params) + "This function does nothing as C is a compiled language with no +support for sessions" + (error "C is a compiled languages -- no support for sessions")) + +;; helper functions + +(defun org-babel-C-var-to-C (pair) + "Convert an elisp val into a string of C code specifying a var +of the same value." + ;; TODO list support + (let ((var (car pair)) + (val (cdr pair))) + (when (symbolp val) + (setq val (symbol-name val)) + (when (= (length val) 1) + (setq val (string-to-char val)))) + (cond + ((integerp val) + (format "int %S = %S;" var val)) + ((floatp val) + (format "double %S = %S;" var val)) + ((or (characterp val)) + (format "char %S = '%S';" var val)) + ((stringp val) + (format "char %S[%d] = \"%s\";" + var (+ 1 (length val)) val)) + (t + (format "u32 %S = %S;" var val))))) + + +(provide 'ob-C) + +;; arch-tag: 8f49e462-54e3-417b-9a8d-423864893b37 + +;;; ob-C.el ends here diff --git a/lisp/org/ob-R.el b/lisp/org/ob-R.el new file mode 100644 index 00000000000..105862c1571 --- /dev/null +++ b/lisp/org/ob-R.el @@ -0,0 +1,279 @@ +;;; ob-R.el --- org-babel functions for R code evaluation + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte, Dan Davison +;; Keywords: literate programming, reproducible research, R, statistics +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating R code + +;;; Code: +(require 'ob) +(require 'ob-ref) +(require 'ob-comint) +(require 'ob-eval) +(eval-when-compile (require 'cl)) + +(declare-function orgtbl-to-tsv "ob-table" (table params)) +(declare-function R "ext:essd-r" (&optional start-args)) +(declare-function inferior-ess-send-input "ext:ess-inf" ()) + +(defconst org-babel-header-arg-names:R + '(width height bg units pointsize antialias quality compression + res type family title fonts version paper encoding + pagecentre colormodel useDingbats horizontal) + "R-specific header arguments.") + +(defvar org-babel-default-header-args:R '()) + +(defvar org-babel-R-command "R --slave --no-save" + "Name of command to use for executing R code.") + +(defun org-babel-expand-body:R (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (let* ((processed-params (or processed-params + (org-babel-process-params params))) + (vars (mapcar + (lambda (i) + (cons (car (nth i (nth 1 processed-params))) + (org-babel-reassemble-table + (cdr (nth i (nth 1 processed-params))) + (cdr (nth i (nth 4 processed-params))) + (cdr (nth i (nth 5 processed-params)))))) + (number-sequence 0 (1- (length (nth 1 processed-params)))))) + (out-file (cdr (assoc :file params)))) + (mapconcat ;; define any variables + #'org-babel-trim + ((lambda (inside) + (if out-file + (append + (list (org-babel-R-construct-graphics-device-call out-file params)) + inside + (list "dev.off()")) + inside)) + (append + (mapcar + (lambda (pair) + (org-babel-R-assign-elisp + (car pair) (cdr pair) + (equal "yes" (cdr (assoc :colnames params))) + (equal "yes" (cdr (assoc :rownames params))))) + vars) + (list body))) "\n"))) + +(defun org-babel-execute:R (body params) + "Execute a block of R code. +This function is called by `org-babel-execute-src-block'." + (save-excursion + (let* ((processed-params (org-babel-process-params params)) + (result-type (nth 3 processed-params)) + (session (org-babel-R-initiate-session + (first processed-params) params)) + (colnames-p (cdr (assoc :colnames params))) + (rownames-p (cdr (assoc :rownames params))) + (out-file (cdr (assoc :file params))) + (full-body (org-babel-expand-body:R body params processed-params)) + (result + (org-babel-R-evaluate + session full-body result-type + (or (equal "yes" colnames-p) + (org-babel-pick-name (nth 4 processed-params) colnames-p)) + (or (equal "yes" rownames-p) + (org-babel-pick-name (nth 5 processed-params) rownames-p))))) + (message "result is %S" result) + (or out-file result)))) + +(defun org-babel-prep-session:R (session params) + "Prepare SESSION according to the header arguments specified in PARAMS." + (let* ((session (org-babel-R-initiate-session session params)) + (vars (org-babel-ref-variables params)) + (var-lines + (mapcar + (lambda (pair) (org-babel-R-assign-elisp + (car pair) (cdr pair) + (equal (cdr (assoc :colnames params)) "yes") + (equal (cdr (assoc :rownames params)) "yes"))) + vars))) + (org-babel-comint-in-buffer session + (mapc (lambda (var) + (end-of-line 1) (insert var) (comint-send-input nil t) + (org-babel-comint-wait-for-output session)) var-lines)) + session)) + +(defun org-babel-load-session:R (session body params) + "Load BODY into SESSION." + (save-window-excursion + (let ((buffer (org-babel-prep-session:R session params))) + (with-current-buffer buffer + (goto-char (process-mark (get-buffer-process (current-buffer)))) + (insert (org-babel-chomp body))) + buffer))) + +;; helper functions + +(defun org-babel-R-quote-tsv-field (s) + "Quote field S for export to R." + (if (stringp s) + (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\"") + (format "%S" s))) + +(defun org-babel-R-assign-elisp (name value colnames-p rownames-p) + "Construct R code assigning the elisp VALUE to a variable named NAME." + (if (listp value) + (let ((transition-file (make-temp-file "org-babel-R-import"))) + ;; ensure VALUE has an orgtbl structure (depth of at least 2) + (unless (listp (car value)) (setq value (list value))) + (with-temp-file (org-babel-maybe-remote-file transition-file) + (insert (orgtbl-to-tsv value '(:fmt org-babel-R-quote-tsv-field))) + (insert "\n")) + (format "%s <- read.table(\"%s\", header=%s, row.names=%s, sep=\"\\t\", as.is=TRUE)" + name transition-file + (if (or (eq (nth 1 value) 'hline) colnames-p) "TRUE" "FALSE") + (if rownames-p "1" "NULL"))) + (format "%s <- %s" name (org-babel-R-quote-tsv-field value)))) + +(defun org-babel-R-initiate-session (session params) + "If there is not a current R process then create one." + (unless (string= session "none") + (let ((session (or session "*R*")) + (ess-ask-for-ess-directory (not (cdr (assoc :dir params))))) + (if (org-babel-comint-buffer-livep session) + session + (save-window-excursion + (require 'ess) (R) + (rename-buffer + (if (bufferp session) + (buffer-name session) + (if (stringp session) + session + (buffer-name)))) + (current-buffer)))))) + +(defun org-babel-R-construct-graphics-device-call (out-file params) + "Construct the call to the graphics device." + (let ((devices + '((:bmp . "bmp") + (:jpg . "jpeg") + (:jpeg . "jpeg") + (:tiff . "tiff") + (:png . "png") + (:svg . "svg") + (:pdf . "pdf") + (:ps . "postscript") + (:postscript . "postscript"))) + (allowed-args '(:width :height :bg :units :pointsize + :antialias :quality :compression :res + :type :family :title :fonts :version + :paper :encoding :pagecentre :colormodel + :useDingbats :horizontal)) + (device (and (string-match ".+\\.\\([^.]+\\)" out-file) + (match-string 1 out-file))) + (extra-args (cdr (assq :R-dev-args params))) filearg args) + (setq device (or (and device (cdr (assq (intern (concat ":" device)) + devices))) "png")) + (setq filearg + (if (member device '("pdf" "postscript" "svg")) "file" "filename")) + (setq args (mapconcat + (lambda (pair) + (if (member (car pair) allowed-args) + (format ",%s=%s" + (substring (symbol-name (car pair)) 1) + (cdr pair)) "")) + params "")) + (format "%s(%s=\"%s\"%s%s%s)" + device filearg out-file args + (if extra-args "," "") (or extra-args "")))) + +(defvar org-babel-R-eoe-indicator "'org_babel_R_eoe'") +(defvar org-babel-R-eoe-output "[1] \"org_babel_R_eoe\"") +(defvar org-babel-R-wrapper-method "main <- function ()\n{\n%s\n} +write.table(main(), file=\"%s\", sep=\"\\t\", na=\"nil\",row.names=%s, col.names=%s, quote=FALSE)") +(defvar org-babel-R-wrapper-lastvar "write.table(.Last.value, file=\"%s\", sep=\"\\t\", na=\"nil\",row.names=%s, col.names=%s, quote=FALSE)") + +(defun org-babel-R-evaluate + (session body result-type column-names-p row-names-p) + "Pass BODY to the R process in SESSION. +If RESULT-TYPE equals 'output then return a list of the outputs +of the statements in BODY, if RESULT-TYPE equals 'value then +return the value of the last statement in BODY, as elisp." + (if (not session) + ;; external process evaluation + (case result-type + (output (org-babel-eval org-babel-R-command body)) + (value + (let ((tmp-file (make-temp-file "org-babel-R-results-"))) + (org-babel-eval org-babel-R-command + (format org-babel-R-wrapper-method + body tmp-file + (if row-names-p "TRUE" "FALSE") + (if column-names-p + (if row-names-p "NA" "TRUE") + "FALSE"))) + (org-babel-R-process-value-result + (org-babel-import-elisp-from-file + (org-babel-maybe-remote-file tmp-file)) column-names-p)))) + ;; comint session evaluation + (case result-type + (value + (let ((tmp-file (make-temp-file "org-babel-R")) + broke) + (org-babel-comint-with-output (session org-babel-R-eoe-output) + (insert (mapconcat + #'org-babel-chomp + (list + body + (format org-babel-R-wrapper-lastvar + tmp-file + (if row-names-p "TRUE" "FALSE") + (if column-names-p + (if row-names-p "NA" "TRUE") + "FALSE")) + org-babel-R-eoe-indicator) "\n")) + (inferior-ess-send-input)) + (org-babel-R-process-value-result + (org-babel-import-elisp-from-file + (org-babel-maybe-remote-file tmp-file)) column-names-p))) + (output + (mapconcat + #'org-babel-chomp + (butlast + (delq nil + (mapcar + #'identity + (org-babel-comint-with-output (session org-babel-R-eoe-output) + (insert (mapconcat #'org-babel-chomp + (list body org-babel-R-eoe-indicator) + "\n")) + (inferior-ess-send-input)))) 2) "\n"))))) + +(defun org-babel-R-process-value-result (result column-names-p) + "R-specific processing of return value. +Insert hline if column names in output have been requested." + (if column-names-p + (cons (car result) (cons 'hline (cdr result))) + result)) + +(provide 'ob-R) + +;; arch-tag: cd4c7298-503b-450f-a3c2-f3e74b630237 + +;;; ob-R.el ends here diff --git a/lisp/org/ob-asymptote.el b/lisp/org/ob-asymptote.el new file mode 100644 index 00000000000..043bc4c5ff7 --- /dev/null +++ b/lisp/org/ob-asymptote.el @@ -0,0 +1,161 @@ +;;; ob-asymptote.el --- org-babel functions for asymptote evaluation + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating asymptote source code. +;; +;; This differs from most standard languages in that +;; +;; 1) there is no such thing as a "session" in asymptote +;; +;; 2) we are generally only going to return results of type "file" +;; +;; 3) we are adding the "file" and "cmdline" header arguments, if file +;; is omitted then the -V option is passed to the asy command for +;; interactive viewing + +;;; Requirements: + +;; - The asymptote program :: http://asymptote.sourceforge.net/ +;; +;; - asy-mode :: Major mode for editing asymptote files + +;;; Code: +(require 'ob) +(eval-when-compile (require 'cl)) + +(declare-function orgtbl-to-generic "org-table" (table params)) +(declare-function org-combine-plists "org" (&rest plists)) + +(add-to-list 'org-babel-tangle-lang-exts '("asymptote" . "asy")) + +(defvar org-babel-default-header-args:asymptote + '((:results . "file") (:exports . "results")) + "Default arguments when evaluating an Asymptote source block.") + +(defun org-babel-expand-body:asymptote (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (let ((vars (nth 1 (or processed-params + (org-babel-process-params params))))) + (concat (mapconcat 'org-babel-asymptote-var-to-asymptote vars "\n") + "\n" body "\n"))) + +(defun org-babel-execute:asymptote (body params) + "Execute a block of Asymptote code. +This function is called by `org-babel-execute-src-block'." + (let* ((processed-params (org-babel-process-params params)) + (result-params (split-string (or (cdr (assoc :results params)) ""))) + (out-file (cdr (assoc :file params))) + (format (or (and out-file + (string-match ".+\\.\\(.+\\)" out-file) + (match-string 1 out-file)) + "pdf")) + (cmdline (cdr (assoc :cmdline params))) + (in-file (make-temp-file "org-babel-asymptote")) + (cmd (concat "asy " + (if out-file + (concat "-globalwrite -f " format " -o " out-file) + "-V") + " " cmdline " " in-file))) + (with-temp-file in-file + (insert (org-babel-expand-body:asymptote body params processed-params))) + (message cmd) (shell-command cmd) + out-file)) + +(defun org-babel-prep-session:asymptote (session params) + "Return an error if the :session header argument is set. +Asymptote does not support sessions" + (error "Asymptote does not support sessions")) + +(defun org-babel-asymptote-var-to-asymptote (pair) + "Convert an elisp value into an Asymptote variable. +The elisp value PAIR is converted into Asymptote code specifying +a variable of the same value." + (let ((var (car pair)) + (val (if (symbolp (cdr pair)) + (symbol-name (cdr pair)) + (cdr pair)))) + (cond + ((integerp val) + (format "int %S=%S;" var val)) + ((floatp val) + (format "real %S=%S;" var val)) + ((stringp val) + (format "string %S=\"%s\";" var val)) + ((listp val) + (let* ((dimension-2-p (not (null (cdr val)))) + (dim (if dimension-2-p "[][]" "[]")) + (type (org-babel-asymptote-define-type val)) + (array (org-babel-asymptote-table-to-array + val + (if dimension-2-p '(:lstart "{" :lend "}," :llend "}"))))) + (format "%S%s %S=%s;" type dim var array)))))) + +(defun org-babel-asymptote-table-to-array (table params) + "Convert values of an elisp table into a string of an asymptote array. +Empty cells are ignored." + (labels ((atom-to-string (table) + (cond + ((null table) '()) + ((not (listp (car table))) + (cons (if (and (stringp (car table)) + (not (string= (car table) ""))) + (format "\"%s\"" (car table)) + (format "%s" (car table))) + (atom-to-string (cdr table)))) + (t + (cons (atom-to-string (car table)) + (atom-to-string (cdr table)))))) + ;; Remove any empty row + (fix-empty-lines (table) + (delq nil (mapcar (lambda (l) (delq "" l)) table)))) + (orgtbl-to-generic + (fix-empty-lines (atom-to-string table)) + (org-combine-plists '(:hline nil :sep "," :tstart "{" :tend "}") params)))) + +(defun org-babel-asymptote-define-type (data) + "Determine type of DATA. +DATA is a list. Type symbol is returned as 'symbol. The type is +usually the type of the first atom encountered, except for arrays +of int, where every cell must be of int type." + (labels ((anything-but-int (el) + (cond + ((null el) nil) + ((not (listp (car el))) + (cond + ((floatp (car el)) 'real) + ((stringp (car el)) 'string) + (t + (anything-but-int (cdr el))))) + (t + (or (anything-but-int (car el)) + (anything-but-int (cdr el))))))) + (or (anything-but-int data) 'int))) + +(provide 'ob-asymptote) + +;; arch-tag: f2f5bd0d-78e8-412b-8e6c-6dadc94cc06b + +;;; ob-asymptote.el ends here diff --git a/lisp/org/ob-clojure.el b/lisp/org/ob-clojure.el new file mode 100644 index 00000000000..c42d9b4db38 --- /dev/null +++ b/lisp/org/ob-clojure.el @@ -0,0 +1,316 @@ +;;; ob-clojure.el --- org-babel functions for clojure evaluation + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Joel Boehland +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;;; ob support for evaluating clojure code + +;;; Requirements: + +;;; A working clojure install. This also implies a working java executable +;;; clojure-mode +;;; slime +;;; swank-clojure + +;;; By far, the best way to install these components is by following +;;; the directions as set out by Phil Hagelberg (Technomancy) on the +;;; web page: http://technomancy.us/126 + +;;; Code: +(require 'ob) +(require 'ob-eval) +(eval-when-compile (require 'cl)) + +(declare-function slime-eval-async "ext:slime" (sexp &optional cont package)) +(declare-function slime-eval "ext:slime" (sexp &optional package)) +(declare-function swank-clojure-concat-paths "ext:slime" (paths)) +(declare-function org-babel-ref-variables "ext:slime" (params)) +(declare-function slime "ext:slime" (&optional command coding-system)) +(declare-function slime-output-buffer "ext:slime" (&optional noprompt)) +(declare-function slime-filter-buffers "ext:slime" (predicate)) + +(add-to-list 'org-babel-tangle-lang-exts '("clojure" . "clj")) + +(defvar org-babel-default-header-args:clojure '()) + +(defvar org-babel-clojure-wrapper-method + " +(defn spit + [f content] + (with-open [#^java.io.PrintWriter w + (java.io.PrintWriter. + (java.io.BufferedWriter. + (java.io.OutputStreamWriter. + (java.io.FileOutputStream. + (java.io.File. f)))))] + (.print w content))) + +(defn main + [] + %s) + +(spit \"%s\" (str (main)))") +;;";; <-- syntax highlighting is messed without this double quote + +;;taken mostly from clojure-test-mode.el +(defun org-babel-clojure-clojure-slime-eval (string &optional handler) + "Evaluate a STRING of clojure code using `slime-eval-async'." + (slime-eval-async `(swank:eval-and-grab-output ,string) + (or handler #'identity))) + +(defun org-babel-clojure-slime-eval-sync (string) + "Evaluate a STRING of clojure code using `slime-eval'." + (slime-eval `(swank:eval-and-grab-output ,string))) + +;;taken from swank-clojure.el +(defvar swank-clojure-binary) +(defvar swank-clojure-classpath) +(defvar swank-clojure-java-path) +(defvar swank-clojure-extra-vm-args) +(defvar swank-clojure-library-paths) +(defvar swank-clojure-extra-classpaths) +(defun org-babel-clojure-babel-clojure-cmd () + "Create the command to start clojure according to current settings." + (if (and (not swank-clojure-binary) (not swank-clojure-classpath)) + (error "%s" (concat "You must specifiy either a `swank-clojure-binary' " + "or a `swank-clojure-jar-path'")) + (if swank-clojure-binary + (if (listp swank-clojure-binary) + swank-clojure-binary + (list swank-clojure-binary)) + (delq + nil + (append + (list swank-clojure-java-path) + swank-clojure-extra-vm-args + (list + (when swank-clojure-library-paths + (concat "-Djava.library.path=" + (swank-clojure-concat-paths swank-clojure-library-paths))) + "-classpath" + (swank-clojure-concat-paths + (append + swank-clojure-classpath + swank-clojure-extra-classpaths)) + "clojure.main")))))) + +(defun org-babel-clojure-table-or-string (results) + "Convert RESULTS to an elisp value. +If RESULTS looks like a table, then convert to an Emacs-lisp +table, otherwise return the results as a string." + (org-babel-read + (if (string-match "^\\[.+\\]$" results) + (org-babel-read + (concat "'" + (replace-regexp-in-string + "\\[" "(" (replace-regexp-in-string + "\\]" ")" (replace-regexp-in-string + ", " " " (replace-regexp-in-string + "'" "\"" results)))))) + results))) + +(defun org-babel-clojure-var-to-clojure (var) + "Convert an elisp value into a clojure variable. +The elisp value VAR is converted into a string of clojure source +code specifying a variable of the same value." + (if (listp var) + (format "'%s" var) + (format "%S" var))) + +(defun org-babel-clojure-build-full-form (body vars) + "Construct a clojure let form with VARS as the let variables." + (let ((vars-forms + (mapconcat ;; define any variables + (lambda (pair) + (format "%s %s" + (car pair) (org-babel-clojure-var-to-clojure (cdr pair)))) + vars "\n ")) + (body (org-babel-trim body))) + (if (> (length vars-forms) 0) + (format "(let [%s]\n %s)" vars-forms body) + body))) + +(defun org-babel-prep-session:clojure (session params) + "Prepare SESSION according to the header arguments specified in PARAMS." + (require 'slime) (require 'swank-clojure) + (let* ((session-buf (org-babel-clojure-initiate-session session)) + (vars (org-babel-ref-variables params)) + (var-lines (mapcar ;; define any top level session variables + (lambda (pair) + (format "(def %s %s)\n" (car pair) + (org-babel-clojure-var-to-clojure (cdr pair)))) + vars))) + session-buf)) + +(defun org-babel-load-session:clojure (session body params) + "Load BODY into SESSION." + (require 'slime) (require 'swank-clojure) + (save-window-excursion + (let ((buffer (org-babel-prep-session:clojure session params))) + (with-current-buffer buffer + (goto-char (point-max)) + (insert (org-babel-chomp body))) + buffer))) + +(defvar org-babel-clojure-buffers '()) +(defvar org-babel-clojure-pending-sessions '()) + +(defun org-babel-clojure-session-buffer (session) + "Return the buffer associated with SESSION." + (cdr (assoc session org-babel-clojure-buffers))) + +(defun org-babel-clojure-initiate-session-by-key (&optional session) + "Initiate a clojure session in an inferior-process-buffer. +If there is not a current inferior-process-buffer in SESSION +then create one. Return the initialized session." + (save-window-excursion + (let* ((session (if session + (if (stringp session) (intern session) + session) + :default)) + (clojure-buffer (org-babel-clojure-session-buffer session))) + (unless (and clojure-buffer (buffer-live-p clojure-buffer)) + (setq org-babel-clojure-buffers + (assq-delete-all session org-babel-clojure-buffers)) + (push session org-babel-clojure-pending-sessions) + (slime) + ;; we are waiting to finish setting up which will be done in + ;; org-babel-clojure-session-connected-hook below. + (let ((timeout 9)) + (while (and (not (org-babel-clojure-session-buffer session)) + (< 0 timeout)) + (message "Waiting for clojure repl for session: %s ... %i" + session timeout) + (sit-for 1) + (decf timeout))) + (setq org-babel-clojure-pending-sessions + (remove session org-babel-clojure-pending-sessions)) + (unless (org-babel-clojure-session-buffer session) + (error "Couldn't create slime clojure process")) + (setq clojure-buffer (org-babel-clojure-session-buffer session))) + session))) + +(defun org-babel-clojure-initiate-session (&optional session params) + "Return the slime-clojure repl buffer bound to SESSION. +Returns nil if \"none\" is specified." + (require 'slime) (require 'swank-clojure) + (unless (and (stringp session) (string= session "none")) + (org-babel-clojure-session-buffer + (org-babel-clojure-initiate-session-by-key session)))) + +(defun org-babel-clojure-session-connected-hook () + "Finish binding an org-babel session to a slime-clojure repl." + (let ((pending-session (pop org-babel-clojure-pending-sessions))) + (when pending-session + (save-excursion + (switch-to-buffer (slime-output-buffer)) + (rename-buffer + (if (stringp pending-session) + pending-session (symbol-name pending-session))) + (org-babel-clojure-bind-session-to-repl-buffer + pending-session (slime-output-buffer)))))) + +(add-hook 'slime-connected-hook 'org-babel-clojure-session-connected-hook) + +(defun org-babel-clojure-bind-session-to-repl-buffer (session repl-buffer) + "Associate SESSION with REPL-BUFFER." + (when (stringp session) (setq session (intern session))) + (setq org-babel-clojure-buffers + (cons (cons session repl-buffer) + (assq-delete-all session org-babel-clojure-buffers)))) + +(defun org-babel-clojure-repl-buffer-pred () + "Test whether the current buffer is an active slime-clojure +repl buffer." + (and (buffer-live-p (current-buffer)) (eq major-mode 'slime-repl-mode))) + +(defun org-babel-clojure-bind-session-to-repl (session) + "Bind SESSION to a clojure repl." + (interactive "sEnter session name: ") + (let ((repl-bufs (slime-filter-buffers 'org-babel-clojure-repl-buffer-pred))) + (unless repl-bufs (error "No existing slime-clojure repl buffers exist")) + (let ((repl-buf (read-buffer "Choose slime-clojure repl: " repl-bufs t))) + (org-babel-clojure-bind-session-to-repl-buffer session repl-buf)))) + +(defun org-babel-clojure-evaluate-external-process + (buffer body &optional result-type) + "Evaluate the body in an external process." + (let ((cmd (format "%s -" (mapconcat #'identity + (org-babel-clojure-babel-clojure-cmd) + " ")))) + (case result-type + (output (org-babel-eval cmd body)) + (value (let* ((tmp-file (make-temp-file "org-babel-clojure-results-"))) + (org-babel-eval cmd (format org-babel-clojure-wrapper-method + body tmp-file tmp-file)) + (org-babel-clojure-table-or-string + (org-babel-eval-read-file tmp-file))))))) + +(defun org-babel-clojure-evaluate-session (buffer body &optional result-type) + "Evaluate the body in the context of a clojure session." + (require 'slime) (require 'swank-clojure) + (let ((raw nil) + (results nil)) + (with-current-buffer buffer + (setq raw (org-babel-clojure-slime-eval-sync body)) + (setq results (reverse (mapcar #'org-babel-trim raw))) + (cond + ((equal result-type 'output) + (mapconcat #'identity (reverse (cdr results)) "\n")) + ((equal result-type 'value) + (org-babel-clojure-table-or-string (car results))))))) + +(defun org-babel-clojure-evaluate (buffer body &optional result-type) + "Pass BODY to the Clojure process in BUFFER. +If RESULT-TYPE equals 'output then return a list of the outputs +of the statements in BODY, if RESULT-TYPE equals 'value then +return the value of the last statement in BODY as elisp." + (if buffer + (org-babel-clojure-evaluate-session buffer body result-type) + (org-babel-clojure-evaluate-external-process buffer body result-type))) + +(defun org-babel-expand-body:clojure (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (org-babel-clojure-build-full-form + body (nth 1 (or processed-params (org-babel-process-params params))))) + +(defun org-babel-execute:clojure (body params) + "Execute a block of Clojure code." + (require 'slime) (require 'swank-clojure) + (let* ((processed-params (org-babel-process-params params)) + (body (org-babel-expand-body:clojure body params processed-params)) + (session (org-babel-clojure-initiate-session + (first processed-params)))) + (org-babel-reassemble-table + (org-babel-clojure-evaluate session body (nth 3 processed-params)) + (org-babel-pick-name + (nth 4 processed-params) (cdr (assoc :colnames params))) + (org-babel-pick-name + (nth 5 processed-params) (cdr (assoc :rownames params)))))) + +(provide 'ob-clojure) + +;; arch-tag: a43b33f2-653e-46b1-ac56-2805cf05b7d1 + +;;; ob-clojure.el ends here diff --git a/lisp/org/ob-comint.el b/lisp/org/ob-comint.el new file mode 100644 index 00000000000..732f2766b28 --- /dev/null +++ b/lisp/org/ob-comint.el @@ -0,0 +1,143 @@ +;;; ob-comint.el --- org-babel functions for interaction with comint buffers + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research, comint +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; These functions build on comint to ease the sending and receiving +;; of commands and results from comint buffers. + +;; Note that the buffers in this file are analogous to sessions in +;; org-babel at large. + +;;; Code: +(require 'ob) +(require 'comint) +(eval-when-compile (require 'cl)) + +(defun org-babel-comint-buffer-livep (buffer) + "Check if BUFFER is a comint buffer with a live process." + (let ((buffer (if buffer (get-buffer buffer)))) + (and buffer (buffer-live-p buffer) (get-buffer-process buffer) buffer))) + +(defmacro org-babel-comint-in-buffer (buffer &rest body) + "Check BUFFER and execute BODY. +BUFFER is checked with `org-babel-comint-buffer-livep'. BODY is +executed inside the protection of `save-window-excursion' and +`save-match-data'." + (declare (indent 1)) + `(save-excursion + (save-match-data + (unless (org-babel-comint-buffer-livep ,buffer) + (error "buffer %s doesn't exist or has no process" ,buffer)) + (set-buffer ,buffer) + ,@body))) + +(defmacro org-babel-comint-with-output (meta &rest body) + "Evaluate BODY in BUFFER and return process output. +Will wait until EOE-INDICATOR appears in the output, then return +all process output. If REMOVE-ECHO and FULL-BODY are present and +non-nil, then strip echo'd body from the returned output. META +should be a list containing the following where the last two +elements are optional. + + (BUFFER EOE-INDICATOR REMOVE-ECHO FULL-BODY) + +This macro ensures that the filter is removed in case of an error +or user `keyboard-quit' during execution of body." + (declare (indent 1)) + (let ((buffer (car meta)) + (eoe-indicator (cadr meta)) + (remove-echo (cadr (cdr meta))) + (full-body (cadr (cdr (cdr meta))))) + `(org-babel-comint-in-buffer ,buffer + (let ((string-buffer "") dangling-text raw) + (flet ((my-filt (text) + (setq string-buffer (concat string-buffer text)))) + ;; setup filter + (add-hook 'comint-output-filter-functions 'my-filt) + (unwind-protect + (progn + ;; got located, and save dangling text + (goto-char (process-mark (get-buffer-process (current-buffer)))) + (let ((start (point)) + (end (point-max))) + (setq dangling-text (buffer-substring start end)) + (delete-region start end)) + ;; pass FULL-BODY to process + ,@body + ;; wait for end-of-evaluation indicator + (while (progn + (goto-char comint-last-input-end) + (not (save-excursion + (and (re-search-forward + comint-prompt-regexp nil t) + (re-search-forward + (regexp-quote ,eoe-indicator) nil t))))) + (accept-process-output (get-buffer-process (current-buffer))) + ;; thought the following this would allow async + ;; background running, but I was wrong... + ;; (run-with-timer .5 .5 'accept-process-output + ;; (get-buffer-process (current-buffer))) + ) + ;; replace cut dangling text + (goto-char (process-mark (get-buffer-process (current-buffer)))) + (insert dangling-text)) + ;; remove filter + (remove-hook 'comint-output-filter-functions 'my-filt))) + ;; remove echo'd FULL-BODY from input + (if (and ,remove-echo ,full-body + (string-match + (replace-regexp-in-string + "\n" "[\r\n]+" (regexp-quote (or ,full-body ""))) + string-buffer)) + (setq raw (substring string-buffer (match-end 0)))) + (split-string string-buffer comint-prompt-regexp))))) + +(defun org-babel-comint-input-command (buffer cmd) + "Pass CMD to BUFFER. +The input will not be echoed." + (org-babel-comint-in-buffer buffer + (goto-char (process-mark (get-buffer-process buffer))) + (insert cmd) + (comint-send-input) + (org-babel-comint-wait-for-output buffer))) + +(defun org-babel-comint-wait-for-output (buffer) + "Wait until output arrives from BUFFER. +Note: this is only safe when waiting for the result of a single +statement (not large blocks of code)." + (org-babel-comint-in-buffer buffer + (while (progn + (goto-char comint-last-input-end) + (not (and (re-search-forward comint-prompt-regexp nil t) + (goto-char (match-beginning 0)) + (string= (face-name (face-at-point)) + "comint-highlight-prompt")))) + (accept-process-output (get-buffer-process buffer))))) + +(provide 'ob-comint) + +;; arch-tag: 9adddce6-0864-4be3-b0b5-6c5157dc7889 + +;;; ob-comint.el ends here diff --git a/lisp/org/ob-css.el b/lisp/org/ob-css.el new file mode 100644 index 00000000000..0a279b24573 --- /dev/null +++ b/lisp/org/ob-css.el @@ -0,0 +1,52 @@ +;;; ob-css.el --- org-babel functions for css evaluation + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Since CSS can't be executed, this file exists solely for tangling +;; CSS from org-mode files. + +;;; Code: +(require 'ob) + +(defvar org-babel-default-header-args:css '()) + +(defun org-babel-expand-body:css (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." body) + +(defun org-babel-execute:css (body params) + "Execute a block of CSS code. +This function is called by `org-babel-execute-src-block'." + body) + +(defun org-babel-prep-session:css (session params) + "Return an error if the :session header argument is set. +CSS does not support sessions." + (error "CSS sessions are nonsensical")) + +(provide 'ob-css) + +;; arch-tag: f4447e8c-50ab-41f9-b322-b7b9574d9fbe + +;;; ob-css.el ends here diff --git a/lisp/org/ob-ditaa.el b/lisp/org/ob-ditaa.el new file mode 100644 index 00000000000..336eaa93f12 --- /dev/null +++ b/lisp/org/ob-ditaa.el @@ -0,0 +1,72 @@ +;;; ob-ditaa.el --- org-babel functions for ditaa evaluation + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating ditaa source code. +;; +;; This differs from most standard languages in that +;; +;; 1) there is no such thing as a "session" in ditaa +;; +;; 2) we are generally only going to return results of type "file" +;; +;; 3) we are adding the "file" and "cmdline" header arguments +;; +;; 4) there are no variables (at least for now) + +;;; Code: +(require 'ob) + +(defvar org-babel-default-header-args:ditaa + '((:results . "file") (:exports . "results")) + "Default arguments for evaluating a ditaa source block.") + +(defun org-babel-expand-body:ditaa (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." body) + +(defvar org-ditaa-jar-path) +(defun org-babel-execute:ditaa (body params) + "Execute a block of Ditaa code with org-babel. +This function is called by `org-babel-execute-src-block'." + (let ((result-params (split-string (or (cdr (assoc :results params)) ""))) + (out-file (cdr (assoc :file params))) + (cmdline (cdr (assoc :cmdline params))) + (in-file (make-temp-file "org-babel-ditaa"))) + (unless (file-exists-p org-ditaa-jar-path) + (error "Could not find ditaa.jar at %s" org-ditaa-jar-path)) + (with-temp-file in-file (insert body)) + (message (concat "java -jar " org-ditaa-jar-path " " cmdline " " in-file " " out-file)) + (shell-command (concat "java -jar " (shell-quote-argument org-ditaa-jar-path) " " cmdline " " in-file " " out-file)) + out-file)) + +(defun org-babel-prep-session:ditaa (session params) + "Return an error because ditaa does not support sessions." + (error "Ditaa does not support sessions")) + +(provide 'ob-ditaa) + +;; arch-tag: 492cd006-07d9-4fac-bef6-5bb60b48842e + +;;; ob-ditaa.el ends here diff --git a/lisp/org/ob-dot.el b/lisp/org/ob-dot.el new file mode 100644 index 00000000000..4657fb80ba0 --- /dev/null +++ b/lisp/org/ob-dot.el @@ -0,0 +1,87 @@ +;;; ob-dot.el --- org-babel functions for dot evaluation + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating dot source code. +;; +;; For information on dot see http://www.graphviz.org/ +;; +;; This differs from most standard languages in that +;; +;; 1) there is no such thing as a "session" in dot +;; +;; 2) we are generally only going to return results of type "file" +;; +;; 3) we are adding the "file" and "cmdline" header arguments +;; +;; 4) there are no variables (at least for now) + +;;; Code: +(require 'ob) +(require 'ob-eval) + +(defvar org-babel-default-header-args:dot + '((:results . "file") (:exports . "results")) + "Default arguments to use when evaluating a dot source block.") + +(defun org-babel-expand-body:dot (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (let ((vars (nth 1 (or processed-params + (org-babel-process-params params))))) + (mapc + (lambda (pair) + (let ((name (symbol-name (car pair))) + (value (cdr pair))) + (setq body + (replace-regexp-in-string + (concat "\$" (regexp-quote name)) + (if (stringp value) value (format "%S" value)) + body)))) + vars) + body)) + +(defun org-babel-execute:dot (body params) + "Execute a block of Dot code with org-babel. +This function is called by `org-babel-execute-src-block'." + (let ((processed-params (org-babel-process-params params)) + (result-params (split-string (or (cdr (assoc :results params)) ""))) + (out-file (cdr (assoc :file params))) + (cmdline (cdr (assoc :cmdline params))) + (cmd (or (cdr (assoc :cmd params)) "dot")) + (in-file (make-temp-file "org-babel-dot"))) + (with-temp-file in-file + (insert (org-babel-expand-body:dot body params processed-params))) + (org-babel-eval (concat cmd " " in-file " " cmdline " -o " out-file) "") + out-file)) + +(defun org-babel-prep-session:dot (session params) + "Return an error because Dot does not support sessions." + (error "Dot does not support sessions")) + +(provide 'ob-dot) + +;; arch-tag: 817d0516-7b47-4f77-a8b2-2aadd8e4d0e2 + +;;; ob-dot.el ends here diff --git a/lisp/org/ob-emacs-lisp.el b/lisp/org/ob-emacs-lisp.el new file mode 100644 index 00000000000..92c3f36e2ed --- /dev/null +++ b/lisp/org/ob-emacs-lisp.el @@ -0,0 +1,74 @@ +;;; ob-emacs-lisp.el --- org-babel functions for emacs-lisp code evaluation + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating emacs-lisp code + +;;; Code: +(require 'ob) + +(defvar org-babel-default-header-args:emacs-lisp + '((:hlines . "yes") (:colnames . "no")) + "Default arguments for evaluating an emacs-lisp source block.") + +(declare-function org-babel-comint-with-output "ob-comint" (&rest body)) +(declare-function org-babel-comint-buffer-livep "ob-comint" (buffer)) +(declare-function org-babel-comint-wait-for-output "ob-comint" (buffer)) +(declare-function org-babel-comint-in-buffer "ob-comint" (buffer &rest body)) +(declare-function orgtbl-to-generic "org-table" (table params)) + +(defun org-babel-expand-body:emacs-lisp (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (let* ((processed-params (or processed-params (org-babel-process-params params))) + (vars (nth 1 processed-params)) + (result-params (nth 2 processed-params)) + (print-level nil) (print-length nil) + (body (if (> (length vars) 0) + (concat "(let (" + (mapconcat + (lambda (var) (format "%S" (print `(,(car var) ',(cdr var))))) + vars "\n ") + ")\n" body ")") + body))) + (if (or (member "code" result-params) + (member "pp" result-params)) + (concat "(pp " body ")") body))) + +(defun org-babel-execute:emacs-lisp (body params) + "Execute a block of emacs-lisp code with Babel." + (save-window-excursion + (let ((processed-params (org-babel-process-params params))) + (org-babel-reassemble-table + (eval (read (format "(progn %s)" + (org-babel-expand-body:emacs-lisp + body params processed-params)))) + (org-babel-pick-name (nth 4 processed-params) (cdr (assoc :colnames params))) + (org-babel-pick-name (nth 5 processed-params) (cdr (assoc :rownames params))))))) + +(provide 'ob-emacs-lisp) + +;; arch-tag: e9a3acca-dc84-472a-9f5a-23c35befbcd6 + +;;; ob-emacs-lisp.el ends here diff --git a/lisp/org/ob-eval.el b/lisp/org/ob-eval.el new file mode 100644 index 00000000000..dea39f12089 --- /dev/null +++ b/lisp/org/ob-eval.el @@ -0,0 +1,255 @@ +;;; ob-run.el --- org-babel functions for external code evaluation + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research, comint +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; These functions build existing Emacs support for executing external +;; shell commands. + +;;; Code: +(require 'ob) +(eval-when-compile (require 'cl)) + +(defun org-babel-eval-error-notify (exit-code stderr) + "Open a buffer to display STDERR and a message with the value of EXIT-CODE." + (let ((buf (get-buffer-create "*Org-Babel Error Output*"))) + (with-current-buffer buf + (goto-char (point-max)) + (save-excursion (insert stderr))) + (display-buffer buf)) + (message "Babel evaluation exited with code %S" exit-code)) + +(defun org-babel-eval (cmd body) + "Run CMD on BODY. +If CMD succeeds then return it's results, otherwise display +STDERR with `org-babel-eval-error-notify'." + (let ((err-buff (get-buffer-create "*Org-Babel Error*")) exit-code) + (with-current-buffer err-buff (erase-buffer)) + (with-temp-buffer + (insert body) + (setq exit-code + (org-babel-shell-command-on-region + (point-min) (point-max) cmd t 'replace err-buff)) + (if (or (not (numberp exit-code)) (> exit-code 0)) + (progn + (with-current-buffer err-buff + (org-babel-eval-error-notify exit-code (buffer-string))) + nil) + (buffer-string))))) + +(defun org-babel-eval-read-file (file) + "Return the contents of FILE as a string." + (with-temp-buffer (insert-file-contents + (org-babel-maybe-remote-file file)) + (buffer-string))) + +(defun org-babel-shell-command-on-region (start end command + &optional output-buffer replace + error-buffer display-error-buffer) + "Execute COMMAND in an inferior shell with region as input. + +Fixes bugs in the emacs 23.1.1 version of `shell-command-on-region' + +Normally display output (if any) in temp buffer `*Shell Command Output*'; +Prefix arg means replace the region with it. Return the exit code of +COMMAND. + +To specify a coding system for converting non-ASCII characters in +the input and output to the shell command, use +\\[universal-coding-system-argument] before this command. By +default, the input (from the current buffer) is encoded in the +same coding system that will be used to save the file, +`buffer-file-coding-system'. If the output is going to replace +the region, then it is decoded from that same coding system. + +The noninteractive arguments are START, END, COMMAND, +OUTPUT-BUFFER, REPLACE, ERROR-BUFFER, and DISPLAY-ERROR-BUFFER. +Noninteractive callers can specify coding systems by binding +`coding-system-for-read' and `coding-system-for-write'. + +If the command generates output, the output may be displayed +in the echo area or in a buffer. +If the output is short enough to display in the echo area +\(determined by the variable `max-mini-window-height' if +`resize-mini-windows' is non-nil), it is shown there. Otherwise +it is displayed in the buffer `*Shell Command Output*'. The output +is available in that buffer in both cases. + +If there is output and an error, a message about the error +appears at the end of the output. + +If there is no output, or if output is inserted in the current buffer, +then `*Shell Command Output*' is deleted. + +If the optional fourth argument OUTPUT-BUFFER is non-nil, +that says to put the output in some other buffer. +If OUTPUT-BUFFER is a buffer or buffer name, put the output there. +If OUTPUT-BUFFER is not a buffer and not nil, +insert output in the current buffer. +In either case, the output is inserted after point (leaving mark after it). + +If REPLACE, the optional fifth argument, is non-nil, that means insert +the output in place of text from START to END, putting point and mark +around it. + +If optional sixth argument ERROR-BUFFER is non-nil, it is a buffer +or buffer name to which to direct the command's standard error output. +If it is nil, error output is mingled with regular output. +If DISPLAY-ERROR-BUFFER is non-nil, display the error buffer if there +were any errors. (This is always t, interactively.) +In an interactive call, the variable `shell-command-default-error-buffer' +specifies the value of ERROR-BUFFER." + (interactive (let (string) + (unless (mark) + (error "The mark is not set now, so there is no region")) + ;; Do this before calling region-beginning + ;; and region-end, in case subprocess output + ;; relocates them while we are in the minibuffer. + (setq string (read-shell-command "Shell command on region: ")) + ;; call-interactively recognizes region-beginning and + ;; region-end specially, leaving them in the history. + (list (region-beginning) (region-end) + string + current-prefix-arg + current-prefix-arg + shell-command-default-error-buffer + t))) + (let ((error-file + (if error-buffer + (make-temp-file + (expand-file-name "scor" + (or (unless (featurep 'xemacs) + small-temporary-file-directory) + temporary-file-directory))) + nil)) + exit-status) + (if (or replace + (and output-buffer + (not (or (bufferp output-buffer) (stringp output-buffer))))) + ;; Replace specified region with output from command. + (let ((swap (and replace (< start end)))) + ;; Don't muck with mark unless REPLACE says we should. + (goto-char start) + (and replace (push-mark (point) 'nomsg)) + (setq exit-status + (call-process-region start end shell-file-name t + (if error-file + (list output-buffer error-file) + t) + nil shell-command-switch command)) + ;; It is rude to delete a buffer which the command is not using. + ;; (let ((shell-buffer (get-buffer "*Shell Command Output*"))) + ;; (and shell-buffer (not (eq shell-buffer (current-buffer))) + ;; (kill-buffer shell-buffer))) + ;; Don't muck with mark unless REPLACE says we should. + (and replace swap (exchange-point-and-mark))) + ;; No prefix argument: put the output in a temp buffer, + ;; replacing its entire contents. + (let ((buffer (get-buffer-create + (or output-buffer "*Shell Command Output*")))) + (unwind-protect + (if (eq buffer (current-buffer)) + ;; If the input is the same buffer as the output, + ;; delete everything but the specified region, + ;; then replace that region with the output. + (progn (setq buffer-read-only nil) + (delete-region (max start end) (point-max)) + (delete-region (point-min) (min start end)) + (setq exit-status + (call-process-region (point-min) (point-max) + shell-file-name t + (if error-file + (list t error-file) + t) + nil shell-command-switch + command))) + ;; Clear the output buffer, then run the command with + ;; output there. + (let ((directory default-directory)) + (with-current-buffer buffer + (setq buffer-read-only nil) + (if (not output-buffer) + (setq default-directory directory)) + (erase-buffer))) + (setq exit-status + (call-process-region start end shell-file-name nil + (if error-file + (list buffer error-file) + buffer) + nil shell-command-switch command))) + ;; Report the output. + (with-current-buffer buffer + (setq mode-line-process + (cond ((null exit-status) + " - Error") + ((stringp exit-status) + (format " - Signal [%s]" exit-status)) + ((not (equal 0 exit-status)) + (format " - Exit [%d]" exit-status))))) + (if (with-current-buffer buffer (> (point-max) (point-min))) + ;; There's some output, display it + (display-message-or-buffer buffer) + ;; No output; error? + (let ((output + (if (and error-file + (< 0 (nth 7 (file-attributes error-file)))) + "some error output" + "no output"))) + (cond ((null exit-status) + (message "(Shell command failed with error)")) + ((equal 0 exit-status) + (message "(Shell command succeeded with %s)" + output)) + ((stringp exit-status) + (message "(Shell command killed by signal %s)" + exit-status)) + (t + (message "(Shell command failed with code %d and %s)" + exit-status output)))) + ;; Don't kill: there might be useful info in the undo-log. + ;; (kill-buffer buffer) + )))) + + (when (and error-file (file-exists-p error-file)) + (if (< 0 (nth 7 (file-attributes error-file))) + (with-current-buffer (get-buffer-create error-buffer) + (let ((pos-from-end (- (point-max) (point)))) + (or (bobp) + (insert "\f\n")) + ;; Do no formatting while reading error file, + ;; because that can run a shell command, and we + ;; don't want that to cause an infinite recursion. + (format-insert-file error-file nil) + ;; Put point after the inserted errors. + (goto-char (- (point-max) pos-from-end))) + (and display-error-buffer + (display-buffer (current-buffer))))) + (delete-file error-file)) + exit-status)) + +(provide 'ob-eval) + +;; arch-tag: 5328b17f-957d-42d9-94da-a2952682d04d + +;;; ob-comint.el ends here diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el new file mode 100644 index 00000000000..4c074887ef1 --- /dev/null +++ b/lisp/org/ob-exp.el @@ -0,0 +1,313 @@ +;;; ob-exp.el --- Exportation of org-babel source blocks + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte, Dan Davison +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; See the online documentation for more information +;; +;; http://orgmode.org/worg/org-contrib/babel/ + +;;; Code: +(require 'ob) +(require 'org-exp-blocks) +(eval-when-compile + (require 'cl)) + +(defvar obe-marker nil) +(defvar org-current-export-file) +(defvar org-babel-lob-one-liner-regexp) +(defvar org-babel-ref-split-regexp) +(declare-function org-babel-lob-get-info "ob-lob" ()) +(declare-function org-babel-ref-literal "ob-ref" (ref)) + +(add-to-list 'org-export-interblocks '(src org-babel-exp-inline-src-blocks)) +(add-to-list 'org-export-interblocks '(lob org-babel-exp-lob-one-liners)) +(add-hook 'org-export-blocks-postblock-hook 'org-exp-res/src-name-cleanup) + +(org-export-blocks-add-block '(src org-babel-exp-src-blocks nil)) + +(defcustom org-export-babel-evaluate t + "Switch controlling code evaluation during export. +When set to nil no code will be exported as part of the export +process." + :group 'org-babel + :type 'boolean) +(put 'org-export-babel-evaluate 'safe-local-variable (lambda (x) (eq x nil))) + +(defvar org-babel-function-def-export-keyword "function" + "The keyword to substitute for the source name line on export. +When exporting a source block function, this keyword will +appear in the exported version in the place of source name +line. A source block is considered to be a source block function +if the source name is present and is followed by a parenthesized +argument list. The parentheses may be empty or contain +whitespace. An example is the following which generates n random +\(uniform) numbers. + +#+source: rand(n) +#+begin_src R + runif(n) +#+end_src") + +(defvar org-babel-function-def-export-indent 4 + "Number of characters to indent a source block on export. +When exporting a source block function, the block contents will +be indented by this many characters. See +`org-babel-function-def-export-name' for the definition of a +source block function.") + +(defun org-babel-exp-src-blocks (body &rest headers) + "Process source block for export. +Depending on the 'export' headers argument in replace the source +code block with... + +both ---- display the code and the results + +code ---- the default, display the code inside the block but do + not process + +results - just like none only the block is run on export ensuring + that it's results are present in the org-mode buffer + +none ----- do not display either code or results upon export" + (interactive) + (message "org-babel-exp processing...") + (save-excursion + (goto-char (match-beginning 0)) + (let* ((info (org-babel-get-src-block-info)) + (params (nth 2 info))) + ;; bail if we couldn't get any info from the block + (when info + ;; expand noweb references in the original file + (setf (nth 1 info) + (if (and (cdr (assoc :noweb params)) + (string= "yes" (cdr (assoc :noweb params)))) + (org-babel-expand-noweb-references + info (get-file-buffer org-current-export-file)) + (nth 1 info)))) + (org-babel-exp-do-export info 'block)))) + +(defun org-babel-exp-inline-src-blocks (start end) + "Process inline source blocks between START and END for export. +See `org-babel-exp-src-blocks' for export options, currently the +options and are taken from `org-babel-default-inline-header-args'." + (interactive) + (save-excursion + (goto-char start) + (while (and (< (point) end) + (re-search-forward org-babel-inline-src-block-regexp end t)) + (let* ((info (save-match-data (org-babel-parse-inline-src-block-match))) + (params (nth 2 info)) + (replacement + (save-match-data + (if (org-babel-in-example-or-verbatim) + (buffer-substring (match-beginning 0) (match-end 0)) + ;; expand noweb references in the original file + (setf (nth 1 info) + (if (and (cdr (assoc :noweb params)) + (string= "yes" (cdr (assoc :noweb params)))) + (org-babel-expand-noweb-references + info (get-file-buffer org-current-export-file)) + (nth 1 info))) + (org-babel-exp-do-export info 'inline))))) + (setq end (+ end (- (length replacement) (length (match-string 1))))) + (replace-match replacement t t nil 1))))) + +(defun org-exp-res/src-name-cleanup () + "Clean up #+results and #+srcname lines for export. +This function should only be called after all block processing +has taken place." + (interactive) + (save-excursion + (goto-char (point-min)) + (while (org-re-search-forward-unprotected + (concat + "\\("org-babel-src-name-regexp"\\|"org-babel-result-regexp"\\)") + nil t) + (delete-region + (progn (beginning-of-line) (point)) + (progn (end-of-line) (+ 1 (point))))))) + +(defun org-babel-in-example-or-verbatim () + "Return true if point is in example or verbatim code. +Example and verbatim code include escaped portions of +an org-mode buffer code that should be treated as normal +org-mode text." + (or (org-in-indented-comment-line) + (save-excursion + (save-match-data + (goto-char (point-at-bol)) + (looking-at "[ \t]*:[ \t]"))) + (org-in-regexps-block-p "^[ \t]*#\\+begin_src" "^[ \t]*#\\+end_src"))) + +(defun org-babel-exp-lob-one-liners (start end) + "Process Library of Babel calls between START and END for export. +See `org-babel-exp-src-blocks' for export options. Currently the +options are taken from `org-babel-default-header-args'." + (interactive) + (let (replacement) + (save-excursion + (goto-char start) + (while (and (< (point) end) + (re-search-forward org-babel-lob-one-liner-regexp nil t)) + (setq replacement + (let ((lob-info (org-babel-lob-get-info))) + (save-match-data + (org-babel-exp-do-export + (list "emacs-lisp" "results" + (org-babel-merge-params + org-babel-default-header-args + (org-babel-parse-header-arguments + (org-babel-clean-text-properties + (concat ":var results=" + (mapconcat #'identity + (butlast lob-info) " "))))) + (car (last lob-info))) + 'lob)))) + (setq end (+ end (- (length replacement) (length (match-string 0))))) + (replace-match replacement t t))))) + +(defun org-babel-exp-do-export (info type) + "Return a string with the exported content of a code block. +The function respects the value of the :exports header argument." + (flet ((silently () (let ((session (cdr (assoc :session (nth 2 info))))) + (when (and session + (not (equal "none" session)) + (not (assoc :noeval (nth 2 info)))) + (org-babel-exp-results info type 'silent)))) + (clean () (org-babel-remove-result info))) + (case (intern (or (cdr (assoc :exports (nth 2 info))) "code")) + ('none (silently) (clean) "") + ('code (silently) (clean) (org-babel-exp-code info type)) + ('results (org-babel-exp-results info type)) + ('both (concat (org-babel-exp-code info type) + "\n\n" + (org-babel-exp-results info type)))))) + +(defvar backend) +(defun org-babel-exp-code (info type) + "Prepare and return code in the current code block for export. +Code is prepared in a manner suitable for exportat by +org-mode. This function is called by `org-babel-exp-do-export'. +The code block is not evaluated." + (let ((lang (nth 0 info)) + (body (nth 1 info)) + (switches (nth 3 info)) + (name (nth 4 info)) + (args (mapcar + #'cdr + (org-remove-if-not (lambda (el) (eq :var (car el))) (nth 2 info))))) + (case type + ('inline (format "=%s=" body)) + ('block + (let ((str + (format "#+BEGIN_SRC %s %s\n%s%s#+END_SRC\n" lang switches body + (if (and body (string-match "\n$" body)) + "" "\n")))) + (when name + (add-text-properties + 0 (length str) + (list 'org-caption + (format "%s(%s)" + name + (mapconcat #'identity args ", "))) + str)) + str)) + ('lob + (let ((call-line (and (string-match "results=" (car args)) + (substring (car args) (match-end 0))))) + (cond + ((eq backend 'html) + (format "\n#+HTML: \n" + call-line)) + ((format ": %s\n" call-line)))))))) + +(defun org-babel-exp-results (info type &optional silent) + "Evaluate and return the results of the current code block for export. +Results are prepared in a manner suitable for export by org-mode. +This function is called by `org-babel-exp-do-export'. The code +block will be evaluated. Optional argument SILENT can be used to +inhibit insertion of results into the buffer." + (if org-export-babel-evaluate + (let ((lang (nth 0 info)) + (body (nth 1 info)) + (params + ;; lets ensure that we lookup references in the original file + (mapcar + (lambda (pair) + (if (and org-current-export-file + (eq (car pair) :var) + (string-match org-babel-ref-split-regexp (cdr pair)) + (equal :ob-must-be-reference + (org-babel-ref-literal + (match-string 2 (cdr pair))))) + `(:var . ,(concat (match-string 1 (cdr pair)) + "=" org-current-export-file + ":" (match-string 2 (cdr pair)))) + pair)) + (nth 2 info)))) + ;; skip code blocks which we can't evaluate + (if (fboundp (intern (concat "org-babel-execute:" lang))) + (case type + ('inline + (let ((raw (org-babel-execute-src-block + nil info '((:results . "silent")))) + (result-params (split-string + (cdr (assoc :results params))))) + (unless silent + (cond ;; respect the value of the :results header argument + ((member "file" result-params) + (org-babel-result-to-file raw)) + ((or (member "raw" result-params) + (member "org" result-params)) + (format "%s" raw)) + ((member "code" result-params) + (format "src_%s{%s}" lang raw)) + (t + (if (stringp raw) + (if (= 0 (length raw)) "=(no results)=" + (format "%s" raw)) + (format "%S" raw))))))) + ('block + (org-babel-execute-src-block + nil info (org-babel-merge-params + params + `((:results . ,(if silent "silent" "replace"))))) + "") + ('lob + (save-excursion + (re-search-backward org-babel-lob-one-liner-regexp nil t) + (org-babel-execute-src-block + nil info (org-babel-merge-params + params + `((:results . ,(if silent "silent" "replace"))))) + ""))) + "")) + "")) + +(provide 'ob-exp) + +;; arch-tag: 523abf4c-76d1-44ed-9f27-e3bddf34bf0f + +;;; ob-exp.el ends here diff --git a/lisp/org/ob-gnuplot.el b/lisp/org/ob-gnuplot.el new file mode 100644 index 00000000000..40543d720b0 --- /dev/null +++ b/lisp/org/ob-gnuplot.el @@ -0,0 +1,229 @@ +;;; ob-gnuplot.el --- org-babel functions for gnuplot evaluation + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating gnuplot source code. +;; +;; This differs from most standard languages in that +;; +;; 1) we are generally only going to return results of type "file" +;; +;; 2) we are adding the "file" and "cmdline" header arguments + +;;; Requirements: + +;; - gnuplot :: http://www.gnuplot.info/ +;; +;; - gnuplot-mode :: http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html + +;;; Code: +(require 'ob) +(require 'ob-ref) +(require 'ob-comint) +(eval-when-compile (require 'cl)) + +(declare-function org-time-string-to-time "org" (s)) +(declare-function org-combine-plists "org" (&rest plists)) +(declare-function orgtbl-to-generic "org-table" (table params)) +(declare-function gnuplot-mode "ext:gnuplot-mode" ()) +(declare-function gnuplot-send-string-to-gnuplot "ext:gnuplot-mode" (str txt)) +(declare-function gnuplot-send-buffer-to-gnuplot "ext:gnuplot-mode" ()) + +(defvar org-babel-default-header-args:gnuplot + '((:results . "file") (:exports . "results") (:session . nil)) + "Default arguments to use when evaluating a gnuplot source block.") + +(defvar org-babel-gnuplot-timestamp-fmt nil) + +(defun org-babel-gnuplot-process-vars (params) + "Extract variables from PARAMS and process the variables. +Dumps all vectors into files and returns an association list +of variable names and the related value to be used in the gnuplot +code." + (mapcar + (lambda (pair) + (cons + (car pair) ;; variable name + (if (listp (cdr pair)) ;; variable value + (org-babel-gnuplot-table-to-data + (cdr pair) (make-temp-file "org-babel-gnuplot") params) + (cdr pair)))) + (org-babel-ref-variables params))) + +(defun org-babel-expand-body:gnuplot (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (save-window-excursion + (let* ((vars (org-babel-gnuplot-process-vars params)) + (out-file (cdr (assoc :file params))) + (term (or (cdr (assoc :term params)) + (when out-file (file-name-extension out-file)))) + (cmdline (cdr (assoc :cmdline params))) + (title (plist-get params :title)) + (lines (plist-get params :line)) + (sets (plist-get params :set)) + (x-labels (plist-get params :xlabels)) + (y-labels (plist-get params :ylabels)) + (timefmt (plist-get params :timefmt)) + (time-ind (or (plist-get params :timeind) + (when timefmt 1))) + output) + (flet ((add-to-body (text) + (setq body (concat text "\n" body)))) + ;; append header argument settings to body + (when title (add-to-body (format "set title '%s'" title))) ;; title + (when lines (mapc (lambda (el) (add-to-body el)) lines)) ;; line + (when sets + (mapc (lambda (el) (add-to-body (format "set %s" el))) sets)) + (when x-labels + (add-to-body + (format "set xtics (%s)" + (mapconcat (lambda (pair) + (format "\"%s\" %d" (cdr pair) (car pair))) + x-labels ", ")))) + (when y-labels + (add-to-body + (format "set ytics (%s)" + (mapconcat (lambda (pair) + (format "\"%s\" %d" (cdr pair) (car pair))) + y-labels ", ")))) + (when time-ind + (add-to-body "set xdata time") + (add-to-body (concat "set timefmt \"" + (or timefmt + "%Y-%m-%d-%H:%M:%S") "\""))) + (when out-file (add-to-body (format "set output \"%s\"" out-file))) + (when term (add-to-body (format "set term %s" term))) + ;; insert variables into code body: this should happen last + ;; placing the variables at the *top* of the code in case their + ;; values are used later + (add-to-body (mapconcat + (lambda (pair) (format "%s = \"%s\"" (car pair) (cdr pair))) + vars "\n")) + ;; replace any variable names preceded by '$' with the actual + ;; value of the variable + (mapc (lambda (pair) + (setq body (replace-regexp-in-string + (format "\\$%s" (car pair)) (cdr pair) body))) + vars)) + body))) + +(defun org-babel-execute:gnuplot (body params) + "Execute a block of Gnuplot code. +This function is called by `org-babel-execute-src-block'." + (require 'gnuplot) + (let ((session (cdr (assoc :session params))) + (result-type (cdr (assoc :results params))) + (out-file (cdr (assoc :file params))) + (body (org-babel-expand-body:gnuplot body params)) + output) + (save-window-excursion + ;; evaluate the code body with gnuplot + (if (string= session "none") + (let ((script-file (make-temp-file "org-babel-gnuplot-script"))) + (with-temp-file script-file + (insert (concat body "\n"))) + (message "gnuplot \"%s\"" script-file) + (setq output + (shell-command-to-string (format "gnuplot \"%s\"" script-file))) + (message output)) + (with-temp-buffer + (insert (concat body "\n")) + (gnuplot-mode) + (gnuplot-send-buffer-to-gnuplot))) + (if (member "output" (split-string result-type)) + output + out-file)))) + +(defun org-babel-prep-session:gnuplot (session params) + "Prepare SESSION according to the header arguments in PARAMS." + (let* ((session (org-babel-gnuplot-initiate-session session)) + (vars (org-babel-ref-variables params)) + (var-lines (mapcar + (lambda (pair) (format "%s = \"%s\"" (car pair) (cdr pair))) + vars))) + (message "%S" session) + (org-babel-comint-in-buffer session + (mapc (lambda (var-line) + (insert var-line) (comint-send-input nil t) + (org-babel-comint-wait-for-output session) + (sit-for .1) (goto-char (point-max))) var-lines)) + session)) + +(defun org-babel-load-session:gnuplot (session body params) + "Load BODY into SESSION." + (save-window-excursion + (let ((buffer (org-babel-prep-session:gnuplot session params))) + (with-current-buffer buffer + (goto-char (process-mark (get-buffer-process (current-buffer)))) + (insert (org-babel-chomp body))) + buffer))) + +(defvar gnuplot-buffer) +(defun org-babel-gnuplot-initiate-session (&optional session params) + "Initiate a gnuplot session. +If there is not a current inferior-process-buffer in SESSION +then create one. Return the initialized session. The current +`gnuplot-mode' doesn't provide support for multiple sessions." + (require 'gnuplot) + (unless (string= session "none") + (save-window-excursion + (gnuplot-send-string-to-gnuplot "" "line") + gnuplot-buffer))) + +(defun org-babel-gnuplot-quote-timestamp-field (s) + "Convert S from timestamp to Unix time and export to gnuplot." + (format-time-string org-babel-gnuplot-timestamp-fmt (org-time-string-to-time s))) + +(defvar org-table-number-regexp) +(defvar org-ts-regexp3) +(defun org-babel-gnuplot-quote-tsv-field (s) + "Quote S for export to gnuplot." + (unless (stringp s) + (setq s (format "%s" s))) + (if (string-match org-table-number-regexp s) s + (if (string-match org-ts-regexp3 s) + (org-babel-gnuplot-quote-timestamp-field s) + (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\"")))) + +(defun org-babel-gnuplot-table-to-data (table data-file params) + "Export TABLE to DATA-FILE in a format readable by gnuplot. +Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE." + (with-temp-file data-file + (make-local-variable 'org-babel-gnuplot-timestamp-fmt) + (setq org-babel-gnuplot-timestamp-fmt (or + (plist-get params :timefmt) + "%Y-%m-%d-%H:%M:%S")) + (insert (orgtbl-to-generic + table + (org-combine-plists + '(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field) + params)))) + data-file) + +(provide 'ob-gnuplot) + +;; arch-tag: 50490ace-a9e1-4b29-a6e5-0db9f16c610b + +;;; ob-gnuplot.el ends here diff --git a/lisp/org/ob-haskell.el b/lisp/org/ob-haskell.el new file mode 100644 index 00000000000..e0803347a64 --- /dev/null +++ b/lisp/org/ob-haskell.el @@ -0,0 +1,230 @@ +;;; ob-haskell.el --- org-babel functions for haskell evaluation + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating haskell source code. This one will +;; be sort of tricky because haskell programs must be compiled before +;; they can be run, but haskell code can also be run through an +;; interactive interpreter. +;; +;; For now lets only allow evaluation using the haskell interpreter. + +;;; Requirements: + +;; - haskell-mode :: http://www.iro.umontreal.ca/~monnier/elisp/#haskell-mode +;; +;; - inf-haskell :: http://www.iro.umontreal.ca/~monnier/elisp/#haskell-mode +;; +;; - (optionally) lhs2tex :: http://people.cs.uu.nl/andres/lhs2tex/ + +;;; Code: +(require 'ob) +(require 'ob-comint) +(require 'comint) +(eval-when-compile (require 'cl)) + +(declare-function org-remove-indentation "org" (code &optional n)) +(declare-function haskell-mode "ext:haskell-mode" ()) +(declare-function run-haskell "ext:inf-haskell" (&optional arg)) +(declare-function inferior-haskell-load-file + "ext:inf-haskell" (&optional reload)) + +(add-to-list 'org-babel-tangle-lang-exts '("haskell" . "hs")) + +(defvar org-babel-default-header-args:haskell '()) + +(defvar org-babel-haskell-lhs2tex-command "lhs2tex") + +(defvar org-babel-haskell-eoe "\"org-babel-haskell-eoe\"") + +(defun org-babel-expand-body:haskell (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (let ((vars (nth 1 (or processed-params (org-babel-process-params params))))) + (concat + (mapconcat + (lambda (pair) (format "let %s = %s" + (car pair) + (org-babel-haskell-var-to-haskell (cdr pair)))) + vars "\n") "\n" body "\n"))) + +(defun org-babel-execute:haskell (body params) + "Execute a block of Haskell code." + (let* ((processed-params (org-babel-process-params params)) + (session (nth 0 processed-params)) + (vars (nth 1 processed-params)) + (result-type (nth 3 processed-params)) + (full-body (org-babel-expand-body:haskell body params processed-params)) + (session (org-babel-haskell-initiate-session session params)) + (raw (org-babel-comint-with-output + (session org-babel-haskell-eoe t full-body) + (insert (org-babel-trim full-body)) + (comint-send-input nil t) + (insert org-babel-haskell-eoe) + (comint-send-input nil t))) + (results (mapcar + #'org-babel-haskell-read-string + (cdr (member org-babel-haskell-eoe + (reverse (mapcar #'org-babel-trim raw))))))) + (org-babel-reassemble-table + (cond + ((equal result-type 'output) + (mapconcat #'identity (reverse (cdr results)) "\n")) + ((equal result-type 'value) + (org-babel-haskell-table-or-string (car results)))) + (org-babel-pick-name (nth 4 processed-params) (cdr (assoc :colnames params))) + (org-babel-pick-name (nth 5 processed-params) (cdr (assoc :rownames params)))))) + +(defun org-babel-haskell-read-string (string) + "Strip \\\"s from around a haskell string." + (if (string-match "^\"\\([^\000]+\\)\"$" string) + (match-string 1 string) + string)) + +(defun org-babel-haskell-initiate-session (&optional session params) + "Initiate a haskell session. +If there is not a current inferior-process-buffer in SESSION +then create one. Return the initialized session." + (require 'inf-haskell) + (or (get-buffer "*haskell*") + (save-window-excursion (run-haskell) (sleep-for 0.25) (current-buffer)))) + +(defun org-babel-load-session:haskell + (session body params &optional processed-params) + "Load BODY into SESSION." + (save-window-excursion + (let* ((buffer (org-babel-prep-session:haskell + session params processed-params)) + (load-file (concat (make-temp-file "org-babel-haskell-load") ".hs"))) + (with-temp-buffer + (insert body) (write-file load-file) + (haskell-mode) (inferior-haskell-load-file)) + buffer))) + +(defun org-babel-prep-session:haskell + (session params &optional processed-params) + "Prepare SESSION according to the header arguments in PARAMS." + (save-window-excursion + (let ((pp (or processed-params (org-babel-process-params params))) + (buffer (org-babel-haskell-initiate-session session))) + (org-babel-comint-in-buffer buffer + (mapc + (lambda (pair) + (insert (format "let %s = %s" + (car pair) + (org-babel-haskell-var-to-haskell (cdr pair)))) + (comint-send-input nil t)) + (nth 1 pp))) + (current-buffer)))) + +(defun org-babel-haskell-table-or-string (results) + "Convert RESULTS to an Emacs-lisp table or string. +If RESULTS look like a table, then convert them into an +Emacs-lisp table, otherwise return the results as a string." + (org-babel-read + (if (and (stringp results) (string-match "^\\[.+\\]$" results)) + (org-babel-read + (concat "'" + (replace-regexp-in-string + "\\[" "(" (replace-regexp-in-string + "\\]" ")" (replace-regexp-in-string + "," " " (replace-regexp-in-string + "'" "\"" results)))))) + results))) + +(defun org-babel-haskell-var-to-haskell (var) + "Convert an elisp value VAR into a haskell variable. +The elisp VAR is converted to a string of haskell source code +specifying a variable of the same value." + (if (listp var) + (concat "[" (mapconcat #'org-babel-haskell-var-to-haskell var ", ") "]") + (format "%S" var))) + +(defvar org-src-preserve-indentation) +(defun org-babel-haskell-export-to-lhs (&optional arg) + "Export to a .lhs file with all haskell code blocks escaped. +When called with a prefix argument the resulting +.lhs file will be exported to a .tex file. This function will +create two new files, base-name.lhs and base-name.tex where +base-name is the name of the current org-mode file. + +Note that all standard Babel literate programming +constructs (header arguments, no-web syntax etc...) are ignored." + (interactive "P") + (let* ((contents (buffer-string)) + (haskell-regexp + (concat "^\\([ \t]*\\)#\\+begin_src[ \t]haskell*\\(.*\\)?[\r\n]" + "\\([^\000]*?\\)[\r\n][ \t]*#\\+end_src.*")) + (base-name (file-name-sans-extension (buffer-file-name))) + (tmp-file (make-temp-file "ob-haskell")) + (tmp-org-file (concat tmp-file ".org")) + (tmp-tex-file (concat tmp-file ".tex")) + (lhs-file (concat base-name ".lhs")) + (tex-file (concat base-name ".tex")) + (command (concat org-babel-haskell-lhs2tex-command " " lhs-file " > " tex-file)) + (preserve-indentp org-src-preserve-indentation) + indentation) + ;; escape haskell source-code blocks + (with-temp-file tmp-org-file + (insert contents) + (goto-char (point-min)) + (while (re-search-forward haskell-regexp nil t) + (save-match-data (setq indentation (length (match-string 1)))) + (replace-match (save-match-data + (concat + "#+begin_latex\n\\begin{code}\n" + (if (or preserve-indentp + (string-match "-i" (match-string 2))) + (match-string 3) + (org-remove-indentation (match-string 3))) + "\n\\end{code}\n#+end_latex\n")) + t t) + (indent-code-rigidly (match-beginning 0) (match-end 0) indentation))) + (save-excursion + ;; export to latex w/org and save as .lhs + (find-file tmp-org-file) (funcall 'org-export-as-latex nil) + (kill-buffer) + (delete-file tmp-org-file) + (find-file tmp-tex-file) + (goto-char (point-min)) (forward-line 2) + (insert "%include polycode.fmt\n") + ;; ensure all \begin/end{code} statements start at the first column + (while (re-search-forward "^[ \t]+\\\\begin{code}[^\000]+\\\\end{code}" nil t) + (replace-match (save-match-data (org-remove-indentation (match-string 0))) + t t)) + (setq contents (buffer-string)) + (save-buffer) (kill-buffer)) + (delete-file tmp-tex-file) + ;; save org exported latex to a .lhs file + (with-temp-file lhs-file (insert contents)) + (if (not arg) + (find-file lhs-file) + ;; process .lhs file with lhs2tex + (message "running %s" command) (shell-command command) (find-file tex-file)))) + +(provide 'ob-haskell) + +;; arch-tag: b53f75f3-ba1a-4b05-82d9-a2a0d4e70804 + +;;; ob-haskell.el ends here diff --git a/lisp/org/ob-keys.el b/lisp/org/ob-keys.el new file mode 100644 index 00000000000..3f8e83b4f91 --- /dev/null +++ b/lisp/org/ob-keys.el @@ -0,0 +1,89 @@ +;;; ob-keys.el --- key bindings for org-babel + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Add org-babel keybindings to the org-mode keymap for exposing +;; org-babel functions. These will all share a common prefix. See +;; the value of `org-babel-key-bindings' for a list of interactive +;; functions and their associated keys. + +;;; Code: +(require 'ob) + +(defvar org-babel-key-prefix "\C-c\C-v" + "The key prefix for Babel interactive key-bindings. +See `org-babel-key-bindings' for the list of interactive babel +functions which are assigned key bindings, and see +`org-babel-map' for the actual babel keymap.") + +(defvar org-babel-map (make-sparse-keymap) + "The keymap for interactive Babel functions.") + +;;;###autoload +(defun org-babel-describe-bindings () + "Describe all keybindings behind `org-babel-key-prefix'." + (interactive) + (describe-bindings org-babel-key-prefix)) + +(defvar org-babel-key-bindings + '(("p" . org-babel-previous-src-block) + ("\C-p" . org-babel-previous-src-block) + ("n" . org-babel-next-src-block) + ("\C-n" . org-babel-next-src-block) + ("e" . org-babel-execute-src-block) + ("\C-e" . org-babel-execute-src-block) + ("o" . org-babel-open-src-block-result) + ("\C-o" . org-babel-open-src-block-result) + ("\C-v" . org-babel-expand-src-block) + ("v" . org-babel-expand-src-block) + ("g" . org-babel-goto-named-src-block) + ("r" . org-babel-goto-named-result) + ("\C-r" . org-babel-goto-named-result) + ("\C-b" . org-babel-execute-buffer) + ("b" . org-babel-execute-buffer) + ("\C-s" . org-babel-execute-subtree) + ("s" . org-babel-execute-subtree) + ("\C-t" . org-babel-tangle) + ("t" . org-babel-tangle) + ("\C-f" . org-babel-tangle-file) + ("f" . org-babel-tangle-file) + ("\C-l" . org-babel-lob-ingest) + ("l" . org-babel-lob-ingest) + ("\C-z" . org-babel-switch-to-session) + ("z" . org-babel-switch-to-session) + ("\C-a" . org-babel-sha1-hash) + ("a" . org-babel-sha1-hash) + ("h" . org-babel-describe-bindings)) + "Alist of key bindings and interactive Babel functions. +This list associates interactive Babel functions +with keys. Each element of this list will add an entry to the +`org-babel-map' using the letter key which is the `car' of the +a-list placed behind the generic `org-babel-key-prefix'.") + +(provide 'ob-keys) + +;; arch-tag: 01e348ee-4906-46fa-839a-6b7b6f989048 + +;;; ob-keys.el ends here diff --git a/lisp/org/ob-latex.el b/lisp/org/ob-latex.el new file mode 100644 index 00000000000..e5b01463a51 --- /dev/null +++ b/lisp/org/ob-latex.el @@ -0,0 +1,158 @@ +;;; ob-latex.el --- org-babel functions for latex "evaluation" + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating LaTeX source code. +;; +;; Currently on evaluation this returns raw LaTeX code, unless a :file +;; header argument is given in which case small png or pdf files will +;; be created directly form the latex source code. + +;;; Code: +(require 'ob) + +(declare-function org-create-formula-image "org" (string tofile options buffer)) +(declare-function org-splice-latex-header "org" + (tpl def-pkg pkg snippets-p &optional extra)) +(declare-function org-export-latex-fix-inputenc "org-latex" ()) + +(add-to-list 'org-babel-tangle-lang-exts '("latex" . "tex")) + +(defvar org-babel-default-header-args:latex + '((:results . "latex") (:exports . "results")) + "Default arguments to use when evaluating a LaTeX source block.") + +(defun org-babel-expand-body:latex (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (mapc (lambda (pair) ;; replace variables + (setq body + (replace-regexp-in-string + (regexp-quote (format "%S" (car pair))) + (if (stringp (cdr pair)) + (cdr pair) (format "%S" (cdr pair))) + body))) (nth 1 (org-babel-process-params params))) + body) + +(defvar org-format-latex-options) +(defvar org-export-latex-packages-alist) +(defun org-babel-execute:latex (body params) + "Execute a block of Latex code with Babel. +This function is called by `org-babel-execute-src-block'." + (setq body (org-babel-expand-body:latex body params)) + (if (cdr (assoc :file params)) + (let ((out-file (cdr (assoc :file params))) + (tex-file (make-temp-file "org-babel-latex" nil ".tex")) + (pdfheight (cdr (assoc :pdfheight params))) + (pdfwidth (cdr (assoc :pdfwidth params))) + (in-buffer (not (string= "no" (cdr (assoc :buffer params))))) + (org-export-latex-packages-alist + (append (cdr (assoc :packages params)) + org-export-latex-packages-alist))) + (cond + ((string-match "\\.png$" out-file) + (org-create-formula-image + body out-file org-format-latex-options in-buffer)) + ((string-match "\\.pdf$" out-file) + (org-babel-latex-body-to-tex-file tex-file body pdfheight pdfwidth) + (when (file-exists-p out-file) (delete-file out-file)) + (rename-file (org-babel-latex-tex-to-pdf tex-file) out-file)) + ((string-match "\\.\\([^\\.]+\\)$" out-file) + (error "can not create %s files, please specify a .png or .pdf file" + (match-string 1 out-file)))) + out-file) + body)) + +(defvar org-format-latex-header) +(defvar org-format-latex-header-extra) +(defvar org-export-latex-packages-alist) +(defvar org-export-latex-default-packages-alist) +(defun org-babel-latex-body-to-tex-file (tex-file body &optional height width) + "Place the contents of BODY into TEX-FILE. +Extracted from `org-create-formula-image' in org.el." + (with-temp-file tex-file + (insert (org-splice-latex-header + org-format-latex-header + (delq + nil + (mapcar + (lambda (el) (unless (and (listp el) (string= "hyperref" (cadr el))) + el)) + org-export-latex-default-packages-alist)) + org-export-latex-packages-alist + org-format-latex-header-extra) + (if height (concat "\n" (format "\\pdfpageheight %s" height)) "") + (if width (concat "\n" (format "\\pdfpagewidth %s" width)) "") + (if org-format-latex-header-extra + (concat "\n" org-format-latex-header-extra) + "") + "\n\\begin{document}\n" body "\n\\end{document}\n") + (org-export-latex-fix-inputenc))) + +(defvar org-export-pdf-logfiles) +(defvar org-latex-to-pdf-process) +(defvar org-export-pdf-remove-logfiles) +(defun org-babel-latex-tex-to-pdf (tex-file) + "Generate a pdf file according to the contents TEX-FILE. +Extracted from `org-export-as-pdf' in org-latex.el." + (let* ((wconfig (current-window-configuration)) + (default-directory (file-name-directory tex-file)) + (base (file-name-sans-extension tex-file)) + (pdffile (concat base ".pdf")) + (cmds org-latex-to-pdf-process) + (outbuf (get-buffer-create "*Org PDF LaTeX Output*")) + cmd) + (if (and cmds (symbolp cmds)) + (funcall cmds tex-file) + (while cmds + (setq cmd (pop cmds)) + (while (string-match "%b" cmd) + (setq cmd (replace-match + (save-match-data + (shell-quote-argument base)) + t t cmd))) + (while (string-match "%s" cmd) + (setq cmd (replace-match + (save-match-data + (shell-quote-argument tex-file)) + t t cmd))) + (shell-command cmd outbuf outbuf))) + (if (not (file-exists-p pdffile)) + (error "PDF file was not produced from %s" tex-file) + (set-window-configuration wconfig) + (when org-export-pdf-remove-logfiles + (dolist (ext org-export-pdf-logfiles) + (setq tex-file (concat base "." ext)) + (and (file-exists-p tex-file) (delete-file tex-file)))) + pdffile))) + +(defun org-babel-prep-session:latex (session params) + "Return an error because LaTeX doesn't support sesstions." + (error "LaTeX does not support sessions")) + +(provide 'ob-latex) + +;; arch-tag: 1f13f7e2-26de-4c24-9274-9f331d4c6ff3 + +;;; ob-latex.el ends here diff --git a/lisp/org/ob-lob.el b/lisp/org/ob-lob.el new file mode 100644 index 00000000000..f806668e2e8 --- /dev/null +++ b/lisp/org/ob-lob.el @@ -0,0 +1,116 @@ +;;; ob-lob.el --- functions supporting the Library of Babel + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte, Dan Davison +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; See the online documentation for more information +;; +;; http://orgmode.org/worg/org-contrib/babel/ + +;;; Code: +(require 'ob) +(require 'ob-table) + +(defvar org-babel-library-of-babel nil + "Library of source-code blocks. +This is an association list. Populate the library by adding +files to `org-babel-lob-files'.") + +(defcustom org-babel-lob-files '() + "Files used to populate the `org-babel-library-of-babel'. +To add files to this list use the `org-babel-lob-ingest' command." + :group 'org-babel + :type 'list) + +;;;###autoload +(defun org-babel-lob-ingest (&optional file) + "Add all source-blocks defined in FILE to `org-babel-library-of-babel'." + (interactive "f") + (org-babel-map-src-blocks file + (let* ((info (org-babel-get-src-block-info)) + (source-name (intern (nth 4 info)))) + (when source-name + (setq org-babel-library-of-babel + (cons (cons source-name info) + (assq-delete-all source-name org-babel-library-of-babel))))))) + +(defconst org-babel-lob-call-aliases '("lob" "call") + "Aliases to call a source block function. +If you change the value of this variable then your files may + become unusable by other org-babel users, and vice versa.") + +(defconst org-babel-lob-one-liner-regexp + (concat "^\\([ \t]*\\)#\\+\\(?:" + (mapconcat #'regexp-quote org-babel-lob-call-aliases "\\|") + "\\):[ \t]+\\([^\(\)\n]+\\)\(\\([^\n]*\\)\)[ \t]*\\([^\n]*\\)") + "Regexp to match calls to predefined source block functions.") + +;; functions for executing lob one-liners +;;;###autoload +(defun org-babel-lob-execute-maybe () + "Execute a Library of Babel source block, if appropriate. +Detect if this is context for a Library Of Babel source block and +if so then run the appropriate source block from the Library." + (interactive) + (let ((info (org-babel-lob-get-info))) + (if (nth 0 info) (progn (org-babel-lob-execute info) t) nil))) + +(add-hook 'org-ctrl-c-ctrl-c-hook 'org-babel-lob-execute-maybe) + +;;;###autoload +(defun org-babel-lob-get-info () + "Return a Library of Babel function call as a string. + +This function is analogous to org-babel-get-src-block-name. For +both functions, after they are called, (match-string 1) matches +the function name, and (match-string 2) matches the function +arguments inside the parentheses. I think perhaps these functions +should be renamed to bring out this similarity, perhaps involving +the word 'call'." + (let ((case-fold-search t)) + (save-excursion + (beginning-of-line 1) + (if (looking-at org-babel-lob-one-liner-regexp) + (append (mapcar #'org-babel-clean-text-properties + (list (format "%s(%s)" (match-string 2) (match-string 3)) + (match-string 4))) + (list (length (match-string 1)))))))) + +(defun org-babel-lob-execute (info) + "Execute the lob call specified by INFO." + (let ((params (org-babel-merge-params + org-babel-default-header-args + (org-babel-params-from-buffer) + (org-babel-params-from-properties) + (org-babel-parse-header-arguments + (org-babel-clean-text-properties + (concat ":var results=" (mapconcat #'identity (butlast info) " "))))))) + (org-babel-execute-src-block + nil (list "emacs-lisp" "results" params nil nil (nth 2 info))))) + +(provide 'ob-lob) + +;; arch-tag: ce0712c9-2147-4019-ba3f-42341b8b474b + +;;; ob-lob.el ends here diff --git a/lisp/org/ob-matlab.el b/lisp/org/ob-matlab.el new file mode 100644 index 00000000000..0728edf49dc --- /dev/null +++ b/lisp/org/ob-matlab.el @@ -0,0 +1,48 @@ +;;; ob-matlab.el --- org-babel support for matlab evaluation + +;; Copyright (C) 2010 Free Software Foundation, Inc. + +;; Author: Dan Davison +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Functions that are common to org-babel support for matlab and +;; octave are in org-babel-octave.el + +;;; Requirements: + +;; Matlab + +;; matlab.el required for interactive emacs sessions and matlab-mode +;; major mode for source code editing buffer +;; http://matlab-emacs.sourceforge.net/ + +;;; Code: +(require 'ob) +(require 'ob-octave) + +;; see ob-octave for matlab implementation + +(provide 'ob-matlab) + +;; arch-tag: 6b234299-c1f7-4eb1-ace8-7b93344065ac + +;;; ob-matlab.el ends here diff --git a/lisp/org/ob-mscgen.el b/lisp/org/ob-mscgen.el new file mode 100644 index 00000000000..a78e0b6bd68 --- /dev/null +++ b/lisp/org/ob-mscgen.el @@ -0,0 +1,89 @@ +;;; ob-msc.el --- org-babel functions for mscgen evaluation + +;; Copyright (C) 2010 Free Software Foundation, Inc. + +;; Author: Juan Pechiar +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: +;; +;; This software provides EMACS org-babel export support for message +;; sequence charts. The mscgen utility is used for processing the +;; sequence definition, and must therefore be installed in the system. +;; +;; Mscgen is available and documented at +;; http://www.mcternan.me.uk/mscgen/index.html +;; +;; This code is directly inspired by Eric Schulte's ob-dot.el +;; +;; Example: +;; +;; #+begin_src mscgen :file example.png +;; msc { +;; A,B; +;; A -> B [ label = "send message" ]; +;; A <- B [ label = "get answer" ]; +;; } +;; #+end_src +;; +;; Header for alternative file type: +;; +;; #+begin_src mscgen :file ex2.svg :filetype svg + +;; This differs from most standard languages in that +;; +;; 1) there is no such thing as a "session" in mscgen +;; 2) we are generally only going to return results of type "file" +;; 3) we are adding the "file" and "filetype" header arguments +;; 4) there are no variables + +;;; Code: +(require 'ob) +(require 'ob-eval) + +(defvar org-babel-default-header-args:mscgen + '((:results . "file") (:exports . "results")) + "Default arguments to use when evaluating a mscgen source block.") + +(defun org-babel-expand-body:mscgen (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." body) + +(defun org-babel-execute:mscgen (body params) + "Execute a block of Mscgen code with Babel. +This function is called by `org-babel-execute-src-block'. +Default filetype is png. Modify by setting :filetype parameter to +mscgen supported formats." + (let* ((out-file (or (cdr (assoc :file params)) "output.png" )) + (filetype (or (cdr (assoc :filetype params)) "png" ))) + (unless (cdr (assoc :file params)) + (error " +ERROR: no output file specified. Add \":file name.png\" to the src header")) + (org-babel-eval (concat "mscgen -T " filetype " -o " out-file) body) + out-file)) + +(defun org-babel-prep-session:mscgen (session params) + "Raise an error because Mscgen doesn't support sessions." + (error "Mscgen does not support sessions")) + +(provide 'ob-mscgen) + +;; arch-tag: 74695b1e-715f-4b5a-a3a9-d78ee39ba5c8 + +;;; ob-msc.el ends here diff --git a/lisp/org/ob-ocaml.el b/lisp/org/ob-ocaml.el new file mode 100644 index 00000000000..f5add5c5754 --- /dev/null +++ b/lisp/org/ob-ocaml.el @@ -0,0 +1,158 @@ +;;; ob-ocaml.el --- org-babel functions for ocaml evaluation + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating ocaml source code. This one will +;; be sort of tricky because ocaml programs must be compiled before +;; they can be run, but ocaml code can also be run through an +;; interactive interpreter. +;; +;; For now lets only allow evaluation using the ocaml interpreter. + +;;; Requirements: + +;; - tuareg-mode :: http://www-rocq.inria.fr/~acohen/tuareg/ + +;;; Code: +(require 'ob) +(require 'ob-comint) +(require 'comint) +(eval-when-compile (require 'cl)) + +(declare-function tuareg-run-caml "ext:tuareg" ()) +(declare-function tuareg-interactive-send-input "ext:tuareg" ()) + +(add-to-list 'org-babel-tangle-lang-exts '("ocaml" . "ml")) + +(defvar org-babel-default-header-args:ocaml '()) + +(defvar org-babel-ocaml-eoe-indicator "\"org-babel-ocaml-eoe\";;") +(defvar org-babel-ocaml-eoe-output "org-babel-ocaml-eoe") + +(defun org-babel-expand-body:ocaml (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (let ((vars (nth 1 (or processed-params (org-babel-process-params params))))) + (concat + (mapconcat + (lambda (pair) (format "let %s = %s;;" (car pair) + (org-babel-ocaml-elisp-to-ocaml (cdr pair)))) + vars "\n") "\n" body "\n"))) + +(defun org-babel-execute:ocaml (body params) + "Execute a block of Ocaml code with Babel." + (let* ((processed-params (org-babel-process-params params)) + (vars (nth 1 processed-params)) + (full-body (org-babel-expand-body:ocaml body params processed-params)) + (session (org-babel-prep-session:ocaml + (cdr (assoc :session params)) params)) + (raw (org-babel-comint-with-output + (session org-babel-ocaml-eoe-output t full-body) + (insert + (concat + (org-babel-chomp full-body)"\n"org-babel-ocaml-eoe-indicator)) + (tuareg-interactive-send-input))) + (clean + (car (let ((re (regexp-quote org-babel-ocaml-eoe-output)) out) + (delq nil (mapcar (lambda (line) + (if out + (progn (setq out nil) line) + (when (string-match re line) + (progn (setq out t) nil)))) + (mapcar #'org-babel-trim (reverse raw)))))))) + (org-babel-reassemble-table + (org-babel-ocaml-parse-output (org-babel-trim clean)) + (org-babel-pick-name + (nth 4 processed-params) (cdr (assoc :colnames params))) + (org-babel-pick-name + (nth 5 processed-params) (cdr (assoc :rownames params)))))) + +(defvar tuareg-interactive-buffer-name) +(defun org-babel-prep-session:ocaml (session params) + "Prepare SESSION according to the header arguments in PARAMS." + (require 'tuareg) + (let ((tuareg-interactive-buffer-name (if (and (not (string= session "none")) + (not (string= session "default")) + (stringp session)) + session + tuareg-interactive-buffer-name))) + (save-window-excursion (tuareg-run-caml) + (get-buffer tuareg-interactive-buffer-name)))) + +(defun org-babel-ocaml-elisp-to-ocaml (val) + "Return a string of ocaml code which evaluates to VAL." + (if (listp val) + (concat "[|" (mapconcat #'org-babel-ocaml-elisp-to-ocaml val "; ") "|]") + (format "%S" val))) + +(defun org-babel-ocaml-parse-output (output) + "Parse OUTPUT. +OUTPUT is string output from an ocaml process." + (let ((regexp "%s = \\(.+\\)$")) + (cond + ((string-match (format regexp "string") output) + (org-babel-read (match-string 1 output))) + ((or (string-match (format regexp "int") output) + (string-match (format regexp "float") output)) + (string-to-number (match-string 1 output))) + ((string-match (format regexp "list") output) + (org-babel-ocaml-read-list (match-string 1 output))) + ((string-match (format regexp "array") output) + (org-babel-ocaml-read-array (match-string 1 output))) + (t (message "don't recognize type of %s" output) output)))) + +(defun org-babel-ocaml-read-list (results) + "Convert RESULTS into an elisp table or string. +If the results look like a table, then convert them into an +Emacs-lisp table, otherwise return the results as a string." + (org-babel-read + (if (and (stringp results) (string-match "^\\[.+\\]$" results)) + (org-babel-read + (replace-regexp-in-string + "\\[" "(" (replace-regexp-in-string + "\\]" ")" (replace-regexp-in-string + "; " " " (replace-regexp-in-string + "'" "\"" results))))) + results))) + +(defun org-babel-ocaml-read-array (results) + "Convert RESULTS into an elisp table or string. +If the results look like a table, then convert them into an +Emacs-lisp table, otherwise return the results as a string." + (org-babel-read + (if (and (stringp results) (string-match "^\\[.+\\]$" results)) + (org-babel-read + (concat + "'" (replace-regexp-in-string + "\\[|" "(" (replace-regexp-in-string + "|\\]" ")" (replace-regexp-in-string + "; " " " (replace-regexp-in-string + "'" "\"" results)))))) + results))) + +(provide 'ob-ocaml) + +;; arch-tag: 2e815f4d-365e-4d69-b1df-dd17fdd7b7b7 + +;;; ob-ocaml.el ends here diff --git a/lisp/org/ob-octave.el b/lisp/org/ob-octave.el new file mode 100644 index 00000000000..2cdbaa0468c --- /dev/null +++ b/lisp/org/ob-octave.el @@ -0,0 +1,266 @@ +;;; ob-octave.el --- org-babel functions for octave and matlab evaluation + +;; Copyright (C) 2010 Free Software Foundation, Inc. + +;; Author: Dan Davison +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;;; Requirements: + +;; octave +;; octave-mode.el and octave-inf.el come with GNU emacs + +;;; Code: +(require 'ob) +(require 'ob-ref) +(require 'ob-comint) +(require 'ob-eval) +(eval-when-compile (require 'cl)) + +(declare-function matlab-shell "ext:matlab-mode") +(declare-function matlab-shell-run-region "ext:matlab-mode") + +(defvar org-babel-default-header-args:matlab '()) +(defvar org-babel-default-header-args:octave '()) + +(defvar org-babel-matlab-shell-command "matlab -nosplash" + "Shell command to run matlab as an external process.") +(defvar org-babel-octave-shell-command "octave -q" + "Shell command to run octave as an external process.") + +(defun org-babel-expand-body:matlab (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (org-babel-expand-body:octave body params processed-params)) +(defun org-babel-expand-body:octave (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (let ((vars (nth 1 (or processed-params (org-babel-process-params params))))) + (concat + (mapconcat + (lambda (pair) + (format "%s=%s" + (car pair) + (org-babel-octave-var-to-octave (cdr pair)))) + vars "\n") "\n" body "\n"))) + +(defvar org-babel-matlab-with-emacs-link nil + "If non-nil use matlab-shell-run-region for session evaluation. + This will use EmacsLink if (matlab-with-emacs-link) evaluates + to a non-nil value.") + +(defvar org-babel-matlab-emacs-link-wrapper-method + "%s +if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans); fclose(fid); +else, save -ascii %s ans +end +delete('%s') +") +(defvar org-babel-octave-wrapper-method + "%s +if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans); fclose(fid); +else, save -ascii %s ans +end") + +(defvar org-babel-octave-eoe-indicator "\'org_babel_eoe\'") + +(defvar org-babel-octave-eoe-output "ans = org_babel_eoe") + +(defun org-babel-execute:matlab (body params) + "Execute a block of matlab code with Babel." + (require 'matlab) + (org-babel-execute:octave body params 'matlab)) +(defun org-babel-execute:octave (body params &optional matlabp) + "Execute a block of octave code with Babel." + (let* ((processed-params (org-babel-process-params params)) + (session + (funcall (intern (format "org-babel-%s-initiate-session" + (if matlabp "matlab" "octave"))) + (nth 0 processed-params) params)) + (vars (nth 1 processed-params)) + (result-params (nth 2 processed-params)) + (result-type (nth 3 processed-params)) + (out-file (cdr (assoc :file params))) + (augmented-body + (org-babel-expand-body:octave body params processed-params)) + (result (org-babel-octave-evaluate + session augmented-body result-type matlabp))) + (or out-file + (org-babel-reassemble-table + result + (org-babel-pick-name + (nth 4 processed-params) (cdr (assoc :colnames params))) + (org-babel-pick-name + (nth 5 processed-params) (cdr (assoc :rownames params))))))) + +(defun org-babel-prep-session:matlab (session params) + "Prepare SESSION according to PARAMS." + (require 'matlab) + (org-babel-prep-session:octave session params 'matlab)) +(defun org-babel-octave-var-to-octave (var) + "Convert an emacs-lisp value into an octave variable. +Converts an emacs-lisp variable into a string of octave code +specifying a variable of the same value." + (if (listp var) + (concat "[" (mapconcat #'org-babel-octave-var-to-octave var ", ") "]") + (format "%S" var))) + +(defun org-babel-prep-session:octave (session params &optional matlabp) + "Prepare SESSION according to the header arguments specified in PARAMS." + (let* ((session (org-babel-octave-initiate-session session params matlabp)) + (vars (org-babel-ref-variables params)) + (var-lines (mapcar + (lambda (pair) + (format "%s=%s" + (car pair) + (org-babel-octave-var-to-octave (cdr pair)))) + vars))) + (org-babel-comint-in-buffer session + (mapc (lambda (var) + (end-of-line 1) (insert var) (comint-send-input nil t) + (org-babel-comint-wait-for-output session)) var-lines)) + session)) + +(defun org-babel-matlab-initiate-session (&optional session params) + "Create a matlab inferior process buffer. +If there is not a current inferior-process-buffer in SESSION then +create. Return the initialized session." + (require 'matlab) + (org-babel-octave-initiate-session session params 'matlab)) +(defun org-babel-octave-initiate-session (&optional session params matlabp) + "Create an octave inferior process buffer. +If there is not a current inferior-process-buffer in SESSION then +create. Return the initialized session." + (require 'octave-inf) + (unless (string= session "none") + (let ((session (or session + (if matlabp "*Inferior Matlab*" "*Inferior Octave*")))) + (if (org-babel-comint-buffer-livep session) session + (save-window-excursion + (if matlabp (unless org-babel-matlab-with-emacs-link (matlab-shell)) + (run-octave)) + (rename-buffer (if (bufferp session) (buffer-name session) + (if (stringp session) session (buffer-name)))) + (current-buffer)))))) + +(defun org-babel-octave-evaluate + (session body result-type lang &optional matlabp) + "Pass BODY to the octave process in SESSION. +If RESULT-TYPE equals 'output then return the outputs of the +statements in BODY, if RESULT-TYPE equals 'value then return the +value of the last statement in BODY, as elisp." + (if session + (org-babel-octave-evaluate-session session body result-type matlabp) + (org-babel-octave-evaluate-external-process body result-type matlabp))) + +(defun org-babel-octave-evaluate-external-process (body result-type matlabp) + "Evaluate BODY in an external octave process." + (let ((cmd (if matlabp + org-babel-matlab-shell-command + org-babel-octave-shell-command))) + (case result-type + (output (org-babel-eval cmd body)) + (value (let ((tmp-file (make-temp-file "org-babel-results-"))) + (org-babel-eval + cmd + (format org-babel-octave-wrapper-method body tmp-file tmp-file)) + (org-babel-eval-read-file tmp-file)))))) + +(defun org-babel-octave-evaluate-session + (session body result-type &optional matlabp) + "Evaluate BODY in SESSION." + (let* ((tmp-file (make-temp-file "org-babel-results-")) + (wait-file (make-temp-file "org-babel-matlab-emacs-link-wait-signal-")) + (full-body + (case result-type + (output + (mapconcat + #'org-babel-chomp + (list body org-babel-octave-eoe-indicator) "\n")) + (value + (if (and matlabp org-babel-matlab-with-emacs-link) + (concat + (format org-babel-matlab-emacs-link-wrapper-method + body tmp-file tmp-file wait-file) "\n") + (mapconcat + #'org-babel-chomp + (list (format org-babel-octave-wrapper-method + body tmp-file tmp-file) + org-babel-octave-eoe-indicator) "\n"))))) + (raw (if (and matlabp org-babel-matlab-with-emacs-link) + (save-window-excursion + (with-temp-buffer + (insert full-body) + (write-region "" 'ignored wait-file nil nil nil 'excl) + (matlab-shell-run-region (point-min) (point-max)) + (message "Waiting for Matlab Emacs Link") + (while (file-exists-p wait-file) (sit-for 0.01)) + "")) ;; matlab-shell-run-region doesn't seem to + ;; make *matlab* buffer contents easily + ;; available, so :results output currently + ;; won't work + (org-babel-comint-with-output + (session + (if matlabp + org-babel-octave-eoe-indicator + org-babel-octave-eoe-output) + t full-body) + (insert full-body) (comint-send-input nil t)))) results) + (case result-type + (value + (org-babel-octave-import-elisp-from-file + (org-babel-maybe-remote-file tmp-file))) + (output + (progn + (setq results + (if matlabp + (cdr (reverse (delq "" (mapcar + #'org-babel-octave-read-string + (mapcar #'org-babel-trim raw))))) + (cdr (member org-babel-octave-eoe-output + (reverse (mapcar + #'org-babel-octave-read-string + (mapcar #'org-babel-trim raw))))))) + (mapconcat #'identity (reverse results) "\n")))))) + +(defun org-babel-octave-import-elisp-from-file (file-name) + "Import data from FILE-NAME. +This removes initial blank and comment lines and then calls +`org-babel-import-elisp-from-file'." + (let ((temp-file (make-temp-file "org-babel-results-")) beg end) + (with-temp-file temp-file + (insert-file-contents file-name) + (re-search-forward "^[ \t]*[^# \t]" nil t) + (if (< (setq beg (point-min)) + (setq end (point-at-bol))) + (delete-region beg end))) + (org-babel-import-elisp-from-file temp-file))) + +(defun org-babel-octave-read-string (string) + "Strip \\\"s from around octave string" + (if (string-match "^\"\\([^\000]+\\)\"$" string) + (match-string 1 string) + string)) + +(provide 'ob-octave) + +;; arch-tag: d8e5f68b-ba13-440a-a495-b653e989e704 + +;;; ob-octave.el ends here diff --git a/lisp/org/ob-perl.el b/lisp/org/ob-perl.el new file mode 100644 index 00000000000..bfba158d4a8 --- /dev/null +++ b/lisp/org/ob-perl.el @@ -0,0 +1,120 @@ +;;; ob-perl.el --- org-babel functions for perl evaluation + +;; Copyright (C) 2009, 2010 Free Software Foundation + +;; Author: Dan Davison, Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating perl source code. + +;;; Code: +(require 'ob) +(require 'ob-eval) +(eval-when-compile (require 'cl)) + +(add-to-list 'org-babel-tangle-lang-exts '("perl" . "pl")) + +(defvar org-babel-default-header-args:perl '()) + +(defvar org-babel-perl-command "perl" + "Name of command to use for executing perl code.") + +(defun org-babel-expand-body:perl (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (let ((vars (nth 1 (or processed-params (org-babel-process-params params))))) + (concat + (mapconcat ;; define any variables + (lambda (pair) + (format "$%s=%s;" + (car pair) + (org-babel-perl-var-to-perl (cdr pair)))) + vars "\n") "\n" (org-babel-trim body) "\n"))) + +(defun org-babel-execute:perl (body params) + "Execute a block of Perl code with Babel. +This function is called by `org-babel-execute-src-block'." + (let* ((processed-params (org-babel-process-params params)) + (session (nth 0 processed-params)) + (vars (nth 1 processed-params)) + (result-params (nth 2 processed-params)) + (result-type (nth 3 processed-params)) + (full-body (org-babel-expand-body:perl + body params processed-params)) + (session (org-babel-perl-initiate-session session))) + (org-babel-reassemble-table + (org-babel-perl-evaluate session full-body result-type) + (org-babel-pick-name + (nth 4 processed-params) (cdr (assoc :colnames params))) + (org-babel-pick-name + (nth 5 processed-params) (cdr (assoc :rownames params)))))) + +(defun org-babel-prep-session:perl (session params) + "Prepare SESSION according to the header arguments in PARAMS." + (error "Sessions are not supported for Perl.")) + +;; helper functions + +(defun org-babel-perl-var-to-perl (var) + "Convert an elisp value to a perl variable. +The elisp value, VAR, is converted to a string of perl source code +specifying a var of the same value." + (if (listp var) + (concat "[" (mapconcat #'org-babel-perl-var-to-perl var ", ") "]") + (format "%S" var))) + +(defvar org-babel-perl-buffers '(:default . nil)) + +(defun org-babel-perl-initiate-session (&optional session params) + "Return nil because sessions are not supported by perl" +nil) + +(defvar org-babel-perl-wrapper-method + " +sub main { +%s +} +@r = main; +open(o, \">%s\"); +print o join(\"\\n\", @r), \"\\n\"") + +(defvar org-babel-perl-pp-wrapper-method + nil) + +(defun org-babel-perl-evaluate (session body &optional result-type) + "Pass BODY to the Perl process in SESSION. +If RESULT-TYPE equals 'output then return a list of the outputs +of the statements in BODY, if RESULT-TYPE equals 'value then +return the value of the last statement in BODY, as elisp." + (when session (error "Sessions are not supported for Perl.")) + (case result-type + (output (org-babel-eval org-babel-perl-command body)) + (value (let ((tmp-file (make-temp-file "org-babel-perl-results-"))) + (org-babel-eval + org-babel-perl-command + (format org-babel-perl-wrapper-method body tmp-file)) + (org-babel-eval-read-file tmp-file))))) + +(provide 'ob-perl) + +;; arch-tag: 88ef9396-d857-4dc3-8946-5a72bdfa2337 + +;;; ob-perl.el ends here diff --git a/lisp/org/ob-python.el b/lisp/org/ob-python.el new file mode 100644 index 00000000000..c082188bea7 --- /dev/null +++ b/lisp/org/ob-python.el @@ -0,0 +1,276 @@ +;;; ob-python.el --- org-babel functions for python evaluation + +;; Copyright (C) 2009, 2010 Free Software Foundation + +;; Author: Eric Schulte, Dan Davison +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating python source code. + +;;; Code: +(require 'ob) +(require 'ob-ref) +(require 'ob-comint) +(require 'ob-eval) +(eval-when-compile (require 'cl)) + +(declare-function org-remove-indentation "org" ) +(declare-function py-shell "ext:python-mode" (&optional argprompt)) +(declare-function run-python "ext:python" (&optional cmd noshow new)) + +(add-to-list 'org-babel-tangle-lang-exts '("python" . "py")) + +(defvar org-babel-default-header-args:python '()) + +(defvar org-babel-python-command "python" + "Name of command for executing python code.") + +(defvar org-babel-python-mode (if (featurep 'xemacs) 'python-mode 'python) + "Preferred python mode for use in running python interactively.") + +(defun org-babel-expand-body:python (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (concat + (mapconcat ;; define any variables + (lambda (pair) + (format "%s=%s" + (car pair) + (org-babel-python-var-to-python (cdr pair)))) + (nth 1 (or processed-params (org-babel-process-params params))) "\n") + "\n" (org-babel-trim body) "\n")) + +(defun org-babel-execute:python (body params) + "Execute a block of Python code with Babel. +This function is called by `org-babel-execute-src-block'." + (let* ((processed-params (org-babel-process-params params)) + (session (org-babel-python-initiate-session (first processed-params))) + (result-params (nth 2 processed-params)) + (result-type (nth 3 processed-params)) + (full-body (org-babel-expand-body:python + body params processed-params)) + (result (org-babel-python-evaluate + session full-body result-type result-params))) + (or (cdr (assoc :file params)) + (org-babel-reassemble-table + result + (org-babel-pick-name (nth 4 processed-params) + (cdr (assoc :colnames params))) + (org-babel-pick-name (nth 5 processed-params) + (cdr (assoc :rownames params))))))) + +(defun org-babel-prep-session:python (session params) + "Prepare SESSION according to the header arguments in PARAMS." + (let* ((session (org-babel-python-initiate-session session)) + (vars (org-babel-ref-variables params)) + (var-lines (mapcar ;; define any variables + (lambda (pair) + (format "%s=%s" + (car pair) + (org-babel-python-var-to-python (cdr pair)))) + vars))) + (org-babel-comint-in-buffer session + (mapc (lambda (var) + (end-of-line 1) (insert var) (comint-send-input) + (org-babel-comint-wait-for-output session)) var-lines)) + session)) + +(defun org-babel-load-session:python (session body params) + "Load BODY into SESSION." + (save-window-excursion + (let ((buffer (org-babel-prep-session:python session params))) + (with-current-buffer buffer + (goto-char (process-mark (get-buffer-process (current-buffer)))) + (insert (org-babel-chomp body))) + buffer))) + +;; helper functions + +(defun org-babel-python-var-to-python (var) + "Convert an elisp value to a python variable. +Convert an elisp value, VAR, into a string of python source code +specifying a variable of the same value." + (if (listp var) + (concat "[" (mapconcat #'org-babel-python-var-to-python var ", ") "]") + (if (equal var 'hline) + "None" + (format + (if (and (stringp var) (string-match "[\n\r]" var)) "\"\"%S\"\"" "%S") + var)))) + +(defun org-babel-python-table-or-string (results) + "Convert RESULTS into an appropriate elisp value. +If the results look like a list or tuple, then convert them into an +Emacs-lisp table, otherwise return the results as a string." + ((lambda (res) + (if (listp res) + (mapcar (lambda (el) (if (equal el 'None) 'hline el)) res) + res)) + (org-babel-read + (if (or (string-match "^\\[.+\\]$" results) + (string-match "^(.+)$" results)) + (org-babel-read + (concat "'" + (replace-regexp-in-string + "\\[" "(" (replace-regexp-in-string + "\\]" ")" (replace-regexp-in-string + ", " " " (replace-regexp-in-string + "'" "\"" results t)))))) + results)))) + +(defvar org-babel-python-buffers '((:default . nil))) + +(defun org-babel-python-session-buffer (session) + "Return the buffer associated with SESSION." + (cdr (assoc session org-babel-python-buffers))) + +(defun org-babel-python-initiate-session-by-key (&optional session) + "Initiate a python session. +If there is not a current inferior-process-buffer in SESSION +then create. Return the initialized session." + (require org-babel-python-mode) + (save-window-excursion + (let* ((session (if session (intern session) :default)) + (python-buffer (org-babel-python-session-buffer session))) + (cond + ((and (equal 'python org-babel-python-mode) + (fboundp 'run-python)) ; python.el + (run-python)) + ((and (equal 'python-mode org-babel-python-mode) + (fboundp 'py-shell)) ; python-mode.el + ;; `py-shell' creates a buffer whose name is the value of + ;; `py-which-bufname' with '*'s at the beginning and end + (let* ((bufname (if python-buffer + (replace-regexp-in-string ;; zap surrounding * + "^\\*\\([^*]+\\)\\*$" "\\1" python-buffer) + (concat "Python-" (symbol-name session)))) + (py-which-bufname bufname)) + (py-shell) + (setq python-buffer (concat "*" bufname "*")))) + (t + (error "No function available for running an inferior python."))) + (setq org-babel-python-buffers + (cons (cons session python-buffer) + (assq-delete-all session org-babel-python-buffers))) + session))) + +(defun org-babel-python-initiate-session (&optional session params) + "Create a session named SESSION according to PARAMS." + (unless (string= session "none") + (org-babel-python-session-buffer + (org-babel-python-initiate-session-by-key session)))) + +(defvar org-babel-python-eoe-indicator "'org_babel_python_eoe'" + "A string to indicate that evaluation has completed.") +(defvar org-babel-python-wrapper-method + " +def main(): +%s + +open('%s', 'w').write( str(main()) )") +(defvar org-babel-python-pp-wrapper-method + " +import pprint +def main(): +%s + +open('%s', 'w').write( pprint.pformat(main()) )") + +(defun org-babel-python-evaluate + (buffer body &optional result-type result-params) + "Pass BODY to the Python process in BUFFER. +If RESULT-TYPE equals 'output then return a list of the outputs +of the statements in BODY, if RESULT-TYPE equals 'value then +return the value of the last statement in BODY, as elisp." + (if (not buffer) + ;; external process evaluation + (case result-type + (output (org-babel-eval org-babel-python-command body)) + (value (let ((tmp-file (make-temp-file "org-babel-python-results-"))) + (org-babel-eval org-babel-python-command + (format + (if (member "pp" result-params) + org-babel-python-pp-wrapper-method + org-babel-python-wrapper-method) + (mapconcat + (lambda (line) (format "\t%s" line)) + (split-string + (org-remove-indentation + (org-babel-trim body)) + "[\r\n]") "\n") + tmp-file)) + ((lambda (raw) + (if (or (member "code" result-params) + (member "pp" result-params)) + raw + (org-babel-python-table-or-string raw))) + (org-babel-eval-read-file tmp-file))))) + ;; comint session evaluation + (flet ((dump-last-value (tmp-file pp) + (mapc + (lambda (statement) (insert statement) (comint-send-input)) + (if pp + (list + "import pp" + (format "open('%s', 'w').write(pprint.pformat(_))" tmp-file)) + (list (format "open('%s', 'w').write(str(_))" tmp-file))))) + (input-body (body) + (mapc (lambda (statement) (insert statement) (comint-send-input)) + (split-string (org-babel-trim body) "[\r\n]+")) + (comint-send-input) (comint-send-input))) + (case result-type + (output + (mapconcat + #'org-babel-trim + (butlast + (org-babel-comint-with-output + (buffer org-babel-python-eoe-indicator t body) + (let ((comint-process-echoes nil)) + (input-body body) + (insert org-babel-python-eoe-indicator) + (comint-send-input))) 2) "\n")) + (value + ((lambda (results) + (if (or (member "code" result-params) (member "pp" result-params)) + results + (org-babel-python-table-or-string results))) + (let ((tmp-file (make-temp-file "org-babel-python-results-"))) + (org-babel-comint-with-output + (buffer org-babel-python-eoe-indicator t body) + (let ((comint-process-echoes nil)) + (input-body body) + (dump-last-value tmp-file (member "pp" result-params)) + (comint-send-input) (comint-send-input) + (insert org-babel-python-eoe-indicator) + (comint-send-input))) + (org-babel-eval-read-file tmp-file)))))))) + +(defun org-babel-python-read-string (string) + "Strip 's from around python string" + (if (string-match "^'\\([^\000]+\\)'$" string) + (match-string 1 string) + string)) + +(provide 'ob-python) + +;; arch-tag: f19b6c3d-dfcb-4a1a-9ce0-45ade1ebc212 + +;;; ob-python.el ends here diff --git a/lisp/org/ob-ref.el b/lisp/org/ob-ref.el new file mode 100644 index 00000000000..4c344e6761e --- /dev/null +++ b/lisp/org/ob-ref.el @@ -0,0 +1,242 @@ +;;; ob-ref.el --- org-babel functions for referencing external data + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte, Dan Davison +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Functions for referencing data from the header arguments of a +;; org-babel block. The syntax of such a reference should be + +;; #+VAR: variable-name=file:resource-id + +;; - variable-name :: the name of the variable to which the value +;; will be assigned + +;; - file :: path to the file containing the resource, or omitted if +;; resource is in the current file + +;; - resource-id :: the id or name of the resource + +;; So an example of a simple src block referencing table data in the +;; same file would be + +;; #+TBLNAME: sandbox +;; | 1 | 2 | 3 | +;; | 4 | org-babel | 6 | +;; +;; #+begin_src emacs-lisp :var table=sandbox +;; (message table) +;; #+end_src + +;;; Code: +(require 'ob) +(eval-when-compile + (require 'cl)) + +(declare-function org-remove-if-not "org" (predicate seq)) +(declare-function org-at-table-p "org" (&optional table-type)) +(declare-function org-count "org" (CL-ITEM CL-SEQ)) + +(defun org-babel-ref-variables (params) + "Convert PARAMS to variable names and values. +Takes a parameter alist, and return an alist of variable names, +and the emacs-lisp representation of the related value." + (let ((assignments + (delq nil (mapcar (lambda (pair) (if (eq (car pair) :var) (cdr pair))) params))) + (others + (delq nil (mapcar (lambda (pair) (unless (eq :var (car pair)) pair)) params)))) + (mapcar (lambda (assignment) (org-babel-ref-parse assignment)) assignments))) + +(defvar org-babel-ref-split-regexp + "[ \f\t\n\r\v]*\\(.+?\\)[ \f\t\n\r\v]*=[ \f\t\n\r\v]*\\(.+\\)[ \f\t\n\r\v]*") + +(defun org-babel-ref-parse (assignment &optional params) + "Parse a variable ASSIGNMENT in a header argument. +If the right hand side of the assignment has a literal value +return that value, otherwise interpret as a reference to an +external resource and find it's value using +`org-babel-ref-resolve-reference'. Return a list with two +elements. The first element of the list will be the name of the +variable, and the second will be an emacs-lisp representation of +the value of the variable." + (if (string-match org-babel-ref-split-regexp assignment) + (let ((var (match-string 1 assignment)) + (ref (match-string 2 assignment))) + (cons (intern var) + ((lambda (val) + (if (equal :ob-must-be-reference val) + (org-babel-ref-resolve-reference ref params) + val)) (org-babel-ref-literal ref)))))) + +(defun org-babel-ref-literal (ref) + "Return the value of REF if it is a literal value. +Determine if the right side of a header argument variable +assignment is a literal value or is a reference to some external +resource. REF should be a string of the right hand side of the +assignment. If REF is literal then return it's value, otherwise +return nil." + (let ((out (org-babel-read ref))) + (if (equal out ref) + (if (string-match "^\".+\"$" ref) + (read ref) + :ob-must-be-reference) + out))) + +(defvar org-babel-library-of-babel) +(defun org-babel-ref-resolve-reference (ref &optional params) + "Resolve the reference REF and return its value." + (save-excursion + (let ((case-fold-search t) + type args new-refere new-referent result lob-info split-file split-ref + index index-row index-col) + ;; if ref is indexed grab the indices -- beware nested indices + (when (and (string-match "\\[\\(.+\\)\\]" ref) + (let ((str (substring ref 0 (match-beginning 0)))) + (= (org-count ?( str) (org-count ?) str)))) + (setq index (match-string 1 ref)) + (setq ref (substring ref 0 (match-beginning 0)))) + ;; assign any arguments to pass to source block + (when (string-match "^\\(.+?\\)\(\\(.*\\)\)$" ref) + (setq new-refere (match-string 1 ref)) + (setq new-referent (match-string 2 ref)) + ;; (message "new-refere=%S, new-referent=%S" new-refere new-referent) ;; debugging + (when (> (length new-refere) 0) + (if (> (length new-referent) 0) + (setq args (mapcar (lambda (ref) (cons :var ref)) + (org-babel-ref-split-args new-referent)))) + ;; (message "args=%S" args) ;; debugging + (setq ref new-refere))) + (when (string-match "^\\(.+\\):\\(.+\\)$" ref) + (setq split-file (match-string 1 ref)) + (setq split-ref (match-string 2 ref)) + (find-file split-file) (setq ref split-ref)) + (save-restriction + (widen) + (goto-char (point-min)) + (if (let ((result_regexp (concat "^[ \t]*#\\+\\(TBLNAME\\|RESNAME\\|RESULTS\\):[ \t]*" + (regexp-quote ref) "[ \t]*$")) + (regexp (concat org-babel-src-name-regexp + (regexp-quote ref) "\\(\(.*\)\\)?" "[ \t]*$"))) + ;; goto ref in the current buffer + (or (and (not args) + (or (re-search-forward result_regexp nil t) + (re-search-backward result_regexp nil t))) + (re-search-forward regexp nil t) + (re-search-backward regexp nil t) + ;; check the Library of Babel + (setq lob-info (cdr (assoc (intern ref) org-babel-library-of-babel))))) + (unless lob-info (goto-char (match-beginning 0))) + ;; ;; TODO: allow searching for names in other buffers + ;; (setq id-loc (org-id-find ref 'marker) + ;; buffer (marker-buffer id-loc) + ;; loc (marker-position id-loc)) + ;; (move-marker id-loc nil) + (error "reference '%s' not found in this buffer" ref)) + (if lob-info + (setq type 'lob) + (while (not (setq type (org-babel-ref-at-ref-p))) + (forward-line 1) + (beginning-of-line) + (if (or (= (point) (point-min)) (= (point) (point-max))) + (error "reference not found")))) + (setq params (org-babel-merge-params params args '((:results . "silent")))) + (setq result + (case type + ('results-line (org-babel-read-result)) + ('table (org-babel-read-table)) + ('file (org-babel-read-link)) + ('source-block (org-babel-execute-src-block nil nil params)) + ('lob (org-babel-execute-src-block nil lob-info params)))) + (if (symbolp result) + (format "%S" result) + (if (and index (listp result)) + (org-babel-ref-index-list index result) + result)))))) + +(defun org-babel-ref-index-list (index lis) + "Return the subset of LIS indexed by INDEX. + +Indices are 0 based and negative indices count from the end of +LIS, so 0 references the first element of LIS and -1 references +the last. If INDEX is separated by \",\"s then each \"portion\" +is assumed to index into the next deepest nesting or dimension. + +A valid \"portion\" can consist of either an integer index, two +integers separated by a \":\" in which case the entire range is +returned, or an empty string or \"*\" both of which are +interpreted to mean the entire range and as such are equivalent +to \"0:-1\"." + (if (and (> (length index) 0) (string-match "^\\([^,]*\\),?" index)) + (let ((ind-re "\\(\\([-[:digit:]]+\\):\\([-[:digit:]]+\\)\\|\*\\)") + (length (length lis)) + (portion (match-string 1 index)) + (remainder (substring index (match-end 0)))) + (flet ((wrap (num) (if (< num 0) (+ length num) num)) + (open (ls) (if (and (listp ls) (= (length ls) 1)) (car ls) ls))) + (open + (mapcar + (lambda (sub-lis) (org-babel-ref-index-list remainder sub-lis)) + (if (or (= 0 (length portion)) (string-match ind-re portion)) + (mapcar + (lambda (n) (nth n lis)) + (apply 'number-sequence + (if (and (> (length portion) 0) (match-string 2 portion)) + (list + (wrap (string-to-number (match-string 2 portion))) + (wrap (string-to-number (match-string 3 portion)))) + (list (wrap 0) (wrap -1))))) + (list (nth (wrap (string-to-number portion)) lis))))))) + lis)) + +(defun org-babel-ref-split-args (arg-string) + "Split ARG-STRING into top-level arguments of balanced parenthesis." + (let ((index 0) (depth 0) (buffer "") holder return) + ;; crawl along string, splitting at any ","s which are on the top level + (while (< index (length arg-string)) + (setq holder (substring arg-string index (+ 1 index))) + (setq buffer (concat buffer holder)) + (setq index (+ 1 index)) + (cond + ((string= holder ",") + (when (= depth 0) + (setq return (reverse (cons (substring buffer 0 -1) return))) + (setq buffer ""))) + ((or (string= holder "(") (string= holder "[")) (setq depth (+ depth 1))) + ((or (string= holder ")") (string= holder "]")) (setq depth (- depth 1))))) + (mapcar #'org-babel-trim (reverse (cons buffer return))))) + +(defvar org-bracket-link-regexp) +(defun org-babel-ref-at-ref-p () + "Return the type of reference located at point. +Return nil if none of the supported reference types are found. +Supported reference types are tables and source blocks." + (cond ((org-at-table-p) 'table) + ((looking-at "^[ \t]*#\\+BEGIN_SRC") 'source-block) + ((looking-at org-bracket-link-regexp) 'file) + ((looking-at org-babel-result-regexp) 'results-line))) + +(provide 'ob-ref) + +;; arch-tag: ace4a4f4-ea38-4dac-8fe6-6f52fcc43b6d + +;;; ob-ref.el ends here diff --git a/lisp/org/ob-ruby.el b/lisp/org/ob-ruby.el new file mode 100644 index 00000000000..e557c80ef1a --- /dev/null +++ b/lisp/org/ob-ruby.el @@ -0,0 +1,254 @@ +;;; ob-ruby.el --- org-babel functions for ruby evaluation + +;; Copyright (C) 2009, 2010 Free Software Foundation + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating ruby source code. + +;;; Requirements: + +;; - ruby and irb executables :: http://www.ruby-lang.org/ +;; +;; - ruby-mode :: Can be installed through ELPA, or from +;; http://github.com/eschulte/rinari/raw/master/util/ruby-mode.el +;; +;; - inf-ruby mode :: Can be installed through ELPA, or from +;; http://github.com/eschulte/rinari/raw/master/util/inf-ruby.el + +;;; Code: +(require 'ob) +(require 'ob-ref) +(require 'ob-comint) +(require 'ob-eval) +(eval-when-compile (require 'cl)) + +(declare-function run-ruby "ext:inf-ruby" (&optional command name)) + +(add-to-list 'org-babel-tangle-lang-exts '("ruby" . "rb")) + +(defvar org-babel-default-header-args:ruby '()) + +(defvar org-babel-ruby-command "ruby" + "Name of command to use for executing ruby code.") + +(defun org-babel-expand-body:ruby (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (require 'inf-ruby) + (let ((vars (nth 1 (or processed-params (org-babel-process-params params))))) + (concat + (mapconcat ;; define any variables + (lambda (pair) + (format "%s=%s" + (car pair) + (org-babel-ruby-var-to-ruby (cdr pair)))) + vars "\n") "\n" body "\n"))) + +(defun org-babel-execute:ruby (body params) + "Execute a block of Ruby code with Babel. +This function is called by `org-babel-execute-src-block'." + (let* ((processed-params (org-babel-process-params params)) + (session (org-babel-ruby-initiate-session (first processed-params))) + (result-params (nth 2 processed-params)) + (result-type (nth 3 processed-params)) + (full-body (org-babel-expand-body:ruby + body params processed-params)) + (result (org-babel-ruby-evaluate + session full-body result-type result-params))) + (or (cdr (assoc :file params)) + (org-babel-reassemble-table + result + (org-babel-pick-name (nth 4 processed-params) + (cdr (assoc :colnames params))) + (org-babel-pick-name (nth 5 processed-params) + (cdr (assoc :rownames params))))))) + +(defun org-babel-prep-session:ruby (session params) + "Prepare SESSION according to the header arguments specified in PARAMS." + ;; (message "params=%S" params) ;; debugging + (let* ((session (org-babel-ruby-initiate-session session)) + (vars (org-babel-ref-variables params)) + (var-lines (mapcar ;; define any variables + (lambda (pair) + (format "%s=%s" + (car pair) + (org-babel-ruby-var-to-ruby (cdr pair)))) + vars))) + (org-babel-comint-in-buffer session + (sit-for .5) (goto-char (point-max)) + (mapc (lambda (var) + (insert var) (comint-send-input nil t) + (org-babel-comint-wait-for-output session) + (sit-for .1) (goto-char (point-max))) var-lines)) + session)) + +(defun org-babel-load-session:ruby (session body params) + "Load BODY into SESSION." + (save-window-excursion + (let ((buffer (org-babel-prep-session:ruby session params))) + (with-current-buffer buffer + (goto-char (process-mark (get-buffer-process (current-buffer)))) + (insert (org-babel-chomp body))) + buffer))) + +;; helper functions + +(defun org-babel-ruby-var-to-ruby (var) + "Convert VAR into a ruby variable. +Convert an elisp value into a string of ruby source code +specifying a variable of the same value." + (if (listp var) + (concat "[" (mapconcat #'org-babel-ruby-var-to-ruby var ", ") "]") + (format "%S" var))) + +(defun org-babel-ruby-table-or-string (results) + "Convert RESULTS into an appropriate elisp value. +If RESULTS look like a table, then convert them into an +Emacs-lisp table, otherwise return the results as a string." + (org-babel-read + (if (and (stringp results) (string-match "^\\[.+\\]$" results)) + (org-babel-read + (concat "'" + (replace-regexp-in-string + "\\[" "(" (replace-regexp-in-string + "\\]" ")" (replace-regexp-in-string + ", " " " (replace-regexp-in-string + "'" "\"" results)))))) + results))) + +(defun org-babel-ruby-initiate-session (&optional session params) + "Initiate a ruby session. +If there is not a current inferior-process-buffer in SESSION +then create one. Return the initialized session." + (require 'inf-ruby) + (unless (string= session "none") + (let ((session-buffer (save-window-excursion + (run-ruby nil session) (current-buffer)))) + (if (org-babel-comint-buffer-livep session-buffer) + (progn (sit-for .25) session-buffer) + (sit-for .5) + (org-babel-ruby-initiate-session session))))) + +(defvar org-babel-ruby-eoe-indicator ":org_babel_ruby_eoe" + "String to indicate that evaluation has completed.") +(defvar org-babel-ruby-f-write + "File.open('%s','w'){|f| f.write((_.class == String) ? _ : _.inspect)}") +(defvar org-babel-ruby-pp-f-write + "File.open('%s','w'){|f| $stdout = f; pp(results); $stdout = orig_out}") +(defvar org-babel-ruby-wrapper-method + " +def main() +%s +end +results = main() +File.open('%s', 'w'){ |f| f.write((results.class == String) ? results : results.inspect) } +") +(defvar org-babel-ruby-pp-wrapper-method + " +require 'pp' +def main() +%s +end +results = main() +File.open('%s', 'w') do |f| + $stdout = f + pp results +end +") + +(defun org-babel-ruby-evaluate + (buffer body &optional result-type result-params) + "Pass BODY to the Ruby process in BUFFER. +If RESULT-TYPE equals 'output then return a list of the outputs +of the statements in BODY, if RESULT-TYPE equals 'value then +return the value of the last statement in BODY, as elisp." + (if (not buffer) + ;; external process evaluation + (case result-type + (output (org-babel-eval org-babel-ruby-command body)) + (value (let ((tmp-file (make-temp-file "org-babel-ruby-results-"))) + (org-babel-eval org-babel-ruby-command + (format (if (member "pp" result-params) + org-babel-ruby-pp-wrapper-method + org-babel-ruby-wrapper-method) + body tmp-file)) + ((lambda (raw) + (if (or (member "code" result-params) + (member "pp" result-params)) + raw + (org-babel-ruby-table-or-string raw))) + (org-babel-eval-read-file tmp-file))))) + ;; comint session evaluation + (case result-type + (output + (mapconcat + #'identity + (butlast + (split-string + (mapconcat + #'org-babel-trim + (butlast + (org-babel-comint-with-output + (buffer org-babel-ruby-eoe-indicator t body) + (mapc + (lambda (line) + (insert (org-babel-chomp line)) (comint-send-input nil t)) + (list body org-babel-ruby-eoe-indicator)) + (comint-send-input nil t)) 2) + "\n") "[\r\n]")) "\n")) + (value + ((lambda (results) + (if (or (member "code" result-params) (member "pp" result-params)) + results + (org-babel-ruby-table-or-string results))) + (let* ((tmp-file (make-temp-file "org-babel-ruby-results-")) + (ppp (or (member "code" result-params) + (member "pp" result-params)))) + (org-babel-comint-with-output + (buffer org-babel-ruby-eoe-indicator t body) + (when ppp (insert "require 'pp';") (comint-send-input nil t)) + (mapc + (lambda (line) + (insert (org-babel-chomp line)) (comint-send-input nil t)) + (append + (list body) + (if (not ppp) + (list (format org-babel-ruby-f-write tmp-file)) + (list + "results=_" "require 'pp'" "orig_out = $stdout" + (format org-babel-ruby-pp-f-write tmp-file))) + (list org-babel-ruby-eoe-indicator))) + (comint-send-input nil t)) + (org-babel-eval-read-file tmp-file))))))) + +(defun org-babel-ruby-read-string (string) + "Strip \\\"s from around a ruby string." + (if (string-match "^\"\\([^\000]+\\)\"$" string) + (match-string 1 string) + string)) + +(provide 'ob-ruby) + +;; arch-tag: 3e9726db-4520-49e2-b263-e8f571ac88f5 + +;;; ob-ruby.el ends here diff --git a/lisp/org/ob-sass.el b/lisp/org/ob-sass.el new file mode 100644 index 00000000000..87f9ff46ecc --- /dev/null +++ b/lisp/org/ob-sass.el @@ -0,0 +1,70 @@ +;;; ob-sass.el --- org-babel functions for the sass css generation language + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; For more information on sass see http://sass-lang.com/ +;; +;; This accepts a 'file' header argument which is the target of the +;; compiled sass. The default output type for sass evaluation is +;; either file (if a 'file' header argument was given) or scalar if no +;; such header argument was supplied. +;; +;; A 'cmdline' header argument can be supplied to pass arguments to +;; the sass command line. + +;;; Requirements: + +;; - sass-mode :: http://github.com/nex3/haml/blob/master/extra/sass-mode.el + +;;; Code: +(require 'ob) + +(defvar org-babel-default-header-args:sass '()) + +(defun org-babel-expand-body:sass (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." body) + +(defun org-babel-execute:sass (body params) + "Execute a block of Sass code with Babel. +This function is called by `org-babel-execute-src-block'." + (let* ((result-params (split-string (or (cdr (assoc :results params)) ""))) + (file (cdr (assoc :file params))) + (out-file (or file (make-temp-file "org-babel-sass-out"))) + (cmdline (cdr (assoc :cmdline params))) + (in-file (make-temp-file "org-babel-sass-in")) + (cmd (concat "sass " (or cmdline "") in-file " " out-file))) + (with-temp-file in-file + (insert (org-babel-expand-body:sass body params))) (shell-command cmd) + (or file (with-temp-buffer (insert-file-contents out-file) (buffer-string))))) + +(defun org-babel-prep-session:sass (session params) + "Raise an error because sass does not support sessions." + (error "Sass does not support sessions")) + +(provide 'ob-sass) + +;; arch-tag: 2954b169-eef4-45ce-a8e5-3e619f0f07ac + +;;; ob-sass.el ends here diff --git a/lisp/org/ob-screen.el b/lisp/org/ob-screen.el new file mode 100644 index 00000000000..7e575aa02ec --- /dev/null +++ b/lisp/org/ob-screen.el @@ -0,0 +1,154 @@ +;;; ob-screen.el --- org-babel support for interactive terminal + +;; Copyright (C) 2009, 2010 Free Software Foundation + +;; Author: Benjamin Andresen +;; Keywords: literate programming, interactive shell +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for interactive terminals. Mostly shell scripts. +;; Heavily inspired by 'eev' from Eduardo Ochs +;; +;; Adding :cmd and :terminal as header arguments +;; :terminal must support the -T (title) and -e (command) parameter +;; +;; You can test the default setup. (xterm + sh) with +;; M-x org-babel-screen-test RET + +;;; Code: +(require 'ob) +(require 'ob-ref) + +(defvar org-babel-screen-location "screen" + "The command location for screen. +In case you want to use a different screen than one selected by your $PATH") + +(defvar org-babel-default-header-args:screen + '((:results . "silent") (:session . "default") (:cmd . "sh") (:terminal . "xterm")) + "Default arguments to use when running screen source blocks.") + +(defun org-babel-expand-body:screen (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." body) + +(defun org-babel-execute:screen (body params) + "Send a block of code via screen to a terminal using Babel. +\"default\" session is be used when none is specified." + (message "Sending source code block to interactive terminal session...") + (save-window-excursion + (let* ((processed-params (org-babel-process-params params)) + (session (nth 0 processed-params)) + (socket (org-babel-screen-session-socketname session))) + (unless socket (org-babel-prep-session:screen session params)) + (org-babel-screen-session-execute-string + session (org-babel-expand-body:screen body params))))) + +(defun org-babel-prep-session:screen (session params) + "Prepare SESSION according to the header arguments specified in PARAMS." + (let* ((processed-params (org-babel-process-params params)) + (session (nth 0 processed-params)) + (vars (nth 1 processed-params)) + (socket (org-babel-screen-session-socketname session)) + (vars (org-babel-ref-variables params)) + (cmd (cdr (assoc :cmd params))) + (terminal (cdr (assoc :terminal params))) + (process-name (concat "org-babel: terminal (" session ")"))) + (apply 'start-process process-name "*Messages*" + terminal `("-T" ,(concat "org-babel: " session) "-e" ,org-babel-screen-location + "-c" "/dev/null" "-mS" ,(concat "org-babel-session-" session) + ,cmd)) + ;; XXX: Is there a better way than the following? + (while (not (org-babel-screen-session-socketname session)) + ;; wait until screen session is available before returning + ))) + +;; helper functions + +(defun org-babel-screen-session-execute-string (session body) + "If SESSION exists, send BODY to it." + (let ((socket (org-babel-screen-session-socketname session))) + (when socket + (let ((tmpfile (org-babel-screen-session-write-temp-file session body))) + (apply 'start-process (concat "org-babel: screen (" session ")") "*Messages*" + org-babel-screen-location + `("-S" ,socket "-X" "eval" "msgwait 0" + ,(concat "readreg z " tmpfile) + "paste z")))))) + +(defun org-babel-screen-session-socketname (session) + "Check if SESSION exists by parsing output of \"screen -ls\"." + (let* ((screen-ls (shell-command-to-string "screen -ls")) + (sockets (delq + nil + (mapcar + (lambda (x) + (when (string-match (rx (or "(Attached)" "(Detached)")) x) + x)) + (split-string screen-ls "\n")))) + (match-socket (car + (delq + nil + (mapcar + (lambda (x) + (when (string-match + (concat "org-babel-session-" session) x) + x)) + sockets))))) + (when match-socket (car (split-string match-socket))))) + +(defun org-babel-screen-session-write-temp-file (session body) + "Save BODY in a temp file that is named after SESSION." + (let ((tmpfile (concat "/tmp/screen.org-babel-session-" session))) + (with-temp-file tmpfile + (insert body) + + ;; org-babel has superflous spaces + (goto-char (point-min)) + (delete-matching-lines "^ +$")) + tmpfile)) + +(defun org-babel-screen-test () + "Test if the default setup works. +The terminal should shortly flicker." + (interactive) + (let* ((session "org-babel-testing") + (random-string (format "%s" (random 99999))) + (tmpfile "/tmp/org-babel-screen.test") + (body (concat "echo '" random-string "' > " tmpfile "\nexit\n")) + process tmp-string) + (org-babel-execute:screen body org-babel-default-header-args:screen) + ;; XXX: need to find a better way to do the following + (while (not (file-readable-p tmpfile)) + ;; do something, otherwise this will be optimized away + (format "org-babel-screen: File not readable yet.")) + (setq tmp-string (with-temp-buffer + (insert-file-contents-literally tmpfile) + (buffer-substring (point-min) (point-max)))) + (delete-file tmpfile) + (message (concat "org-babel-screen: Setup " + (if (string-match random-string tmp-string) + "WORKS." + "DOESN'T work."))))) + +(provide 'ob-screen) + +;; arch-tag: 908e5afe-89a0-4f27-b982-23f1f2e3bac9 + +;;; ob-screen.el ends here diff --git a/lisp/org/ob-sh.el b/lisp/org/ob-sh.el new file mode 100644 index 00000000000..69fbefc82c4 --- /dev/null +++ b/lisp/org/ob-sh.el @@ -0,0 +1,189 @@ +;;; ob-sh.el --- org-babel functions for shell evaluation + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating shell source code. + +;;; Code: +(require 'ob) +(require 'ob-comint) +(require 'ob-eval) +(require 'shell) +(eval-when-compile (require 'cl)) + +(declare-function org-babel-ref-variables "ob-ref" (params)) +(declare-function org-babel-comint-in-buffer "ob-comint" (buffer &rest body)) +(declare-function org-babel-comint-wait-for-output "ob-comint" (buffer)) +(declare-function org-babel-comint-buffer-livep "ob-comint" (buffer)) +(declare-function org-babel-comint-with-output "ob-comint" (meta &rest body)) +(declare-function orgtbl-to-generic "org-table" (table params)) + +(defvar org-babel-default-header-args:sh '()) + +(defvar org-babel-sh-command "sh" + "Command used to invoke a shell. +This will be passed to `shell-command-on-region'") + +(defun org-babel-expand-body:sh (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (let ((vars (nth 1 (or processed-params (org-babel-process-params params)))) + (sep (cdr (assoc :separator params)))) + (concat + (mapconcat ;; define any variables + (lambda (pair) + (format "%s=%s" + (car pair) + (org-babel-sh-var-to-sh (cdr pair) sep))) + vars "\n") "\n" body "\n\n"))) + +(defun org-babel-execute:sh (body params) + "Execute a block of Shell commands with Babel. +This function is called by `org-babel-execute-src-block'." + (let* ((processed-params (org-babel-process-params params)) + (session (org-babel-sh-initiate-session (nth 0 processed-params))) + (result-params (nth 2 processed-params)) + (full-body (org-babel-expand-body:sh + body params processed-params))) + (org-babel-reassemble-table + (org-babel-sh-evaluate session full-body result-params) + (org-babel-pick-name + (nth 4 processed-params) (cdr (assoc :colnames params))) + (org-babel-pick-name + (nth 5 processed-params) (cdr (assoc :rownames params)))))) + +(defun org-babel-prep-session:sh (session params) + "Prepare SESSION according to the header arguments specified in PARAMS." + (let* ((session (org-babel-sh-initiate-session session)) + (vars (org-babel-ref-variables params)) + (sep (cdr (assoc :separator params))) + (var-lines (mapcar ;; define any variables + (lambda (pair) + (format "%s=%s" + (car pair) + (org-babel-sh-var-to-sh (cdr pair) sep))) + vars))) + (org-babel-comint-in-buffer session + (mapc (lambda (var) + (insert var) (comint-send-input nil t) + (org-babel-comint-wait-for-output session)) var-lines)) + session)) + +(defun org-babel-load-session:sh (session body params) + "Load BODY into SESSION." + (save-window-excursion + (let ((buffer (org-babel-prep-session:sh session params))) + (with-current-buffer buffer + (goto-char (process-mark (get-buffer-process (current-buffer)))) + (insert (org-babel-chomp body))) + buffer))) + +;; helper functions + +(defun org-babel-sh-var-to-sh (var &optional sep) + "Convert an elisp value to a shell variable. +Convert an elisp var into a string of shell commands specifying a +var of the same value." + (if (listp var) + (flet ((deep-string (el) + (if (listp el) + (mapcar #'deep-string el) + (org-babel-sh-var-to-sh el sep)))) + (format "$(cat <. + +;;; Commentary: + +;; Org-Babel support for evaluating sql source code. +;; +;; SQL is somewhat unique in that there are many different engines for +;; the evaluation of sql (Mysql, PostgreSQL, etc...), so much of this +;; file will have to be implemented engine by engine. +;; +;; Also SQL evaluation generally takes place inside of a database. +;; +;; For now lets just allow a generic ':cmdline' header argument. +;; +;; TODO: +;; +;; - support for sessions +;; - add more useful header arguments (user, passwd, database, etc...) +;; - support for more engines (currently only supports mysql) +;; - what's a reasonable way to drop table data into SQL? +;; + +;;; Code: +(require 'ob) +(eval-when-compile (require 'cl)) + +(declare-function org-table-import "org-table" (file arg)) + +(defvar org-babel-default-header-args:sql '()) + +(defun org-babel-expand-body:sql (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." body) + +(defun org-babel-execute:sql (body params) + "Execute a block of Sql code with Babel. +This function is called by `org-babel-execute-src-block'." + (let* ((result-params (split-string (or (cdr (assoc :results params)) ""))) + (processed-params (org-babel-process-params params)) + (cmdline (cdr (assoc :cmdline params))) + (engine (cdr (assoc :engine params))) + (in-file (make-temp-file "org-babel-sql-in")) + (out-file (or (cdr (assoc :out-file params)) + (make-temp-file "org-babel-sql-out"))) + (command (case (intern engine) + ('mysql (format "mysql %s -e \"source %s\" > %s" + (or cmdline "") in-file out-file)) + (t (error "no support for the %s sql engine" engine))))) + (with-temp-file in-file + (insert (org-babel-expand-body:sql body params))) + (message command) + (shell-command command) + (with-temp-buffer + (org-table-import out-file nil) + (org-babel-reassemble-table + (org-table-to-lisp) + (org-babel-pick-name (nth 4 processed-params) (cdr (assoc :colnames params))) + (org-babel-pick-name (nth 5 processed-params) (cdr (assoc :rownames params))))))) + + +(defun org-babel-prep-session:sql (session params) + "Raise an error because Sql sessions aren't implemented." + (error "sql sessions not yet implemented")) + +(provide 'ob-sql) + +;; arch-tag: a43ff944-6de1-4566-a83c-626814e3dad2 + +;;; ob-sql.el ends here diff --git a/lisp/org/ob-sqlite.el b/lisp/org/ob-sqlite.el new file mode 100644 index 00000000000..7d6930abd4b --- /dev/null +++ b/lisp/org/ob-sqlite.el @@ -0,0 +1,152 @@ +;;; ob-sqlite.el --- org-babel functions for sqlite database interaction + +;; Copyright (C) 2010 Free Software Foundation + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating sqlite source code. + +;;; Code: +(require 'ob) +(require 'ob-ref) + +(declare-function org-fill-template "org" (template alist)) +(declare-function org-table-convert-region "org-table" + (beg0 end0 &optional separator)) +(declare-function orgtbl-to-csv "org-table" (TABLE PARAMS)) + +(defvar org-babel-default-header-args:sqlite '()) + +(defvar org-babel-header-arg-names:sqlite + '(db header echo bail csv column html line list separator nullvalue) + "Sqlite specific header args.") + +(defun org-babel-expand-body:sqlite (body params &optional processed-params) + (org-babel-sqlite-expand-vars + body (or (nth 1 processed-params) (org-babel-ref-variables params)))) + +(defvar org-babel-sqlite3-command "sqlite3") + +(defun org-babel-execute:sqlite (body params) + "Execute a block of Sqlite code with Babel. +This function is called by `org-babel-execute-src-block'." + (let ((result-params (split-string (or (cdr (assoc :results params)) ""))) + (vars (org-babel-ref-variables params)) + (db (cdr (assoc :db params))) + (separator (cdr (assoc :separator params))) + (nullvalue (cdr (assoc :nullvalue params))) + (headers-p (equal "yes" (cdr (assoc :colnames params)))) + (others (delq nil (mapcar + (lambda (arg) (car (assoc arg params))) + (list :header :echo :bail :column + :csv :html :line :list)))) + exit-code) + (unless db (error "ob-sqlite: can't evaluate without a database.")) + (with-temp-buffer + (insert + (shell-command-to-string + (org-fill-template + "%cmd -init %body %header %separator %nullvalue %others %csv %db " + (list + (cons "body" ((lambda (sql-file) + (with-temp-file sql-file + (insert (org-babel-expand-body:sqlite + body nil (list nil vars)))) + sql-file) + (make-temp-file "ob-sqlite-sql"))) + (cons "cmd" org-babel-sqlite3-command) + (cons "header" (if headers-p "-header" "-noheader")) + (cons "separator" + (if separator (format "-separator %s" separator) "")) + (cons "nullvalue" + (if nullvalue (format "-nullvalue %s" nullvalue) "")) + (cons "others" + (mapconcat + (lambda (arg) (format "-%s" (substring (symbol-name arg) 1))) + others " ")) + ;; for easy table parsing, default header type should be -csv + (cons "csv" (if (or (member :csv others) (member :column others) + (member :line others) (member :list others) + (member :html others) separator) + "" + "-csv")) + (cons "db " db))))) + (if (or (member "scalar" result-params) + (member "html" result-params) + (member "code" result-params) + (equal (point-min) (point-max))) + (buffer-string) + (org-table-convert-region (point-min) (point-max)) + (org-babel-sqlite-table-or-scalar + (org-babel-sqlite-offset-colnames + (org-table-to-lisp) headers-p)))))) + +(defun org-babel-sqlite-expand-vars (body vars) + "Expand the variables held in VARS in BODY." + (mapc + (lambda (pair) + (setq body + (replace-regexp-in-string + (format "\$%s" (car pair)) + ((lambda (val) + (if (listp val) + ((lambda (data-file) + (with-temp-file data-file + (insert (orgtbl-to-csv + val '(:fmt (lambda (el) (if (stringp el) + el + (format "%S" el))))))) + data-file) + (make-temp-file "ob-sqlite-data")) + (format "%S" val))) + (cdr pair)) + body))) + vars) + body) + +(defun org-babel-sqlite-table-or-scalar (result) + "If RESULT looks like a trivial table, then unwrap it." + (if (and (equal 1 (length result)) + (equal 1 (length (car result)))) + (org-babel-read (caar result)) + (mapcar (lambda (row) + (if (equal 'hline row) + 'hline + (mapcar #'org-babel-read row))) result))) + +(defun org-babel-sqlite-offset-colnames (table headers-p) + "If HEADERS-P is non-nil then offset the first row as column names." + (if headers-p + (cons (car table) (cons 'hline (cdr table))) + table)) + +(defun org-babel-prep-session:sqlite (session params) + "Raise an error because support for sqlite sessions isn't implemented. +Prepare SESSION according to the header arguments specified in PARAMS." + (error "sqlite sessions not yet implemented")) + +(provide 'ob-sqlite) + +;; arch-tag: 5c03d7f2-0f72-48b8-bbd1-35aafea248ac + +;;; ob-sqlite.el ends here diff --git a/lisp/org/ob-table.el b/lisp/org/ob-table.el new file mode 100644 index 00000000000..f1506550829 --- /dev/null +++ b/lisp/org/ob-table.el @@ -0,0 +1,109 @@ +;;; ob-table.el --- support for calling org-babel functions from tables + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Should allow calling functions from org-mode tables using the +;; function `sbe' as so... + +;; #+begin_src emacs-lisp :results silent +;; (defun fibbd (n) (if (< n 2) 1 (+ (fibbd (- n 1)) (fibbd (- n 2))))) +;; #+end_src + +;; #+srcname: fibbd +;; #+begin_src emacs-lisp :var n=2 :results silent +;; (fibbd n) +;; #+end_src + +;; | original | fibbd | +;; |----------+--------| +;; | 0 | | +;; | 1 | | +;; | 2 | | +;; | 3 | | +;; | 4 | | +;; | 5 | | +;; | 6 | | +;; | 7 | | +;; | 8 | | +;; | 9 | | +;; #+TBLFM: $2='(sbe 'fibbd (n $1)) + +;;; Code: +(require 'ob) + +(defun org-babel-table-truncate-at-newline (string) + "Replace newline character with ellipses. +If STRING ends in a newline character, then remove the newline +character and replace it with ellipses." + (if (and (stringp string) (string-match "[\n\r]" string)) + (concat (substring string 0 (match-beginning 0)) "...") + string)) + +(defmacro sbe (source-block &rest variables) + "Return the results of calling SOURCE-BLOCK with VARIABLES. +Each element of VARIABLES should be a two +element list, whose first element is the name of the variable and +second element is a string of its value. The following call to +`sbe' would be equivalent to the following source code block. + + (sbe 'source-block (n $2) (m 3)) + +#+begin_src emacs-lisp :var results=source-block(n=val_at_col_2, m=3) :results silent +results +#+end_src + +NOTE: by default string variable names are interpreted as +references to source-code blocks, to force interpretation of a +cell's value as a string, prefix the identifier with two \"$\"s +rather than a single \"$\" (i.e. \"$$2\" instead of \"$2\" in the +example above." + (let ((variables (mapcar + (lambda (var) + (if (and (= 3 (length var)) (eq (nth 1 var) '$)) + (list (car var) (format "\"%s\"" (last var))) + var)) + variables))) + (unless (stringp source-block) (setq source-block (symbol-name source-block))) + (org-babel-table-truncate-at-newline ;; org-table cells can't be multi-line + (if (and source-block (> (length source-block) 0)) + (let ((params + (eval `(org-babel-parse-header-arguments + (concat ":var results=" + ,source-block + "(" + (mapconcat (lambda (var-spec) + (format "%S=%s" (nth 0 var-spec) (nth 1 var-spec))) + ',variables ", ") + ")"))))) + (org-babel-execute-src-block + nil (list "emacs-lisp" "results" + (org-babel-merge-params '((:results . "silent")) params)))) + "")))) + +(provide 'ob-table) + +;; arch-tag: 4234cc7c-4fc8-4e92-abb0-2892de1a493b + +;;; ob-table.el ends here diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el new file mode 100644 index 00000000000..85f69ede357 --- /dev/null +++ b/lisp/org/ob-tangle.el @@ -0,0 +1,300 @@ +;;; ob-tangle.el --- extract source code from org-mode files + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Extract the code from source blocks out into raw source-code files. + +;;; Code: +(require 'ob) +(require 'org-src) +(eval-when-compile + (require 'cl)) + +(declare-function org-link-escape "org" (text &optional table)) +(declare-function org-heading-components "org" ()) + +(defcustom org-babel-tangle-lang-exts + '(("emacs-lisp" . "el")) + "Alist mapping languages to their file extensions. +The key is the language name, the value is the string that should +be inserted as the extension commonly used to identify files +written in this language. If no entry is found in this list, +then the name of the language is used." + :group 'org-babel-tangle + :type '(repeat + (cons + (string "Language name") + (string "File Extension")))) + +(defcustom org-babel-post-tangle-hook nil + "Hook run in code files tangled by `org-babel-tangle'." + :group 'org-babel + :type 'hook) + +(defmacro org-babel-with-temp-filebuffer (file &rest body) + "Open FILE into a temporary buffer execute BODY there like +`progn', then kill the FILE buffer returning the result of +evaluating BODY." + (declare (indent 1)) + (let ((temp-result (make-symbol "temp-result")) + (temp-file (make-symbol "temp-file"))) + `(let (,temp-result ,temp-file) + (find-file ,file) + (setf ,temp-file (current-buffer)) + (setf ,temp-result (progn ,@body)) + (kill-buffer ,temp-file) + ,temp-result))) + +;;;###autoload +(defun org-babel-load-file (file) + "Load Emacs Lisp source code blocks in the Org-mode FILE. +This function exports the source code using +`org-babel-tangle' and then loads the resulting file using +`load-file'." + (flet ((age (file) + (float-time + (time-subtract (current-time) + (nth 5 (or (file-attributes (file-truename file)) + (file-attributes file))))))) + (let* ((base-name (file-name-sans-extension file)) + (exported-file (concat base-name ".el"))) + ;; tangle if the org-mode file is newer than the elisp file + (unless (and (file-exists-p exported-file) + (> (age file) (age exported-file))) + (org-babel-tangle-file file exported-file "emacs-lisp")) + (load-file exported-file) + (message "loaded %s" exported-file)))) + +;;;###autoload +(defun org-babel-tangle-file (file &optional target-file lang) + "Extract the bodies of source code blocks in FILE. +Source code blocks are extracted with `org-babel-tangle'. +Optional argument TARGET-FILE can be used to specify a default +export file for all source blocks. Optional argument LANG can be +used to limit the exported source code blocks by language." + (interactive "fFile to tangle: \nP") + (let ((visited-p (get-file-buffer (expand-file-name file))) + to-be-removed) + (save-window-excursion + (find-file file) + (setq to-be-removed (current-buffer)) + (org-babel-tangle target-file lang)) + (unless visited-p + (kill-buffer to-be-removed)))) + +(defun org-babel-tangle-publish (_ filename pub-dir) + "Tangle FILENAME and place the results in PUB-DIR." + (mapc (lambda (el) (copy-file el pub-dir t)) (org-babel-tangle-file filename))) + +;;;###autoload +(defun org-babel-tangle (&optional target-file lang) + "Write code blocks to source-specific files. +Extract the bodies of all source code blocks from the current +file into their own source-specific files. Optional argument +TARGET-FILE can be used to specify a default export file for all +source blocks. Optional argument LANG can be used to limit the +exported source code blocks by language." + (interactive) + (save-buffer) + (save-excursion + (let ((block-counter 0) + (org-babel-default-header-args + (if target-file + (org-babel-merge-params org-babel-default-header-args + (list (cons :tangle target-file))) + org-babel-default-header-args)) + path-collector) + (mapc ;; map over all languages + (lambda (by-lang) + (let* ((lang (car by-lang)) + (specs (cdr by-lang)) + (ext (or (cdr (assoc lang org-babel-tangle-lang-exts)) lang)) + (lang-f (intern + (concat + (or (and (cdr (assoc lang org-src-lang-modes)) + (symbol-name + (cdr (assoc lang org-src-lang-modes)))) + lang) + "-mode"))) + she-banged) + (mapc + (lambda (spec) + (flet ((get-spec (name) + (cdr (assoc name (nth 2 spec))))) + (let* ((tangle (get-spec :tangle)) + (she-bang ((lambda (sheb) (when (> (length sheb) 0) sheb)) + (get-spec :shebang))) + (base-name (cond + ((string= "yes" tangle) + (file-name-sans-extension + (buffer-file-name))) + ((string= "no" tangle) nil) + ((> (length tangle) 0) tangle))) + (file-name (when base-name + ;; decide if we want to add ext to base-name + (if (and ext (string= "yes" tangle)) + (concat base-name "." ext) base-name)))) + (when file-name + ;; delete any old versions of file + (when (and (file-exists-p file-name) + (not (member file-name path-collector))) + (delete-file file-name)) + ;; drop source-block to file + (with-temp-buffer + (when (fboundp lang-f) (funcall lang-f)) + (when (and she-bang (not (member file-name she-banged))) + (insert (concat she-bang "\n")) + (setq she-banged (cons file-name she-banged))) + (org-babel-spec-to-string spec) + ;; We avoid append-to-file as it does not work with tramp. + (let ((content (buffer-string))) + (with-temp-buffer + (if (file-exists-p file-name) + (insert-file-contents file-name)) + (goto-char (point-max)) + (insert content) + (write-region nil nil file-name)))) + ;; if files contain she-bangs, then make the executable + (when she-bang (set-file-modes file-name ?\755)) + ;; update counter + (setq block-counter (+ 1 block-counter)) + (add-to-list 'path-collector file-name))))) + specs))) + (org-babel-tangle-collect-blocks lang)) + (message "tangled %d code block%s" block-counter + (if (= block-counter 1) "" "s")) + ;; run `org-babel-post-tangle-hook' in all tangled files + (when org-babel-post-tangle-hook + (mapc + (lambda (file) + (org-babel-with-temp-filebuffer file + (run-hooks 'org-babel-post-tangle-hook))) + path-collector)) + path-collector))) + +(defun org-babel-tangle-clean () + "Remove comments inserted by `org-babel-tangle'. +Call this function inside of a source-code file generated by +`org-babel-tangle' to remove all comments inserted automatically +by `org-babel-tangle'. Warning, this comment removes any lines +containing constructs which resemble org-mode file links or noweb +references." + (interactive) + (goto-char (point-min)) + (while (or (re-search-forward "\\[\\[file:.*\\]\\[.*\\]\\]" nil t) + (re-search-forward "<<[^[:space:]]*>>" nil t)) + (delete-region (save-excursion (beginning-of-line 1) (point)) + (save-excursion (end-of-line 1) (forward-char 1) (point))))) + +(defvar org-stored-links) +(defun org-babel-tangle-collect-blocks (&optional lang) + "Collect source blocks in the current Org-mode file. +Return an association list of source-code block specifications of +the form used by `org-babel-spec-to-string' grouped by language. +Optional argument LANG can be used to limit the collected source +code blocks by language." + (let ((block-counter 1) (current-heading "") blocks) + (org-babel-map-src-blocks (buffer-file-name) + ((lambda (new-heading) + (if (not (string= new-heading current-heading)) + (progn + (setq block-counter 1) + (setq current-heading new-heading)) + (setq block-counter (+ 1 block-counter)))) + (replace-regexp-in-string "[ \t]" "-" + (nth 4 (org-heading-components)))) + (let* ((link (progn (call-interactively 'org-store-link) + (org-babel-clean-text-properties + (car (pop org-stored-links))))) + (info (org-babel-get-src-block-info)) + (source-name (intern (or (nth 4 info) + (format "%s:%d" + current-heading block-counter)))) + (src-lang (nth 0 info)) + (expand-cmd (intern (concat "org-babel-expand-body:" src-lang))) + (params (nth 2 info)) + by-lang) + (unless (string= (cdr (assoc :tangle params)) "no") ;; skip + (unless (and lang (not (string= lang src-lang))) ;; limit by language + ;; add the spec for this block to blocks under it's language + (setq by-lang (cdr (assoc src-lang blocks))) + (setq blocks (delq (assoc src-lang blocks) blocks)) + (setq blocks + (cons + (cons src-lang + (cons (list link source-name params + ((lambda (body) + (if (assoc :no-expand params) + body + (funcall + (if (fboundp expand-cmd) + expand-cmd + 'org-babel-expand-body:generic) + body + params))) + (if (and (cdr (assoc :noweb params)) + (string= + "yes" + (cdr (assoc :noweb params)))) + (org-babel-expand-noweb-references + info) + (nth 1 info)))) + by-lang)) blocks)))))) + ;; ensure blocks in the correct order + (setq blocks + (mapcar + (lambda (by-lang) (cons (car by-lang) (reverse (cdr by-lang)))) + blocks)) + blocks)) + +(defun org-babel-spec-to-string (spec) + "Insert SPEC into the current file. +Insert the source-code specified by SPEC into the current +source code file. This function uses `comment-region' which +assumes that the appropriate major-mode is set. SPEC has the +form + + (link source-name params body)" + (let ((link (nth 0 spec)) + (source-name (nth 1 spec)) + (body (nth 3 spec)) + (commentable (string= (cdr (assoc :comments (nth 2 spec))) "yes"))) + (flet ((insert-comment (text) + (when commentable + (insert "\n") + (comment-region (point) + (progn (insert text) (point))) + (end-of-line nil) + (insert "\n")))) + (insert-comment (format "[[%s][%s]]" (org-link-escape link) source-name)) + (insert (format "\n%s\n" (replace-regexp-in-string + "^," "" (org-babel-chomp body)))) + (insert-comment (format "%s ends here" source-name))))) + +(provide 'ob-tangle) + +;; arch-tag: 413ced93-48f5-4216-86e4-3fc5df8c8f24 + +;;; ob-tangle.el ends here diff --git a/lisp/org/ob.el b/lisp/org/ob.el new file mode 100644 index 00000000000..eeb60836b3f --- /dev/null +++ b/lisp/org/ob.el @@ -0,0 +1,1591 @@ +;;; ob.el --- working with code blocks in org-mode + +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte, Dan Davison +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01 + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; See the online documentation for more information +;; +;; http://orgmode.org/worg/org-contrib/babel/ + +;;; Code: +(eval-when-compile (require 'cl)) +(require 'org-macs) + +(defvar org-babel-call-process-region-original) +(declare-function show-all "outline" ()) +(declare-function tramp-compat-make-temp-file "tramp" (filename &optional dir-flag)) +(declare-function tramp-dissect-file-name "tramp" (name &optional nodefault)) +(declare-function tramp-file-name-user "tramp" (vec)) +(declare-function tramp-file-name-host "tramp" (vec)) +(declare-function org-icompleting-read "org" (&rest args)) +(declare-function org-edit-src-code "org" (context code edit-buffer-name)) +(declare-function org-open-at-point "org" (&optional in-emacs reference-buffer)) +(declare-function org-save-outline-visibility "org" (use-markers &rest body)) +(declare-function org-narrow-to-subtree "org" ()) +(declare-function org-entry-get "org" (pom property &optional inherit)) +(declare-function org-make-options-regexp "org" (kwds &optional extra)) +(declare-function org-match-string-no-properties "org" (num &optional string)) +(declare-function org-do-remove-indentation "org" (&optional n)) +(declare-function org-show-context "org" (&optional key)) +(declare-function org-at-table-p "org" (&optional table-type)) +(declare-function org-cycle "org" (&optional arg)) +(declare-function org-uniquify "org" (list)) +(declare-function org-table-import "org" (file arg)) +(declare-function org-add-hook "org-compat" (hook function &optional append local)) +(declare-function org-table-align "org-table" ()) +(declare-function org-table-end "org-table" (&optional table-type)) +(declare-function orgtbl-to-generic "org-table" (table params)) +(declare-function orgtbl-to-orgtbl "org-table" (table params)) +(declare-function org-babel-lob-get-info "ob-lob" nil) +(declare-function org-babel-ref-split-args "ob-ref" (arg-string)) +(declare-function org-babel-ref-variables "ob-ref" (params)) +(declare-function org-babel-ref-resolve-reference "ob-ref" (ref &optional params)) + +(defgroup org-babel nil + "Code block evaluation and management in `org-mode' documents." + :tag "Babel" + :group 'org) + +(defcustom org-confirm-babel-evaluate t + "Confirm before evaluation. +Require confirmation before interactively evaluating code +blocks in Org-mode buffers. The default value of this variable +is t, meaning confirmation is required for any code block +evaluation. This variable can be set to nil to inhibit any +future confirmation requests. This variable can also be set to a +function which takes two arguments the language of the code block +and the body of the code block. Such a function should then +return a non-nil value if the user should be prompted for +execution or nil if no prompt is required. + +Warning: Disabling confirmation may result in accidental +evaluation of potentially harmful code. It may be advisable +remove code block execution from C-c C-c as further protection +against accidental code block evaluation. The +`org-babel-no-eval-on-ctrl-c-ctrl-c' variable can be used to +remove code block execution from the C-c C-c keybinding." + :group 'org-babel + :type '(choice boolean function)) +;; don't allow this variable to be changed through file settings +(put 'org-confirm-babel-evaluate 'safe-local-variable (lambda (x) (eq x t))) + +(defcustom org-babel-no-eval-on-ctrl-c-ctrl-c nil + "Remove code block evaluation from the C-c C-c key binding." + :group 'org-babel + :type 'boolean) + +(defvar org-babel-src-name-regexp + "^[ \t]*#\\+\\(srcname\\|source\\|function\\):[ \t]*" + "Regular expression used to match a source name line.") + +(defvar org-babel-src-name-w-name-regexp + (concat org-babel-src-name-regexp + "\\([^ ()\f\t\n\r\v]+\\)\\(\(\\(.*\\)\)\\|\\)") + "Regular expression matching source name lines with a name.") + +(defvar org-babel-src-block-regexp + (concat + ;; (1) indentation (2) lang + "^\\([ \t]*\\)#\\+begin_src[ \t]+\\([^ \f\t\n\r\v]+\\)[ \t]*" + ;; (3) switches + "\\([^\":\n]*\"[^\"\n*]*\"[^\":\n]*\\|[^\":\n]*\\)" + ;; (4) header arguments + "\\([^\n]*\\)\n" + ;; (5) body + "\\([^\000]+?\n\\)[ \t]*#\\+end_src") + "Regexp used to identify code blocks.") + +(defvar org-babel-inline-src-block-regexp + (concat + ;; (1) replacement target (2) lang + "[ \f\t\n\r\v]\\(src_\\([^ \f\t\n\r\v]+\\)" + ;; (3,4) (unused, headers) + "\\(\\|\\[\\(.*?\\)\\]\\)" + ;; (5) body + "{\\([^\f\n\r\v]+?\\)}\\)") + "Regexp used to identify inline src-blocks.") + +(defun org-babel-get-src-block-info (&optional header-vars-only) + "Get information on the current source block. + +Returns a list + (language body header-arguments-alist switches name function-args indent). +Unless HEADER-VARS-ONLY is non-nil, any variable +references provided in 'function call style' (i.e. in a +parenthesised argument list following the src block name) are +added to the header-arguments-alist." + (let ((case-fold-search t) head info args indent) + (if (setq head (org-babel-where-is-src-block-head)) + (save-excursion + (goto-char head) + (setq info (org-babel-parse-src-block-match)) + (setq indent (car (last info))) + (setq info (butlast info)) + (forward-line -1) + (if (and (looking-at org-babel-src-name-w-name-regexp) + (match-string 2)) + (progn + (setq info (append info (list (org-babel-clean-text-properties + (match-string 2))))) + ;; Note that e.g. "name()" and "name( )" result in + ;; ((:var . "")). We maintain that behaviour, and the + ;; resulting non-nil sixth element is relied upon in + ;; org-babel-exp-code to detect a functional-style + ;; block in those cases. However, "name" without any + ;; parentheses would result in the same thing, so we + ;; explicitly avoid that. + (if (setq args (match-string 4)) + (setq info + (append info (list + (mapcar + (lambda (ref) (cons :var ref)) + (org-babel-ref-split-args args)))))) + (unless header-vars-only + (setf (nth 2 info) + (org-babel-merge-params (nth 5 info) (nth 2 info))))) + (setq info (append info (list nil nil)))) + (append info (list indent))) + (if (save-excursion ;; inline source block + (re-search-backward "[ \f\t\n\r\v]" nil t) + (looking-at org-babel-inline-src-block-regexp)) + (org-babel-parse-inline-src-block-match) + nil)))) + +(defun org-babel-confirm-evaluate (info) + "Confirm evaluation of the code block INFO. +This behavior can be suppressed by setting the value of +`org-confirm-babel-evaluate' to nil, in which case all future +interactive code block evaluations will proceed without any +confirmation from the user. + +Note disabling confirmation may result in accidental evaluation +of potentially harmful code." + (let* ((eval (cdr (assoc :eval (nth 2 info)))) + (query (or (equal eval "query") + (and (functionp org-confirm-babel-evaluate) + (funcall org-confirm-babel-evaluate + (nth 0 info) (nth 1 info))) + org-confirm-babel-evaluate))) + (when (or (equal eval "never") + (and query + (not (yes-or-no-p + (format "Evaluate this%scode on your system? " + (if info (format " %s " (nth 0 info)) " ")))))) + (error "evaluation aborted")))) + +;;;###autoload +(defun org-babel-execute-src-block-maybe () + "Conditionally execute a source block. +Detect if this is context for a Babel src-block and if so +then run `org-babel-execute-src-block'." + (interactive) + (if (not org-babel-no-eval-on-ctrl-c-ctrl-c) + (let ((info (org-babel-get-src-block-info))) + (if info + (progn (org-babel-execute-src-block current-prefix-arg info) t) nil)) + nil)) +(add-hook 'org-ctrl-c-ctrl-c-hook 'org-babel-execute-src-block-maybe) + +;;;###autoload +(defun org-babel-expand-src-block-maybe () + "Conditionally expand a source block. +Detect if this is context for a org-babel src-block and if so +then run `org-babel-expand-src-block'." + (interactive) + (let ((info (org-babel-get-src-block-info))) + (if info + (progn (org-babel-expand-src-block current-prefix-arg info) t) + nil))) + +;;;###autoload +(defun org-babel-load-in-session-maybe () + "Conditionally load a source block in a session. +Detect if this is context for a org-babel src-block and if so +then run `org-babel-load-in-session'." + (interactive) + (let ((info (org-babel-get-src-block-info))) + (if info + (progn (org-babel-load-in-session current-prefix-arg info) t) + nil))) + +(add-hook 'org-metaup-hook 'org-babel-load-in-session-maybe) + +;;;###autoload +(defun org-babel-pop-to-session-maybe () + "Conditionally pop to a session. +Detect if this is context for a org-babel src-block and if so +then run `org-babel-pop-to-session'." + (interactive) + (let ((info (org-babel-get-src-block-info))) + (if info (progn (org-babel-pop-to-session current-prefix-arg info) t) nil))) + +(add-hook 'org-metadown-hook 'org-babel-pop-to-session-maybe) + +(defconst org-babel-header-arg-names + '(cache cmdline colnames dir exports file noweb results + session tangle var noeval comments) + "Common header arguments used by org-babel. +Note that individual languages may define their own language +specific header arguments as well.") + +(defvar org-babel-default-header-args + '((:session . "none") (:results . "replace") (:exports . "code") + (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no")) + "Default arguments to use when evaluating a source block.") + +(defvar org-babel-default-inline-header-args + '((:session . "none") (:results . "silent") (:exports . "results")) + "Default arguments to use when evaluating an inline source block.") + +(defvar org-babel-current-buffer-properties) +(make-variable-buffer-local 'org-babel-current-buffer-properties) + +(defvar org-babel-result-regexp + "^[ \t]*#\\+res\\(ults\\|name\\)\\(\\[\\([[:alnum:]]+\\)\\]\\)?\\:[ \t]*" + "Regular expression used to match result lines. +If the results are associated with a hash key then the hash will +be saved in the second match data.") + +(defvar org-babel-result-w-name-regexp + (concat org-babel-result-regexp + "\\([^ ()\f\t\n\r\v]+\\)\\(\(\\(.*\\)\)\\|\\)")) + +(defvar org-babel-min-lines-for-block-output 10 + "The minimum number of lines for block output. +If number of lines of output is equal to or exceeds this +value, the output is placed in a #+begin_example...#+end_example +block. Otherwise the output is marked as literal by inserting +colons at the starts of the lines. This variable only takes +effect if the :results output option is in effect.") + +(defvar org-babel-noweb-error-langs nil + "Languages for which Babel will raise literate programming errors. +List of languages for which errors should be raised when the +source code block satisfying a noweb reference in this language +can not be resolved.") + +(defvar org-babel-hash-show 4 + "Number of initial characters to show of a hidden results hash.") + +(defvar org-babel-after-execute-hook nil + "Hook for functions to be called after `org-babel-execute-src-block'") +(defun org-babel-named-src-block-regexp-for-name (name) + "This generates a regexp used to match a src block named NAME." + (concat org-babel-src-name-regexp (regexp-quote name) "[ \t\n]*" + (substring org-babel-src-block-regexp 1))) + +;;; functions +(defvar call-process-region) +;;;###autoload +(defun org-babel-execute-src-block (&optional arg info params) + "Execute the current source code block. +Insert the results of execution into the buffer. Source code +execution and the collection and formatting of results can be +controlled through a variety of header arguments. + +Optionally supply a value for INFO in the form returned by +`org-babel-get-src-block-info'. + +Optionally supply a value for PARAMS which will be merged with +the header arguments specified at the front of the source code +block." + (interactive) + (let* ((info (or info (org-babel-get-src-block-info))) + ;; note the `evaluation-confirmed' variable is currently not + ;; used, but could be used later to avoid the need for + ;; chaining confirmations + (evaluation-confirmed (org-babel-confirm-evaluate info)) + (lang (nth 0 info)) + (params (setf (nth 2 info) + (sort (org-babel-merge-params (nth 2 info) params) + (lambda (el1 el2) (string< (symbol-name (car el1)) + (symbol-name (car el2))))))) + (new-hash + (if (and (cdr (assoc :cache params)) + (string= "yes" (cdr (assoc :cache params)))) + (org-babel-sha1-hash info))) + (old-hash (org-babel-result-hash info)) + (body (setf (nth 1 info) + (if (and (cdr (assoc :noweb params)) + (string= "yes" (cdr (assoc :noweb params)))) + (org-babel-expand-noweb-references info) + (nth 1 info)))) + (result-params (split-string (or (cdr (assoc :results params)) ""))) + (result-type (cond ((member "output" result-params) 'output) + ((member "value" result-params) 'value) + (t 'value))) + (cmd (intern (concat "org-babel-execute:" lang))) + (dir (cdr (assoc :dir params))) + (default-directory + (or (and dir (file-name-as-directory dir)) default-directory)) + (org-babel-call-process-region-original + (if (boundp 'org-babel-call-process-region-original) org-babel-call-process-region-original + (symbol-function 'call-process-region))) + (indent (car (last info))) + result) + (unwind-protect + (flet ((call-process-region (&rest args) + (apply 'org-babel-tramp-handle-call-process-region args))) + (unless (fboundp cmd) + (error "No org-babel-execute function for %s!" lang)) + (if (and (not arg) new-hash (equal new-hash old-hash)) + (save-excursion ;; return cached result + (goto-char (org-babel-where-is-src-block-result nil info)) + (end-of-line 1) (forward-char 1) + (setq result (org-babel-read-result)) + (message (replace-regexp-in-string "%" "%%" + (format "%S" result))) result) + (message "executing %s code block%s..." + (capitalize lang) + (if (nth 4 info) (format " (%s)" (nth 4 info)) "")) + (setq result (funcall cmd body params)) + (if (eq result-type 'value) + (setq result (if (and (or (member "vector" result-params) + (member "table" result-params)) + (not (listp result))) + (list (list result)) + result))) + (org-babel-insert-result + result result-params info new-hash indent lang) + (run-hooks 'org-babel-after-execute-hook) + result)) + (setq call-process-region 'org-babel-call-process-region-original)))) + +(defun org-babel-expand-body:generic (body params &optional processed-params) + "Expand BODY with PARAMS. +Expand a block of code with org-babel according to it's header +arguments. This generic implementation of body expansion is +called for languages which have not defined their own specific +org-babel-expand-body:lang function." body) + +;;;###autoload +(defun org-babel-expand-src-block (&optional arg info params) + "Expand the current source code block. +Expand according to the source code block's header +arguments and pop open the results in a preview buffer." + (interactive) + (let* ((info (or info (org-babel-get-src-block-info))) + (lang (nth 0 info)) + (params (setf (nth 2 info) + (sort (org-babel-merge-params (nth 2 info) params) + (lambda (el1 el2) (string< (symbol-name (car el1)) + (symbol-name (car el2))))))) + (body (setf (nth 1 info) + (if (and (cdr (assoc :noweb params)) + (string= "yes" (cdr (assoc :noweb params)))) + (org-babel-expand-noweb-references info) (nth 1 info)))) + (cmd (intern (concat "org-babel-expand-body:" lang))) + (expanded (funcall (if (fboundp cmd) cmd 'org-babel-expand-body:generic) + body params))) + (org-edit-src-code + nil expanded (concat "*Org-Babel Preview " (buffer-name) "[ " lang " ]*")))) + +;;;###autoload +(defun org-babel-load-in-session (&optional arg info) + "Load the body of the current source-code block. +Evaluate the header arguments for the source block before +entering the session. After loading the body this pops open the +session." + (interactive) + (let* ((info (or info (org-babel-get-src-block-info))) + (lang (nth 0 info)) + (body (nth 1 info)) + (params (nth 2 info)) + (session (cdr (assoc :session params))) + (cmd (intern (concat "org-babel-load-session:" lang)))) + (unless (fboundp cmd) + (error "No org-babel-load-session function for %s!" lang)) + (pop-to-buffer (funcall cmd session body params)) + (end-of-line 1))) + +;;;###autoload +(defun org-babel-switch-to-session (&optional arg info) + "Switch to the session of the current source-code block. +If called with a prefix argument then evaluate the header arguments +for the source block before entering the session. Copy the body +of the source block to the kill ring." + (interactive) + (let* ((info (or info (org-babel-get-src-block-info))) + (lang (nth 0 info)) + (body (nth 1 info)) + (params (nth 2 info)) + (session (cdr (assoc :session params))) + (dir (cdr (assoc :dir params))) + (default-directory + (or (and dir (file-name-as-directory dir)) default-directory)) + (cmd (intern (format "org-babel-%s-initiate-session" lang))) + (cmd2 (intern (concat "org-babel-prep-session:" lang)))) + (unless (fboundp cmd) + (error "No org-babel-initiate-session function for %s!" lang)) + ;; copy body to the kill ring + (with-temp-buffer (insert (org-babel-trim body)) + (copy-region-as-kill (point-min) (point-max))) + ;; if called with a prefix argument, then process header arguments + (unless (fboundp cmd2) + (error "No org-babel-prep-session function for %s!" lang)) + (when arg (funcall cmd2 session params)) + ;; just to the session using pop-to-buffer + (pop-to-buffer (funcall cmd session params)) + (end-of-line 1))) + +(defalias 'org-babel-pop-to-session 'org-babel-switch-to-session) + +(defvar org-bracket-link-regexp) +;;;###autoload +(defun org-babel-open-src-block-result (&optional re-run) + "If `point' is on a src block then open the results of the +source code block, otherwise return nil. With optional prefix +argument RE-RUN the source-code block is evaluated even if +results already exist." + (interactive "P") + (when (org-babel-get-src-block-info) + (save-excursion + ;; go to the results, if there aren't any then run the block + (goto-char (or (and (not re-run) (org-babel-where-is-src-block-result)) + (progn (org-babel-execute-src-block) + (org-babel-where-is-src-block-result)))) + (end-of-line 1) + (while (looking-at "[\n\r\t\f ]") (forward-char 1)) + ;; open the results + (if (looking-at org-bracket-link-regexp) + ;; file results + (org-open-at-point) + (let ((results (org-babel-read-result))) + (flet ((echo-res (result) + (if (stringp result) result (format "%S" result)))) + (pop-to-buffer (get-buffer-create "org-babel-results")) + (delete-region (point-min) (point-max)) + (if (listp results) + ;; table result + (insert (orgtbl-to-generic results '(:sep "\t" :fmt echo-res))) + ;; scalar result + (insert (echo-res results)))))) + t))) + +;;;###autoload +(defun org-babel-execute-buffer (&optional arg) + "Execute source code blocks in a buffer. +Call `org-babel-execute-src-block' on every source block in +the current buffer." + (interactive "P") + (save-excursion + (org-save-outline-visibility t + (goto-char (point-min)) + (show-all) + (while (re-search-forward org-babel-src-block-regexp nil t) + (let ((pos-end (match-end 0))) + (goto-char (match-beginning 0)) + (org-babel-execute-src-block arg) + (goto-char pos-end)))))) + +;;;###autoload +(defun org-babel-execute-subtree (&optional arg) + "Execute source code blocks in a subtree. +Call `org-babel-execute-src-block' on every source block in +the current subtree." + (interactive "P") + (save-restriction + (save-excursion + (org-narrow-to-subtree) + (org-babel-execute-buffer) + (widen)))) + +;;;###autoload +(defun org-babel-sha1-hash (&optional info) + "Generate an sha1 hash based on the value of info." + (interactive) + (let* ((info (or info (org-babel-get-src-block-info))) + (hash (sha1 (format "%s-%s" (mapconcat (lambda (arg) (format "%S" arg)) + (nth 2 info) ":") + (nth 1 info))))) + (when (interactive-p) (message hash)) + hash)) + +(defun org-babel-result-hash (&optional info) + "Return the in-buffer hash associated with INFO." + (org-babel-where-is-src-block-result nil info) + (org-babel-clean-text-properties (match-string 3))) + +(defun org-babel-hide-hash () + "Hide the hash in the current results line. +Only the initial `org-babel-hash-show' characters of the hash +will remain visible." + (add-to-invisibility-spec '(org-babel-hide-hash . t)) + (save-excursion + (when (and (re-search-forward org-babel-result-regexp nil t) + (match-string 3)) + (let* ((start (match-beginning 3)) + (hide-start (+ org-babel-hash-show start)) + (end (match-end 3)) + (hash (match-string 3)) + ov1 ov2) + (setq ov1 (make-overlay start hide-start)) + (setq ov2 (make-overlay hide-start end)) + (overlay-put ov2 'invisible 'org-babel-hide-hash) + (overlay-put ov1 'babel-hash hash))))) + +(defun org-babel-hide-all-hashes () + "Hide the hash in the current buffer. +Only the initial `org-babel-hash-show' characters of each hash +will remain visible. This function should be called as part of +the `org-mode-hook'." + (save-excursion + (while (re-search-forward org-babel-result-regexp nil t) + (goto-char (match-beginning 0)) + (org-babel-hide-hash) + (goto-char (match-end 0))))) +(add-hook 'org-mode-hook 'org-babel-hide-all-hashes) + +(defun org-babel-hash-at-point (&optional point) + "Return the value of the hash at POINT. +The hash is also added as the last element of the kill ring. +This can be called with C-c C-c." + (interactive) + (let ((hash (car (delq nil (mapcar + (lambda (ol) (overlay-get ol 'babel-hash)) + (overlays-at (or point (point)))))))) + (when hash (kill-new hash) (message hash)))) +(add-hook 'org-ctrl-c-ctrl-c-hook 'org-babel-hash-at-point) + +(defun org-babel-result-hide-spec () + "Hide portions of results lines. +Add `org-babel-hide-result' as an invisibility spec for hiding +portions of results lines." + (add-to-invisibility-spec '(org-babel-hide-result . t))) +(add-hook 'org-mode-hook 'org-babel-result-hide-spec) + +(defvar org-babel-hide-result-overlays nil + "Overlays hiding results.") + +(defun org-babel-result-hide-all () + "Fold all results in the current buffer." + (interactive) + (org-babel-show-result-all) + (save-excursion + (while (re-search-forward org-babel-result-regexp nil t) + (save-excursion (goto-char (match-beginning 0)) + (org-babel-hide-result-toggle-maybe))))) + +(defun org-babel-show-result-all () + "Unfold all results in the current buffer." + (mapc 'delete-overlay org-babel-hide-result-overlays) + (setq org-babel-hide-result-overlays nil)) + +;;;###autoload +(defun org-babel-hide-result-toggle-maybe () + "Toggle visibility of result at point." + (interactive) + (let ((case-fold-search t)) + (if (save-excursion + (beginning-of-line 1) + (looking-at org-babel-result-regexp)) + (progn (org-babel-hide-result-toggle) + t) ;; to signal that we took action + nil))) ;; to signal that we did not + +(defun org-babel-hide-result-toggle (&optional force) + "Toggle the visibility of the current result." + (interactive) + (save-excursion + (beginning-of-line) + (if (re-search-forward org-babel-result-regexp nil t) + (let ((start (progn (beginning-of-line 2) (- (point) 1))) + (end (progn (goto-char (- (org-babel-result-end) 1)) (point))) + ov) + (if (memq t (mapcar (lambda (overlay) + (eq (overlay-get overlay 'invisible) + 'org-babel-hide-result)) + (overlays-at start))) + (if (or (not force) (eq force 'off)) + (mapc (lambda (ov) + (when (member ov org-babel-hide-result-overlays) + (setq org-babel-hide-result-overlays + (delq ov org-babel-hide-result-overlays))) + (when (eq (overlay-get ov 'invisible) + 'org-babel-hide-result) + (delete-overlay ov))) + (overlays-at start))) + (setq ov (make-overlay start end)) + (overlay-put ov 'invisible 'org-babel-hide-result) + ;; make the block accessible to isearch + (overlay-put + ov 'isearch-open-invisible + (lambda (ov) + (when (member ov org-babel-hide-result-overlays) + (setq org-babel-hide-result-overlays + (delq ov org-babel-hide-result-overlays))) + (when (eq (overlay-get ov 'invisible) + 'org-babel-hide-result) + (delete-overlay ov)))) + (push ov org-babel-hide-result-overlays))) + (error "Not looking at a result line")))) + +;; org-tab-after-check-for-cycling-hook +(add-hook 'org-tab-first-hook 'org-babel-hide-result-toggle-maybe) +;; Remove overlays when changing major mode +(add-hook 'org-mode-hook + (lambda () (org-add-hook 'change-major-mode-hook + 'org-babel-show-result-all 'append 'local))) + +(defmacro org-babel-map-src-blocks (file &rest body) + "Evaluate BODY forms on each source-block in FILE." + (declare (indent 1)) + `(let ((visited-p (get-file-buffer (expand-file-name ,file))) + to-be-removed) + (save-window-excursion + (find-file ,file) + (setq to-be-removed (current-buffer)) + (goto-char (point-min)) + (while (re-search-forward org-babel-src-block-regexp nil t) + (goto-char (match-beginning 0)) + (save-match-data ,@body) + (goto-char (match-end 0)))) + (unless visited-p + (kill-buffer to-be-removed)))) + +(defvar org-file-properties) +(defun org-babel-params-from-properties (&optional lang) + "Retrieve parameters specified as properties. +Return an association list of any source block params which +may be specified in the properties of the current outline entry." + (save-match-data + (let (val sym) + (delq nil + (mapcar + (lambda (header-arg) + (and (setq val + (or (condition-case nil + (org-entry-get (point) header-arg t) + (error nil)) + (cdr (assoc header-arg org-file-properties)))) + (cons (intern (concat ":" header-arg)) val))) + (mapcar + 'symbol-name + (append + org-babel-header-arg-names + (progn + (setq sym (intern (concat "org-babel-header-arg-names:" lang))) + (and (boundp sym) (eval sym)))))))))) + +(defun org-babel-params-from-buffer () + "Retrieve per-buffer parameters. + Return an association list of any source block params which +may be specified at the top of the current buffer." + (or org-babel-current-buffer-properties + (setq org-babel-current-buffer-properties + (save-match-data + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (when (re-search-forward + (org-make-options-regexp (list "BABEL")) nil t) + (org-babel-parse-header-arguments + (org-match-string-no-properties 2))))))))) + +(defvar org-src-preserve-indentation) +(defun org-babel-parse-src-block-match () + "Parse the results from a match of the `org-babel-src-block-regexp'." + (let* ((block-indentation (length (match-string 1))) + (lang (org-babel-clean-text-properties (match-string 2))) + (lang-headers (intern (concat "org-babel-default-header-args:" lang))) + (switches (match-string 3)) + (body (org-babel-clean-text-properties (match-string 5))) + (preserve-indentation (or org-src-preserve-indentation + (string-match "-i\\>" switches)))) + (list lang + ;; get block body less properties, protective commas, and indentation + (with-temp-buffer + (save-match-data + (insert (org-babel-strip-protective-commas body)) + (unless preserve-indentation (org-do-remove-indentation)) + (buffer-string))) + (org-babel-merge-params + org-babel-default-header-args + (org-babel-params-from-buffer) + (org-babel-params-from-properties lang) + (if (boundp lang-headers) (eval lang-headers) nil) + (org-babel-parse-header-arguments + (org-babel-clean-text-properties (or (match-string 4) "")))) + switches + block-indentation))) + +(defun org-babel-parse-inline-src-block-match () + "Parse the results from a match of the `org-babel-inline-src-block-regexp'." + (let* ((lang (org-babel-clean-text-properties (match-string 2))) + (lang-headers (intern (concat "org-babel-default-header-args:" lang)))) + (list lang + (org-babel-strip-protective-commas + (org-babel-clean-text-properties (match-string 5))) + (org-babel-merge-params + org-babel-default-inline-header-args + (org-babel-params-from-buffer) + (org-babel-params-from-properties lang) + (if (boundp lang-headers) (eval lang-headers) nil) + (org-babel-parse-header-arguments + (org-babel-clean-text-properties (or (match-string 4) ""))))))) + +(defun org-babel-parse-header-arguments (arg-string) + "Parse a string of header arguments returning an alist." + (if (> (length arg-string) 0) + (delq nil + (mapcar + (lambda (arg) + (if (string-match + "\\([^ \f\t\n\r\v]+\\)[ \f\t\n\r\v]+\\([^ \f\t\n\r\v]+.*\\)" + arg) + (cons (intern (concat ":" (match-string 1 arg))) + (let ((raw (org-babel-chomp (match-string 2 arg)))) + (if (org-babel-number-p raw) + raw (org-babel-read raw)))) + (cons (intern (concat ":" arg)) nil))) + (split-string (concat " " arg-string) "[ \f\t\n\r\v]+:" t))))) + +(defun org-babel-process-params (params) + "Parse params and resolve references. + +Return a list (session vars result-params result-type colnames rownames)." + (let* ((session (cdr (assoc :session params))) + (vars-and-names (org-babel-disassemble-tables + (org-babel-ref-variables params) + (cdr (assoc :hlines params)) + (cdr (assoc :colnames params)) + (cdr (assoc :rownames params)))) + (vars (car vars-and-names)) + (colnames (cadr vars-and-names)) + (rownames (caddr vars-and-names)) + (result-params (split-string (or (cdr (assoc :results params)) ""))) + (result-type (cond ((member "output" result-params) 'output) + ((member "value" result-params) 'value) + (t 'value)))) + (list session vars result-params result-type colnames rownames))) + +;; row and column names +(defun org-babel-del-hlines (table) + "Remove all 'hlines from TABLE." + (remove 'hline table)) + +(defun org-babel-get-colnames (table) + "Return the column names of TABLE. +Return a cons cell, the `car' of which contains the TABLE less +colnames, and the `cdr' of which contains a list of the column +names." + (if (equal 'hline (nth 1 table)) + (cons (cddr table) (car table)) + (cons (cdr table) (car table)))) + +(defun org-babel-get-rownames (table) + "Return the row names of TABLE. +Return a cons cell, the `car' of which contains the TABLE less +colnames, and the `cdr' of which contains a list of the column +names. Note: this function removes any hlines in TABLE." + (flet ((trans (table) (apply #'mapcar* #'list table))) + (let* ((width (apply 'max (mapcar (lambda (el) (if (listp el) (length el) 0)) table))) + (table (trans (mapcar (lambda (row) + (if (not (equal row 'hline)) + row + (setq row '()) + (dotimes (n width) (setq row (cons 'hline row))) + row)) + table)))) + (cons (mapcar (lambda (row) (if (equal (car row) 'hline) 'hline row)) + (trans (cdr table))) + (remove 'hline (car table)))))) + +(defun org-babel-put-colnames (table colnames) + "Add COLNAMES to TABLE if they exist." + (if colnames (apply 'list colnames 'hline table) table)) + +(defun org-babel-put-rownames (table rownames) + "Add ROWNAMES to TABLE if they exist." + (if rownames + (mapcar (lambda (row) + (if (listp row) + (cons (or (pop rownames) "") row) + row)) table) + table)) + +(defun org-babel-pick-name (names selector) + "Select one out of an alist of row or column names." + (when names + (if (and selector (symbolp selector) (not (equal t selector))) + (cdr (assoc selector names)) + (if (integerp selector) + (nth (- selector 1) names) + (cdr (car (last names))))))) + +(defun org-babel-disassemble-tables (vars hlines colnames rownames) + "Parse tables for further processing. +Process the variables in VARS according to the HLINES, +ROWNAMES and COLNAMES header arguments. Return a list consisting +of the vars, cnames and rnames." + (let (cnames rnames) + (list + (mapcar + (lambda (var) + (when (listp (cdr var)) + (when (and (not (equal colnames "no")) + (or colnames (and (equal (nth 1 (cdr var)) 'hline) + (not (member 'hline (cddr (cdr var))))))) + (let ((both (org-babel-get-colnames (cdr var)))) + (setq cnames (cons (cons (car var) (cdr both)) + cnames)) + (setq var (cons (car var) (car both))))) + (when (and rownames (not (equal rownames "no"))) + (let ((both (org-babel-get-rownames (cdr var)))) + (setq rnames (cons (cons (car var) (cdr both)) + rnames)) + (setq var (cons (car var) (car both))))) + (when (and hlines (not (equal hlines "yes"))) + (setq var (cons (car var) (org-babel-del-hlines (cdr var)))))) + var) + vars) + cnames rnames))) + +(defun org-babel-reassemble-table (table colnames rownames) + "Add column and row names to a table. +Given a TABLE and set of COLNAMES and ROWNAMES add the names +to the table for reinsertion to org-mode." + (if (listp table) + ((lambda (table) + (if (and colnames (listp (car table)) (= (length (car table)) + (length colnames))) + (org-babel-put-colnames table colnames) table)) + (if (and rownames (= (length table) (length rownames))) + (org-babel-put-rownames table rownames) table)) + table)) + +(defun org-babel-where-is-src-block-head () + "Find where the current source block begins. +Return the point at the beginning of the current source +block. Specifically at the beginning of the #+BEGIN_SRC line. +If the point is not on a source block then return nil." + (let ((initial (point)) top bottom) + (or + (save-excursion ;; on a source name line + (beginning-of-line 1) + (and (looking-at org-babel-src-name-regexp) (forward-line 1) + (looking-at org-babel-src-block-regexp) + (point))) + (save-excursion ;; on a #+begin_src line + (beginning-of-line 1) + (and (looking-at org-babel-src-block-regexp) + (point))) + (save-excursion ;; inside a src block + (and + (re-search-backward "^[ \t]*#\\+begin_src" nil t) (setq top (point)) + (re-search-forward "^[ \t]*#\\+end_src" nil t) (setq bottom (point)) + (< top initial) (< initial bottom) + (progn (goto-char top) (beginning-of-line 1) + (looking-at org-babel-src-block-regexp)) + (point)))))) + +;;;###autoload +(defun org-babel-goto-named-src-block (name) + "Go to a named source-code block." + (interactive + (let ((completion-ignore-case t)) + (list (org-icompleting-read "source-block name: " + (org-babel-src-block-names) nil t)))) + (let ((point (org-babel-find-named-block name))) + (if point + ;; taken from `org-open-at-point' + (progn (goto-char point) (org-show-context)) + (message "source-code block '%s' not found in this buffer" name)))) + +(defun org-babel-find-named-block (name) + "Find a named source-code block. +Return the location of the source block identified by source +NAME, or nil if no such block exists. Set match data according to +org-babel-named-src-block-regexp." + (save-excursion + (let ((case-fold-search t) + (regexp (org-babel-named-src-block-regexp-for-name name)) msg) + (goto-char (point-min)) + (when (or (re-search-forward regexp nil t) + (re-search-backward regexp nil t)) + (match-beginning 0))))) + +(defun org-babel-src-block-names (&optional file) + "Returns the names of source blocks in FILE or the current buffer." + (save-excursion + (when file (find-file file)) (goto-char (point-min)) + (let (names) + (while (re-search-forward org-babel-src-name-w-name-regexp nil t) + (setq names (cons (org-babel-clean-text-properties (match-string 2)) + names))) + names))) + +;;;###autoload +(defun org-babel-goto-named-result (name) + "Go to a named result." + (interactive + (let ((completion-ignore-case t)) + (list (org-icompleting-read "source-block name: " + (org-babel-result-names) nil t)))) + (let ((point (org-babel-find-named-result name))) + (if point + ;; taken from `org-open-at-point' + (progn (goto-char point) (org-show-context)) + (message "result '%s' not found in this buffer" name)))) + +(defun org-babel-find-named-result (name) + "Find a named result. +Return the location of the result named NAME in the current +buffer or nil if no such result exists." + (save-excursion + (goto-char (point-min)) + (when (re-search-forward + (concat org-babel-result-regexp + "[ \t]" (regexp-quote name) "[ \t\n\f\v\r]") nil t) + (beginning-of-line 0) (point)))) + +(defun org-babel-result-names (&optional file) + "Returns the names of results in FILE or the current buffer." + (save-excursion + (when file (find-file file)) (goto-char (point-min)) + (let (names) + (while (re-search-forward org-babel-result-w-name-regexp nil t) + (setq names (cons (org-babel-clean-text-properties (match-string 4)) + names))) + names))) + +;;;###autoload +(defun org-babel-next-src-block (&optional arg) + "Jump to the next source block. +With optional prefix argument ARG, jump forward ARG many source blocks." + (interactive "P") + (when (looking-at org-babel-src-block-regexp) (forward-char 1)) + (re-search-forward org-babel-src-block-regexp nil nil (or arg 1)) + (goto-char (match-beginning 0)) (org-show-context)) + +;;;###autoload +(defun org-babel-previous-src-block (&optional arg) + "Jump to the previous source block. +With optional prefix argument ARG, jump backward ARG many source blocks." + (interactive "P") + (re-search-backward org-babel-src-block-regexp nil nil (or arg 1)) + (goto-char (match-beginning 0)) (org-show-context)) + +(defvar org-babel-lob-one-liner-regexp) +(defun org-babel-where-is-src-block-result (&optional insert info hash indent) + "Find where the current source block results begin. +Return the point at the beginning of the result of the current +source block. Specifically at the beginning of the results line. +If no result exists for this block then create a results line +following the source block." + (save-excursion + (let* ((on-lob-line (progn (beginning-of-line 1) + (looking-at org-babel-lob-one-liner-regexp))) + (name (if on-lob-line + (nth 0 (org-babel-lob-get-info)) + (nth 4 (or info (org-babel-get-src-block-info))))) + (head (unless on-lob-line (org-babel-where-is-src-block-head))) + found beg end) + (when head (goto-char head)) + (setq + found ;; was there a result (before we potentially insert one) + (or + (and + ;; named results: + ;; - return t if it is found, else return nil + ;; - if it does not need to be rebuilt, then don't set end + ;; - if it does need to be rebuilt then do set end + name (setq beg (org-babel-find-named-result name)) + (prog1 beg + (when (and hash (not (string= hash (match-string 3)))) + (goto-char beg) (setq end beg) ;; beginning of result + (forward-line 1) + (delete-region end (org-babel-result-end)) nil))) + (and + ;; unnamed results: + ;; - return t if it is found, else return nil + ;; - if it is found, and the hash doesn't match, delete and set end + (or on-lob-line (re-search-forward "^[ \t]*#\\+end_src" nil t)) + (progn (end-of-line 1) + (if (eobp) (insert "\n") (forward-char 1)) + (setq end (point)) + (or (and (not name) + (progn ;; unnamed results line already exists + (re-search-forward "[^ \f\t\n\r\v]" nil t) + (beginning-of-line 1) + (looking-at + (concat org-babel-result-regexp "\n"))) + (prog1 (point) + ;; must remove and rebuild if hash!=old-hash + (if (and hash (not (string= hash (match-string 3)))) + (prog1 nil + (forward-line 1) + (delete-region + end (org-babel-result-end))) + (setq end nil))))))))) + (if (and insert end) + (progn + (goto-char end) + (unless beg + (if (looking-at "[\n\r]") (forward-char 1) (insert "\n"))) + (insert (concat + (if indent + (mapconcat + (lambda (el) " ") + (number-sequence 1 indent) "") + "") + "#+results" + (when hash (concat "["hash"]")) + ":" + (when name (concat " " name)) "\n")) + (unless beg (insert "\n") (backward-char)) + (beginning-of-line 0) + (if hash (org-babel-hide-hash)) + (point)) + found)))) + +(defvar org-block-regexp) +(defun org-babel-read-result () + "Read the result at `point' into emacs-lisp." + (let ((case-fold-search t) result-string) + (cond + ((org-at-table-p) (org-babel-read-table)) + ((looking-at org-bracket-link-regexp) (org-babel-read-link)) + ((looking-at org-block-regexp) (org-babel-trim (match-string 4))) + ((looking-at "^[ \t]*: ") + (setq result-string + (org-babel-trim + (mapconcat (lambda (line) + (if (and (> (length line) 1) + (string-match "^[ \t]*: \\(.+\\)" line)) + (match-string 1 line) + line)) + (split-string + (buffer-substring + (point) (org-babel-result-end)) "[\r\n]+") + "\n"))) + (or (org-babel-number-p result-string) result-string)) + ((looking-at org-babel-result-regexp) + (save-excursion (forward-line 1) (org-babel-read-result)))))) + +(defun org-babel-read-table () + "Read the table at `point' into emacs-lisp." + (mapcar (lambda (row) + (if (and (symbolp row) (equal row 'hline)) row + (mapcar #'org-babel-read row))) + (org-table-to-lisp))) + +(defvar org-link-types-re) +(defun org-babel-read-link () + "Read the link at `point' into emacs-lisp. +If the path of the link is a file path it is expanded using +`expand-file-name'." + (let* ((case-fold-search t) + (raw (and (looking-at org-bracket-link-regexp) + (org-babel-clean-text-properties (match-string 1)))) + (type (and (string-match org-link-types-re raw) + (match-string 1 raw)))) + (cond + ((not type) (expand-file-name raw)) + ((string= type "file") + (and (string-match "file\\(.*\\):\\(.+\\)" raw) + (expand-file-name (match-string 2 raw)))) + (t raw)))) + +(defun org-babel-insert-result + (result &optional result-params info hash indent lang) + "Insert RESULT into the current buffer. +By default RESULT is inserted after the end of the +current source block. With optional argument RESULT-PARAMS +controls insertion of results in the org-mode file. +RESULT-PARAMS can take the following values... + +replace - (default option) insert results after the source block + replacing any previously inserted results + +silent -- no results are inserted + +file ---- the results are interpreted as a file path, and are + inserted into the buffer using the Org-mode file syntax + +raw ----- results are added directly to the org-mode file. This + is a good option if you code block will output org-mode + formatted text. + +org ----- this is the same as the 'raw' option + +html ---- results are added inside of a #+BEGIN_HTML block. This + is a good option if you code block will output html + formatted text. + +latex --- results are added inside of a #+BEGIN_LATEX block. + This is a good option if you code block will output + latex formatted text. + +code ---- the results are extracted in the syntax of the source + code of the language being evaluated and are added + inside of a #+BEGIN_SRC block with the source-code + language set appropriately. Note this relies on the + optional LANG argument." + (if (stringp result) + (progn + (setq result (org-babel-clean-text-properties result)) + (when (member "file" result-params) + (setq result (org-babel-result-to-file result)))) + (unless (listp result) (setq result (format "%S" result)))) + (if (= (length result) 0) + (if (member "value" result-params) + (message "No result returned by source block") + (message "Source block produced no output")) + (if (and result-params (member "silent" result-params)) + (progn + (message (replace-regexp-in-string "%" "%%" (format "%S" result))) + result) + (when (and (stringp result) ;; ensure results end in a newline + (not (or (string-equal (substring result -1) "\n") + (string-equal (substring result -1) "\r")))) + (setq result (concat result "\n"))) + (save-excursion + (let ((existing-result (org-babel-where-is-src-block-result + t info hash indent)) + (results-switches + (cdr (assoc :results_switches (nth 2 info)))) + beg end) + (when existing-result + (goto-char existing-result) + (save-excursion + (re-search-forward "#" nil t) + (setq indent (- (current-column) 1))) + (forward-line 1) + (setq beg (point)) + (cond + ((member "replace" result-params) + (delete-region (point) (org-babel-result-end))) + ((member "append" result-params) + (goto-char (org-babel-result-end)) (setq beg (point))) + ((member "prepend" result-params) ;; already there + ))) + (setq results-switches + (if results-switches (concat " " results-switches) "")) + (cond + ;; assume the result is a table if it's not a string + ((not (stringp result)) + (insert (concat (orgtbl-to-orgtbl + (if (or (eq 'hline (car result)) + (and (listp (car result)) + (listp (cdr (car result))))) + result (list result)) + '(:fmt (lambda (cell) (format "%s" cell)))) "\n")) + (goto-char beg) (when (org-at-table-p) (org-table-align))) + ((member "file" result-params) + (insert result)) + ((member "html" result-params) + (insert (format "#+BEGIN_HTML%s\n%s#+END_HTML\n" + results-switches result))) + ((member "latex" result-params) + (insert (format "#+BEGIN_LaTeX%s\n%s#+END_LaTeX\n" + results-switches result))) + ((member "code" result-params) + (insert (format "#+BEGIN_SRC %s%s\n%s#+END_SRC\n" + (or lang "none") results-switches result))) + ((or (member "raw" result-params) (member "org" result-params)) + (save-excursion (insert result)) (if (org-at-table-p) (org-cycle))) + (t + (org-babel-examplize-region + (point) (progn (insert result) (point)) results-switches))) + ;; possibly indent the results to match the #+results line + (setq end (if (listp result) (org-table-end) (point))) + (when (and indent (> indent 0) + ;; in this case `table-align' does the work for us + (not (and (listp result) + (member "append" result-params)))) + (indent-rigidly beg end indent)))) + (message "finished")))) + +(defun org-babel-remove-result (&optional info) + "Remove the result of the current source block." + (interactive) + (let ((location (org-babel-where-is-src-block-result nil info)) start) + (when location + (save-excursion + (goto-char location) (setq start (point)) (forward-line 1) + (delete-region start (org-babel-result-end)))))) + +(defun org-babel-result-end () + "Return the point at the end of the current set of results" + (save-excursion + (if (org-at-table-p) + (progn (goto-char (org-table-end)) (point)) + (let ((case-fold-search t)) + (cond + ((looking-at "[ \t]*#\\+begin_latex") + (re-search-forward "[ \t]*#\\+end_latex" nil t) + (forward-line 1)) + ((looking-at "[ \t]*#\\+begin_html") + (re-search-forward "[ \t]*#\\+end_html" nil t) + (forward-line 1)) + ((looking-at "[ \t]*#\\+begin_example") + (re-search-forward "[ \t]*#\\+end_example" nil t) + (forward-line 1)) + ((looking-at "[ \t]*#\\+begin_src") + (re-search-forward "[ \t]*#\\+end_src" nil t) + (forward-line 1)) + (t (progn (while (looking-at "[ \t]*\\(: \\|\\[\\[\\)") + (forward-line 1)))))) + (point)))) + +(defun org-babel-result-to-file (result) + "Convert RESULT into an `org-mode' link. +If the `default-directory' is different from the containing +file's directory then expand relative links." + (format + "[[file:%s]]" + (if (and default-directory + buffer-file-name + (not (string= (expand-file-name default-directory) + (expand-file-name + (file-name-directory buffer-file-name))))) + (expand-file-name result default-directory) + result))) + +(defun org-babel-examplize-region (beg end &optional results-switches) + "Comment out region using the ': ' org example quote." + (interactive "*r") + (let ((size (count-lines beg end))) + (save-excursion + (cond ((= size 0) + (error (concat "This should be impossible:" + "a newline was appended to result if missing"))) + ((< size org-babel-min-lines-for-block-output) + (goto-char beg) + (dotimes (n size) + (beginning-of-line 1) (insert ": ") (forward-line 1))) + (t + (goto-char beg) + (insert (if results-switches + (format "#+begin_example%s\n" results-switches) + "#+begin_example\n")) + (forward-char (- end beg)) + (insert "#+end_example\n")))))) + +(defun org-babel-merge-params (&rest plists) + "Combine all parameter association lists in PLISTS. +Later elements of PLISTS override the values of previous element. +This takes into account some special considerations for certain +parameters when merging lists." + (let ((results-exclusive-groups + '(("file" "vector" "table" "scalar" "raw" "org" + "html" "latex" "code" "pp") + ("replace" "silent" "append" "prepend") + ("output" "value"))) + (exports-exclusive-groups + '(("code" "results" "both" "none"))) + params results exports tangle noweb cache vars var ref shebang comments) + (flet ((e-merge (exclusive-groups &rest result-params) + ;; maintain exclusivity of mutually exclusive parameters + (let (output) + (mapc (lambda (new-params) + (mapc (lambda (new-param) + (mapc (lambda (exclusive-group) + (when (member new-param exclusive-group) + (mapcar (lambda (excluded-param) + (setq output + (delete + excluded-param + output))) + exclusive-group))) + exclusive-groups) + (setq output (org-uniquify + (cons new-param output)))) + new-params)) + result-params) + output))) + (mapc (lambda (plist) + (mapc (lambda (pair) + (case (car pair) + (:var + ;; we want only one specification per variable + (when (string-match + (concat "^\\([^= \f\t\n\r\v]+\\)[ \t]*=" + "[ \t]*\\([^\f\n\r\v]+\\)$") (cdr pair)) + ;; TODO: When is this not true? + (setq var (intern (match-string 1 (cdr pair))) + ref (match-string 2 (cdr pair)) + vars (cons (cons var ref) + (assq-delete-all var vars))))) + (:results + (setq results + (e-merge results-exclusive-groups + results (split-string (cdr pair))))) + (:file + (when (cdr pair) + (setq results (e-merge results-exclusive-groups + results '("file"))) + (unless (or (member "both" exports) + (member "none" exports) + (member "code" exports)) + (setq exports (e-merge exports-exclusive-groups + exports '("results")))) + (setq params + (cons pair + (assq-delete-all (car pair) params))))) + (:exports + (setq exports + (e-merge exports-exclusive-groups + exports (split-string (cdr pair))))) + (:tangle ;; take the latest -- always overwrite + (setq tangle (or (list (cdr pair)) tangle))) + (:noweb + (setq noweb + (e-merge '(("yes" "no")) noweb + (split-string (or (cdr pair) ""))))) + (:cache + (setq cache + (e-merge '(("yes" "no")) cache + (split-string (or (cdr pair) ""))))) + (:shebang ;; take the latest -- always overwrite + (setq shebang (or (list (cdr pair)) shebang))) + (:comments + (setq comments + (e-merge '(("yes" "no")) comments + (split-string (or (cdr pair) ""))))) + (t ;; replace: this covers e.g. :session + (setq params + (cons pair + (assq-delete-all (car pair) params)))))) + plist)) + plists)) + (setq vars (mapcar (lambda (pair) (format "%s=%s" (car pair) (cdr pair))) vars)) + (while vars (setq params (cons (cons :var (pop vars)) params))) + (cons (cons :comments (mapconcat 'identity comments " ")) + (cons (cons :shebang (mapconcat 'identity shebang " ")) + (cons (cons :cache (mapconcat 'identity cache " ")) + (cons (cons :noweb (mapconcat 'identity noweb " ")) + (cons (cons :tangle (mapconcat 'identity tangle " ")) + (cons (cons :exports + (mapconcat 'identity exports " ")) + (cons + (cons :results + (mapconcat 'identity results " ")) + params))))))))) + +(defun org-babel-expand-noweb-references (&optional info parent-buffer) + "Expand Noweb references in the body of the current source code block. + +For example the following reference would be replaced with the +body of the source-code block named 'example-block'. + +<> + +Note that any text preceding the <> construct on a line will +be interposed between the lines of the replacement text. So for +example if <> is placed behind a comment, then the entire +replacement text will also be commented. + +This function must be called from inside of the buffer containing +the source-code block which holds BODY. + +In addition the following syntax can be used to insert the +results of evaluating the source-code block named 'example-block'. + +<> + +Any optional arguments can be passed to example-block by placing +the arguments inside the parenthesis following the convention +defined by `org-babel-lob'. For example + +<> + +would set the value of argument \"a\" equal to \"9\". Note that +these arguments are not evaluated in the current source-code +block but are passed literally to the \"example-block\"." + (let* ((parent-buffer (or parent-buffer (current-buffer))) + (info (or info (org-babel-get-src-block-info))) + (lang (nth 0 info)) + (body (nth 1 info)) + (new-body "") index source-name evaluate prefix) + (flet ((nb-add (text) + (setq new-body (concat new-body text)))) + (with-temp-buffer + (insert body) (goto-char (point-min)) + (setq index (point)) + (while (and (re-search-forward "<<\\(.+?\\)>>" nil t)) + (save-match-data (setf source-name (match-string 1))) + (save-match-data (setq evaluate (string-match "\(.*\)" source-name))) + (save-match-data + (setq prefix + (buffer-substring (match-beginning 0) + (save-excursion + (beginning-of-line 1) (point))))) + ;; add interval to new-body (removing noweb reference) + (goto-char (match-beginning 0)) + (nb-add (buffer-substring index (point))) + (goto-char (match-end 0)) + (setq index (point)) + (nb-add (with-current-buffer parent-buffer + (mapconcat ;; interpose PREFIX between every line + #'identity + (split-string + (if evaluate + (let ((raw (org-babel-ref-resolve-reference + source-name nil))) + (if (stringp raw) raw (format "%S" raw))) + (save-restriction + (widen) + (let ((point (org-babel-find-named-block + source-name))) + (if point + (save-excursion + (goto-char point) + (org-babel-trim + (org-babel-expand-noweb-references + (org-babel-get-src-block-info)))) + ;; optionally raise an error if named + ;; source-block doesn't exist + (if (member lang org-babel-noweb-error-langs) + (error "%s" + (concat + "<<" source-name ">> " + "could not be resolved (see " + "`org-babel-noweb-error-langs')")) + ""))))) + "[\n\r]") (concat "\n" prefix))))) + (nb-add (buffer-substring index (point-max))))) + new-body)) + +(defun org-babel-clean-text-properties (text) + "Strip all properties from text return." + (when text + (set-text-properties 0 (length text) nil text) text)) + +(defun org-babel-strip-protective-commas (body) + "Strip protective commas from bodies of source blocks." + (replace-regexp-in-string "^,#" "#" body)) + +(defun org-babel-read (cell) + "Convert the string value of CELL to a number if appropriate. +Otherwise if cell looks like lisp (meaning it starts with a +\"(\" or a \"'\") then read it as lisp, otherwise return it +unmodified as a string. + +This is taken almost directly from `org-read-prop'." + (if (and (stringp cell) (not (equal cell ""))) + (or (org-babel-number-p cell) + (if (or (equal "(" (substring cell 0 1)) + (equal "'" (substring cell 0 1)) + (equal "`" (substring cell 0 1))) + (eval (read cell)) + (progn (set-text-properties 0 (length cell) nil cell) cell))) + cell)) + +(defun org-babel-number-p (string) + "Return t if STRING represents a number." + (if (and (string-match "^-?[0-9]*\\.?[0-9]*$" string) + (= (length (substring string (match-beginning 0) + (match-end 0))) + (length string))) + (string-to-number string))) + +(defun org-babel-import-elisp-from-file (file-name) + "Read the results located at FILE-NAME into an elisp table. +If the table is trivial, then return it as a scalar." + (let (result) + (save-window-excursion + (with-temp-buffer + (condition-case nil + (progn + (org-table-import file-name nil) + (delete-file file-name) + (setq result (mapcar (lambda (row) + (mapcar #'org-babel-string-read row)) + (org-table-to-lisp)))) + (error nil))) + (if (null (cdr result)) ;; if result is trivial vector, then scalarize it + (if (consp (car result)) + (if (null (cdr (car result))) + (caar result) + result) + (car result)) + result)))) + +(defun org-babel-string-read (cell) + "Strip nested \"s from around strings." + (org-babel-read (or (and (stringp cell) + (string-match "\\\"\\(.+\\)\\\"" cell) + (match-string 1 cell)) + cell))) + +(defun org-babel-reverse-string (string) + "Return the reverse of STRING." + (apply 'string (reverse (string-to-list string)))) + +(defun org-babel-chomp (string &optional regexp) + "Strip trailing spaces and carriage returns from STRING. +Default regexp used is \"[ \f\t\n\r\v]\" but can be +overwritten by specifying a regexp as a second argument." + (let ((regexp (or regexp "[ \f\t\n\r\v]"))) + (while (and (> (length string) 0) + (string-match regexp (substring string -1))) + (setq string (substring string 0 -1))) + string)) + +(defun org-babel-trim (string &optional regexp) + "Strip leading and trailing spaces and carriage returns from STRING. +Like `org-babel-chomp' only it runs on both the front and back +of the string." + (org-babel-chomp (org-babel-reverse-string + (org-babel-chomp (org-babel-reverse-string string) regexp)) + regexp)) + +(defvar org-babel-org-babel-call-process-region-original nil) +(defun org-babel-tramp-handle-call-process-region + (start end program &optional delete buffer display &rest args) + "Use tramp to handle call-process-region. +Fixes a bug in `tramp-handle-call-process-region'." + (if (and (featurep 'tramp) (file-remote-p default-directory)) + (let ((tmpfile (tramp-compat-make-temp-file ""))) + (write-region start end tmpfile) + (when delete (delete-region start end)) + (unwind-protect + ;; (apply 'call-process program tmpfile buffer display args) + ;; bug in tramp + (apply 'process-file program tmpfile buffer display args) + (delete-file tmpfile))) + ;; org-babel-call-process-region-original is the original emacs definition. It + ;; is in scope from the let binding in org-babel-execute-src-block + (apply org-babel-call-process-region-original + start end program delete buffer display args))) + +(defun org-babel-maybe-remote-file (file) + "Conditionally parse information on a remote connnection. +If FILE specifies a remove file, then parse the information on +the remote connection." + (if (file-remote-p default-directory) + (let* ((vec (tramp-dissect-file-name default-directory)) + (user (tramp-file-name-user vec)) + (host (tramp-file-name-host vec))) + (concat "/" user (when user "@") host ":" file)) + file)) + +(provide 'ob) + +;; arch-tag: 01a7ebee-06c5-4ee4-a709-e660d28c0af1 + +;;; ob.el ends here diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 50e78528256..a3d288065d3 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -32,8 +32,7 @@ (require 'org) (eval-when-compile - (require 'cl) - (require 'calendar)) + (require 'cl)) (declare-function diary-add-to-list "diary-lib" (date string specifier &optional marker globcolor literal)) @@ -143,8 +142,8 @@ specifies the maximum number of lines that will be added for each entry that is listed in the agenda view. Note that this variable is not used during display, only when exporting -the agenda. For agenda display, see org-agenda-entry-text-mode and the -variable `org-agenda-entry-text-maxlines'." +the agenda. For agenda display, see the variables `org-agenda-entry-text-mode' +and `org-agenda-entry-text-maxlines'." :group 'org-agenda :type 'integer) @@ -198,6 +197,11 @@ you can \"misuse\" it to also add other text to the header. However, :group 'org-export-html :type 'string) +(defcustom org-agenda-persistent-filter nil + "When set, keep filters from one agenda view to the next." + :group 'org-agenda + :type 'boolean) + (defgroup org-agenda-custom-commands nil "Options concerning agenda views in Org-mode." :tag "Org Agenda Custom Commands" @@ -212,6 +216,7 @@ you can \"misuse\" it to also add other text to the header. However, (const todo-state-up) (const todo-state-down) (const effort-up) (const effort-down) (const habit-up) (const habit-down) + (const alpha-up) (const alpha-down) (const user-defined-up) (const user-defined-down)) "Sorting choices.") @@ -590,7 +595,7 @@ to make his option also apply to the tags-todo list." There are different motivations for using different values, please think carefully when configuring this variable. -This applie when creating the global todo list. +This applies when creating the global todo list. Valid values are: near Don't show near deadline entries. A deadline is near when it is @@ -757,7 +762,7 @@ Needs to be set before org.el is loaded." :type 'boolean) (defcustom org-agenda-start-with-follow-mode nil - "The initial value of follow-mode in a newly created agenda window." + "The initial value of follow mode in a newly created agenda window." :group 'org-agenda-startup :type 'boolean) @@ -1003,7 +1008,7 @@ When this is non-nil, the string will be split on whitespace, and each snippet will be searched individually, and all must match in order to select an entry. A snippet is then a single string of non-white characters, or a string in double quotes, or a regexp in {} braces. -If a snippet is preceeded by \"-\", the snippet must *not* match. +If a snippet is preceded by \"-\", the snippet must *not* match. \"+\" is syntactic sugar for positive selection. Each snippet may be found as a full word or a partial word, but see the variable `org-agenda-search-view-force-full-words'. @@ -1013,7 +1018,7 @@ with each space character matching any amount of whitespace, including line breaks. Even when this is nil, you can still switch to Boolean search dynamically -by preceeding the first snippet with \"+\" or \"-\". If the first snippet +by preceding the first snippet with \"+\" or \"-\". If the first snippet is a regexp marked with braces like \"{abc}\", this will also switch to boolean search." :group 'org-agenda-search-view @@ -1024,8 +1029,7 @@ boolean search." 'org-agenda-search-view-always-boolean)) (defcustom org-agenda-search-view-force-full-words nil - "Non-nil me -ans, search words must be matches as complete words. + "Non-nil means, search words must be matches as complete words. When nil, they may also match part of a word." :group 'org-agenda-search-view :type 'boolean) @@ -1121,6 +1125,8 @@ user-defined-up Sort according to `org-agenda-cmp-user-defined', high last. user-defined-down Sort according to `org-agenda-cmp-user-defined', high first. habit-up Put entries that are habits first habit-down Put entries that are habits last +alpha-up Sort headlines alphabetically +alpha-down Sort headlines alphabetically, reversed The different possibilities will be tried in sequence, and testing stops if one comparison returns a \"not-equal\". For example, the default @@ -1279,7 +1285,7 @@ range, respectively." (function)))) (defcustom org-agenda-scheduled-leaders '("Scheduled: " "Sched.%2dx: ") - "Text preceeding scheduled items in the agenda view. + "Text preceding scheduled items in the agenda view. This is a list with two strings. The first applies when the item is scheduled on the current day. The second applies when it has been scheduled previously, it may contain a %d indicating that this is the nth time that @@ -1292,7 +1298,7 @@ that passed since this item was scheduled first." (string :tag "Scheduled previously"))) (defcustom org-agenda-inactive-leader "[" - "Text preceeding item pulled into the agenda by inactive time stamps. + "Text preceding item pulled into the agenda by inactive time stamps. These entries are added to the agenda when pressing \"[\"." :group 'org-agenda-line-format :type '(list @@ -1300,7 +1306,7 @@ These entries are added to the agenda when pressing \"[\"." (string :tag "Scheduled previously"))) (defcustom org-agenda-deadline-leaders '("Deadline: " "In %3d d.: ") - "Text preceeding deadline items in the agenda view. + "Text preceding deadline items in the agenda view. This is a list with two strings. The first applies when the item has its deadline on the current day. The second applies when it is in the past or in the future, it may contain %d to capture how many days away the deadline @@ -1321,7 +1327,7 @@ placed into the prefix. If this option is non-nil, the original specification 11:30-4pm) will be removed for agenda display. This makes the agenda less cluttered. The option can be t or nil. It may also be the symbol `beg', indicating -that the time should only be removed what it is located at the beginning of +that the time should only be removed when it is located at the beginning of the headline/diary entry." :group 'org-agenda-line-format :type '(choice @@ -1329,6 +1335,11 @@ the headline/diary entry." (const :tag "Never" nil) (const :tag "When at beginning of entry" beg))) +(defcustom org-agenda-remove-timeranges-from-blocks nil + "Non-nil means remove time ranges specifications in agenda +items that span on several days." + :group 'org-agenda-line-format + :type 'boolean) (defcustom org-agenda-default-appointment-duration nil "Default duration for appointments that only have a starting time. @@ -1347,7 +1358,7 @@ When non-nil, this must be the number of minutes, e.g. 60 for one hour." (defcustom org-agenda-hide-tags-regexp nil "Regular expression used to filter away specific tags in agenda views. This means that these tags will be present, but not be shown in the agenda -line. Secondayt filltering will still work on the hidden tags. +line. Secondary filtering will still work on the hidden tags. Nil means don't hide any tags." :group 'org-agenda-line-format :type '(choice @@ -1382,7 +1393,7 @@ it means that the tags should be flushright to that column. For example, (defcustom org-agenda-fontify-priorities 'cookies "Non-nil means highlight low and high priorities in agenda. When t, the highest priority entries are bold, lowest priority italic. -However, settings in org-priority-faces will overrule these faces. +However, settings in `org-priority-faces' will overrule these faces. When this variable is the symbol `cookies', only fontify the cookies, not the entire task. This may also be an association list of priority faces, whose @@ -1485,7 +1496,7 @@ works you probably want to add it to `org-agenda-custom-commands' for good." (defvar org-agenda-redo-command nil) (defvar org-agenda-query-string nil) (defvar org-agenda-mode-hook nil - "Hook for org-agenda-mode, run after the mode is turned on.") + "Hook for `org-agenda-mode', run after the mode is turned on.") (defvar org-agenda-type nil) (defvar org-agenda-force-single-file nil) (defvar org-agenda-bulk-marked-entries) ;; Defined further down in this file @@ -1663,10 +1674,8 @@ The following commands are available: (org-defkey org-agenda-mode-map "\C-c\C-x\C-mg" 'org-mobile-pull) (org-defkey org-agenda-mode-map "\C-c\C-x\C-mp" 'org-mobile-push) -(org-defkey org-agenda-mode-map - (if (featurep 'xemacs) [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse) -(org-defkey org-agenda-mode-map - (if (featurep 'xemacs) [(button3)] [(mouse-3)]) 'org-agenda-show-mouse) +(org-defkey org-agenda-mode-map [mouse-2] 'org-agenda-goto-mouse) +(org-defkey org-agenda-mode-map [mouse-3] 'org-agenda-show-mouse) (when org-agenda-mouse-1-follows-link (org-defkey org-agenda-mode-map [follow-link] 'mouse-face)) (easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu" @@ -1967,7 +1976,6 @@ Pressing `<' twice means to restrict to the current subtree or region (move-marker org-agenda-restrict-end (progn (org-end-of-subtree t))))))) - (require 'calendar) ; FIXME: can we avoid this for some commands? ;; For example the todo list should not need it (but does...) (cond ((setq entry (assoc keys org-agenda-custom-commands)) @@ -2256,7 +2264,7 @@ s Search for keywords C Configure custom agenda commands If CMD-KEY is a string of length 1, it is used as a key in `org-agenda-custom-commands' and triggers this command. If it is a longer string it is used as a tags/todo match string. -Paramters are alternating variable names and values that will be bound +Parameters are alternating variable names and values that will be bound before running the agenda command." (let (pars) (while parameters @@ -2284,7 +2292,7 @@ before running the agenda command." If CMD-KEY is a string of length 1, it is used as a key in `org-agenda-custom-commands' and triggers this command. If it is a longer string it is used as a tags/todo match string. -Paramters are alternating variable names and values that will be bound +Parameters are alternating variable names and values that will be bound before running the agenda command. The output gives a line for each selected agenda item. Each @@ -2339,8 +2347,8 @@ agenda-day The day in the agenda where this is listed" (princ "\n")))))) (defun org-fix-agenda-info (props) - "Make sure all properties on an agenda item have a canonical form, -so the export commands can easily use it." + "Make sure all properties on an agenda item have a canonical form. +This ensures the export commands can easily use it." (let (tmp re) (when (setq tmp (plist-get props 'tags)) (setq props (plist-put props 'tags (mapconcat 'identity tmp ":")))) @@ -2446,7 +2454,7 @@ higher priority settings." ((string-match "\\.html?\\'" file) (require 'htmlize)) ((string-match "\\.ps\\'" file) (require 'ps-print))) (org-let (if nosettings nil org-agenda-exporter-settings) - '(save-excursion + `(save-excursion (save-window-excursion (org-agenda-mark-filtered-text) (let ((bs (copy-sequence (buffer-string))) beg) @@ -2478,14 +2486,14 @@ higher priority settings." (message "HTML written to %s" file)) ((string-match "\\.ps\\'" file) (require 'ps-print) - (flet ((ps-get-buffer-name () "Agenda View")) - (ps-print-buffer-with-faces file)) + ,(flet ((ps-get-buffer-name () "Agenda View")) + (ps-print-buffer-with-faces file)) (message "Postscript written to %s" file)) ((string-match "\\.pdf\\'" file) (require 'ps-print) - (flet ((ps-get-buffer-name () "Agenda View")) - (ps-print-buffer-with-faces - (concat (file-name-sans-extension file) ".ps"))) + ,(flet ((ps-get-buffer-name () "Agenda View")) + (ps-print-buffer-with-faces + (concat (file-name-sans-extension file) ".ps"))) (call-process "ps2pdf" nil nil nil (expand-file-name (concat (file-name-sans-extension file) ".ps")) @@ -2518,9 +2526,9 @@ higher priority settings." (let ((inhibit-read-only t)) (mapc (lambda (o) - (when (equal (org-overlay-buffer o) (current-buffer)) + (when (equal (overlay-buffer o) (current-buffer)) (put-text-property - (org-overlay-start o) (org-overlay-end o) + (overlay-start o) (overlay-end o) 'org-filtered t))) org-agenda-filter-overlays))) @@ -2706,7 +2714,7 @@ removed from the entry content. Currently only `planning' is allowed here." (defvar org-agenda-filter nil) (defvar org-agenda-filter-preset nil "A preset of the tags filter used for secondary agenda filtering. -This must be a list of strings, each string must be a single tag preceeded +This must be a list of strings, each string must be a single tag preceded by \"+\" or \"-\". This variable should not be set directly, but agenda custom commands can bind it in the options section.") @@ -2715,7 +2723,8 @@ bind it in the options section.") (setq org-todo-keywords-for-agenda nil) (setq org-done-keywords-for-agenda nil) (setq org-drawers-for-agenda nil) - (setq org-agenda-filter nil) + (unless org-agenda-persistent-filter + (setq org-agenda-filter nil)) (put 'org-agenda-filter :preset-filter org-agenda-filter-preset) (if org-agenda-multi (progn @@ -2790,16 +2799,16 @@ bind it in the options section.") (org-habit-insert-consistency-graphs)) (run-hooks 'org-finalize-agenda-hook) (setq org-agenda-type (org-get-at-bol 'org-agenda-type)) - (when (get 'org-agenda-filter :preset-filter) + (when (or org-agenda-filter (get 'org-agenda-filter :preset-filter)) (org-agenda-filter-apply org-agenda-filter)) ))) (defun org-agenda-mark-clocking-task () "Mark the current clock entry in the agenda if it is present." (mapc (lambda (o) - (if (eq (org-overlay-get o 'type) 'org-agenda-clocking) - (org-delete-overlay o))) - (org-overlays-in (point-min) (point-max))) + (if (eq (overlay-get o 'type) 'org-agenda-clocking) + (delete-overlay o))) + (overlays-in (point-min) (point-max))) (when (marker-buffer org-clock-hd-marker) (save-excursion (goto-char (point-min)) @@ -2808,18 +2817,18 @@ bind it in the options section.") (goto-char s) (when (equal (org-get-at-bol 'org-hd-marker) org-clock-hd-marker) - (setq ov (org-make-overlay (point-at-bol) (1+ (point-at-eol)))) - (org-overlay-put ov 'type 'org-agenda-clocking) - (org-overlay-put ov 'face 'org-agenda-clocking) - (org-overlay-put ov 'help-echo + (setq ov (make-overlay (point-at-bol) (1+ (point-at-eol)))) + (overlay-put ov 'type 'org-agenda-clocking) + (overlay-put ov 'face 'org-agenda-clocking) + (overlay-put ov 'help-echo "The clock is running in this item"))))))) (defun org-agenda-fontify-priorities () "Make highest priority lines bold, and lowest italic." (interactive) - (mapc (lambda (o) (if (eq (org-overlay-get o 'org-type) 'org-priority) - (org-delete-overlay o))) - (org-overlays-in (point-min) (point-max))) + (mapc (lambda (o) (if (eq (overlay-get o 'org-type) 'org-priority) + (delete-overlay o))) + (overlays-in (point-min) (point-max))) (save-excursion (let ((inhibit-read-only t) b e p ov h l) @@ -2834,8 +2843,8 @@ bind it in the options section.") e (if (eq org-agenda-fontify-priorities 'cookies) (match-end 0) (point-at-eol)) - ov (org-make-overlay b e)) - (org-overlay-put + ov (make-overlay b e)) + (overlay-put ov 'face (cond ((org-face-from-face-or-color 'priority nil @@ -2846,13 +2855,13 @@ bind it in the options section.") (cdr (assoc p org-agenda-fontify-priorities))))) ((equal p l) 'italic) ((equal p h) 'bold))) - (org-overlay-put ov 'org-type 'org-priority))))) + (overlay-put ov 'org-type 'org-priority))))) (defun org-agenda-dim-blocked-tasks () "Dim currently blocked TODO's in the agenda display." - (mapc (lambda (o) (if (eq (org-overlay-get o 'org-type) 'org-blocked-todo) - (org-delete-overlay o))) - (org-overlays-in (point-min) (point-max))) + (mapc (lambda (o) (if (eq (overlay-get o 'org-type) 'org-blocked-todo) + (delete-overlay o))) + (overlays-in (point-min) (point-max))) (save-excursion (let ((inhibit-read-only t) (org-depend-tag-blocked nil) @@ -2881,11 +2890,11 @@ bind it in the options section.") (max (point-min) (1- (point-at-bol))) (point-at-bol)) e (point-at-eol) - ov (org-make-overlay b e)) + ov (make-overlay b e)) (if invis1 - (org-overlay-put ov 'invisible t) - (org-overlay-put ov 'face 'org-agenda-dimmed-todo-face)) - (org-overlay-put ov 'org-type 'org-blocked-todo))))))) + (overlay-put ov 'invisible t) + (overlay-put ov 'face 'org-agenda-dimmed-todo-face)) + (overlay-put ov 'org-type 'org-blocked-todo))))))) (defvar org-agenda-skip-function nil "Function to be called at each match during agenda construction. @@ -2896,7 +2905,7 @@ This may also be a Lisp form, it will be evaluated. Never set this variable using `setq' or so, because then it will apply to all future agenda commands. Instead, bind it with `let' to scope it dynamically into the agenda-constructing command. A good way to set -it is through options in org-agenda-custom-commands.") +it is through options in `org-agenda-custom-commands'.") (defun org-agenda-skip () "Throw to `:skip' in places that should be skipped. @@ -2958,10 +2967,10 @@ no longer in use." (org-agenda-get-some-entry-text m org-agenda-entry-text-maxlines " > ")))) (when (string-match "\\S-" txt) - (setq o (org-make-overlay (point-at-bol) (point-at-eol))) - (org-overlay-put o 'evaporate t) - (org-overlay-put o 'org-overlay-type 'agenda-entry-content) - (org-overlay-put o 'after-string txt)))) + (setq o (make-overlay (point-at-bol) (point-at-eol))) + (overlay-put o 'evaporate t) + (overlay-put o 'org-overlay-type 'agenda-entry-content) + (overlay-put o 'after-string txt)))) (defun org-agenda-entry-text-show () "Add entry context for all agenda lines." @@ -2978,10 +2987,10 @@ no longer in use." "Remove any shown entry context." (delq nil (mapcar (lambda (o) - (if (eq (org-overlay-get o 'org-overlay-type) + (if (eq (overlay-get o 'org-overlay-type) 'agenda-entry-content) - (progn (org-delete-overlay o) t))) - (org-overlays-in (point-min) (point-max))))) + (progn (delete-overlay o) t))) + (overlays-in (point-min) (point-max))))) ;;; Agenda timeline @@ -2995,7 +3004,6 @@ under the current date. If the buffer contains an active region, only check the region for dates." (interactive "P") - (require 'calendar) (org-compile-prefix-format 'timeline) (org-set-sorting-strategy 'timeline) (let* ((dopast t) @@ -3127,7 +3135,7 @@ When EMPTY is non-nil, also include days without any entries." (defvar org-agenda-start-day nil ; dynamically scoped parameter "Custom commands can set this variable in the options section.") (defvar org-agenda-last-arguments nil - "The arguments of the previous call to org-agenda") + "The arguments of the previous call to `org-agenda'.") (defvar org-starting-day nil) ; local variable in the agenda buffer (defvar org-agenda-span nil) ; local variable in the agenda buffer (defvar org-include-all-loc nil) ; local variable @@ -3197,7 +3205,6 @@ given in `org-agenda-start-on-weekday'." (setq org-agenda-last-arguments (list include-all start-day ndays)) (org-compile-prefix-format 'agenda) (org-set-sorting-strategy 'agenda) - (require 'calendar) (let* ((org-agenda-start-on-weekday (if (or (equal ndays 7) (and (null ndays) (equal 7 org-agenda-ndays))) org-agenda-start-on-weekday nil)) @@ -3400,7 +3407,7 @@ is, or it can be broken into a number of snippets, each of which must match in a Boolean way to select an entry. The default depends on the variable `org-agenda-search-view-always-boolean'. Even if this is turned off (the default) you can always switch to -Boolean search dynamically by preceeding the first word with \"+\" or \"-\". +Boolean search dynamically by preceding the first word with \"+\" or \"-\". The default is a direct search of the whole phrase, where each space in the search string can expand to an arbitrary amount of whitespace, @@ -3415,9 +3422,9 @@ match whole words, not parts of a word) if `org-agenda-search-view-force-full-words' is set (default is nil). Boolean search snippets enclosed by curly braces are interpreted as -regular expressions that must or (when preceeded with \"-\") must not +regular expressions that must or (when preceded with \"-\") must not match in the entry. Snippets enclosed into double quotes will be taken -as a whole, to incude whitespace. +as a whole, to include whitespace. - If the search string starts with an asterisk, search only in headlines. - If (possibly after the leading star) the search string starts with an @@ -3441,6 +3448,7 @@ in `org-agenda-text-search-extra-files'." 'mouse-face 'highlight 'help-echo (format "mouse-2 or RET jump to location"))) (full-words org-agenda-search-view-force-full-words) + (org-agenda-text-search-extra-files org-agenda-text-search-extra-files) regexp rtn rtnall files file pos marker category tags c neg re boolean ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str) @@ -3618,13 +3626,12 @@ in `org-agenda-text-search-extra-files'." ;;;###autoload (defun org-todo-list (arg) - "Show all TODO entries from all agenda file in a single list. + "Show all (not done) TODO entries from all agenda file in a single list. The prefix arg can be used to select a specific TODO keyword and limit the list to these. When using \\[universal-argument], you will be prompted for a keyword. A numeric prefix directly selects the Nth keyword in `org-todo-keywords-1'." (interactive "P") - (require 'calendar) (org-compile-prefix-format 'todo) (org-set-sorting-strategy 'todo) (org-prepare-agenda "TODO") @@ -3771,7 +3778,7 @@ This variable should not be set directly, but custom commands can bind it in the options section.") (defun org-agenda-skip-entry-when-regexp-matches () - "Checks if the current entry contains match for `org-agenda-skip-regexp'. + "Check if the current entry contains match for `org-agenda-skip-regexp'. If yes, it returns the end position of this entry, causing agenda commands to skip the entry but continuing the search in the subtree. This is a function that can be put into `org-agenda-skip-function' for the duration @@ -3783,7 +3790,7 @@ of a command." (and skip end))) (defun org-agenda-skip-subtree-when-regexp-matches () - "Checks if the current subtree contains match for `org-agenda-skip-regexp'. + "Check if the current subtree contains match for `org-agenda-skip-regexp'. If yes, it returns the end position of this tree, causing agenda commands to skip this subtree. This is a function that can be put into `org-agenda-skip-function' for the duration of a command." @@ -3794,7 +3801,7 @@ to skip this subtree. This is a function that can be put into (and skip end))) (defun org-agenda-skip-entry-when-regexp-matches-in-subtree () - "Checks if the current subtree contains match for `org-agenda-skip-regexp'. + "Check if the current subtree contains match for `org-agenda-skip-regexp'. If yes, it returns the end position of the current entry (NOT the tree), causing agenda commands to skip the entry but continuing the search in the subtree. This is a function that can be put into @@ -3981,7 +3988,6 @@ MATCH is being ignored." "Get the (Emacs Calendar) diary entries for DATE." (require 'diary-lib) (let* ((diary-fancy-buffer "*temporary-fancy-diary-buffer*") - (fancy-diary-buffer diary-fancy-buffer) (diary-display-hook '(fancy-diary-display)) (diary-display-function 'fancy-diary-display) (pop-up-frames nil) @@ -4343,7 +4349,7 @@ the documentation of `org-diary'." clockp (and org-agenda-include-inactive-timestamps (or (string-match org-clock-string tmp) (string-match "]-+\\'" tmp))) - todo-state (org-get-todo-state) + todo-state (ignore-errors (org-get-todo-state)) donep (member todo-state org-done-keywords)) (if (or scheduledp deadlinep closedp clockp (and donep org-agenda-skip-timestamp-if-done)) @@ -4424,7 +4430,7 @@ the documentation of `org-diary'." "Entry applies if date is between dates on DAYNAME, but skips SKIP-WEEKS. The order of the first 2 times 3 arguments depends on the variable `calendar-date-style' or, if that is not defined, on `european-calendar-style'. -So for american calendars, give this as MONTH DAY YEAR, for european as +So for American calendars, give this as MONTH DAY YEAR, for European as DAY MONTH YEAR, and for ISO as YEAR MONTH DAY. DAYNAME is a number between 0 (Sunday) and 6 (Saturday). SKIP-WEEKS is any number of ISO weeks in the block period for which the item should @@ -4501,15 +4507,15 @@ be skipped." (setq clocked (match-string 2 rest))) (setq clocked "-"))) (save-excursion + (setq extra nil) (cond - ((not org-agenda-log-mode-add-notes) (setq extra nil)) + ((not org-agenda-log-mode-add-notes)) (statep (and (looking-at ".*\n[ \t]*\\([^-\n \t].*?\\)[ \t]*$") (setq extra (match-string 1)))) (clockp (and (looking-at ".*\n[ \t]*-[ \t]+\\([^-\n \t].*?\\)[ \t]*$") - (setq extra (match-string 1)))) - (t (setq extra nil))) + (setq extra (match-string 1))))) (if (not (re-search-backward "^\\*+ " nil t)) (setq txt org-agenda-no-heading-message) (goto-char (match-beginning 0)) @@ -4789,13 +4795,20 @@ FRACTION is what fraction of the head-warning time has passed." (setq tags (org-get-tags-at)) (looking-at "\\*+[ \t]+\\([^\r\n]+\\)") (setq head (match-string 1)) - (setq txt (org-format-agenda-item - (format - (nth (if (= d1 d2) 0 1) - org-agenda-timerange-leaders) - (1+ (- d0 d1)) (1+ (- d2 d1))) - head category tags - timestr))) + (let ((remove-re + (if org-agenda-remove-timeranges-from-blocks + (concat + "<" (regexp-quote s1) ".*?>" + "--" + "<" (regexp-quote s2) ".*?>") + nil))) + (setq txt (org-format-agenda-item + (format + (nth (if (= d1 d2) 0 1) + org-agenda-timerange-leaders) + (1+ (- d0 d1)) (1+ (- d2 d1))) + head category tags + timestr nil remove-re)))) (org-add-props txt props 'org-marker marker 'org-hd-marker hdmarker 'type "block" 'date date @@ -4818,9 +4831,9 @@ The flag is set if the currently compiled format contains a `%T'.") "A flag, set by `org-compile-prefix-format'. The flag is set if the currently compiled format contains a `%e'.") (defvar org-prefix-category-length nil - "Used by `org-compile-prefix-format' to remember the category field widh.") + "Used by `org-compile-prefix-format' to remember the category field width.") (defvar org-prefix-category-max-length nil - "Used by `org-compile-prefix-format' to remember the category field widh.") + "Used by `org-compile-prefix-format' to remember the category field width.") (defun org-format-agenda-item (extra txt &optional category tags dotime noprefix remove-re habitp) @@ -5161,11 +5174,12 @@ HH:MM." (or (match-end 1) (match-end 0)) (match-end 0) (list 'face (org-get-todo-face (match-string 2 x))) x) - (setq x (concat (substring x 0 (match-end 1)) - (format org-agenda-todo-keyword-format - (match-string 2 x)) - (org-add-props " " (text-properties-at 0 x)) - (substring x (match-end 3))))) + (when (match-end 1) + (setq x (concat (substring x 0 (match-end 1)) + (format org-agenda-todo-keyword-format + (match-string 2 x)) + (org-add-props " " (text-properties-at 0 x)) + (substring x (match-end 3)))))) x))) (defsubst org-cmp-priority (a b) @@ -5216,6 +5230,28 @@ HH:MM." ((< lb la) +1) (t nil)))) +(defsubst org-cmp-alpha (a b) + "Compare the headlines, alphabetically." + (let* ((pla (get-text-property 0 'prefix-length a)) + (plb (get-text-property 0 'prefix-length b)) + (ta (and pla (substring a pla))) + (tb (and plb (substring b plb)))) + (when pla + (if (string-match (concat "\\`[ \t]*" (or (get-text-property 0 'org-todo-regexp a) "") + "\\([ \t]*\\[[a-zA-Z0-9]\\]\\)? *") ta) + (setq ta (substring ta (match-end 0)))) + (setq ta (downcase ta))) + (when plb + (if (string-match (concat "\\`[ \t]*" (or (get-text-property 0 'org-todo-regexp b) "") + "\\([ \t]*\\[[a-zA-Z0-9]\\]\\)? *") tb) + (setq tb (substring tb (match-end 0)))) + (setq tb (downcase tb))) + (cond ((not ta) +1) + ((not tb) -1) + ((string-lessp ta tb) -1) + ((string-lessp tb ta) +1) + (t nil)))) + (defsubst org-cmp-tag (a b) "Compare the string values of the first tags of A and B." (let ((ta (car (last (get-text-property 1 'tags a)))) @@ -5243,25 +5279,39 @@ HH:MM." ((and (not ha) hb) +1) (t nil)))) +(defsubst org-em (x y list) (or (memq x list) (memq y list))) + (defun org-entries-lessp (a b) "Predicate for sorting agenda entries." ;; The following variables will be used when the form is evaluated. ;; So even though the compiler complains, keep them. - (let* ((time-up (org-cmp-time a b)) - (time-down (if time-up (- time-up) nil)) - (priority-up (org-cmp-priority a b)) - (priority-down (if priority-up (- priority-up) nil)) - (effort-up (org-cmp-effort a b)) - (effort-down (if effort-up (- effort-up) nil)) - (category-up (org-cmp-category a b)) - (category-down (if category-up (- category-up) nil)) - (category-keep (if category-up +1 nil)) - (tag-up (org-cmp-tag a b)) - (tag-down (if tag-up (- tag-up) nil)) - (todo-state-up (org-cmp-todo-state a b)) + (let* ((ss org-agenda-sorting-strategy-selected) + (time-up (and (org-em 'time-up 'time-down ss) + (org-cmp-time a b))) + (time-down (if time-up (- time-up) nil)) + (priority-up (and (org-em 'priority-up 'priority-down ss) + (org-cmp-priority a b))) + (priority-down (if priority-up (- priority-up) nil)) + (effort-up (and (org-em 'effort-up 'effort-down ss) + (org-cmp-effort a b))) + (effort-down (if effort-up (- effort-up) nil)) + (category-up (and (or (org-em 'category-up 'category-down ss) + (memq 'category-keep ss)) + (org-cmp-category a b))) + (category-down (if category-up (- category-up) nil)) + (category-keep (if category-up +1 nil)) + (tag-up (and (org-em 'tag-up 'tag-down ss) + (org-cmp-tag a b))) + (tag-down (if tag-up (- tag-up) nil)) + (todo-state-up (and (org-em 'todo-state-up 'todo-state-down ss) + (org-cmp-todo-state a b))) (todo-state-down (if todo-state-up (- todo-state-up) nil)) - (habit-up (org-cmp-habit-p a b)) - (habit-down (if habit-up (- habit-up) nil)) + (habit-up (and (org-em 'habit-up 'habit-down ss) + (org-cmp-habit-p a b))) + (habit-down (if habit-up (- habit-up) nil)) + (alpha-up (and (org-em 'alpha-up 'alpha-down ss) + (org-cmp-alpha a b))) + (alpha-down (if alpha-up (- alpha-up) nil)) user-defined-up user-defined-down) (if (and org-agenda-cmp-user-defined (functionp org-agenda-cmp-user-defined)) @@ -5274,12 +5324,12 @@ HH:MM." ;;; Agenda restriction lock -(defvar org-agenda-restriction-lock-overlay (org-make-overlay 1 1) +(defvar org-agenda-restriction-lock-overlay (make-overlay 1 1) "Overlay to mark the headline to which agenda commands are restricted.") -(org-overlay-put org-agenda-restriction-lock-overlay - 'face 'org-agenda-restriction-lock) -(org-overlay-put org-agenda-restriction-lock-overlay - 'help-echo "Agendas are currently limited to this subtree.") +(overlay-put org-agenda-restriction-lock-overlay + 'face 'org-agenda-restriction-lock) +(overlay-put org-agenda-restriction-lock-overlay + 'help-echo "Agendas are currently limited to this subtree.") (org-detach-overlay org-agenda-restriction-lock-overlay) (defun org-agenda-set-restriction-lock (&optional type) @@ -5302,7 +5352,7 @@ in the file. Otherwise, restriction will be to the current subtree." (put 'org-agenda-files 'org-restrict (list (buffer-file-name (buffer-base-buffer)))) (org-back-to-heading t) - (org-move-overlay org-agenda-restriction-lock-overlay (point) (point-at-eol)) + (move-overlay org-agenda-restriction-lock-overlay (point) (point-at-eol)) (move-marker org-agenda-restrict-begin (point)) (move-marker org-agenda-restrict-end (save-excursion (org-end-of-subtree t))) @@ -5391,8 +5441,9 @@ Org-mode buffers visited directly by the user will not be touched." (org-agenda-quit)) (defun org-agenda-execute (arg) - "Execute another agenda command, keeping same window.\\ -So this is just a shortcut for `\\[org-agenda]', available in the agenda." + "Execute another agenda command, keeping same window. +So this is just a shortcut for \\`\\[org-agenda]', available +in the agenda." (interactive "P") (let ((org-agenda-window-setup 'current-window)) (org-agenda arg))) @@ -5549,7 +5600,7 @@ to switch to narrowing." (defun org-agenda-filter-effort-form (e) "Return the form to compare the effort of the current line with what E says. -E looks line \"+<2:25\"." +E looks like \"+<2:25\"." (let (op) (setq e (substring e 1)) (setq op (string-to-char e) e (substring e 1)) @@ -5588,25 +5639,25 @@ If the line does not have an effort defined, return nil." (defun org-agenda-filter-by-tag-hide-line () (let (ov) - (setq ov (org-make-overlay (max (point-min) (1- (point-at-bol))) + (setq ov (make-overlay (max (point-min) (1- (point-at-bol))) (point-at-eol))) - (org-overlay-put ov 'invisible t) - (org-overlay-put ov 'type 'tags-filter) + (overlay-put ov 'invisible t) + (overlay-put ov 'type 'tags-filter) (push ov org-agenda-filter-overlays))) (defun org-agenda-fix-tags-filter-overlays-at (&optional pos) (setq pos (or pos (point))) (save-excursion - (dolist (ov (org-overlays-at pos)) - (when (and (org-overlay-get ov 'invisible) - (eq (org-overlay-get ov 'type) 'tags-filter)) + (dolist (ov (overlays-at pos)) + (when (and (overlay-get ov 'invisible) + (eq (overlay-get ov 'type) 'tags-filter)) (goto-char pos) - (if (< (org-overlay-start ov) (point-at-eol)) - (org-move-overlay ov (point-at-eol) - (org-overlay-end ov))))))) + (if (< (overlay-start ov) (point-at-eol)) + (move-overlay ov (point-at-eol) + (overlay-end ov))))))) (defun org-agenda-filter-by-tag-show-all () - (mapc 'org-delete-overlay org-agenda-filter-overlays) + (mapc 'delete-overlay org-agenda-filter-overlays) (setq org-agenda-filter-overlays nil) (setq org-agenda-filter nil) (setq org-agenda-filter-form nil) @@ -5881,17 +5932,16 @@ so that the date SD will be in that range." (error "No previous date before this line in this buffer"))) ;; Initialize the highlight -(defvar org-hl (org-make-overlay 1 1)) -(org-overlay-put org-hl 'face 'highlight) +(defvar org-hl (make-overlay 1 1)) +(overlay-put org-hl 'face 'highlight) (defun org-highlight (begin end &optional buffer) "Highlight a region with overlay." - (funcall (if (featurep 'xemacs) 'set-extent-endpoints 'move-overlay) - org-hl begin end (or buffer (current-buffer)))) + (move-overlay org-hl begin end (or buffer (current-buffer)))) (defun org-unhighlight () "Detach overlay INDEX." - (funcall (if (featurep 'xemacs) 'detach-extent 'delete-overlay) org-hl)) + (org-detach-overlay org-hl)) ;; FIXME this is currently not used. (defun org-highlight-until-next-command (beg end &optional buffer) @@ -6043,7 +6093,7 @@ When called with a prefix argument, include all archive files as well." 'org-agenda-type)))) (defun org-agenda-next-line () - "Move cursor to the next line, and show if follow-mode is active." + "Move cursor to the next line, and show if follow mode is active." (interactive) (call-interactively 'next-line) (org-agenda-do-context-action)) @@ -6056,7 +6106,7 @@ When called with a prefix argument, include all archive files as well." (org-agenda-do-context-action)) (defun org-agenda-do-context-action () - "Show outline path and, maybe, follow-mode window." + "Show outline path and, maybe, follow mode window." (let ((m (org-get-at-bol 'org-marker))) (if (and org-agenda-follow-mode m) (org-agenda-show)) @@ -6090,6 +6140,7 @@ and by additional input from the age of a schedules or deadline entry." (pos (marker-position marker))) (switch-to-buffer-other-window buffer) (widen) + (push-mark) (goto-char pos) (when (org-mode-p) (org-show-context 'agenda) @@ -6206,7 +6257,7 @@ If this information is not given, the function uses the tree at point." (delete-region (point-at-bol) (1+ (point-at-eol))))) (beginning-of-line 0)))))) -(defun org-agenda-refile (&optional goto rfloc) +(defun org-agenda-refile (&optional goto rfloc no-update) "Refile the item at point." (interactive "P") (if (equal goto '(16)) @@ -6225,7 +6276,8 @@ If this information is not given, the function uses the tree at point." (widen) (goto-char marker) (org-remove-subtree-entries-from-agenda) - (org-refile goto buffer rfloc))))))) + (org-refile goto buffer rfloc))))) + (unless no-update (org-agenda-redo)))) (defun org-agenda-open-link (&optional arg) "Follow the link in the current line, if any. @@ -6435,8 +6487,8 @@ docstring of `org-agenda-show-1'." This calls the command `org-tree-to-indirect-buffer' from the original Org-mode buffer. With numerical prefix arg ARG, go up to this level and then take that tree. -With a C-u prefix, make a separate frame for this tree (i.e. don't use the -dedicated frame)." +With a \\[universal-argument] prefix, make a separate frame for this tree (i.e. don't +use the dedicated frame)." (interactive) (org-agenda-check-no-diary) (let* ((marker (or (org-get-at-bol 'org-marker) @@ -6926,13 +6978,14 @@ m Mark the entry at point for an agenda action s Schedule the marked entry to the date at the cursor d Set the deadline of the marked entry to the date at the cursor r Call `org-remember' with cursor date as the default date +c Call `org-capture' with cursor date as the default date SPC Show marked entry in other window TAB Visit marked entry in other window The cursor may be at a date in the calendar, or in the Org agenda." (interactive) (let (ans) - (message "Select action: [m]ark | [s]chedule [d]eadline [r]emember [ ]show") + (message "Select action: [m]ark | [s]chedule [d]eadline [r]emember [c]apture [ ]show") (setq ans (read-char-exclusive)) (cond ((equal ans ?m) @@ -6953,6 +7006,8 @@ The cursor may be at a date in the calendar, or in the Org agenda." (org-agenda-do-action '(org-deadline nil org-overriding-default-time))) ((equal ans ?r) (org-agenda-do-action '(org-remember) t)) + ((equal ans ?c) + (org-agenda-do-action '(org-capture) t)) ((equal ans ?\ ) (let ((cw (selected-window))) (org-switch-to-buffer-other-window @@ -7312,9 +7367,7 @@ argument, latitude and longitude will be prompted for." (date (calendar-gregorian-from-absolute day)) (calendar-move-hook nil) (calendar-view-holidays-initially-flag nil) - (calendar-view-diary-initially-flag nil) - (view-calendar-holidays-initially nil) - (view-diary-entries-initially nil)) + (calendar-view-diary-initially-flag nil)) (calendar) (calendar-goto-date date))) @@ -7373,11 +7426,11 @@ This is a command that has to be installed in `calendar-mode-map'." (unless (org-agenda-bulk-marked-p) (unless m (error "Nothing to mark at point")) (push m org-agenda-bulk-marked-entries) - (setq ov (org-make-overlay (point-at-bol) (+ 2 (point-at-bol)))) + (setq ov (make-overlay (point-at-bol) (+ 2 (point-at-bol)))) (org-overlay-display ov "> " (org-get-todo-face "TODO") 'evaporate) - (org-overlay-put ov 'type 'org-marked-entry-overlay)) + (overlay-put ov 'type 'org-marked-entry-overlay)) (beginning-of-line 2) (while (and (get-char-property (point) 'invisible) (not (eobp))) (beginning-of-line 2)) @@ -7414,9 +7467,9 @@ This only removes the overlays, it does not remove the markers from the list in `org-agenda-bulk-marked-entries'." (interactive) (mapc (lambda (ov) - (and (eq (org-overlay-get ov 'type) 'org-marked-entry-overlay) - (org-delete-overlay ov))) - (org-overlays-in (or beg (point-min)) (or end (point-max))))) + (and (eq (overlay-get ov 'type) 'org-marked-entry-overlay) + (delete-overlay ov))) + (overlays-in (or beg (point-min)) (or end (point-max))))) (defun org-agenda-bulk-remove-all-marks () "Remove all marks in the agenda buffer. @@ -7436,6 +7489,7 @@ The prefix arg is passed through to the command if possible." (let* ((action (read-char-exclusive)) (org-log-refile (if org-log-refile 'time nil)) (entries (reverse org-agenda-bulk-marked-entries)) + redo-at-end cmd rfloc state e tag pos (cnt 0) (cntskip 0)) (cond ((equal action ?$) @@ -7449,13 +7503,15 @@ The prefix arg is passed through to the command if possible." "Refile to: " (marker-buffer (car org-agenda-bulk-marked-entries)) org-refile-allow-creating-parent-nodes)) - (setcar (nthcdr 3 rfloc) - (move-marker (make-marker) (nth 3 rfloc) - (or (get-file-buffer (nth 1 rfloc)) - (find-buffer-visiting (nth 1 rfloc)) - (error "This should not happen")))) + (if (nth 3 rfloc) + (setcar (nthcdr 3 rfloc) + (move-marker (make-marker) (nth 3 rfloc) + (or (get-file-buffer (nth 1 rfloc)) + (find-buffer-visiting (nth 1 rfloc)) + (error "This should not happen"))))) - (setq cmd (list 'org-agenda-refile nil (list 'quote rfloc)))) + (setq cmd (list 'org-agenda-refile nil (list 'quote rfloc) t) + redo-at-end t)) ((equal action ?t) (setq state (org-icompleting-read @@ -7516,6 +7572,7 @@ The prefix arg is passed through to the command if possible." (setq cnt (1+ cnt)))) (setq org-agenda-bulk-marked-entries nil) (org-agenda-bulk-remove-all-marks) + (when redo-at-end (org-agenda-redo)) (message "Acted on %d entries%s" cnt (if (= cntskip 0) @@ -7595,7 +7652,6 @@ either 'headline or 'category. For example: will only add headlines containing IMPORTANT or headlines belonging to the \"Work\" category." (interactive "P") - (require 'calendar) (if refresh (setq appt-time-msg-list nil)) (if (eq filter t) (setq filter (read-from-minibuffer "Regexp filter: "))) diff --git a/lisp/org/org-archive.el b/lisp/org/org-archive.el index b9bd8a447d2..31ae488d4d8 100644 --- a/lisp/org/org-archive.el +++ b/lisp/org/org-archive.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-ascii.el b/lisp/org/org-ascii.el index 3d86e7a5230..730f8bdfa41 100644 --- a/lisp/org/org-ascii.el +++ b/lisp/org/org-ascii.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -26,7 +26,10 @@ ;; ;;; Commentary: +;;; Code: + (require 'org-exp) + (eval-when-compile (require 'cl)) @@ -541,7 +544,7 @@ publishing directory." (current-buffer)))) (defun org-export-ascii-preprocess (parameters) - "Do extra work for ASCII export" + "Do extra work for ASCII export." ;; ;; Realign tables to get rid of narrowing (when org-export-ascii-table-widen-columns @@ -550,9 +553,8 @@ publishing directory." (org-ascii-replace-entities) (goto-char (point-min)) (org-table-map-tables - (lambda () - (org-if-unprotected - (org-table-align)))))) + (lambda () (org-if-unprotected (org-table-align))) + 'quietly))) ;; Put quotes around verbatim text (goto-char (point-min)) (while (re-search-forward org-verbatim-re nil t) @@ -566,7 +568,12 @@ publishing directory." (goto-char (point-min)) (while (re-search-forward "<<]*\\)>>>?\\([ \t]*\\)" nil t) (org-if-unprotected-at (match-beginning 1) - (replace-match "\\1\\2")))) + (replace-match "\\1\\2"))) + ;; Remove list start counters + (goto-char (point-min)) + (while (re-search-forward "\\[@start:[0-9]+\\] ?" nil t) + (org-if-unprotected + (replace-match "")))) (defun org-html-expand-for-ascii (line) "Handle quoted HTML for ASCII export." diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el index 42a3894388e..573244beed4 100644 --- a/lisp/org/org-attach.el +++ b/lisp/org/org-attach.el @@ -4,7 +4,7 @@ ;; Author: John Wiegley ;; Keywords: org data task -;; Version: 6.35i +;; Version: 7.01 ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-bbdb.el b/lisp/org/org-bbdb.el index 8915faa565a..0d7b5fa086a 100644 --- a/lisp/org/org-bbdb.el +++ b/lisp/org/org-bbdb.el @@ -7,7 +7,7 @@ ;; Thomas Baumann ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -207,7 +207,7 @@ date year)." (defun org-bbdb-export (path desc format) "Create the export version of a BBDB link specified by PATH or DESC. If exporting to either HTML or LaTeX FORMAT the link will be -italicised, in all other cases it is left unchanged." +italicized, in all other cases it is left unchanged." (cond ((eq format 'html) (format "%s" (or desc path))) ((eq format 'latex) (format "\\textit{%s}" (or desc path))) diff --git a/lisp/org/org-beamer.el b/lisp/org/org-beamer.el index c4bf197c22c..06853b8bd63 100644 --- a/lisp/org/org-beamer.el +++ b/lisp/org/org-beamer.el @@ -2,7 +2,7 @@ ;; ;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; -;; Version: 6.35i +;; Version: 7.01 ;; Author: Carsten Dominik ;; Maintainer: Carsten Dominik ;; Keywords: org, wp, tex @@ -27,8 +27,11 @@ ;; This library implement the special treatment needed by using the ;; beamer class during LaTeX export. +;;; Code: + (require 'org) (require 'org-exp) + (defvar org-export-latex-header) (defvar org-export-latex-options-plist) (defvar org-export-opt-plist) @@ -47,7 +50,7 @@ "The level that should be interpreted as a frame. The levels above this one will be translated into a sectioning structure. Setting this to 2 will allow sections, 3 will allow subsections as well. -You can se this to 4 as well, if you at the same time set +You can set this to 4 as well, if you at the same time set `org-beamer-use-parts' to make the top levels `\part'." :group 'org-beamer :type '(choice @@ -64,7 +67,9 @@ And example for this is \"[allowframebreaks]\"." "%45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)" "Default column view format that should be used to fill the template." :group 'org-beamer - :type '(string :tag "Beamer column view format")) + :type '(choice + (const :tag "Do not insert Beamer column view format" nil) + (string :tag "Beamer column view format"))) (defcustom org-beamer-themes "\\usetheme{default}\\usecolortheme{default}" @@ -72,7 +77,9 @@ And example for this is \"[allowframebreaks]\"." When a beamer template is filled, this will be the default for BEAMER_HEADER_EXTRA, which will be inserted just before \\begin{document}." :group 'org-beamer - :type '(string :tag "Beamer column view format")) + :type '(choice + (const :tag "Do not insert Beamer themes" nil) + (string :tag "Beamer themes"))) (defconst org-beamer-column-widths "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC" @@ -105,7 +112,7 @@ These are just a completion help.") "Environments triggered by properties in Beamer export. These are the defaults - for user definitions, see `org-beamer-environments-extra'. -\"normal\" is a special fake environment, which emite the heading as +\"normal\" is a special fake environment, which emit the heading as normal text. It is needed when an environment should be surrounded by normal text. Since beamer export converts nodes into environments, you need to have a node to end the environment. @@ -125,7 +132,7 @@ Each entry has 4 elements: name Name of the environment key Selection key for `org-beamer-select-environment' -open The opening template for the environment, with the following excapes +open The opening template for the environment, with the following escapes %a the action/overlay specification %A the default action/overlay specification %o the options argument of the template @@ -178,7 +185,7 @@ close The closing string of the environment." (defun org-beamer-select-environment () "Select the environment to be used by beamer for this entry. -While this uses (for convenince) a tag selection interface, the result +While this uses (for convenience) a tag selection interface, the result of this command will be that the BEAMER_env *property* of the entry is set. In addition to this, the command will also set a tag as a visual aid, but @@ -383,11 +390,12 @@ the value will be inserted right after the documentclass statement." org-beamer-header-extra) (goto-char (point-min)) (cond - ((re-search-forward "^[ \t]*BEAMER-HEADER-EXTRA-HERE[ \t]*$" nil t) + ((re-search-forward + "^[ \t]*\\[?BEAMER-HEADER-EXTRA\\(-HERE\\)?\\]?[ \t]*$" nil t) (replace-match org-beamer-header-extra t t) (or (bolp) (insert "\n"))) - ((re-search-forward "^[ \t]*\\\\documentclass\\>" nil t) - (beginning-of-line 2) + ((re-search-forward "^[ \t]*\\\\begin{document}" nil t) + (beginning-of-line 1) (insert org-beamer-header-extra) (or (bolp) (insert "\n")))))) @@ -412,7 +420,7 @@ the value will be inserted right after the documentclass statement." (setq org-beamer-export-is-beamer-p nil)) (defun org-beamer-after-initial-vars () - "Find special setings for beamer and store them. + "Find special settings for beamer and store them. The effect is that these values will be accessible during export." ;; First verify that we are exporting using the beamer class (setq org-beamer-export-is-beamer-p @@ -479,7 +487,7 @@ The effect is that these values will be accessible during export." (defun org-beamer-auto-fragile-frames () "Mark any frames containing verbatim environments as fragile. -This funcion will run in the final LaTeX document." +This function will run in the final LaTeX document." (when org-beamer-export-is-beamer-p (let (opts) (goto-char (point-min)) @@ -507,9 +515,9 @@ This funcion will run in the final LaTeX document." ) (defcustom org-beamer-outline-frame-options nil - "Outline frame options appended after \\begin{frame}. You might -want to put e.g. [allowframebreaks=0.9] here. Remember to include -square brackets." + "Outline frame options appended after \\begin{frame}. +You might want to put e.g. [allowframebreaks=0.9] here. Remember to +include square brackets." :group 'org-beamer :type '(string :tag "Outline frame options") ) @@ -571,7 +579,7 @@ square brackets." (add-hook 'org-export-preprocess-before-selecting-backend-code-hook 'org-beamer-select-beamer-code) -(defun org-beamer-settings-template (kind) +(defun org-insert-beamer-options-template (kind) "Insert a settings template, to make sure users do this right." (interactive (progn (message "Current [s]ubtree or [g]lobal?") @@ -587,14 +595,18 @@ square brackets." (org-entry-put nil "EXPORT_FILE_NAME" "presentation.pdf") (org-entry-put nil "BEAMER_FRAME_LEVEL" (number-to-string org-beamer-frame-level)) - (org-entry-put nil "BEAMER_HEADER_EXTRA" org-beamer-themes) - (org-entry-put nil "COLUMNS" org-beamer-column-view-format) + (when org-beamer-themes + (org-entry-put nil "BEAMER_HEADER_EXTRA" org-beamer-themes)) + (when org-beamer-column-view-format + (org-entry-put nil "COLUMNS" org-beamer-column-view-format)) (org-entry-put nil "BEAMER_col_ALL" "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC")) (insert "#+LaTeX_CLASS: beamer\n") (insert "#+LaTeX_CLASS_OPTIONS: [presentation]\n") (insert (format "#+BEAMER_FRAME_LEVEL: %d\n" org-beamer-frame-level) "\n") - (insert "#+BEAMER_HEADER_EXTRA: " org-beamer-themes "\n") - (insert "#+COLUMNS: " org-beamer-column-view-format "\n") + (when org-beamer-themes + (insert "#+BEAMER_HEADER_EXTRA: " org-beamer-themes "\n")) + (when org-beamer-column-view-format + (insert "#+COLUMNS: " org-beamer-column-view-format "\n")) (insert "#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC\n"))) diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el index fc5a605c186..f7f6595f5a1 100644 --- a/lisp/org/org-bibtex.el +++ b/lisp/org/org-bibtex.el @@ -5,7 +5,7 @@ ;; Author: Bastien Guerry ;; Carsten Dominik ;; Keywords: org, wp, remember -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el new file mode 100644 index 00000000000..c6197d69fb3 --- /dev/null +++ b/lisp/org/org-capture.el @@ -0,0 +1,1321 @@ +;;; org-capture.el --- Fast note taking in Org-mode + +;; Copyright (C) 2010 Free Software Foundation, Inc. + +;; Author: Carsten Dominik +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: http://orgmode.org +;; Version: 7.01 +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file contains an alternative implementation of the same functionality +;; that is also provided by org-remember.el. The implementation is more +;; streamlined, can produce more target types (e.g. plain list items or +;; table lines). Also, it does not use a temporary buffer for editing +;; the captured entry - instead it uses an indirect buffer that visits +;; the new entry already in the target buffer (this was an idea by Samuel +;; Wales). John Wiegley's excellent `remember.el' is not needed for this +;; implementation, even though we borrow heavily from its ideas. + +;; This implementation heavily draws on ideas by James TD Smith and +;; Samuel Wales, and, of cause, uses John Wiegley's remember.el as inspiration. + +;;; TODO + +;; - find a clever way to not always insert an annotation maybe a +;; predicate function that can check for conditions for %a to be +;; used. This could be one of the properties. + +;; - Should there be plist members that arrange for properties to be +;; asked for, like James proposed in his RFC? + +;;; Code: + +(eval-when-compile + (require 'cl)) +(require 'org) +(require 'org-mks) + +(declare-function org-datetree-find-date-create "org-datetree" + (DATE &optional KEEP-RESTRICTION)) +(declare-function org-table-get-specials "org-table" ()) +(declare-function org-table-goto-line "org-table" (N)) +(defvar org-remember-default-headline) +(defvar org-remember-templates) +(defvar org-table-hlines) + +(defvar org-capture-clock-was-started nil + "Internal flag, noting if the clock was started.") + +(defvar org-capture-last-stored-marker (make-marker) + "Marker pointing to the entry most recently stored with `org-capture'.") + +;; The following variable is scoped dynamically by org-protocol +;; to indicate that the link properties have already been stored +(defvar org-capture-link-is-already-stored nil) + +(defgroup org-capture nil + "Options concerning capturing new entries." + :tag "Org Capture" + :group 'org) + +(defcustom org-capture-templates nil + "Templates for the creation of new entries. + +Each entry is a list with the following items: + +keys The keys that will select the template, as a string, characters + only, for example \"a\" for a template to be selected with a + single key, or \"bt\" for selection with two keys. When using + several keys, keys using the same prefix key must be together + in the list and preceded by a 2-element entry explaining the + prefix key, for example + + (\"b\" \"Templates for marking stuff to buy\") + + The \"C\" key is used by default for quick access to the + customization of the template variable. But if you want to use + that key for a template, you can. + +description A short string describing the template, will be shown during + selection. + +type The type of entry. Valid types are: + entry an Org-mode node, with a headline. Will be + filed as the child of the target entry or as + a top-level entry. + item a plain list item, will be placed in the + first plain list at the target + location. + checkitem a checkbox item. This differs from the + plain list item only is so far as it uses a + different default template. + table-line a new line in the first table at target location. + plain text to be inserted as it is. + +target Specification of where the captured item should be placed. + In Org-mode files, targets usually define a node. Entries will + become children of this node, other types will be added to the + table or list in the body of this node. + + Valid values are: + + (file \"path/to/file\") + Text will be placed at the beginning or end of that file + + (id \"id of existing org entry\") + File as child of this entry, or in the body of the entry + + (file+headline \"path/to/file\" \"node headline\") + Fast configuration if the target heading is unique in the file + + (file+olp \"path/to/file\" \"Level 1 heading\" \"Level 2\" ...) + For non-unique headings, the full path is safer + + (file+regexp \"path/to/file\" \"regexp to find location\") + File to the entry matching regexp + + (file+datetree \"path/to/file\") + Will create a heading in a date tree + + (file+function \"path/to/file\" function-finding-location) + A function to find the right location in the file + + (clock) + File to the entry that is currently being clocked + + (function function-finding-location) + Most general way, write your own function to find both + file and location + +template The template for creating the capture item. If you leave this + empty, an appropriate default template will be used. See below + for more details. Instead of a string, this may also be one of + + (file \"/path/to/template-file\") + (function function-returning-the-template) + + in order to get a template from a file, or dynamically + from a function. + +The rest of the entry is a property list of additional options. Recognized +properties are: + + :prepend Normally newly captured information will be appended at + the target location (last child, last table line, + last list item...). Setting this property will + change that. + + :immediate-finish When set, do not offer to edit the information, just + file it away immediately. This makes sense if the + template only needs information that can be added + automatically. + + :empty-lines Set this to the number of lines the should be inserted + before and after the new item. Default 0, only common + other value is 1. + + :clock-in Start the clock in this item. + + :clock-resume Start the interrupted clock when finishing the capture. + + :unnarrowed Do not narrow the target buffer, simply show the + full buffer. Default is to narrow it so that you + only see the new stuff. + + :table-line-pos Specification of the location in the table where the + new line should be inserted. It looks like \"II-3\" + which means that the new line should become the third + line before the second horizontal separator line. + +The template defines the text to be inserted. Often this is an org-mode +entry (so the first line should start with a star) that will be filed as a +child of the target headline. It can also be freely formatted text. +Furthermore, the following %-escapes will be replaced with content: + + %^{prompt} prompt the user for a string and replace this sequence with it. + A default value and a completion table ca be specified like this: + %^{prompt|default|completion2|completion3|...} + %t time stamp, date only + %T time stamp with date and time + %u, %U like the above, but inactive time stamps + %^t like %t, but prompt for date. Similarly %^T, %^u, %^U. + You may define a prompt like %^{Please specify birthday + %n user name (taken from `user-full-name') + %a annotation, normally the link created with `org-store-link' + %i initial content, copied from the active region. If %i is + indented, the entire inserted text will be indented as well. + %c current kill ring head + %x content of the X clipboard + %^C interactive selection of which kill or clip to use + %^L like %^C, but insert as link + %k title of currently clocked task + %K link to currently clocked task + %^g prompt for tags, with completion on tags in target file + %^G prompt for tags, with completion on all tags in all agenda files + %^{prop}p prompt the user for a value for property `prop' + %:keyword specific information for certain link types, see below + %[pathname] insert the contents of the file given by `pathname' + %(sexp) evaluate elisp `(sexp)' and replace with the result + + %? After completing the template, position cursor here. + +Apart from these general escapes, you can access information specific to the +link type that is created. For example, calling `org-capture' in emails +or gnus will record the author and the subject of the message, which you +can access with \"%:author\" and \"%:subject\", respectively. Here is a +complete list of what is recorded for each link type. + +Link type | Available information +-------------------+------------------------------------------------------ +bbdb | %:type %:name %:company +vm, wl, mh, rmail | %:type %:subject %:message-id + | %:from %:fromname %:fromaddress + | %:to %:toname %:toaddress + | %:fromto (either \"to NAME\" or \"from NAME\") +gnus | %:group, for messages also all email fields +w3, w3m | %:type %:url +info | %:type %:file %:node +calendar | %:type %:date" + :group 'org-capture + :type + '(repeat + (choice :value ("" "" entry (file "~/org/notes.org") "") + (list :tag "Multikey description" + (string :tag "Keys ") + (string :tag "Description")) + (list :tag "Template entry" + (string :tag "Keys ") + (string :tag "Description ") + (choice :tag "Capture Type " :value entry + (const :tag "Org entry" entry) + (const :tag "Plain list item" item) + (const :tag "Checkbox item" checkitem) + (const :tag "Plain text" plain) + (const :tag "Table line" table-line)) + (choice :tag "Target location" + (list :tag "File" + (const :format "" file) + (file :tag " File")) + (list :tag "ID" + (const :format "" id) + (string :tag " ID")) + (list :tag "File & Headline" + (const :format "" file+headline) + (file :tag " File ") + (string :tag " Headline")) + (list :tag "File & Outline path" + (const :format "" file+olp) + (file :tag " File ") + (repeat :tag "Outline path" :inline t + (string :tag "Headline"))) + (list :tag "File & Regexp" + (const :format "" file+regexp) + (file :tag " File ") + (regexp :tag " Regexp")) + (list :tag "File & Date tree" + (const :format "" file+datetree) + (file :tag " File")) + (list :tag "File & function" + (const :format "" file+function) + (file :tag " File ") + (sexp :tag " Function")) + (list :tag "Current clocking task" + (const :format "" clock)) + (list :tag "Function" + (const :format "" function) + (sexp :tag " Function"))) + (choice :tag "Template" + (string) + (list :tag "File" + (const :format "" file) + (file :tag "Template file")) + (list :tag "Function" + (const :format "" function) + (file :tag "Template function"))) + (plist :inline t + ;; Give the most common options as checkboxes + :options (((const :format "%v " :prepend) (const t)) + ((const :format "%v " :immediate-finish) (const t)) + ((const :format "%v " :empty-lines) (const 1)) + ((const :format "%v " :clock-in) (const t)) + ((const :format "%v " :clock-resume) (const t)) + ((const :format "%v " :unnarrowed) (const t)))))))) + +(defcustom org-capture-before-finalize-hook nil + "Hook that is run right before a remember process is finalized. +The remember buffer is still current when this hook runs." + :group 'org-capture + :type 'hook) + +;;; The property list for keeping information about the capture process + +(defvar org-capture-plist nil + "Plist for the current capture process, global, to avoid having to pass it.") +(defvar org-capture-current-plist nil + "Local variable holding the plist in a capture buffer. +This is used to store the plist for use when finishing a capture process. +Another such process might have changed the global variable by then.") + +(defun org-capture-put (&rest stuff) + (while stuff + (setq org-capture-plist (plist-put org-capture-plist + (pop stuff) (pop stuff))))) +(defun org-capture-get (prop &optional local) + (plist-get (if local org-capture-current-plist org-capture-plist) prop)) + +(defun org-capture-member (prop) + (plist-get org-capture-plist prop)) + +;;; The minor mode + +(defvar org-capture-mode-map (make-sparse-keymap) + "Keymap for `org-capture-mode', a minor mode. +Use this map to set additional keybindings for when Org-mode is used +for a Remember buffer.") + +(defvar org-capture-mode-hook nil + "Hook for the minor `org-capture-mode'.") + +(define-minor-mode org-capture-mode + "Minor mode for special key bindings in a remember buffer." + nil " Rem" org-capture-mode-map + (org-set-local + 'header-line-format + "Capture buffer. Finish `C-c C-c', refile `C-c C-w', abort `C-c C-k'.") + (run-hooks 'org-capture-mode-hook)) +(define-key org-capture-mode-map "\C-c\C-c" 'org-capture-finalize) +(define-key org-capture-mode-map "\C-c\C-k" 'org-capture-kill) +(define-key org-capture-mode-map "\C-c\C-w" 'org-capture-refile) + +;;; The main commands + +;;;###autoload +(defun org-capture (&optional goto keys) + "Capture something. +\\ +This will let you select a template from `org-capture-templates', and then +file the newly captured information. The text is immediately inserted +at the target location, and an indirect buffer is shown where you can +edit it. Pressing \\[org-capture-finalize] brings you back to the previous state +of Emacs, so that you can continue your work. + +When called interactively with a \\[universal-argument] prefix argument GOTO, don't capture +anything, just go to the file/headline where the selected template +stores its notes. With a double prefix argument \ +\\[universal-argument] \\[universal-argument], go to the last note +stored. + +When called with a `C-0' (zero) prefix, insert a template at point. + +Lisp programs can set KEYS to a string associated with a template in +`org-capture-templates'. In this case, interactive selection will be +bypassed." + (interactive "P") + (cond + ((equal goto '(4)) (org-capture-goto-target)) + ((equal goto '(16)) (org-capture-goto-last-stored)) + (t + ;; FIXME: Are these needed? + (let* ((orig-buf (current-buffer)) + (annotation (if (and (boundp 'org-capture-link-is-already-stored) + org-capture-link-is-already-stored) + (plist-get org-store-link-plist :annotation) + (org-store-link nil))) + (initial (and (org-region-active-p) + (buffer-substring (point) (mark)))) + (entry (org-capture-select-template keys))) + (cond + ((equal entry "C") + (customize-variable 'org-capture-templates)) + ((equal entry "q") + (error "Abort")) + (t + (org-capture-set-plist entry) + (org-capture-get-template) + (org-capture-put :original-buffer orig-buf :annotation annotation + :initial initial) + (org-capture-put :default-time + (or org-overriding-default-time + (org-current-time))) + (org-capture-set-target-location) + (condition-case error + (org-capture-put :template (org-capture-fill-template)) + ((error quit) + (if (get-buffer "*Capture*") (kill-buffer "*Capture*")) + (error "Capture abort: %s" error))) + + (if (equal goto 0) + ;;insert at point + (org-capture-insert-template-here) + (condition-case error + (org-capture-place-template) + ((error quit) + (if (and (buffer-base-buffer (current-buffer)) + (string-match "\\`CAPTURE-" (buffer-name))) + (kill-buffer (current-buffer))) + (set-window-configuration (org-capture-get :return-to-wconf)) + (error "Capture template `%s': %s" + (org-capture-get :key) + (nth 1 error)))) + (if (org-capture-get :immediate-finish) + (org-capture-finalize) + (if (and (org-mode-p) + (org-capture-get :clock-in)) + (condition-case nil + (progn + (if (org-clock-is-active) + (org-capture-put :interrupted-clock + (copy-marker org-clock-marker))) + (org-clock-in) + (org-set-local 'org-capture-clock-was-started t)) + (error + "Could not start the clock in this capture buffer"))))))))))) + + +(defun org-capture-get-template () + "Get the template from a file or a function if necessary." + (let ((txt (org-capture-get :template)) file) + (cond + ((and (listp txt) (eq (car txt) 'file)) + (if (file-exists-p + (setq file (expand-file-name (nth 1 txt) org-directory))) + (setq txt (org-file-contents file)) + (setq txt (format "* Template file %s not found" (nth 1 txt))))) + ((and (listp txt) (eq (car txt) 'function)) + (if (fboundp (nth 1 txt)) + (setq txt (funcall (nth 1 txt))) + (setq txt (format "* Template function %s not found" (nth 1 txt))))) + ((not txt) (setq txt "")) + ((stringp txt)) + (t (setq txt "* Invalid capture template"))) + (org-capture-put :template txt))) + +(defun org-capture-finalize () + "Finalize the capture process." + (interactive) + (unless (and org-capture-mode + (buffer-base-buffer (current-buffer))) + (error "This does not seem to be a capture buffer for Org-mode")) + + ;; Did we start the clock in this capture buffer? + (when (and org-capture-clock-was-started + org-clock-marker (marker-buffer org-clock-marker) + (equal (marker-buffer org-clock-marker) (buffer-base-buffer)) + (> org-clock-marker (point-min)) + (< org-clock-marker (point-max))) + ;; Looks like the clock we started is still running. Clock out. + (let (org-log-note-clock-out) (org-clock-out)) + (when (and (org-capture-get :clock-resume 'local) + (markerp (org-capture-get :interrupted-clock 'local)) + (buffer-live-p (marker-buffer + (org-capture-get :interrupted-clock 'local)))) + (org-with-point-at (org-capture-get :interrupted-clock 'local) + (org-clock-in)) + (message "Interrupted clock has been resumed"))) + + (let ((beg (point-min)) + (end (point-max)) + (abort-note nil)) + (widen) + + (if org-note-abort + (let ((m1 (org-capture-get :begin-marker 'local)) + (m2 (org-capture-get :end-marker 'local))) + (if (and m1 m2 (= m1 beg) (= m2 end)) + (progn + (setq abort-note 'clean) + (kill-region m1 m2)) + (setq abort-note 'dirty))) + + ;; Make sure that the empty lines after are correct + (when (and (> (point-max) end) ; indeed, the buffer was still narrowed + (member (org-capture-get :type 'local) + '(entry item checkitem plain))) + (save-excursion + (goto-char end) + (or (bolp) (newline)) + (org-capture-empty-lines-after + (or (org-capture-get :empty-lines 'local) 0)))) + ;; Postprocessing: Update Statistics cookies, do the sorting + (when (org-mode-p) + (save-excursion + (when (ignore-errors (org-back-to-heading)) + (org-update-parent-todo-statistics) + (org-update-checkbox-count))) + ;; FIXME Here we should do the sorting + ;; If we have added a table line, maybe recompute? + (when (and (eq (org-capture-get :type 'local) 'table-line) + (org-at-table-p)) + (if (org-table-get-stored-formulas) + (org-table-recalculate 'all) ;; FIXME: Should we iterate??? + (org-table-align))) + ) + ;; Store this place as the last one where we stored something + ;; Do the marking in the base buffer, so that it makes sense after + ;; the indirect buffer has been killed. + (org-capture-bookmark-last-stored-position) + + ;; Run the hook + (run-hooks 'org-capture-before-finalize-hook) + ) + + ;; Kill the indirect buffer + (save-buffer) + (let ((return-wconf (org-capture-get :return-to-wconf 'local))) + (kill-buffer (current-buffer)) + ;; Restore the window configuration before capture + (set-window-configuration return-wconf)) + (when abort-note + (cond + ((equal abort-note 'clean) + (message "Capture process aborted and target file cleaned up")) + ((equal abort-note 'dirty) + (error "Capture process aborted, but target buffer could not be cleaned up correctly")))))) + +(defun org-capture-refile () + "Finalize the current capture and then refile the entry. +Refiling is done from the base buffer, because the indirect buffer is then +already gone." + (interactive) + (unless (eq (org-capture-get :type 'local) 'entry) + (error + "Refiling from a capture buffer makes only sense for `entry'-type templates")) + (let ((pos (point)) + (base (buffer-base-buffer (current-buffer))) + (org-refile-for-capture t)) + (org-capture-finalize) + (save-window-excursion + (with-current-buffer (or base (current-buffer)) + (save-excursion + (save-restriction + (widen) + (goto-char pos) + (call-interactively 'org-refile))))))) + +(defun org-capture-kill () + "Abort the current capture process." + (interactive) + ;; FIXME: This does not do the right thing, we need to remove the new stuff + ;; By hand it is easy: undo, then kill the buffer + (let ((org-note-abort t) (org-capture-before-finalize-hook nil)) + (org-capture-finalize))) + +(defun org-capture-goto-last-stored () + "Go to the location where the last remember note was stored." + (interactive) + (org-goto-marker-or-bmk org-capture-last-stored-marker + "org-capture-last-stored") + (message "This is the last note stored by a capture process")) + +;;; Supporting functions for handling the process + +(defun org-capture-set-target-location (&optional target) + "Find target buffer and position and store then in the property list." + (let ((target-entry-p t)) + (setq target (or target (org-capture-get :target))) + (save-excursion + (cond + ((eq (car target) 'file) + (set-buffer (org-capture-target-buffer (nth 1 target))) + (setq target-entry-p nil)) + + ((eq (car target) 'id) + (let ((loc (org-id-find (nth 1 target)))) + (if (not loc) + (error "Cannot find target ID \"%s\"" (nth 1 target)) + (set-buffer (org-capture-target-buffer (car loc))) + (goto-char (cdr loc))))) + + ((eq (car target) 'file+headline) + (set-buffer (org-capture-target-buffer (nth 1 target))) + (let ((hd (nth 2 target))) + (goto-char (point-min)) + (if (re-search-forward + (format org-complex-heading-regexp-format (regexp-quote hd)) + nil t) + (goto-char (point-at-bol)) + (goto-char (point-max)) + (or (bolp) (insert "\n")) + (insert "* " hd "\n") + (beginning-of-line 0)))) + + ((eq (car target) 'file+olp) + (let ((m (org-find-olp (cdr target)))) + (set-buffer (marker-buffer m)) + (goto-char m))) + + ((eq (car target) 'file+regexp) + (set-buffer (org-capture-target-buffer (nth 1 target))) + (goto-char (point-min)) + (if (re-search-forward (nth 2 target) nil t) + (progn + (goto-char (if (org-capture-get :prepend) + (match-beginning 0) (match-end 0))) + (org-capture-put :exact-position (point)) + (setq target-entry-p (and (org-mode-p) (org-at-heading-p)))) + (error "No match for target regexp in file %s" (nth 1 target)))) + + ((eq (car target) 'file+datetree) + (require 'org-datetree) + (set-buffer (org-capture-target-buffer (nth 1 target))) + ;; Make a date tree entry, with the current date (or yesterday, + ;; if we are extending dates for a couple of hours) + (org-datetree-find-date-create + (calendar-gregorian-from-absolute + (if org-overriding-default-time + (time-to-days org-overriding-default-time) + (time-to-days + (time-subtract (current-time) + (list 0 (* 3600 org-extend-today-until) 0))))))) + + ((eq (car target) 'file+function) + (set-buffer (org-capture-target-buffer (nth 1 target))) + (funcall (nth 2 target)) + (org-capture-put :exact-position (point)) + (setq target-entry-p (and (org-mode-p) (org-at-heading-p)))) + + ((eq (car target) 'function) + (funcall (nth 1 target)) + (org-capture-put :exact-position (point)) + (setq target-entry-p (and (org-mode-p) (org-at-heading-p)))) + + ((eq (car target) 'clock) + (if (and (markerp org-clock-hd-marker) + (marker-buffer org-clock-hd-marker)) + (progn (set-buffer (marker-buffer org-clock-hd-marker)) + (goto-char org-clock-hd-marker)) + (error "No running clock that could be used as capture target"))) + + (t (error "Invalid capture target specification"))) + + (org-capture-put :buffer (current-buffer) :pos (point) + :target-entry-p target-entry-p)))) + +(defun org-capture-target-buffer (file) + "Get a buffer for FILE." + (or (org-find-base-buffer-visiting file) + (find-file-noselect (expand-file-name file org-directory)))) + +(defun org-capture-steal-local-variables (buffer) + "Install Org-mode local variables." + (mapc (lambda (v) + (ignore-errors (org-set-local (car v) (cdr v)))) + (buffer-local-variables buffer))) + +(defun org-capture-place-template () + "Insert the template at the target location, and display the buffer." + (org-capture-put :return-to-wconf (current-window-configuration)) + (delete-other-windows) + (org-switch-to-buffer-other-window + (org-capture-get-indirect-buffer (org-capture-get :buffer) "CAPTURE")) + (show-all) + (goto-char (org-capture-get :pos)) + (org-set-local 'org-capture-target-marker + (move-marker (make-marker) (point))) + (let* ((template (org-capture-get :template)) + (type (org-capture-get :type))) + (case type + ((nil entry) (org-capture-place-entry)) + (table-line (org-capture-place-table-line)) + (plain (org-capture-place-plain-text)) + (item (org-capture-place-item)))) + (org-capture-mode 1) + (org-set-local 'org-capture-current-plist org-capture-plist)) + +(defun org-capture-place-entry () + "Place the template as a new Org entry." + (let* ((txt (org-capture-get :template)) + (reversed (org-capture-get :prepend)) + (target-entry-p (org-capture-get :target-entry-p)) + level beg end file) + + (cond + ((org-capture-get :exact-position) + (goto-char (org-capture-get :exact-position))) + ((not target-entry-p) + ;; Insert as top-level entry, either at beginning or at end of file + (setq level 1) + (if reversed + (progn (goto-char (point-min)) + (outline-next-heading)) + (goto-char (point-max)) + (or (bolp) (insert "\n")))) + (t + ;; Insert as a child of the current entry + (and (looking-at "\\*+") + (setq level (- (match-end 0) (match-beginning 0)))) + (setq level (org-get-valid-level (or level 1) 1)) + (if reversed + (progn + (outline-next-heading) + (or (bolp) (insert "\n"))) + (org-end-of-subtree t t) + (or (bolp) (insert "\n"))))) + (org-capture-empty-lines-before) + (setq beg (point)) + (org-paste-subtree level txt 'for-yank) + (org-capture-empty-lines-after 1) + (org-capture-position-for-last-stored beg) + (outline-next-heading) + (setq end (point)) + (org-capture-mark-kill-region beg (1- end)) + (org-capture-narrow beg (1- end)) + (if (re-search-forward "%\\?" end t) (replace-match "")))) + +(defun org-capture-place-item () + "Place the template as a new plain list item." + (let* ((txt (org-capture-get :template)) + (target-entry-p (org-capture-get :target-entry-p)) + (ind 0) + beg end) + (cond + ((org-capture-get :exact-position) + (goto-char (org-capture-get :exact-position))) + ((not target-entry-p) + ;; Insert as top-level entry, either at beginning or at end of file + (setq beg (point-min) end (point-max))) + (t + (setq beg (1+ (point-at-eol)) + end (save-excursion (outline-next-heading) (point))))) + (if (org-capture-get :prepend) + (progn + (goto-char beg) + (if (re-search-forward (concat "^" (org-item-re)) nil t) + (progn + (goto-char (match-beginning 0)) + (setq ind (org-get-indentation))) + (goto-char end) + (setq ind 0))) + (goto-char end) + (if (re-search-backward (concat "^" (org-item-re)) nil t) + (progn + (setq ind (org-get-indentation)) + (org-end-of-item)) + (setq ind 0))) + ;; Remove common indentation + (setq txt (org-remove-indentation txt)) + ;; Make sure this is indeed an item + (unless (string-match (concat "\\`" (org-item-re)) txt) + (setq txt (concat "- " + (mapconcat 'identity (split-string txt "\n") + "\n ")))) + ;; Set the correct indentation, depending on context + (setq ind (make-string ind ?\ )) + (setq txt (concat ind + (mapconcat 'identity (split-string txt "\n") + (concat "\n" ind)) + "\n")) + ;; Insert, with surrounding empty lines + (org-capture-empty-lines-before) + (setq beg (point)) + (insert txt) + (or (bolp) (insert "\n")) + (org-capture-empty-lines-after 1) + (org-capture-position-for-last-stored beg) + (forward-char 1) + (setq end (point)) + (org-capture-mark-kill-region beg (1- end)) + (org-capture-narrow beg (1- end)) + (if (re-search-forward "%\\?" end t) (replace-match "")))) + +(defun org-capture-place-table-line () + "Place the template as a table line." + (require 'org-table) + (let* ((txt (org-capture-get :template)) + (target-entry-p (org-capture-get :target-entry-p)) + (table-line-pos (org-capture-get :table-line-pos)) + ind beg end) + (cond + ((org-capture-get :exact-position) + (goto-char (org-capture-get :exact-position))) + ((not target-entry-p) + ;; Table is not necessarily under a heading + (setq beg (point-min) end (point-max))) + (t + ;; WE are at a heading, limit search to the body + (setq beg (1+ (point-at-eol)) + end (save-excursion (outline-next-heading) (point))))) + (if (re-search-forward org-table-dataline-regexp end t) + (let ((b (org-table-begin)) (e (org-table-end))) + (goto-char e) + (if (looking-at "[ \t]*#\\+TBLFM:") + (forward-line 1)) + (narrow-to-region b (point))) + (goto-char end) + (insert "\n| |\n|----|\n| |\n") + (narrow-to-region (1+ end) (point))) + ;; We are narrowed to the table, or to an empty line if there was no table + + ;; Check if the template is good + (if (not (string-match org-table-dataline-regexp txt)) + (setq txt "| %?Bad template |\n")) + (cond + ((and table-line-pos + (string-match "\\(I+\\)\\([-+][0-9]\\)" table-line-pos)) + ;; we have a complex line specification + (goto-char (point-min)) + (let ((nh (- (match-end 1) (match-beginning 1))) + (delta (string-to-number (match-string 2 table-line-pos))) + ll) + ;; The user wants a special position in the table + (org-table-get-specials) + (setq ll (ignore-errors (aref org-table-hlines nh))) + (unless ll (error "Invalid table line specification \"%s\"" + table-line-pos)) + (setq ll (+ ll delta (if (< delta 0) 0 -1))) + (org-goto-line ll) + (org-table-insert-row 'below) + (beginning-of-line 1) + (delete-region (point) (1+ (point-at-eol))) + (setq beg (point)) + (insert txt) + (setq end (point)))) + ((org-capture-get :prepend) + (goto-char (point-min)) + (re-search-forward org-table-hline-regexp nil t) + (beginning-of-line 1) + (re-search-forward org-table-dataline-regexp nil t) + (beginning-of-line 1) + (setq beg (point)) + (org-table-insert-row) + (beginning-of-line 1) + (delete-region (point) (1+ (point-at-eol))) + (insert txt) + (setq end (point))) + (t + (goto-char (point-max)) + (re-search-backward org-table-dataline-regexp nil t) + (beginning-of-line 1) + (org-table-insert-row 'below) + (beginning-of-line 1) + (delete-region (point) (1+ (point-at-eol))) + (setq beg (point)) + (insert txt) + (setq end (point)))) + (goto-char beg) + (org-capture-position-for-last-stored 'table-line) + (if (re-search-forward "%\\?" end t) (replace-match "")) + (org-table-align))) + +(defun org-capture-place-plain-text () + "Place the template plainly." + (let* ((txt (org-capture-get :template)) + beg end) + (goto-char (cond + ((org-capture-get :exact-position)) + ((org-capture-get :prepend) (point-min)) + (t (point-max)))) + (or (bolp) (newline)) + (org-capture-empty-lines-before) + (setq beg (point)) + (insert txt) + (org-capture-empty-lines-after 1) + (org-capture-position-for-last-stored beg) + (setq end (point)) + (org-capture-mark-kill-region beg (1- end)) + (org-capture-narrow beg (1- end)) + (if (re-search-forward "%\\?" end t) (replace-match "")))) + +(defun org-capture-mark-kill-region (beg end) + "Mark the region that will have to be killed when aborting capture." + (let ((m1 (move-marker (make-marker) beg)) + (m2 (move-marker (make-marker) end))) + (org-capture-put :begin-marker m1) + (org-capture-put :end-marker m2))) + +(defun org-capture-position-for-last-stored (where) + "Memorize the position that should later become the position of last capture." + (cond + ((integerp where) + (org-capture-put :position-for-last-stored + (move-marker (make-marker) where + (or (buffer-base-buffer (current-buffer)) + (current-buffer))))) + ((eq where 'table-line) + (org-capture-put :position-for-last-stored + (list 'table-line + (org-table-current-dline)))) + (t (error "This should not happen")))) + +(defun org-capture-bookmark-last-stored-position () + "Bookmark the last-captured position." + (let* ((where (org-capture-get :position-for-last-stored 'local)) + (pos (cond + ((markerp where) + (prog1 (marker-position where) + (move-marker where nil))) + ((and (listp where) (eq (car where) 'table-line)) + (if (org-at-table-p) + (save-excursion + (org-table-goto-line (nth 1 where)) + (point-at-bol)) + (point)))))) + (with-current-buffer (buffer-base-buffer (current-buffer)) + (save-excursion + (save-restriction + (widen) + (goto-char pos) + (bookmark-set "org-capture-last-stored") + (move-marker org-capture-last-stored-marker (point))))))) + +(defun org-capture-narrow (beg end) + "Narrow, unless configuration says not to narrow." + (unless (org-capture-get :unnarrowed) + (narrow-to-region beg end) + (goto-char beg))) + +(defun org-capture-empty-lines-before (&optional n) + "Arrange for the correct number of empty lines before the insertion point. +Point will be after the empty lines, so insertion can directly be done." + (setq n (or n (org-capture-get :empty-lines) 0)) + (let ((pos (point))) + (org-back-over-empty-lines) + (delete-region (point) pos) + (newline n))) + +(defun org-capture-empty-lines-after (&optional n) + "Arrange for the correct number of empty lines after the inserted string. +Point will remain at the first line after the inserted text." + (setq n (or n (org-capture-get :empty-lines) 0)) + (org-back-over-empty-lines) + (while (looking-at "[ \t]*\n") (replace-match "")) + (let ((pos (point))) + (newline n) + (goto-char pos))) + +(defvar org-clock-marker) ; Defined in org.el +;;;###autoload +(defun org-capture-insert-template-here () + (let* ((template (org-capture-get :template)) + (type (org-capture-get :type)) + beg end pp) + (or (bolp) (newline)) + (setq beg (point)) + (cond + ((and (eq type 'entry) (org-mode-p)) + (org-paste-subtree nil template t)) + ((and (memq type '(item checkitem)) + (org-mode-p) + (save-excursion (skip-chars-backward " \t\n") + (setq pp (point)) + (org-in-item-p))) + (goto-char pp) + (org-insert-item) + (skip-chars-backward " ") + (skip-chars-backward "-+*0123456789).") + (delete-region (point) (point-at-eol)) + (setq beg (point)) + (org-remove-indentation template) + (insert template) + (org-capture-empty-lines-after) + (goto-char beg) + (org-maybe-renumber-ordered-list) + (org-end-of-item) + (setq end (point))) + (t (insert template))) + (setq end (point)) + (goto-char beg) + (if (re-search-forward "%\\?" end t) + (replace-match "")))) + +(defun org-capture-set-plist (entry) + "Initialize the property list from the template definition." + (setq org-capture-plist (copy-sequence (nthcdr 5 entry))) + (org-capture-put :key (car entry) :description (nth 1 entry) + :target (nth 3 entry)) + (let ((txt (nth 4 entry)) (type (or (nth 2 entry) 'entry))) + (when (or (not txt) (and (stringp txt) (not (string-match "\\S-" txt)))) + ;; The template may be empty or omitted for special types. + ;; Here we insert the default templates for such cases. + (cond + ((eq type 'item) (setq txt "- %?")) + ((eq type 'checkitem) (setq txt "- [ ] %?")) + ((eq type 'table-line) (setq txt "| %? |")) + ((member type '(nil entry)) (setq txt "* %?\n %a")))) + (org-capture-put :template txt :type type))) + +(defun org-capture-goto-target (&optional template-key) + "Go to the target location of a capture template. +The user is queried for the template." + (interactive) + (let* (org-select-template-temp-major-mode + (entry (org-capture-select-template template-key))) + (unless entry + (error "No capture template selected")) + (org-capture-set-plist entry) + (org-capture-set-target-location) + (switch-to-buffer (org-capture-get :buffer)) + (goto-char (org-capture-get :pos)))) + +(defun org-capture-get-indirect-buffer (&optional buffer prefix) + "Make an indirect buffer for a capture process. +Use PREFIX as a prefix for the name of the indirect buffer." + (setq buffer (or buffer (current-buffer))) + (let ((n 1) (base (buffer-name buffer)) bname) + (setq bname (concat prefix "-" base)) + (while (buffer-live-p (get-buffer bname)) + (setq bname (concat prefix "-" (number-to-string (incf n)) "-" base))) + (condition-case nil + (make-indirect-buffer buffer bname 'clone) + (error (make-indirect-buffer buffer bname))))) + + +;;; The template code + +(defun org-capture-select-template (&optional keys) + "Select a capture template. +Lisp programs can force the template by setting KEYS to a string." + (when org-capture-templates + (if keys + (or (assoc keys org-capture-templates) + (error "No capture template referred to by \"%s\" keys" keys)) + (if (= 1 (length org-capture-templates)) + (car org-capture-templates) + (org-mks org-capture-templates + "Select a capture template\n=========================" + "Template key: " + '(("C" "Customize org-capture-templates") + ("q" "Abort"))))))) + +(defun org-capture-fill-template (&optional template initial annotation) + "Fill a template and return the filled template as a string. +The template may still contain \"%?\" for cursor positioning." + (setq template (or template (org-capture-get :template))) + (when (stringp initial) + (setq initial (org-no-properties initial)) + (remove-text-properties 0 (length initial) '(read-only t) initial)) + (let* ((buffer (org-capture-get :buffer)) + (file (buffer-file-name (or (buffer-base-buffer buffer) buffer))) + (ct (org-capture-get :default-time)) + (dct (decode-time ct)) + (ct1 + (if (< (nth 2 dct) org-extend-today-until) + (encode-time 0 59 23 (1- (nth 3 dct)) (nth 4 dct) (nth 5 dct)) + ct)) + (plist-p (if org-store-link-plist t nil)) + (v-c (and (> (length kill-ring) 0) (current-kill 0))) + (v-x (or (org-get-x-clipboard 'PRIMARY) + (org-get-x-clipboard 'CLIPBOARD) + (org-get-x-clipboard 'SECONDARY))) + (v-t (format-time-string (car org-time-stamp-formats) ct)) + (v-T (format-time-string (cdr org-time-stamp-formats) ct)) + (v-u (concat "[" (substring v-t 1 -1) "]")) + (v-U (concat "[" (substring v-T 1 -1) "]")) + ;; `initial' and `annotation' might habe been passed. + ;; But if the property list has them, we prefer those values + (v-i (or (plist-get org-store-link-plist :initial) + initial + (org-capture-get :initial) + "")) + (v-a (or (plist-get org-store-link-plist :annotation) + annotation + (org-capture-get :annotation) + "")) + ;; Is the link empty? Then we do not want it... + (v-a (if (equal v-a "[[]]") "" v-a)) + (clipboards (remove nil (list v-i + (org-get-x-clipboard 'PRIMARY) + (org-get-x-clipboard 'CLIPBOARD) + (org-get-x-clipboard 'SECONDARY) + v-c))) + (v-A (if (and v-a + (string-match + "\\[\\(\\[.*?\\]\\)\\(\\[.*?\\]\\)?\\]" v-a)) + (replace-match "[\\1[%^{Link description}]]" nil nil v-a) + v-a)) + (v-n user-full-name) + (v-k (if (marker-buffer org-clock-marker) + (org-substring-no-properties org-clock-heading))) + (v-K (if (marker-buffer org-clock-marker) + (org-make-link-string + (buffer-file-name (marker-buffer org-clock-marker)) + org-clock-heading))) + v-I + (org-startup-folded nil) + (org-inhibit-startup t) + org-time-was-given org-end-time-was-given x + prompt completions char time pos default histvar) + + (setq org-store-link-plist + (plist-put org-store-link-plist :annotation v-a) + org-store-link-plist + (plist-put org-store-link-plist :initial v-i)) + + (unless template (setq template "") (message "No template") (ding) + (sit-for 1)) + (save-window-excursion + (delete-other-windows) + (switch-to-buffer (get-buffer-create "*Capture*")) + (erase-buffer) + (insert template) + (goto-char (point-min)) + (org-capture-steal-local-variables buffer) + (setq buffer-file-name nil) + + ;; %[] Insert contents of a file. + (goto-char (point-min)) + (while (re-search-forward "%\\[\\(.+\\)\\]" nil t) + (unless (org-capture-escaped-%) + (let ((start (match-beginning 0)) + (end (match-end 0)) + (filename (expand-file-name (match-string 1)))) + (goto-char start) + (delete-region start end) + (condition-case error + (insert-file-contents filename) + (error (insert (format "%%![Couldn't insert %s: %s]" + filename error))))))) + ;; %() embedded elisp + (goto-char (point-min)) + (while (re-search-forward "%\\((.+)\\)" nil t) + (unless (org-capture-escaped-%) + (goto-char (match-beginning 0)) + (let ((template-start (point))) + (forward-char 1) + (let ((result + (condition-case error + (eval (read (current-buffer))) + (error (format "%%![Error: %s]" error))))) + (delete-region template-start (point)) + (insert result))))) + + ;; Simple %-escapes + (while (re-search-forward "%\\([tTuUaiAcxkKI]\\)" nil t) + (unless (org-capture-escaped-%) + (when (and initial (equal (match-string 0) "%i")) + (save-match-data + (let* ((lead (buffer-substring + (point-at-bol) (match-beginning 0)))) + (setq v-i (mapconcat 'identity + (org-split-string initial "\n") + (concat "\n" lead)))))) + (replace-match + (or (eval (intern (concat "v-" (match-string 1)))) "") + t t))) + + ;; From the property list + (when plist-p + (goto-char (point-min)) + (while (re-search-forward "%\\(:[-a-zA-Z]+\\)" nil t) + (unless (org-capture-escaped-%) + (and (setq x (or (plist-get org-store-link-plist + (intern (match-string 1))) "")) + (replace-match x t t))))) + + ;; Turn on org-mode in temp buffer, set local variables + ;; This is to support completion in interactive prompts + (let ((org-inhibit-startup t)) (org-mode)) + ;; Interactive template entries + (goto-char (point-min)) + (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?" + nil t) + (unless (org-capture-escaped-%) + (setq char (if (match-end 3) (match-string 3)) + prompt (if (match-end 2) (match-string 2))) + (goto-char (match-beginning 0)) + (replace-match "") + (setq completions nil default nil) + (when prompt + (setq completions (org-split-string prompt "|") + prompt (pop completions) + default (car completions) + histvar (intern (concat + "org-capture-template-prompt-history::" + (or prompt ""))) + completions (mapcar 'list completions))) + (cond + ((member char '("G" "g")) + (let* ((org-last-tags-completion-table + (org-global-tags-completion-table + (if (equal char "G") + (org-agenda-files) + (and file (list file))))) + (org-add-colon-after-tag-completion t) + (ins (org-icompleting-read + (if prompt (concat prompt ": ") "Tags: ") + 'org-tags-completion-function nil nil nil + 'org-tags-history))) + (setq ins (mapconcat 'identity + (org-split-string + ins (org-re "[^[:alnum:]_@]+")) + ":")) + (when (string-match "\\S-" ins) + (or (equal (char-before) ?:) (insert ":")) + (insert ins) + (or (equal (char-after) ?:) (insert ":"))))) + ((equal char "C") + (cond ((= (length clipboards) 1) (insert (car clipboards))) + ((> (length clipboards) 1) + (insert (read-string "Clipboard/kill value: " + (car clipboards) '(clipboards . 1) + (car clipboards)))))) + ((equal char "L") + (cond ((= (length clipboards) 1) + (org-insert-link 0 (car clipboards))) + ((> (length clipboards) 1) + (org-insert-link 0 (read-string "Clipboard/kill value: " + (car clipboards) + '(clipboards . 1) + (car clipboards)))))) + ((equal char "p") + (let* + ((prop (org-substring-no-properties prompt)) + (pall (concat prop "_ALL")) + (allowed + (with-current-buffer + (get-buffer (file-name-nondirectory file)) + (or (cdr (assoc pall org-file-properties)) + (cdr (assoc pall org-global-properties)) + (cdr (assoc pall org-global-properties-fixed))))) + (existing (with-current-buffer + (get-buffer (file-name-nondirectory file)) + (mapcar 'list (org-property-values prop)))) + (propprompt (concat "Value for " prop ": ")) + (val (if allowed + (org-completing-read + propprompt + (mapcar 'list (org-split-string allowed + "[ \t]+")) + nil 'req-match) + (org-completing-read-no-i propprompt + existing nil nil + "" nil "")))) + (org-set-property prop val))) + (char + ;; These are the date/time related ones + (setq org-time-was-given (equal (upcase char) char)) + (setq time (org-read-date (equal (upcase char) char) t nil + prompt)) + (if (equal (upcase char) char) (setq org-time-was-given t)) + (org-insert-time-stamp time org-time-was-given + (member char '("u" "U")) + nil nil (list org-end-time-was-given))) + (t + (let (org-completion-use-ido) + (insert (org-completing-read-no-i + (concat (if prompt prompt "Enter string") + (if default (concat " [" default "]")) + ": ") + completions nil nil nil histvar default))))))) + ;; Make sure there are no empty lines before the text, and that + ;; it ends with a newline character + (goto-char (point-min)) + (while (looking-at "[ \t]*\n") (replace-match "")) + (if (re-search-forward "[ \t\n]*\\'" nil t) (replace-match "\n")) + ;; Return the expanded tempate and kill the temporary buffer + (untabify (point-min) (point-max)) + (set-buffer-modified-p nil) + (prog1 (buffer-string) (kill-buffer (current-buffer)))))) + +(defun org-capture-escaped-% () + "Check if % was escaped - if yes, unescape it now." + (if (equal (char-before (match-beginning 0)) ?\\) + (progn + (delete-region (1- (match-beginning 0)) (match-beginning 0)) + t) + nil)) + +;;;###autoload +(defun org-capture-import-remember-templates () + "Set org-capture-templates to be similar to `org-remember-templates'." + (interactive) + (when (and (yes-or-no-p + "Import old remember templates into org-capture-templates? ") + (yes-or-no-p + "Note that this will remove any templates currently defined in `org-capture-templates'. Do you still want to go ahead? ")) + (require 'org-remember) + (setq org-capture-templates + (mapcar + (lambda (entry) + (let ((desc (car entry)) + (key (char-to-string (nth 1 entry))) + (template (nth 2 entry)) + (file (or (nth 3 entry) org-default-notes-file)) + (position (or (nth 4 entry) org-remember-default-headline)) + (type 'entry) + (prepend org-reverse-note-order) + immediate target) + (cond + ((member position '(top bottom)) + (setq target (list 'file file) + prepend (eq position 'top))) + ((eq position 'date-tree) + (setq target (list 'file+datetree file) + prepend nil)) + (t (setq target (list 'file+headline file position)))) + + (when (string-match "%!" template) + (setq template (replace-match "" t t template) + immediate t)) + + (append (list key desc type target template) + (if prepend '(:prepend t)) + (if immediate '(:immediate-finish t))))) + + org-remember-templates)))) + +(provide 'org-capture) + +;; arch-tag: 986bf41b-8ada-4e28-bf20-e8388a7205a0 + +;;; org-capture.el ends here + + diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 02ad4bf8b50..f451cf80792 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -29,9 +29,10 @@ ;; This file contains the time clocking code for Org-mode (require 'org) +;;; Code: + (eval-when-compile - (require 'cl) - (require 'calendar)) + (require 'cl)) (declare-function calendar-absolute-from-iso "cal-iso" (&optional date)) (defvar org-time-stamp-formats) @@ -83,7 +84,7 @@ clocking out." (defcustom org-clock-in-switch-to-state nil "Set task to a special todo state while clocking it. The value should be the state to which the entry should be -switched. If the value is a function, it must take one +switched. If the value is a function, it must take one parameter (the current TODO state of the item) and return the state to switch it to." :group 'org-clock @@ -96,7 +97,7 @@ state to switch it to." (defcustom org-clock-out-switch-to-state nil "Set task to a special todo state after clocking out. The value should be the state to which the entry should be -switched. If the value is a function, it must take one +switched. If the value is a function, it must take one parameter (the current TODO state of the item) and return the state to switch it to." :group 'org-clock @@ -124,7 +125,7 @@ The function is called with point at the beginning of the headline." :type 'function) (defcustom org-clock-string-limit 0 - "Maximum length of clock strings in the modeline. 0 means no limit." + "Maximum length of clock strings in the modeline. 0 means no limit." :group 'org-clock :type 'integer) @@ -136,8 +137,8 @@ the clock can be resumed from that point." :type 'boolean) (defcustom org-clock-persist nil - "When non-nil, save the running clock when emacs is closed. -The clock is resumed when emacs restarts. + "When non-nil, save the running clock when Emacs is closed. +The clock is resumed when Emacs restarts. When this is t, both the running clock, and the entire clock history are saved. When this is the symbol `clock', only the running clock is saved. @@ -245,6 +246,11 @@ string as argument." :group 'org-clock :type 'boolean) +(defcustom org-clock-resolve-expert nil + "Non-nil means do not show the splash buffer with the clock resolver." + :group 'org-clock + :type 'boolean) + (defvar org-clock-in-prepare-hook nil "Hook run when preparing the clock. This hook is run before anything happens to the task that @@ -277,7 +283,7 @@ to add an effort property.") "If non-nil, user cancelled a clock; this is when leftover time started.") (defvar org-clock-effort "" - "Effort estimate of the currently clocking task") + "Effort estimate of the currently clocking task.") (defvar org-clock-total-time nil "Holds total time, spent previously on currently clocked item. @@ -310,7 +316,10 @@ of a different task.") (defun org-clock-history-push (&optional pos buffer) "Push a marker to the clock history." (setq org-clock-history-length (max 1 (min 35 org-clock-history-length))) - (let ((m (move-marker (make-marker) (or pos (point)) buffer)) n l) + (let ((m (move-marker (make-marker) + (or pos (point)) (org-base-buffer + (or buffer (current-buffer))))) + n l) (while (setq n (member m org-clock-history)) (move-marker (car n) nil)) (setq org-clock-history @@ -334,11 +343,11 @@ of a different task.") org-clock-history)) (defun org-clocking-buffer () - "Returns clocking buffer if we are currently clocking a task or nil" + "Return the clocking buffer if we are currently clocking a task or nil." (marker-buffer org-clock-marker)) (defun org-clocking-p () - "Returns t when clocking a task" + "Return t when clocking a task." (not (equal (org-clocking-buffer) nil))) (defun org-clock-select-task (&optional prompt) @@ -501,7 +510,8 @@ the mode line." ;; A string. See if it is a delta (setq sign (string-to-char value)) (if (member sign '(?- ?+)) - (setq current (org-hh:mm-string-to-minutes (substring current 1))) + (setq current (org-hh:mm-string-to-minutes current) + value (substring value 1)) (setq current 0)) (setq value (org-hh:mm-string-to-minutes value)) (if (equal ?- sign) @@ -587,7 +597,7 @@ Use alsa's aplay tool if available." (save-excursion (goto-char (point-min)) (while (re-search-forward "CLOCK: \\(\\[.*?\\]\\)$" nil t) - (push (cons (copy-marker (1- (match-end 1)) t) + (push (cons (copy-marker (match-end 1) t) (org-time-string-to-time (match-string 1))) clocks)))) clocks)) @@ -624,12 +634,12 @@ This macro also protects the current active clock from being altered." (put 'org-with-clock 'lisp-indent-function 1) -(defsubst org-clock-clock-in (clock &optional resume) +(defsubst org-clock-clock-in (clock &optional resume start-time) "Clock in to the clock located by CLOCK. If necessary, clock-out of the currently active clock." (org-with-clock-position clock (let ((org-clock-in-resume (or resume org-clock-in-resume))) - (org-clock-in)))) + (org-clock-in nil start-time)))) (defsubst org-clock-clock-out (clock &optional fail-quietly at-time) "Clock out of the clock located by CLOCK." @@ -655,39 +665,10 @@ If necessary, clock-out of the currently active clock." (defvar org-clock-resolving-clocks nil) (defvar org-clock-resolving-clocks-due-to-idleness nil) -(defun org-clock-resolve-clock (clock resolve-to &optional close-p - restart-p fail-quietly) +(defun org-clock-resolve-clock (clock resolve-to clock-out-time + &optional close-p restart-p fail-quietly) "Resolve `CLOCK' given the time `RESOLVE-TO', and the present. -`CLOCK' is a cons cell of the form (MARKER START-TIME). -This routine can do one of many things: - - if `RESOLVE-TO' is nil - if `CLOSE-P' is non-nil, give an error - if this clock is the active clock, cancel it - else delete the clock line (as if it never happened) - if `RESTART-P' is non-nil, start a new clock - - else if `RESOLVE-TO' is the symbol `now' - if `RESTART-P' is non-nil, give an error - if `CLOSE-P' is non-nil, clock out the entry and - if this clock is the active clock, stop it - else if this clock is the active clock, do nothing - else if there is no active clock, resume this clock - else ask to cancel the active clock, and if so, - resume this clock after cancelling it - - else if `RESOLVE-TO' is some date in the future - give an error about `RESOLVE-TO' being invalid - - else if `RESOLVE-TO' is some date in the past - if `RESTART-P' is non-nil, give an error - if `CLOSE-P' is non-nil, enter a closing time and - if this clock is the active clock, stop it - else if this clock is the active clock, enter a - closing time, stop the current clock, then - start a new clock for the same item - else just enter a closing time for this clock - and then start a new clock for the same item" +`CLOCK' is a cons cell of the form (MARKER START-TIME)." (let ((org-clock-resolving-clocks t)) (cond ((null resolve-to) @@ -709,11 +690,41 @@ This routine can do one of many things: (t (if restart-p (error "RESTART-P is not valid here")) - (org-clock-clock-out clock fail-quietly resolve-to) + (org-clock-clock-out clock fail-quietly (or clock-out-time + resolve-to)) (unless org-clock-clocking-in (if close-p - (setq org-clock-leftover-time resolve-to) - (org-clock-clock-in clock))))))) + (setq org-clock-leftover-time (and (null clock-out-time) + resolve-to)) + (org-clock-clock-in clock nil (and clock-out-time + resolve-to)))))))) + +(defun org-clock-jump-to-current-clock (&optional effective-clock) + (interactive) + (let ((clock (or effective-clock (cons org-clock-marker + org-clock-start-time)))) + (unless (marker-buffer (car clock)) + (error "No clock is currently running")) + (org-with-clock clock (org-clock-goto)) + (with-current-buffer (marker-buffer (car clock)) + (goto-char (car clock)) + (if org-clock-into-drawer + (let ((logbook + (if (stringp org-clock-into-drawer) + (concat ":" org-clock-into-drawer ":") + ":LOGBOOK:"))) + (ignore-errors + (outline-flag-region + (save-excursion + (outline-back-to-heading t) + (search-forward logbook) + (goto-char (match-beginning 0))) + (save-excursion + (outline-back-to-heading t) + (search-forward logbook) + (search-forward ":END:") + (goto-char (match-end 0))) + nil))))))) (defun org-clock-resolve (clock &optional prompt-fn last-valid fail-quietly) "Resolve an open org-mode clock. @@ -739,51 +750,66 @@ was started." (save-window-excursion (save-excursion (unless org-clock-resolving-clocks-due-to-idleness - (org-with-clock clock (org-clock-goto)) - (with-current-buffer (marker-buffer (car clock)) - (goto-char (car clock)) - (if org-clock-into-drawer - (let ((logbook - (if (stringp org-clock-into-drawer) - (concat ":" org-clock-into-drawer ":") - ":LOGBOOK:"))) - (ignore-errors - (outline-flag-region - (save-excursion - (outline-back-to-heading t) - (search-forward logbook) - (goto-char (match-beginning 0))) - (save-excursion - (outline-back-to-heading t) - (search-forward logbook) - (search-forward ":END:") - (goto-char (match-end 0))) - nil)))))) + (org-clock-jump-to-current-clock clock)) + (unless org-clock-resolve-expert + (with-output-to-temp-buffer "*Org Clock*" + (princ "Select a Clock Resolution Command: + +i/q/C-g Ignore this question; the same as keeping all the idle time. + +k/K Keep X minutes of the idle time (default is all). If this + amount is less than the default, you will be clocked out + that many minutes after the time that idling began, and then + clocked back in at the present time. +g/G Indicate that you \"got back\" X minutes ago. This is quite + different from 'k': it clocks you out from the beginning of + the idle period and clock you back in X minutes ago. +s/S Subtract the idle time from the current clock. This is the + same as keeping 0 minutes. +C Cancel the open timer altogether. It will be as though you + never clocked in. +j/J Jump to the current clock, to make manual adjustments. + +For all these options, using uppercase makes your final state +to be CLOCKED OUT."))) + (org-fit-window-to-buffer (get-buffer-window "*Org Clock*")) (let (char-pressed) - (if (featurep 'xemacs) - (progn - (message (concat (funcall prompt-fn clock) - " [(kK)eep (sS)ubtract (C)ancel]? ")) - (setq char-pressed (read-char-exclusive))) + (when (featurep 'xemacs) + (message (concat (funcall prompt-fn clock) + " [jkKgGsScCiq]? ")) + (setq char-pressed (read-char-exclusive))) (while (or (null char-pressed) - (and (not (memq char-pressed '(?k ?K ?s ?S ?C ?i))) + (and (not (memq char-pressed + '(?k ?K ?g ?G ?s ?S ?C + ?j ?J ?i ?q))) (or (ding) t))) (setq char-pressed (read-char (concat (funcall prompt-fn clock) - " [(kK)p (sS)ub (C)ncl (i)gn]? ") + " [jkKgGSscCiq]? ") nil 45))) - (and (not (eq char-pressed ?i)) char-pressed)))))) - (default (floor (/ (org-float-time - (time-subtract (current-time) last-valid)) 60))) - (keep (and (memq ch '(?k ?K)) - (read-number "Keep how many minutes? " default))) + (and (not (memq char-pressed '(?i ?q))) char-pressed))))) + (default + (floor (/ (org-float-time + (time-subtract (current-time) last-valid)) 60))) + (keep + (and (memq ch '(?k ?K)) + (read-number "Keep how many minutes? " default))) + (gotback + (and (memq ch '(?g ?G)) + (read-number "Got back how many minutes ago? " default))) (subtractp (memq ch '(?s ?S))) (barely-started-p (< (- (org-float-time last-valid) (org-float-time (cdr clock))) 45)) (start-over (and subtractp barely-started-p))) - (if (or (null ch) - (not (memq ch '(?k ?K ?s ?S ?C)))) - (message "") + (cond + ((memq ch '(?j ?J)) + (if (eq ch ?J) + (org-clock-resolve-clock clock 'now nil t nil fail-quietly)) + (org-clock-jump-to-current-clock clock)) + ((or (null ch) + (not (memq ch '(?k ?K ?g ?G ?s ?S ?C)))) + (message "")) + (t (org-clock-resolve-clock clock (cond ((or (eq ch ?C) @@ -792,21 +818,29 @@ was started." ;; time... start-over) nil) - (subtractp + ((or subtractp + (and gotback (= gotback 0))) last-valid) - ((= keep default) + ((or (and keep (= keep default)) + (and gotback (= gotback default))) 'now) + (keep + (time-add last-valid (seconds-to-time (* 60 keep)))) + (gotback + (time-subtract (current-time) + (seconds-to-time (* 60 gotback)))) (t - (time-add last-valid (seconds-to-time (* 60 keep))))) - (memq ch '(?K ?S)) + (error "Unexpected, please report this as a bug"))) + (and gotback last-valid) + (memq ch '(?K ?G ?S)) (and start-over - (not (memq ch '(?K ?S ?C)))) - fail-quietly)))) + (not (memq ch '(?K ?G ?S ?C)))) + fail-quietly))))) -(defun org-resolve-clocks (&optional also-non-dangling-p prompt-fn last-valid) +(defun org-resolve-clocks (&optional only-dangling-p prompt-fn last-valid) "Resolve all currently open org-mode clocks. -If `also-non-dangling-p' is non-nil, also ask to resolve -non-dangling (i.e., currently open and valid) clocks." +If `only-dangling-p' is non-nil, only ask to resolve dangling +\(i.e., not currently open and valid) clocks." (interactive "P") (unless org-clock-resolving-clocks (let ((org-clock-resolving-clocks t)) @@ -815,7 +849,7 @@ non-dangling (i.e., currently open and valid) clocks." (dolist (clock clocks) (let ((dangling (or (not (org-clock-is-active)) (/= (car clock) org-clock-marker)))) - (unless (and (not dangling) (not also-non-dangling-p)) + (if (or (not only-dangling-p) dangling) (org-clock-resolve clock (or prompt-fn @@ -837,11 +871,11 @@ non-dangling (i.e., currently open and valid) clocks." 0))) (defun org-mac-idle-seconds () - "Return the current Mac idle time in seconds" + "Return the current Mac idle time in seconds." (string-to-number (shell-command-to-string "ioreg -c IOHIDSystem | perl -ane 'if (/Idle/) {$idle=(pop @F)/1000000000; print $idle; last}'"))) (defun org-x11-idle-seconds () - "Return the current X11 idle time in seconds" + "Return the current X11 idle time in seconds." (/ (string-to-number (shell-command-to-string "x11idle")) 1000)) (defun org-user-idle-seconds () @@ -882,11 +916,13 @@ so long." 60.0)))) org-clock-user-idle-start))))) -(defun org-clock-in (&optional select) +(defun org-clock-in (&optional select start-time) "Start the clock on the current item. If necessary, clock-out of the currently active clock. -With prefix arg SELECT, offer a list of recently clocked tasks to -clock into. When SELECT is `C-u C-u', clock into the current task and mark +With a prefix argument SELECT (\\[universal-argument]), offer a list of \ +recently clocked tasks to +clock into. When SELECT is \\[universal-argument] \\[universal-argument], \ +clock into the current task and mark is as the default task, a special task that will always be offered in the clocking selection, associated with the letter `d'." (interactive "P") @@ -930,7 +966,8 @@ the clocking selection, associated with the letter `d'." (move-marker org-clock-interrupted-task (marker-position org-clock-marker) (org-clocking-buffer)) - (org-clock-out t)))) + (let ((org-clock-clocking-in t)) + (org-clock-out t))))) (when (equal select '(16)) ;; Mark as default clocking task @@ -1027,6 +1064,7 @@ the clocking selection, associated with the letter `d'." (/ (- (org-float-time (current-time)) (org-float-time leftover)) 60))) leftover) + start-time (current-time))) (setq ts (org-insert-time-stamp org-clock-start-time 'with-hm 'inactive)))) @@ -1059,7 +1097,7 @@ the clocking selection, associated with the letter `d'." "Task currently clocked in.") (defun org-clock-set-current () "Set `org-clock-current-task' to the task currently clocked in." - (setq org-clock-current-task (org-get-heading))) + (setq org-clock-current-task (nth 4 (org-heading-components)))) (defun org-clock-delete-current () "Reset `org-clock-current-task' to nil." (setq org-clock-current-task nil)) @@ -1196,11 +1234,14 @@ line and position cursor in that line." If there is no running clock, throw an error, unless FAIL-QUIETLY is set." (interactive) (catch 'exit - (if (not (org-clocking-p)) - (if fail-quietly (throw 'exit t) (error "No active clock"))) + (when (not (org-clocking-p)) + (setq global-mode-string + (delq 'org-mode-line-string global-mode-string)) + (force-mode-line-update) + (if fail-quietly (throw 'exit t) (error "No active clock"))) (let (ts te s h m remove) - (save-excursion - (set-buffer (org-clocking-buffer)) + (save-excursion ; Do not replace this with `with-current-buffer'. + (with-no-warnings (set-buffer (org-clocking-buffer))) (save-restriction (widen) (goto-char org-clock-marker) @@ -1263,12 +1304,15 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set." (org-clock-delete-current)))))) (defun org-clock-cancel () - "Cancel the running clock be removing the start timestamp." + "Cancel the running clock by removing the start timestamp." (interactive) - (if (not (org-clocking-p)) - (error "No active clock")) - (save-excursion - (set-buffer (org-clocking-buffer)) + (when (not (org-clocking-p)) + (setq global-mode-string + (delq 'org-mode-line-string global-mode-string)) + (force-mode-line-update) + (error "No active clock")) + (save-excursion ; Do not replace this with `with-current-buffer'. + (with-no-warnings (set-buffer (org-clocking-buffer))) (goto-char org-clock-marker) (delete-region (1- (point-at-bol)) (point-at-eol)) ;; Just in case, remove any empty LOGBOOK left over @@ -1313,10 +1357,13 @@ With prefix arg SELECT, offer recently clocked tasks for selection." "Holds the file total time in minutes, after a call to `org-clock-sum'.") (make-variable-buffer-local 'org-clock-file-total-minutes) -(defun org-clock-sum (&optional tstart tend) +(defun org-clock-sum (&optional tstart tend headline-filter) "Sum the times for each subtree. Puts the resulting times in minutes as a text property on each headline. -TSTART and TEND can mark a time range to be considered." +TSTART and TEND can mark a time range to be considered. HEADLINE-FILTER is a +zero-arg function that, if specified, is called for each headline in the time +range with point at the headline. Headlines for which HEADLINE-FILTER returns +nil are excluded from the clock summation." (interactive) (let* ((bmp (buffer-modified-p)) (re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" @@ -1332,7 +1379,9 @@ TSTART and TEND can mark a time range to be considered." (if (stringp tend) (setq tend (org-time-string-to-seconds tend))) (if (consp tstart) (setq tstart (org-float-time tstart))) (if (consp tend) (setq tend (org-float-time tend))) - (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t)) + (remove-text-properties (point-min) (point-max) + '(:org-clock-minutes t + :org-clock-force-headline-inclusion t)) (save-excursion (goto-char (point-max)) (while (re-search-backward re nil t) @@ -1357,24 +1406,47 @@ TSTART and TEND can mark a time range to be considered." ;; Add the currently clocking item time to the total (when (and org-clock-report-include-clocking-task (equal (org-clocking-buffer) (current-buffer)) - (equal (marker-position org-clock-hd-marker) (point))) - (let ((time (floor (- (org-float-time) - (org-float-time org-clock-start-time)) 60))) - (setq t1 (+ t1 time)))) - (setq level (- (match-end 1) (match-beginning 1))) - (when (or (> t1 0) (> (aref ltimes level) 0)) - (loop for l from 0 to level do - (aset ltimes l (+ (aref ltimes l) t1))) - (setq t1 0 time (aref ltimes level)) - (loop for l from level to (1- lmax) do - (aset ltimes l 0)) - (goto-char (match-beginning 0)) - (put-text-property (point) (point-at-eol) :org-clock-minutes time))))) + (equal (marker-position org-clock-hd-marker) (point)) + tstart + tend + (>= (org-float-time org-clock-start-time) tstart) + (<= (org-float-time org-clock-start-time) tend)) + (let ((time (floor (- (org-float-time) + (org-float-time org-clock-start-time)) 60))) + (setq t1 (+ t1 time)))) + (let* ((headline-forced + (get-text-property (point) + :org-clock-force-headline-inclusion)) + (headline-included + (or (null headline-filter) + (save-excursion + (save-match-data (funcall headline-filter)))))) + (setq level (- (match-end 1) (match-beginning 1))) + (when (or (> t1 0) (> (aref ltimes level) 0)) + (when (or headline-included headline-forced) + (if headline-included + (loop for l from 0 to level do + (aset ltimes l (+ (aref ltimes l) t1)))) + (setq time (aref ltimes level)) + (goto-char (match-beginning 0)) + (put-text-property (point) (point-at-eol) :org-clock-minutes time) + (if headline-filter + (save-excursion + (save-match-data + (while + (> (funcall outline-level) 1) + (outline-up-heading 1 t) + (put-text-property + (point) (point-at-eol) + :org-clock-force-headline-inclusion t)))))) + (setq t1 0) + (loop for l from level to (1- lmax) do + (aset ltimes l 0))))))) (setq org-clock-file-total-minutes (aref ltimes 0))) (set-buffer-modified-p bmp))) (defun org-clock-sum-current-item (&optional tstart) - "Returns time, clocked on current item in total" + "Return time, clocked on current item in total." (save-excursion (save-restriction (org-narrow-to-subtree) @@ -1430,7 +1502,7 @@ will be easy to remove." (org-move-to-column c) (unless (eolp) (skip-chars-backward "^ \t")) (skip-chars-backward " \t") - (setq ov (org-make-overlay (1- (point)) (point-at-eol)) + (setq ov (make-overlay (1- (point)) (point-at-eol)) tx (concat (buffer-substring (1- (point)) (point)) (make-string (+ off (max 0 (- c (current-column)))) ?.) (org-add-props (if org-time-clocksum-use-fractional @@ -1444,9 +1516,9 @@ will be easy to remove." (list 'face 'org-clock-overlay)) "")) (if (not (featurep 'xemacs)) - (org-overlay-put ov 'display tx) - (org-overlay-put ov 'invisible t) - (org-overlay-put ov 'end-glyph (make-glyph tx))) + (overlay-put ov 'display tx) + (overlay-put ov 'invisible t) + (overlay-put ov 'end-glyph (make-glyph tx))) (push ov org-clock-overlays))) (defun org-clock-remove-overlays (&optional beg end noremove) @@ -1455,7 +1527,7 @@ BEG and END are ignored. If NOREMOVE is nil, remove this function from the `before-change-functions' in the current buffer." (interactive) (unless org-inhibit-highlight-removal - (mapc 'org-delete-overlay org-clock-overlays) + (mapc 'delete-overlay org-clock-overlays) (setq org-clock-overlays nil) (unless noremove (remove-hook 'before-change-functions @@ -1689,6 +1761,8 @@ the currently selected interval size." (te (plist-get params :tend)) (block (plist-get params :block)) (link (plist-get params :link)) + (tags (plist-get params :tags)) + (matcher (if tags (cdr (org-make-tags-matcher tags)))) ipos time p level hlc hdl tsp props content recalc formula pcol cc beg end pos tbl tbl1 range-text rm-file-column scope-is-list st) (setq org-clock-file-total-minutes nil) @@ -1770,7 +1844,14 @@ the currently selected interval size." (goto-char pos) (unless scope-is-list - (org-clock-sum ts te) + (org-clock-sum ts te + (unless (null matcher) + (lambda () + (let ((tags-list + (org-split-string + (or (org-entry-get (point) "ALLTAGS") "") + ":"))) + (eval matcher))))) (goto-char (point-min)) (setq st t) (while (or (and (bobp) (prog1 st (setq st nil)) @@ -1874,7 +1955,8 @@ the currently selected interval size." (org-table-recalculate 'all)) (when rm-file-column (forward-char 1) - (org-table-delete-column))))))) + (org-table-delete-column)) + total-time))))) (defun org-clocktable-steps (params) (let* ((p1 (copy-sequence params)) @@ -1882,8 +1964,9 @@ the currently selected interval size." (te (plist-get p1 :tend)) (step0 (plist-get p1 :step)) (step (cdr (assoc step0 '((day . 86400) (week . 604800))))) + (stepskip0 (plist-get p1 :stepskip0)) (block (plist-get p1 :block)) - cc range-text) + cc range-text step-time) (when block (setq cc (org-clock-special-range block nil t) ts (car cc) te (nth 1 cc) range-text (nth 2 cc))) @@ -1904,8 +1987,14 @@ the currently selected interval size." (seconds-to-time (setq ts (+ ts step)))))) (insert "\n" (if (eq step0 'day) "Daily report: " "Weekly report starting on: ") (plist-get p1 :tstart) "\n") - (org-dblock-write:clocktable p1) + (setq step-time (org-dblock-write:clocktable p1)) (re-search-forward "#\\+END:") + (when (and (equal step-time 0) stepskip0) + ;; Remove the empty table + (delete-region (point-at-bol) + (save-excursion + (re-search-backward "^\\(Daily\\|Weekly\\) report" nil t) + (point)))) (end-of-line 0)))) (defun org-clocktable-add-file (file table) @@ -2038,7 +2127,7 @@ The details of what will be saved are regulated by the variable ;;;###autoload (defun org-clock-persistence-insinuate () - "Set up hooks for clock persistence" + "Set up hooks for clock persistence." (add-hook 'org-mode-hook 'org-clock-load) (add-hook 'kill-emacs-hook 'org-clock-save)) diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el index 38938a53837..8e45fdf3e3c 100644 --- a/lisp/org/org-colview.el +++ b/lisp/org/org-colview.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -36,6 +36,9 @@ (declare-function org-agenda-redo "org-agenda" ()) (declare-function org-agenda-do-context-action "org-agenda" ()) +(when (featurep 'xemacs) + (error "Do not load this file into XEmacs, use 'org-colview-xemacs.el'.")) + ;;; Column View (defvar org-columns-overlays nil @@ -146,8 +149,8 @@ This is the compiled version of the format.") (defun org-columns-new-overlay (beg end &optional string face) "Create a new column overlay and add it to the list." - (let ((ov (org-make-overlay beg end))) - (org-overlay-put ov 'face (or face 'secondary-selection)) + (let ((ov (make-overlay beg end))) + (overlay-put ov 'face (or face 'secondary-selection)) (org-overlay-display ov string face) (push ov org-columns-overlays) ov)) @@ -220,12 +223,12 @@ This is the compiled version of the format.") (org-unmodified (setq ov (org-columns-new-overlay beg (setq beg (1+ beg)) string (if dateline face1 face))) - (org-overlay-put ov 'keymap org-columns-map) - (org-overlay-put ov 'org-columns-key property) - (org-overlay-put ov 'org-columns-value (cdr ass)) - (org-overlay-put ov 'org-columns-value-modified modval) - (org-overlay-put ov 'org-columns-pom pom) - (org-overlay-put ov 'org-columns-format f)) + (overlay-put ov 'keymap org-columns-map) + (overlay-put ov 'org-columns-key property) + (overlay-put ov 'org-columns-value (cdr ass)) + (overlay-put ov 'org-columns-value-modified modval) + (overlay-put ov 'org-columns-pom pom) + (overlay-put ov 'org-columns-format f)) (if (or (not (char-after beg)) (equal (char-after beg) ?\n)) (let ((inhibit-read-only t)) @@ -235,12 +238,12 @@ This is the compiled version of the format.") ;; Make the rest of the line disappear. (org-unmodified (setq ov (org-columns-new-overlay beg (point-at-eol))) - (org-overlay-put ov 'invisible t) - (org-overlay-put ov 'keymap org-columns-map) - (org-overlay-put ov 'intangible t) + (overlay-put ov 'invisible t) + (overlay-put ov 'keymap org-columns-map) + (overlay-put ov 'intangible t) (push ov org-columns-overlays) - (setq ov (org-make-overlay (1- (point-at-eol)) (1+ (point-at-eol)))) - (org-overlay-put ov 'keymap org-columns-map) + (setq ov (make-overlay (1- (point-at-eol)) (1+ (point-at-eol)))) + (overlay-put ov 'keymap org-columns-map) (push ov org-columns-overlays) (let ((inhibit-read-only t)) (put-text-property (max (point-min) (1- (point-at-bol))) @@ -298,7 +301,7 @@ for the duration of the command.") (org-add-hook 'post-command-hook 'org-columns-hscoll-title nil 'local))) (defun org-columns-hscoll-title () - "Set the header-line-format so that it scrolls along with the table." + "Set the `header-line-format' so that it scrolls along with the table." (sit-for .0001) ; need to force a redisplay to update window-hscroll (when (not (= (window-hscroll) org-columns-previous-hscroll)) (setq header-line-format @@ -323,7 +326,7 @@ for the duration of the command.") (move-marker org-columns-begin-marker nil) (move-marker org-columns-top-level-marker nil) (org-unmodified - (mapc 'org-delete-overlay org-columns-overlays) + (mapc 'delete-overlay org-columns-overlays) (setq org-columns-overlays nil) (let ((inhibit-read-only t)) (remove-text-properties (point-min) (point-max) '(read-only t)))) @@ -495,7 +498,7 @@ Where possible, use the standard interface for changing this line." (progn (setq org-columns-overlays (org-delete-all line-overlays org-columns-overlays)) - (mapc 'org-delete-overlay line-overlays) + (mapc 'delete-overlay line-overlays) (org-columns-eval eval)) (org-columns-display-here))) (org-move-to-column col) @@ -624,7 +627,7 @@ an integer, select that value." (progn (setq org-columns-overlays (org-delete-all line-overlays org-columns-overlays)) - (mapc 'org-delete-overlay line-overlays) + (mapc 'delete-overlay line-overlays) (org-columns-eval '(org-entry-put pom key nval))) (org-columns-display-here))) (org-move-to-column col) @@ -746,17 +749,17 @@ around it." (lambda (x) (- org-columns-time x)))) "Operator <-> format,function,calc map. Used to compile/uncompile columns format and completing read in -interactive function org-columns-new. +interactive function `org-columns-new'. operator string used in #+COLUMNS definition describing the summary type format symbol describing summary type selected interactively in - org-columns-new and internally in - org-columns-number-to-string and - org-columns-string-to-number + `org-columns-new' and internally in + `org-columns-number-to-string' and + `org-columns-string-to-number' function called with a list of values as argument to calculate the summary value -calc function called on every element before summarizing. This is +calc function called on every element before summarizing. This is optional and should only be specified if needed") (defun org-columns-new (&optional prop title width op fmt fun &rest rest) @@ -918,15 +921,15 @@ Don't set this, this is meant for dynamic scoping.") (let (fmt val pos) (save-excursion (mapc (lambda (ov) - (when (equal (org-overlay-get ov 'org-columns-key) property) - (setq pos (org-overlay-start ov)) + (when (equal (overlay-get ov 'org-columns-key) property) + (setq pos (overlay-start ov)) (goto-char pos) (when (setq val (cdr (assoc property (get-text-property (point-at-bol) 'org-summaries)))) - (setq fmt (org-overlay-get ov 'org-columns-format)) - (org-overlay-put ov 'org-columns-value val) - (org-overlay-put ov 'display (format fmt val))))) + (setq fmt (overlay-get ov 'org-columns-format)) + (overlay-put ov 'org-columns-value val) + (overlay-put ov 'display (format fmt val))))) org-columns-overlays)))) (defun org-columns-compute (property) @@ -1109,8 +1112,7 @@ operator the operator if any format the output format for computed results, derived from operator printf a printf format for computed values fun the lisp function to compute summary values, derived from operator -calc function to get values from base elements -" +calc function to get values from base elements" (let ((start 0) width prop title op op-match f printf fun calc) (setq org-columns-current-fmt-compiled nil) (while (string-match @@ -1479,7 +1481,7 @@ This will add overlays to the date lines, to show the summary for each day." (org-columns-compute (car fm))))))))))) (defun org-format-time-period (interval) - "Convert time in fractional days to days/hours/minutes/seconds" + "Convert time in fractional days to days/hours/minutes/seconds." (if (numberp interval) (let* ((days (floor interval)) (frac-hours (* 24 (- interval days))) diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index 80a45d61f22..1b96b8d0535 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -39,7 +39,10 @@ (declare-function find-library-name "find-func" (library)) (declare-function w32-focus-frame "term/w32-win" (frame)) -(defconst org-xemacs-p (featurep 'xemacs)) ; not used by org.el itself +;; The following constant is for backward compatibility. We do not use +;; it in org-mode, because the Byte compiler evaluates (featurep 'xemacs) +;; at compilation time and can therefore optimize code better. +(defconst org-xemacs-p (featurep 'xemacs)) (defconst org-format-transports-properties-p (let ((x "a")) (add-text-properties 0 1 '(test t) x) @@ -86,25 +89,44 @@ any other entries, and any resulting duplicates will be removed entirely." (t specs))) (put 'org-compatible-face 'lisp-indent-function 1) +(defun org-version-check (version feature level) + (let* ((v1 (mapcar 'string-to-number (split-string version "[.]"))) + (v2 (mapcar 'string-to-number (split-string emacs-version "[.]"))) + (rmaj (or (nth 0 v1) 99)) + (rmin (or (nth 1 v1) 99)) + (rbld (or (nth 2 v1) 99)) + (maj (or (nth 0 v2) 0)) + (min (or (nth 1 v2) 0)) + (bld (or (nth 2 v2) 0))) + (if (or (< maj rmaj) + (and (= maj rmaj) + (< min rmin)) + (and (= maj rmaj) + (= min rmin) + (< bld rbld))) + (if (eq level :predicate) + ;; just return if we have the version + nil + (let ((msg (format "Emacs %s or greater is recommended for %s" + version feature))) + (display-warning 'org msg level) + t)) + t))) + ;;;; Emacs/XEmacs compatibility +;; Keys +(defconst org-xemacs-key-equivalents + '(([mouse-1] . [button1]) + ([mouse-2] . [button2]) + ([mouse-3] . [button3]) + ([C-mouse-4] . [(control mouse-4)]) + ([C-mouse-5] . [(control mouse-5)])) + "Translation alist for a couple of keys.") + ;; Overlay compatibility functions -(defun org-make-overlay (beg end &optional buffer) - (if (featurep 'xemacs) - (make-extent beg end buffer) - (make-overlay beg end buffer))) -(defun org-delete-overlay (ovl) - (if (featurep 'xemacs) (progn (delete-extent ovl) nil) (delete-overlay ovl))) (defun org-detach-overlay (ovl) (if (featurep 'xemacs) (detach-extent ovl) (delete-overlay ovl))) -(defun org-move-overlay (ovl beg end &optional buffer) - (if (featurep 'xemacs) - (set-extent-endpoints ovl beg end (or buffer (current-buffer))) - (move-overlay ovl beg end buffer))) -(defun org-overlay-put (ovl prop value) - (if (featurep 'xemacs) - (set-extent-property ovl prop value) - (overlay-put ovl prop value))) (defun org-overlay-display (ovl text &optional face evap) "Make overlay OVL display TEXT with face FACE." (if (featurep 'xemacs) @@ -124,32 +146,24 @@ any other entries, and any resulting duplicates will be removed entirely." (if face (org-add-props text nil 'face face)) (overlay-put ovl 'before-string text) (if evap (overlay-put ovl 'evaporate t)))) -(defun org-overlay-get (ovl prop) - (if (featurep 'xemacs) - (extent-property ovl prop) - (overlay-get ovl prop))) -(defun org-overlays-at (pos) - (if (featurep 'xemacs) (extents-at pos) (overlays-at pos))) -(defun org-overlays-in (&optional start end) - (if (featurep 'xemacs) - (extent-list nil start end) - (overlays-in start end))) -(defun org-overlay-start (o) - (if (featurep 'xemacs) (extent-start-position o) (overlay-start o))) -(defun org-overlay-end (o) - (if (featurep 'xemacs) (extent-end-position o) (overlay-end o))) -(defun org-overlay-buffer (o) - (if (featurep 'xemacs) (extent-buffer o) (overlay-buffer o))) (defun org-find-overlays (prop &optional pos delete) "Find all overlays specifying PROP at POS or point. If DELETE is non-nil, delete all those overlays." - (let ((overlays (org-overlays-at (or pos (point)))) + (let ((overlays (overlays-at (or pos (point)))) ov found) (while (setq ov (pop overlays)) - (if (org-overlay-get ov prop) - (if delete (org-delete-overlay ov) (push ov found)))) + (if (overlay-get ov prop) + (if delete (delete-overlay ov) (push ov found)))) found)) +(defun org-get-x-clipboard (value) + "Get the value of the x clipboard, compatible with XEmacs, and GNU Emacs 21." + (if (eq window-system 'x) + (let ((x (org-get-x-clipboard-compat value))) + (if x (org-no-properties x))))) + +;; Miscellaneous functions + (defun org-add-hook (hook function &optional append local) "Add-hook, compatible with both Emacsen." (if (and local (featurep 'xemacs)) @@ -170,7 +184,7 @@ that will be added to PLIST. Returns the string that was modified." "Fit WINDOW to the buffer, but only if it is not a side-by-side window. WINDOW defaults to the selected window. MAX-HEIGHT and MIN-HEIGHT are passed through to `fit-window-to-buffer'. If SHRINK-ONLY is set, call -`shrink-window-if-larger-than-buffer' instead, the hight limit are +`shrink-window-if-larger-than-buffer' instead, the height limit is ignored in this case." (cond ((if (fboundp 'window-full-width-p) (not (window-full-width-p window)) @@ -206,19 +220,6 @@ Works on both Emacs and XEmacs." ;; Invisibility compatibility -(defun org-add-to-invisibility-spec (arg) - "Add elements to `buffer-invisibility-spec'. -See documentation for `buffer-invisibility-spec' for the kind of elements -that can be added." - (cond - ((fboundp 'add-to-invisibility-spec) - (add-to-invisibility-spec arg)) - ((or (null buffer-invisibility-spec) (eq buffer-invisibility-spec t)) - (setq buffer-invisibility-spec (list arg))) - (t - (setq buffer-invisibility-spec - (cons arg buffer-invisibility-spec))))) - (defun org-remove-from-invisibility-spec (arg) "Remove elements from `buffer-invisibility-spec'." (if (fboundp 'remove-from-invisibility-spec) @@ -233,62 +234,42 @@ that can be added." (member arg buffer-invisibility-spec) nil)) +(defmacro org-xemacs-without-invisibility (&rest body) + "Turn off exents with invisibility while executing BODY." + `(let ((ext-inv (extent-list nil (point-at-bol) (point-at-eol) + 'all-extents-closed-open 'invisible)) + ext-inv-specs) + (dolist (ext ext-inv) + (when (extent-property ext 'invisible) + (add-to-list 'ext-inv-specs (list ext (extent-property + ext 'invisible))) + (set-extent-property ext 'invisible nil))) + ,@body + (dolist (ext-inv-spec ext-inv-specs) + (set-extent-property (car ext-inv-spec) 'invisible + (cadr ext-inv-spec))))) + (defun org-indent-to-column (column &optional minimum buffer) "Work around a bug with extents with invisibility in XEmacs." (if (featurep 'xemacs) - (let ((ext-inv (extent-list - nil (point-at-bol) (point-at-eol) - 'all-extents-closed-open 'invisible)) - ext-inv-specs) - (dolist (ext ext-inv) - (when (extent-property ext 'invisible) - (add-to-list 'ext-inv-specs (list ext (extent-property - ext 'invisible))) - (set-extent-property ext 'invisible nil))) - (indent-to-column column minimum buffer) - (dolist (ext-inv-spec ext-inv-specs) - (set-extent-property (car ext-inv-spec) 'invisible - (cadr ext-inv-spec)))) + (org-xemacs-without-invisibility (indent-to-column column minimum buffer)) (indent-to-column column minimum))) (defun org-indent-line-to (column) "Work around a bug with extents with invisibility in XEmacs." (if (featurep 'xemacs) - (let ((ext-inv (extent-list - nil (point-at-bol) (point-at-eol) - 'all-extents-closed-open 'invisible)) - ext-inv-specs) - (dolist (ext ext-inv) - (when (extent-property ext 'invisible) - (add-to-list 'ext-inv-specs (list ext (extent-property - ext 'invisible))) - (set-extent-property ext 'invisible nil))) - (indent-line-to column) - (dolist (ext-inv-spec ext-inv-specs) - (set-extent-property (car ext-inv-spec) 'invisible - (cadr ext-inv-spec)))) + (org-xemacs-without-invisibility (indent-line-to column)) (indent-line-to column))) (defun org-move-to-column (column &optional force buffer) (if (featurep 'xemacs) - (let ((ext-inv (extent-list - nil (point-at-bol) (point-at-eol) - 'all-extents-closed-open 'invisible)) - ext-inv-specs) - (dolist (ext ext-inv) - (when (extent-property ext 'invisible) - (add-to-list 'ext-inv-specs (list ext (extent-property ext - 'invisible))) - (set-extent-property ext 'invisible nil))) - (move-to-column column force buffer) - (dolist (ext-inv-spec ext-inv-specs) - (set-extent-property (car ext-inv-spec) 'invisible - (cadr ext-inv-spec)))) + (org-xemacs-without-invisibility (move-to-column column force buffer)) (move-to-column column force))) (defun org-get-x-clipboard-compat (value) - "Get the clipboard value on XEmacs or Emacs 21" - (cond (org-xemacs-p (org-no-warnings (get-selection-no-error value))) + "Get the clipboard value on XEmacs or Emacs 21." + (cond ((featurep 'xemacs) + (org-no-warnings (get-selection-no-error value))) ((fboundp 'x-get-selection) (condition-case nil (or (x-get-selection value 'UTF8_STRING) @@ -362,6 +343,18 @@ TIME defaults to the current time." (time-to-seconds (or time (current-time))) (float-time time))) +(defun org-string-match-p (&rest args) + (if (fboundp 'string-match-p) + (apply 'string-match-p args) + (save-match-data + (apply 'string-match args)))) + +(defun org-looking-at-p (&rest args) + (if (fboundp 'looking-at-p) + (apply 'looking-at-p args) + (save-match-data + (apply 'looking-at-p args)))) + ; XEmacs does not have `looking-back'. (if (fboundp 'looking-back) (defalias 'org-looking-back 'looking-back) diff --git a/lisp/org/org-crypt.el b/lisp/org/org-crypt.el index 04f519a7aa9..d93981227e5 100644 --- a/lisp/org/org-crypt.el +++ b/lisp/org/org-crypt.el @@ -4,7 +4,7 @@ ;; Emacs Lisp Archive Entry ;; Filename: org-crypt.el -;; Version: 6.35i +;; Version: 7.01 ;; Keywords: org-mode ;; Author: John Wiegley ;; Maintainer: Peter Jones @@ -45,6 +45,7 @@ ;; decrypt it. This makes it possible to leave secure notes that ;; only the intended recipient can read in a shared-org-mode-files ;; scenario. +;; If the key is not set, org-crypt will default to symmetric encryption. ;; ;; 3. To later decrypt an entry, use `org-decrypt-entries' or ;; `org-decrypt-entry'. It might be useful to bind this to a key, @@ -66,6 +67,8 @@ (require 'org) +;;; Code: + (declare-function epg-decrypt-string "epg" (context cipher)) (declare-function epg-list-keys "epg" (context &optional name mode)) (declare-function epg-make-context "epg" @@ -80,24 +83,25 @@ :tag "Org Crypt" :group 'org) (defcustom org-crypt-tag-matcher "crypt" - "The tag matcher used to find headings whose contents should be -encrypted. See the \"Match syntax\" section of the org manual -for more details." + "The tag matcher used to find headings whose contents should be encrypted. + +See the \"Match syntax\" section of the org manual for more details." :type 'string :group 'org-crypt) (defcustom org-crypt-key nil - "The default key to use when encrypting the contents of a -heading. This can also be overridden in the CRYPTKEY property." + "The default key to use when encrypting the contents of a heading. + +This setting can also be overridden in the CRYPTKEY property." :type 'string :group 'org-crypt) (defun org-crypt-key-for-heading () - "Returns the encryption key for the current heading." + "Return the encryption key for the current heading." (save-excursion (org-back-to-heading t) (or (org-entry-get nil "CRYPTKEY" 'selective) org-crypt-key (and (boundp 'epa-file-encrypt-to) epa-file-encrypt-to) - (error "No crypt key set")))) + (message "No crypt key set, using symmetric encryption.")))) (defun org-encrypt-entry () "Encrypt the content of the current headline." @@ -105,52 +109,54 @@ heading. This can also be overridden in the CRYPTKEY property." (require 'epg) (save-excursion (org-back-to-heading t) - (forward-line) - (when (not (looking-at "-----BEGIN PGP MESSAGE-----")) - (let ((folded (org-invisible-p)) - (epg-context (epg-make-context nil t t)) - (crypt-key (org-crypt-key-for-heading)) - (beg (point)) - end encrypted-text) - (org-end-of-subtree t t) - (org-back-over-empty-lines) - (setq end (point) - encrypted-text - (epg-encrypt-string - epg-context - (buffer-substring-no-properties beg end) - (epg-list-keys epg-context crypt-key))) - (delete-region beg end) - (insert encrypted-text) - (when folded - (save-excursion - (org-back-to-heading t) - (hide-subtree))) - nil)))) + (let ((start-heading (point))) + (forward-line) + (when (not (looking-at "-----BEGIN PGP MESSAGE-----")) + (let ((folded (org-invisible-p)) + (epg-context (epg-make-context nil t t)) + (crypt-key (org-crypt-key-for-heading)) + (beg (point)) + end encrypted-text) + (goto-char start-heading) + (org-end-of-subtree t t) + (org-back-over-empty-lines) + (setq end (point) + encrypted-text + (epg-encrypt-string + epg-context + (buffer-substring-no-properties beg end) + (epg-list-keys epg-context crypt-key))) + (delete-region beg end) + (insert encrypted-text) + (when folded + (goto-char start-heading) + (hide-subtree)) + nil))))) (defun org-decrypt-entry () "Decrypt the content of the current headline." (interactive) (require 'epg) - (save-excursion - (org-back-to-heading t) - (forward-line) - (when (looking-at "-----BEGIN PGP MESSAGE-----") - (let* ((beg (point)) - (end (save-excursion - (search-forward "-----END PGP MESSAGE-----") - (forward-line) - (point))) - (epg-context (epg-make-context nil t t)) - (decrypted-text - (decode-coding-string - (epg-decrypt-string - epg-context - (buffer-substring-no-properties beg end)) - 'utf-8))) - (delete-region beg end) - (insert decrypted-text) - nil)))) + (unless (org-before-first-heading-p) + (save-excursion + (org-back-to-heading t) + (forward-line) + (when (looking-at "-----BEGIN PGP MESSAGE-----") + (let* ((beg (point)) + (end (save-excursion + (search-forward "-----END PGP MESSAGE-----") + (forward-line) + (point))) + (epg-context (epg-make-context nil t t)) + (decrypted-text + (decode-coding-string + (epg-decrypt-string + epg-context + (buffer-substring-no-properties beg end)) + 'utf-8))) + (delete-region beg end) + (insert decrypted-text) + nil))))) (defun org-encrypt-entries () "Encrypt all top-level entries in the current buffer." @@ -167,8 +173,7 @@ heading. This can also be overridden in the CRYPTKEY property." (cdr (org-make-tags-matcher org-crypt-tag-matcher)))) (defun org-crypt-use-before-save-magic () - "Adds a hook that will automatically encrypt entries before a -file is saved to disk." + "Add a hook to automatically encrypt entries before a file is saved to disk." (add-hook 'org-mode-hook (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t)))) diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el index 0a0023898a5..fc6b192e566 100644 --- a/lisp/org/org-ctags.el +++ b/lisp/org/org-ctags.el @@ -3,10 +3,10 @@ ;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; Author: Paul Sexton -;; Version: 1.0 +;; Version: 7.01 ;; Keywords: org, wp -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -134,7 +134,10 @@ ;; (message "-- rebuilding tags tables...") ;; (mapc 'org-create-tags tags-table-list)) +;;; Code: + (eval-when-compile (require 'cl)) + (require 'org) (defgroup org-ctags nil @@ -146,8 +149,8 @@ "Activate ctags support in org mode?") (defvar org-ctags-tag-regexp "/<<([^>]+)>>/\\1/d,definition/" - "Regexp expression used by ctags external program, that matches -tag destinations in org-mode files. + "Regexp expression used by ctags external program. +The regexp matches tag destinations in org-mode files. Format is: /REGEXP/TAGNAME/FLAGS,TAGTYPE/ See the ctags documentation for more information.") @@ -164,8 +167,7 @@ See the ctags documentation for more information.") '(org-ctags-find-tag org-ctags-ask-rebuild-tags-file-then-find-tag org-ctags-ask-append-topic) - "List of functions to be prepended to ORG-OPEN-LINK-FUNCTIONS when -ORG-CTAGS is active." + "List of functions to be prepended to ORG-OPEN-LINK-FUNCTIONS when ORG-CTAGS is active." :group 'org-ctags :type 'hook :options '(org-ctags-find-tag @@ -179,8 +181,8 @@ ORG-CTAGS is active." (defvar org-ctags-tag-list nil - "List of all tags in the active TAGS file. Created as a local -variable in each buffer.") + "List of all tags in the active TAGS file. +Created as a local variable in each buffer.") (defcustom org-ctags-new-topic-template "* <<%t>>\n\n\n\n\n\n" @@ -218,12 +220,12 @@ The following patterns are replaced in the string: (add-hook 'org-open-link-functions fn t))) -;;; General utility functions. =============================================== +;;; General utility functions. =============================================== ;; These work outside org-ctags mode. (defun org-ctags-get-filename-for-tag (tag) - "TAG is a string. Search the active TAGS file for a matching tag, -and if found, return a list containing the filename, line number, and + "TAG is a string. Search the active TAGS file for a matching tag. +If the tag is found, return a list containing the filename, line number, and buffer position where the tag is found." (interactive "sTag: ") (unless tags-file-name @@ -279,8 +281,8 @@ Return the list." (defun org-ctags-open-file (name &optional title) - "Visit or create a file called `NAME.org', and insert a new topic titled -NAME (or TITLE if supplied)." + "Visit or create a file called `NAME.org', and insert a new topic. +The new topic will be titled NAME (or TITLE if supplied)." (interactive "sFile name: ") (let ((filename (substitute-in-file-name (expand-file-name name)))) (condition-case v @@ -349,7 +351,7 @@ If there is no plausible default, return nil." (defun org-ctags-find-tag (name) "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. -Look for a tag called `NAME' in the current TAGS table. If it is found, +Look for a tag called `NAME' in the current TAGS table. If it is found, visit the file and location where the tag is found." (interactive "sTag: ") (let ((old-buf (current-buffer)) @@ -368,11 +370,11 @@ visit the file and location where the tag is found." (defun org-ctags-visit-buffer-or-file (name &optional create) "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. -Visit buffer named `NAME.org'. If there is no such buffer, visit the file -with the same name if it exists. If the file does not exist, then behaviour +Visit buffer named `NAME.org'. If there is no such buffer, visit the file +with the same name if it exists. If the file does not exist, then behavior depends on the value of CREATE. -If CREATE is nil (default), then return nil. Do not create a new file. +If CREATE is nil (default), then return nil. Do not create a new file. If CREATE is t, create the new file and visit it. If CREATE is the symbol `ask', then ask the user if they wish to create the new file." @@ -453,7 +455,7 @@ Wrapper for org-ctags-rebuild-tags-file-then-find-tag." (if (and (buffer-file-name) (y-or-n-p (format - "Tag `%s' not found. Rebuild table `%s/TAGS' and look again?" + "Tag `%s' not found. Rebuild table `%s/TAGS' and look again?" name (file-name-directory (buffer-file-name))))) (org-ctags-rebuild-tags-file-then-find-tag name) @@ -463,7 +465,7 @@ Wrapper for org-ctags-rebuild-tags-file-then-find-tag." (defun org-ctags-fail-silently (name) "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. Put as the last function in the list if you want to prevent org's default -behaviour of free text search." +behavior of free text search." t) @@ -471,14 +473,14 @@ behaviour of free text search." (defun org-ctags-create-tags (&optional directory-name) - "(Re)create tags file in the directory of the active buffer, -containing tag definitions for all the files in the directory and its -subdirectories which are recognised by ctags. This will include -files ending in `.org' as well as most other source files (.C, -.H, .EL, .LISP, etc). All the resulting tags end up in one file, -called TAGS, located in the directory. This function -may take several seconds to finish if the directory or its -subdirectories contain large numbers of taggable files." + "(Re)create tags file in the directory of the active buffer. +The file will contain tag definitions for all the files in the +directory and its subdirectories which are recognized by ctags. +This will include files ending in `.org' as well as most other +source files (.C, .H, .EL, .LISP, etc). All the resulting tags +end up in one file, called TAGS, located in the directory. This +function may take several seconds to finish if the directory or +its subdirectories contain large numbers of taggable files." (interactive) (assert (buffer-file-name)) (let ((dir-name (or directory-name @@ -509,8 +511,8 @@ subdirectories contain large numbers of taggable files." "History of tags visited by org-ctags-find-tag-interactive.") (defun org-ctags-find-tag-interactive () - "Prompt for the name of a tag, with autocompletion, then visit -the named tag. Uses ido-mode if available. + "Prompt for the name of a tag, with autocompletion, then visit the named tag. +Uses `ido-mode' if available. If the user enters a string that does not match an existing tag, create a new topic." (interactive) diff --git a/lisp/org/org-datetree.el b/lisp/org/org-datetree.el index d1a42731b51..331d6d6a1d1 100644 --- a/lisp/org/org-datetree.el +++ b/lisp/org/org-datetree.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -36,8 +36,8 @@ (defvar org-datetree-base-level 1 "The level at which years should be placed in the date tree. This is normally one, but if the buffer has an entry with a DATE_TREE -property, the date tree will become a subtree under that entry, so the -base level will be properly adjusted.") +property (any value), the date tree will become a subtree under that entry, +so the base level will be properly adjusted.") ;;;###autoload (defun org-datetree-find-date-create (date &optional keep-restriction) diff --git a/lisp/org/org-docbook.el b/lisp/org/org-docbook.el index e5ee98bb344..12ab96deff9 100644 --- a/lisp/org/org-docbook.el +++ b/lisp/org/org-docbook.el @@ -4,7 +4,7 @@ ;; ;; Emacs Lisp Archive Entry ;; Filename: org-docbook.el -;; Version: 6.35i +;; Version: 7.01 ;; Author: Baoqiu Cui ;; Maintainer: Baoqiu Cui ;; Keywords: org, wp, docbook @@ -26,7 +26,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . -;; Commentary: +;;; Commentary: ;; ;; This library implements a DocBook exporter for org-mode. The basic ;; idea and design is very similar to what `org-export-as-html' has. @@ -76,6 +76,7 @@ (require 'org) (require 'org-exp) (require 'org-html) +(require 'format-spec) ;;; Variables: @@ -141,8 +142,8 @@ people work on the same document." :type 'string) (defcustom org-export-docbook-footnote-id-prefix "fn-" - "The prefix of footnote IDs used during exporting. Like -`org-export-docbook-section-id-prefix', this variable can help + "The prefix of footnote IDs used during exporting. +Like `org-export-docbook-section-id-prefix', this variable can help avoid same set of footnote IDs being used multiple times." :group 'org-export-docbook :type 'string) @@ -154,7 +155,7 @@ avoid same set of footnote IDs being used multiple times." ("=" "" "") ("~" "" "") ("+" "" "")) - "Alist of DocBook expressions to convert emphasis fontifiers. + "A list of DocBook expressions to convert emphasis fontifiers. Each element of the list is a list of three elements. The first element is the character used as a marker for fontification. The second element is a formatting string to wrap fontified text with. @@ -183,32 +184,39 @@ default, but users can override them using `#+ATTR_DocBook:'." :group 'org-export-docbook :type 'coding-system) +(defcustom org-export-docbook-xslt-stylesheet nil + "File name of the XSLT stylesheet used by DocBook exporter. +This XSLT stylesheet is used by +`org-export-docbook-xslt-proc-command' to generate the Formatting +Object (FO) files. You can use either `fo/docbook.xsl' that +comes with DocBook, or any customization layer you may have." + :group 'org-export-docbook + :type 'string) + (defcustom org-export-docbook-xslt-proc-command nil - "XSLT processor command used by DocBook exporter. -This is the command used to process a DocBook XML file to -generate the formatting object (FO) file. + "Format of XSLT processor command used by DocBook exporter. +This command is used to process a DocBook XML file to generate +the Formatting Object (FO) file. The value of this variable should be a format control string that -includes two `%s' arguments: the first one is for the output FO -file name, and the second one is for the input DocBook XML file -name. +includes three arguments: `%i', `%o', and `%s'. During exporting +time, `%i' is replaced by the input DocBook XML file name, `%o' +is replaced by the output FO file name, and `%s' is replaced by +`org-export-docbook-xslt-stylesheet' (or the #+XSLT option if it +is specified in the Org file). For example, if you use Saxon as the XSLT processor, you may want to set the variable to - \"java com.icl.saxon.StyleSheet -o %s %s /path/to/docbook.xsl\" + \"java com.icl.saxon.StyleSheet -o %o %i %s\" If you use Xalan, you can set it to - \"java org.apache.xalan.xslt.Process -out %s -in %s -xsl /path/to/docbook.xsl\" + \"java org.apache.xalan.xslt.Process -out %o -in %i -xsl %s\" For xsltproc, the following string should work: - \"xsltproc --output %s /path/to/docbook.xsl %s\" - -You need to replace \"/path/to/docbook.xsl\" with the actual path -to the DocBook stylesheet file on your machine. You can also -replace it with your own customization layer if you have one. + \"xsltproc --output %o %s %i\" You can include additional stylesheet parameters in this command. Just make sure that they meet the syntax requirement of each @@ -217,18 +225,19 @@ processor." :type 'string) (defcustom org-export-docbook-xsl-fo-proc-command nil - "XSL-FO processor command used by DocBook exporter. -This is the command used to process a formatting object (FO) file -to generate the PDF file. + "Format of XSL-FO processor command used by DocBook exporter. +This command is used to process a Formatting Object (FO) file to +generate the PDF file. The value of this variable should be a format control string that -includes two `%s' arguments: the first one is for the input FO -file name, and the second one is for the output PDF file name. +includes two arguments: `%i' and `%o'. During exporting time, +`%i' is replaced by the input FO file name, and `%o' is replaced +by the output PDF file name. For example, if you use FOP as the XSL-FO processor, you can set the variable to - \"fop %s %s\"" + \"fop %i %o\"" :group 'org-export-docbook :type 'string) @@ -333,13 +342,18 @@ in a window. A non-interactive call will only return the buffer." "Export as DocBook XML file, and generate PDF file." (interactive "P") (if (or (not org-export-docbook-xslt-proc-command) - (not (string-match "%s.+%s" org-export-docbook-xslt-proc-command))) + (not (string-match "%[ios].+%[ios].+%[ios]" org-export-docbook-xslt-proc-command))) (error "XSLT processor command is not set correctly")) (if (or (not org-export-docbook-xsl-fo-proc-command) - (not (string-match "%s.+%s" org-export-docbook-xsl-fo-proc-command))) + (not (string-match "%[io].+%[io]" org-export-docbook-xsl-fo-proc-command))) (error "XSL-FO processor command is not set correctly")) (message "Exporting to PDF...") (let* ((wconfig (current-window-configuration)) + (opt-plist + (org-export-process-option-filters + (org-combine-plists (org-default-export-plist) + ext-plist + (org-infile-export-plist)))) (docbook-buf (org-export-as-docbook hidden ext-plist to-buffer body-only pub-dir)) (filename (buffer-file-name docbook-buf)) @@ -348,10 +362,17 @@ in a window. A non-interactive call will only return the buffer." (pdffile (concat base ".pdf"))) (and (file-exists-p pdffile) (delete-file pdffile)) (message "Processing DocBook XML file...") - (shell-command (format org-export-docbook-xslt-proc-command - fofile (shell-quote-argument filename))) - (shell-command (format org-export-docbook-xsl-fo-proc-command - fofile pdffile)) + (shell-command (format-spec org-export-docbook-xslt-proc-command + (format-spec-make + ?i (shell-quote-argument filename) + ?o (shell-quote-argument fofile) + ?s (shell-quote-argument + (or (plist-get opt-plist :xslt) + org-export-docbook-xslt-stylesheet))))) + (shell-command (format-spec org-export-docbook-xsl-fo-proc-command + (format-spec-make + ?i (shell-quote-argument fofile) + ?o (shell-quote-argument pdffile)))) (message "Processing DocBook file...done") (if (not (file-exists-p pdffile)) (error "PDF file was not produced") @@ -533,7 +554,7 @@ publishing directory." table-buffer table-orig-buffer ind item-type starter didclose rpl path attr caption label desc descp desc1 desc2 link - fnc item-tag + fnc item-tag initial-number footref-seen footnote-list id-file ) @@ -998,7 +1019,11 @@ publishing directory." starter (if (match-beginning 2) (substring (match-string 2 line) 0 -1)) line (substring line (match-beginning 5)) - item-tag nil) + item-tag nil + initial-number nil) + (if (string-match "\\`\\[@start:\\([0-9]+\\)\\][ \t]?" line) + (setq initial-number (match-string 1 line) + line (replace-match "" t t line))) (if (and starter (string-match "\\(.*?\\) ::[ \t]*" line)) (setq item-type "d" item-tag (match-string 1 line) @@ -1031,7 +1056,18 @@ publishing directory." (org-export-docbook-close-para-maybe) (insert (cond ((equal item-type "u") "\n\n") - ((equal item-type "o") "\n\n") + ((equal item-type "o") + ;; Check for a specific start number. If it + ;; is specified, we use the ``override'' + ;; attribute of element to pass the + ;; info to DocBook. We could also use the + ;; ``startingnumber'' attribute of element + ;; , but the former works on both + ;; DocBook 5.0 and prior versions. + (if initial-number + (format "\n\n" + initial-number) + "\n\n")) ((equal item-type "d") (format "\n%s\n" item-tag)))) ;; For DocBook, we need to open a para right after tag @@ -1228,7 +1264,8 @@ When TITLE is nil, just close all open levels." (setq section-number (org-section-number level)) (insert (format "\n
\n%s" org-export-docbook-section-id-prefix - section-number title)) + (replace-regexp-in-string "\\." "_" section-number) + title)) (org-export-docbook-open-para)))) (defun org-docbook-expand (string) diff --git a/lisp/org/org-docview.el b/lisp/org/org-docview.el index ad507546696..cac13e6ddfc 100644 --- a/lisp/org/org-docview.el +++ b/lisp/org/org-docview.el @@ -2,10 +2,10 @@ ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. -;; Author: Jan Bcker +;; Author: Jan Böcker ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -62,7 +62,7 @@ ))) (defun org-docview-store-link () - "Store a link to a docview buffer" + "Store a link to a docview buffer." (when (eq major-mode 'doc-view-mode) ;; This buffer is in doc-view-mode (let* ((path buffer-file-name) @@ -75,11 +75,16 @@ :description path)))) (defun org-docview-complete-link () - "Use the existing file name completion for file: links to get the file name, - then ask the user for the page number and append it." + "Use the existing file name completion for file. +Links to get the file name, then ask the user for the page number +and append it." (concat (replace-regexp-in-string "^file:" "docview:" (org-file-complete-link)) "::" (read-from-minibuffer "Page:" "1"))) (provide 'org-docview) + +;; arch-tag: dd147a78-cce1-481b-b40a-15869417debe + +;;; org-docview.el ends here diff --git a/lisp/org/org-entities.el b/lisp/org/org-entities.el index 709c037d488..70c88afa6a2 100644 --- a/lisp/org/org-entities.el +++ b/lisp/org/org-entities.el @@ -6,7 +6,7 @@ ;; Ulf Stegemann ;; Keywords: outlines, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -26,6 +26,8 @@ ;; ;;; Commentary: +;;; Code: + (require 'org-macs) (declare-function org-table-align "org-table" ()) @@ -46,11 +48,11 @@ in backends where the corresponding character is not available." :type 'boolean) (defcustom org-entities-user nil - "User-defined entities used in Org-mode to preduce special characters. -Each entry in this list is a list of strings. It associate the name + "User-defined entities used in Org-mode to produce special characters. +Each entry in this list is a list of strings. It associates the name of the entity that can be inserted into an Org file as \\name with the appropriate replacements for the different export backends. The order -of the fields is he following +of the fields is the following name As a string, without the leading backslash LaTeX replacement In ready LaTeX, no further processing will take place @@ -59,10 +61,10 @@ LaTeX mathp A Boolean, either t or nil. t if this entity needs HTML replacement In ready HTML, no further processing will take place. Usually this will be an &...; entity. ASCII replacement Plain ASCII, no extensions. Symbols that cannot be - represented will be written out as an explanatory text. - But see the variable `org-entities-ascii-keep-macro-form'. + represented will be left as they are, but see the. + variable `org-entities-ascii-explanatory'. Latin1 replacement Use the special characters available in latin1. -utf-8 replacement Use special character available in utf-8. +utf-8 replacement Use the special characters available in utf-8. If you define new entities here that require specific LaTeX packages to be loaded, add these packages to `org-export-latex-packages-alist'." @@ -78,229 +80,245 @@ loaded, add these packages to `org-export-latex-packages-alist'." (string :tag "utf-8 ")))) (defconst org-entities - '(("nbsp" "~" nil " " " " " " " ") - ("iexcl" "!`" nil "¡" "!" "¡" "¡") - ("cent" "\\textcent{}" nil "¢" "cent" "¢" "¢") - ("pound" "\\pounds{}" nil "£" "pound" "£" "£") - ("curren" "\\textcurrency{}" nil "¤" "curr." "¤" "¤") - ("yen" "\\textyen{}" nil "¥" "yen" "¥" "¥") - ("brvbar" "\\textbrokenbar{}" nil "¦" "|" "¦" "¦") - ("vert" "\\vert{}" t "|" "|" "|" "|") - ("sect" "\\S" nil "§" "paragraph" "§" "§") - ("uml" "\\textasciidieresis{}" nil "¨" "[diaeresis]" "¨" "¨") - ("copy" "\\textcopyright{}" nil "©" "(c)" "©" "©") - ("ordf" "\\textordfeminine{}" nil "ª" "_a_" "ª" "ª") - ("laquo" "\\guillemotleft{}" nil "«" "<<" "«" "«") - ("not" "\\textlnot{}" nil "¬" "[angled dash]" "¬" "¬") - ("shy" "\\-" nil "­" "" "" "") - ("reg" "\\textregistered{}" nil "®" "(r)" "®" "®") - ("macr" "\\textasciimacron{}" nil "¯" "[macron]" "¯" "¯") - ("deg" "\\textdegree{}" nil "deg" "degree" "°" "°") - ("pm" "\\textpm{}" nil "±" "+-" "±" "±") - ("plusmn" "\\textpm{}" nil "±" "+-" "±" "±") - ("sup2" "\\texttwosuperior{}" nil "²" "^2" "²" "²") - ("sup3" "\\textthreesuperior{}" nil "³" "^3" "³" "³") - ("acutex" "\\acute x" t "´x" "'x" "'x" "𝑥́") - ("micro" "\\textmu{}" nil "µ" "micro" "µ" "µ") - ("para" "\\P{}" nil "¶" "[pilcrow]" "¶" "¶") - ("middot" "\\textperiodcentered{}" nil "·" "." "·" "·") - ("odot" "\\odot" t "o" "[circled dot]" "[circled dot]" "ʘ") - ("star" "\\star" t "*" "*" "*" "⋆") - ("cedil" "\\c{}" nil "¸" "[cedilla]" "¸" "¸") - ("sup1" "\\textonesuperior{}" nil "¹" "^1" "¹" "¹") - ("ordm" "\\textordmasculine{}" nil "º" "_o_" "º" "º") - ("raquo" "\\guillemotright{}" nil "»" ">>" "»" "»") - ("iquest" "?`" nil "¿" "?" "¿" "¿") + '( + "* Letters" + "** Latin" ("Agrave" "\\`{A}" nil "À" "A" "À" "À") + ("agrave" "\\`{a}" nil "à" "a" "à" "à") ("Aacute" "\\'{A}" nil "Á" "A" "Á" "Á") + ("aacute" "\\'{a}" nil "á" "a" "á" "á") ("Acirc" "\\^{A}" nil "Â" "A" "Â" "Â") + ("acirc" "\\^{a}" nil "â" "a" "â" "â") ("Atilde" "\\~{A}" nil "Ã" "A" "Ã" "Ã") + ("atilde" "\\~{a}" nil "ã" "a" "ã" "ã") ("Auml" "\\\"{A}" nil "Ä" "Ae" "Ä" "Ä") + ("auml" "\\\"{a}" nil "ä" "ae" "ä" "ä") ("Aring" "\\AA{}" nil "Å" "A" "Å" "Å") ("AA" "\\AA{}" nil "Å" "A" "Å" "Å") - ("AElig" "\\AE{}" nil "Æ" "AE" "Æ" "Æ") - ("Ccedil" "\\c{C}" nil "Ç" "C" "Ç" "Ç") - ("Egrave" "\\`{E}" nil "È" "E" "È" "È") - ("Eacute" "\\'{E}" nil "É" "E" "É" "É") - ("Ecirc" "\\^{E}" nil "Ê" "E" "Ê" "Ê") - ("Euml" "\\\"{E}" nil "Ë" "E" "Ë" "Ë") - ("Igrave" "\\`{I}" nil "Ì" "I" "Ì" "Ì") - ("Iacute" "\\'{I}" nil "Í" "I" "Í" "Í") - ("Icirc" "\\^{I}" nil "Î" "I" "Î" "Î") - ("Iuml" "\\\"{I}" nil "Ï" "I" "Ï" "Ï") - ("ETH" "\\DH{}" nil "Ð" "D" "Ð" "Ð") - ("Ntilde" "\\~{N}" nil "Ñ" "N" "Ñ" "Ñ") - ("Ograve" "\\`{O}" nil "Ò" "O" "Ò" "Ò") - ("Oacute" "\\'{O}" nil "Ó" "O" "Ó" "Ó") - ("Ocirc" "\\^{O}" nil "Ô" "O" "Ô" "Ô") - ("Otilde" "\\~{O}" nil "Õ" "O" "Õ" "Õ") - ("Ouml" "\\\"{O}" nil "Ö" "Oe" "Ö" "Ö") - ("times" "\\texttimes{}" nil "×" "*" "×" "×") - ("Oslash" "\\O" nil "Ø" "O" "Ø" "Ø") - ("Ugrave" "\\`{U}" nil "Ù" "U" "Ù" "Ù") - ("Uacute" "\\'{U}" nil "Ú" "U" "Ú" "Ú") - ("Ucirc" "\\^{U}" nil "Û" "U" "Û" "Û") - ("Uuml" "\\\"{U}" nil "Ü" "Ue" "Ü" "Ü") - ("Yacute" "\\'{Y}" nil "Ý" "Y" "Ý" "Ý") - ("THORN" "\\TH{}" nil "Þ" "TH" "Þ" "Þ") - ("szlig" "\\ss{}" nil "ß" "ss" "ß" "ß") - ("agrave" "\\`{a}" nil "à" "a" "à" "à") - ("aacute" "\\'{a}" nil "á" "a" "á" "á") - ("acirc" "\\^{a}" nil "â" "a" "â" "â") - ("atilde" "\\~{a}" nil "ã" "a" "ã" "ã") - ("auml" "\\\"{a}" nil "ä" "ae" "ä" "ä") ("aring" "\\aa{}" nil "å" "a" "å" "å") + ("AElig" "\\AE{}" nil "Æ" "AE" "Æ" "Æ") ("aelig" "\\ae{}" nil "æ" "ae" "æ" "æ") + ("Ccedil" "\\c{C}" nil "Ç" "C" "Ç" "Ç") ("ccedil" "\\c{c}" nil "ç" "c" "ç" "ç") - ("checkmark" "\\checkmark" t "✓" "[checkmark]" "[checkmark]" "✓") + ("Egrave" "\\`{E}" nil "È" "E" "È" "È") ("egrave" "\\`{e}" nil "è" "e" "è" "è") + ("Eacute" "\\'{E}" nil "É" "E" "É" "É") ("eacute" "\\'{e}" nil "é" "e" "é" "é") + ("Ecirc" "\\^{E}" nil "Ê" "E" "Ê" "Ê") ("ecirc" "\\^{e}" nil "ê" "e" "ê" "ê") + ("Euml" "\\\"{E}" nil "Ë" "E" "Ë" "Ë") ("euml" "\\\"{e}" nil "ë" "e" "ë" "ë") + ("Igrave" "\\`{I}" nil "Ì" "I" "Ì" "Ì") ("igrave" "\\`{i}" nil "ì" "i" "ì" "ì") + ("Iacute" "\\'{I}" nil "Í" "I" "Í" "Í") ("iacute" "\\'{i}" nil "í" "i" "í" "í") + ("Icirc" "\\^{I}" nil "Î" "I" "Î" "Î") ("icirc" "\\^{i}" nil "î" "i" "î" "î") + ("Iuml" "\\\"{I}" nil "Ï" "I" "Ï" "Ï") ("iuml" "\\\"{i}" nil "ï" "i" "ï" "ï") - ("eth" "\\dh{}" nil "ð" "dh" "ð" "ð") + ("Ntilde" "\\~{N}" nil "Ñ" "N" "Ñ" "Ñ") ("ntilde" "\\~{n}" nil "ñ" "n" "ñ" "ñ") + ("Ograve" "\\`{O}" nil "Ò" "O" "Ò" "Ò") ("ograve" "\\`{o}" nil "ò" "o" "ò" "ò") + ("Oacute" "\\'{O}" nil "Ó" "O" "Ó" "Ó") ("oacute" "\\'{o}" nil "ó" "o" "ó" "ó") + ("Ocirc" "\\^{O}" nil "Ô" "O" "Ô" "Ô") ("ocirc" "\\^{o}" nil "ô" "o" "ô" "ô") + ("Otilde" "\\~{O}" nil "Õ" "O" "Õ" "Õ") ("otilde" "\\~{o}" nil "õ" "o" "õ" "õ") + ("Ouml" "\\\"{O}" nil "Ö" "Oe" "Ö" "Ö") ("ouml" "\\\"{o}" nil "ö" "oe" "ö" "ö") + ("Oslash" "\\O" nil "Ø" "O" "Ø" "Ø") ("oslash" "\\o{}" nil "ø" "o" "ø" "ø") + ("OElig" "\\OE{}" nil "Œ" "OE" "OE" "Œ") + ("oelig" "\\oe{}" nil "œ" "oe" "oe" "œ") + ("Scaron" "\\v{S}" nil "Š" "S" "S" "Š") + ("scaron" "\\v{s}" nil "š" "s" "s" "š") + ("szlig" "\\ss{}" nil "ß" "ss" "ß" "ß") + ("Ugrave" "\\`{U}" nil "Ù" "U" "Ù" "Ù") ("ugrave" "\\`{u}" nil "ù" "u" "ù" "ù") + ("Uacute" "\\'{U}" nil "Ú" "U" "Ú" "Ú") ("uacute" "\\'{u}" nil "ú" "u" "ú" "ú") + ("Ucirc" "\\^{U}" nil "Û" "U" "Û" "Û") ("ucirc" "\\^{u}" nil "û" "u" "û" "û") + ("Uuml" "\\\"{U}" nil "Ü" "Ue" "Ü" "Ü") ("uuml" "\\\"{u}" nil "ü" "ue" "ü" "ü") + ("Yacute" "\\'{Y}" nil "Ý" "Y" "Ý" "Ý") ("yacute" "\\'{y}" nil "ý" "y" "ý" "ý") - ("thorn" "\\th{}" nil "þ" "th" "þ" "þ") + ("Yuml" "\\\"{Y}" nil "Ÿ" "Y" "Y" "Ÿ") ("yuml" "\\\"{y}" nil "ÿ" "y" "ÿ" "ÿ") + + "** Latin (special face)" ("fnof" "\\textit{f}" nil "ƒ" "f" "f" "ƒ") + ("real" "\\Re" t "ℜ" "R" "R" "ℜ") + ("image" "\\Im" t "ℑ" "I" "I" "ℑ") + ("weierp" "\\wp" t "℘" "P" "P" "℘") + + "** Greek" ("Alpha" "A" nil "Α" "Alpha" "Alpha" "Α") - ("Beta" "B" nil "Β" "Beta" "Beta" "Β") - ("Gamma" "\\Gamma" t "Γ" "Gamma" "Gamma" "Γ") - ("Delta" "\\Delta" t "Δ" "Delta" "Gamma" "Δ") - ("Epsilon" "E" nil "Ε" "Epsilon" "Epsilon" "Ε") - ("Zeta" "Z" nil "Ζ" "Zeta" "Zeta" "Ζ") - ("Eta" "H" nil "Η" "Eta" "Eta" "Η") - ("Theta" "\\Theta" t "Θ" "Theta" "Theta" "Θ") - ("Iota" "I" nil "Ι" "Iota" "Iota" "Ι") - ("Kappa" "K" nil "Κ" "Kappa" "Kappa" "Κ") - ("Lambda" "\\Lambda" t "Λ" "Lambda" "Lambda" "Λ") - ("Mu" "M" nil "Μ" "Mu" "Mu" "Μ") - ("Nu" "N" nil "Ν" "Nu" "Nu" "Ν") - ("Xi" "\\Xi" t "Ξ" "Xi" "Xi" "Ξ") - ("Omicron" "O" nil "Ο" "Omicron" "Omicron" "Ο") - ("Pi" "\\Pi" t "Π" "Pi" "Pi" "Π") - ("Rho" "P" nil "Ρ" "Rho" "Rho" "Ρ") - ("Sigma" "\\Sigma" t "Σ" "Sigma" "Sigma" "Σ") - ("Tau" "T" nil "Τ" "Tau" "Tau" "Τ") - ("Upsilon" "\\Upsilon" t "Υ" "Upsilon" "Upsilon" "Υ") - ("Phi" "\\Phi" t "Φ" "Phi" "Phi" "Φ") - ("Chi" "X" nil "Χ" "Chi" "Chi" "Χ") - ("Psi" "\\Psi" t "Ψ" "Psi" "Psi" "Ψ") - ("Omega" "\\Omega" t "Ω" "Omega" "Omega" "Ω") ("alpha" "\\alpha" t "α" "alpha" "alpha" "α") + ("Beta" "B" nil "Β" "Beta" "Beta" "Β") ("beta" "\\beta" t "β" "beta" "beta" "β") + ("Gamma" "\\Gamma" t "Γ" "Gamma" "Gamma" "Γ") ("gamma" "\\gamma" t "γ" "gamma" "gamma" "γ") + ("Delta" "\\Delta" t "Δ" "Delta" "Gamma" "Δ") ("delta" "\\delta" t "δ" "delta" "delta" "δ") + ("Epsilon" "E" nil "Ε" "Epsilon" "Epsilon" "Ε") ("epsilon" "\\epsilon" t "ε" "epsilon" "epsilon" "ε") ("varepsilon" "\\varepsilon" t "ε" "varepsilon" "varepsilon" "ε") + ("Zeta" "Z" nil "Ζ" "Zeta" "Zeta" "Ζ") ("zeta" "\\zeta" t "ζ" "zeta" "zeta" "ζ") + ("Eta" "H" nil "Η" "Eta" "Eta" "Η") ("eta" "\\eta" t "η" "eta" "eta" "η") + ("Theta" "\\Theta" t "Θ" "Theta" "Theta" "Θ") ("theta" "\\theta" t "θ" "theta" "theta" "θ") - ("iota" "\\iota" t "ι" "iota" "iota" "ι") - ("kappa" "\\kappa" t "κ" "kappa" "kappa" "κ") - ("lambda" "\\lambda" t "λ" "lambda" "lambda" "λ") - ("mu" "\\mu" t "μ" "mu" "mu" "μ") - ("nu" "\\nu" t "ν" "nu" "nu" "ν") - ("xi" "\\xi" t "ξ" "xi" "xi" "ξ") - ("omicron" "\\textit{o}" nil "ο" "omicron" "omicron" "ο") - ("pi" "\\pi" t "π" "pi" "pi" "π") - ("rho" "\\rho" t "ρ" "rho" "rho" "ρ") - ("sigmaf" "\\varsigma" t "ς" "sigmaf" "sigmaf" "ς") - ("varsigma" "\\varsigma" t "ς" "varsigma" "varsigma" "ς") - ("sigma" "\\sigma" t "σ" "sigma" "sigma" "σ") - ("tau" "\\tau" t "τ" "tau" "tau" "τ") - ("upsilon" "\\upsilon" t "υ" "upsilon" "upsilon" "υ") - ("phi" "\\phi" t "φ" "phi" "phi" "φ") - ("chi" "\\chi" t "χ" "chi" "chi" "χ") - ("psi" "\\psi" t "ψ" "psi" "psi" "ψ") - ("omega" "\\omega" t "ω" "omega" "omega" "ω") ("thetasym" "\\vartheta" t "ϑ" "theta" "theta" "ϑ") ("vartheta" "\\vartheta" t "ϑ" "theta" "theta" "ϑ") + ("Iota" "I" nil "Ι" "Iota" "Iota" "Ι") + ("iota" "\\iota" t "ι" "iota" "iota" "ι") + ("Kappa" "K" nil "Κ" "Kappa" "Kappa" "Κ") + ("kappa" "\\kappa" t "κ" "kappa" "kappa" "κ") + ("Lambda" "\\Lambda" t "Λ" "Lambda" "Lambda" "Λ") + ("lambda" "\\lambda" t "λ" "lambda" "lambda" "λ") + ("Mu" "M" nil "Μ" "Mu" "Mu" "Μ") + ("mu" "\\mu" t "μ" "mu" "mu" "μ") + ("nu" "\\nu" t "ν" "nu" "nu" "ν") + ("Nu" "N" nil "Ν" "Nu" "Nu" "Ν") + ("Xi" "\\Xi" t "Ξ" "Xi" "Xi" "Ξ") + ("xi" "\\xi" t "ξ" "xi" "xi" "ξ") + ("Omicron" "O" nil "Ο" "Omicron" "Omicron" "Ο") + ("omicron" "\\textit{o}" nil "ο" "omicron" "omicron" "ο") + ("Pi" "\\Pi" t "Π" "Pi" "Pi" "Π") + ("pi" "\\pi" t "π" "pi" "pi" "π") + ("Rho" "P" nil "Ρ" "Rho" "Rho" "Ρ") + ("rho" "\\rho" t "ρ" "rho" "rho" "ρ") + ("Sigma" "\\Sigma" t "Σ" "Sigma" "Sigma" "Σ") + ("sigma" "\\sigma" t "σ" "sigma" "sigma" "σ") + ("sigmaf" "\\varsigma" t "ς" "sigmaf" "sigmaf" "ς") + ("varsigma" "\\varsigma" t "ς" "varsigma" "varsigma" "ς") + ("Tau" "T" nil "Τ" "Tau" "Tau" "Τ") + ("Upsilon" "\\Upsilon" t "Υ" "Upsilon" "Upsilon" "Υ") ("upsih" "\\Upsilon" t "ϒ" "upsilon" "upsilon" "ϒ") + ("upsilon" "\\upsilon" t "υ" "upsilon" "upsilon" "υ") + ("Phi" "\\Phi" t "Φ" "Phi" "Phi" "Φ") + ("phi" "\\phi" t "φ" "phi" "phi" "φ") + ("Chi" "X" nil "Χ" "Chi" "Chi" "Χ") + ("chi" "\\chi" t "χ" "chi" "chi" "χ") + ("acutex" "\\acute x" t "´x" "'x" "'x" "𝑥́") + ("Psi" "\\Psi" t "Ψ" "Psi" "Psi" "Ψ") + ("psi" "\\psi" t "ψ" "psi" "psi" "ψ") + ("tau" "\\tau" t "τ" "tau" "tau" "τ") + ("Omega" "\\Omega" t "Ω" "Omega" "Omega" "Ω") + ("omega" "\\omega" t "ω" "omega" "omega" "ω") ("piv" "\\varpi" t "ϖ" "omega-pi" "omega-pi" "ϖ") - ("bull" "\\textbullet{}" nil "•" "*" "*" "•") - ("bullet" "\\textbullet{}" nil "•" "*" "*" "•") - ("hellip" "\\dots{}" nil "…" "..." "..." "…") + ("partial" "\\partial" t "∂" "[partial differential]" "[partial differential]" "∂") + + "** Hebrew" + ("alefsym" "\\aleph" t "ℵ" "aleph" "aleph" "ℵ") + + "** Dead languages" + ("ETH" "\\DH{}" nil "Ð" "D" "Ð" "Ð") + ("eth" "\\dh{}" nil "ð" "dh" "ð" "ð") + ("THORN" "\\TH{}" nil "Þ" "TH" "Þ" "Þ") + ("thorn" "\\th{}" nil "þ" "th" "þ" "þ") + + "* Punctuation" + "** Dots and Marks" ("dots" "\\dots{}" nil "…" "..." "..." "…") + ("hellip" "\\dots{}" nil "…" "..." "..." "…") + ("middot" "\\textperiodcentered{}" nil "·" "." "·" "·") + ("iexcl" "!`" nil "¡" "!" "¡" "¡") + ("iquest" "?`" nil "¿" "?" "¿" "¿") + + "** Dash-like" + ("shy" "\\-" nil "­" "" "" "") + ("ndash" "--" nil "–" "-" "-" "–") + ("mdash" "---" nil "—" "--" "--" "—") + + "** Quotations" + ("quot" "\\textquotedbl{}" nil """ "\"" "\"" "\"") + ("acute" "\\textasciiacute{}" nil "´" "'" "´" "´") + ("ldquo" "\\textquotedblleft{}" nil "“" "\"" "\"" "“") + ("rdquo" "\\textquotedblright{}" nil "”" "\"" "\"" "”") + ("bdquo" "\\quotedblbase{}" nil "„" "\"" "\"" "„") + ("lsquo" "\\textquoteleft{}" nil "‘" "`" "`" "‘") + ("rsquo" "\\textquoteright{}" nil "’" "'" "'" "’") + ("sbquo" "\\quotesinglbase{}" nil "‚" "," "," "‚") + ("laquo" "\\guillemotleft{}" nil "«" "<<" "«" "«") + ("raquo" "\\guillemotright{}" nil "»" ">>" "»" "»") + ("lsaquo" "\\guilsinglleft{}" nil "‹" "<" "<" "‹") + ("rsaquo" "\\guilsinglright{}" nil "›" ">" ">" "›") + + "* Other" + "** Misc. (often used)" + ("circ" "\\circ" t "ˆ" "^" "^" "ˆ") + ("vert" "\\vert{}" t "|" "|" "|" "|") + ("brvbar" "\\textbrokenbar{}" nil "¦" "|" "¦" "¦") + ("sect" "\\S" nil "§" "paragraph" "§" "§") + ("amp" "\\&" nil "&" "&" "&" "&") + ("lt" "\\textless{}" nil "<" "<" "<" "<") + ("gt" "\\textgreater{}" nil ">" ">" ">" ">") + ("tilde" "\\~{}" nil "˜" "~" "~" "~") + ("dagger" "\\textdagger{}" nil "†" "[dagger]" "[dagger]" "†") + ("Dagger" "\\textdaggerdbl{}" nil "‡" "[doubledagger]" "[doubledagger]" "‡") + + "** Whitespace" + ("nbsp" "~" nil " " " " " " " ") + ("ensp" "\\hspace*{.5em}" nil " " " " " " " ") + ("emsp" "\\hspace*{1em}" nil " " " " " " " ") + ("thinsp" "\\hspace*{.2em}" nil " " " " " " " ") + + "** Currency" + ("curren" "\\textcurrency{}" nil "¤" "curr." "¤" "¤") + ("cent" "\\textcent{}" nil "¢" "cent" "¢" "¢") + ("pound" "\\pounds{}" nil "£" "pound" "£" "£") + ("yen" "\\textyen{}" nil "¥" "yen" "¥" "¥") + ("euro" "\\texteuro{}" nil "€" "EUR" "EUR" "€") + ("EUR" "\\EUR{}" nil "€" "EUR" "EUR" "€") + ("EURdig" "\\EURdig{}" nil "€" "EUR" "EUR" "€") + ("EURhv" "\\EURhv{}" nil "€" "EUR" "EUR" "€") + ("EURcr" "\\EURcr{}" nil "€" "EUR" "EUR" "€") + ("EURtm" "\\EURtm{}" nil "€" "EUR" "EUR" "€") + + "** Property Marks" + ("copy" "\\textcopyright{}" nil "©" "(c)" "©" "©") + ("reg" "\\textregistered{}" nil "®" "(r)" "®" "®") + ("trade" "\\texttrademark{}" nil "™" "TM" "TM" "™") + + "** Science et al." + ("minus" "\\minus" t "−" "-" "-" "−") + ("pm" "\\textpm{}" nil "±" "+-" "±" "±") + ("plusmn" "\\textpm{}" nil "±" "+-" "±" "±") + ("times" "\\texttimes{}" nil "×" "*" "×" "×") + ("frasl" "/" nil "⁄" "/" "/" "⁄") + ("div" "\\textdiv{}" nil "÷" "/" "÷" "÷") + ("frac12" "\\textonehalf{}" nil "½" "1/2" "½" "½") + ("frac14" "\\textonequarter{}" nil "¼" "1/4" "¼" "¼") + ("frac34" "\\textthreequarters{}" nil "¾" "3/4" "¾" "¾") + ("permil" "\\textperthousand{}" nil "‰" "per thousand" "per thousand" "‰") + ("sup1" "\\textonesuperior{}" nil "¹" "^1" "¹" "¹") + ("sup2" "\\texttwosuperior{}" nil "²" "^2" "²" "²") + ("sup3" "\\textthreesuperior{}" nil "³" "^3" "³" "³") + ("radic" "\\sqrt{\\,}" t "√" "[square root]" "[square root]" "√") + ("sum" "\\sum" t "∑" "[sum]" "[sum]" "∑") + ("prod" "\\prod" t "∏" "[product]" "[n-ary product]" "∏") + ("micro" "\\textmu{}" nil "µ" "micro" "µ" "µ") + ("macr" "\\textasciimacron{}" nil "¯" "[macron]" "¯" "¯") + ("deg" "\\textdegree{}" nil "deg" "degree" "°" "°") ("prime" "\\prime" t "′" "'" "'" "′") ("Prime" "\\prime{}\\prime" t "″" "''" "''" "″") - ("oline" "\\overline{~}" t "‾" "[overline]" "¯" "‾") - ("frasl" "/" nil "⁄" "/" "/" "⁄") - ("weierp" "\\wp" t "℘" "P" "P" "℘") - ("image" "\\Im" t "ℑ" "I" "I" "ℑ") - ("real" "\\Re" t "ℜ" "R" "R" "ℜ") - ("trade" "\\texttrademark{}" nil "™" "TM" "TM" "™") - ("alefsym" "\\aleph" t "ℵ" "aleph" "aleph" "ℵ") - ("larr" "\\leftarrow" t "←" "<-" "<-" "←") - ("leftarrow" "\\leftarrow" t "←" "<-" "<-" "←") - ("gets" "\\gets" t "←" "<-" "<-" "←") - ("uarr" "\\uparrow" t "↑" "[uparrow]" "[uparrow]" "↑") - ("uparrow" "\\uparrow" t "↑" "[uparrow]" "[uparrow]" "↑") - ("rarr" "\\rightarrow" t "→" "->" "->" "→") - ("to" "\\to" t "→" "->" "->" "→") - ("rightarrow" "\\rightarrow" t "→" "->" "->" "→") - ("darr" "\\downarrow" t "↓" "[downarrow]" "[downarrow]" "↓") - ("downarrow" "\\downarrow" t "↓" "[downarrow]" "[downarrow]" "↓") - ("harr" "\\leftrightarrow" t "↔" "<->" "<->" "↔") - ("leftrightarrow" "\\leftrightarrow" t "↔" "<->" "<->" "↔") - ("crarr" "\\hookleftarrow" t "↵" "<-'" "<-'" "↵") - ("hookleftarrow" "\\hookleftarrow" t "↵" "<-'" "<-'" "↵") - ("lArr" "\\Leftarrow" t "⇐" "<=" "<=" "⇐") - ("Leftarrow" "\\Leftarrow" t "⇐" "<=" "<=" "⇐") - ("uArr" "\\Uparrow" t "⇑" "[dbluparrow]" "[dbluparrow]" "⇑") - ("Uparrow" "\\Uparrow" t "⇑" "[dbluparrow]" "[dbluparrow]" "⇑") - ("rArr" "\\Rightarrow" t "⇒" "=>" "=>" "⇒") - ("Rightarrow" "\\Rightarrow" t "⇒" "=>" "=>" "⇒") - ("dArr" "\\Downarrow" t "⇓" "[dbldownarrow]" "[dbldownarrow]" "⇓") - ("Downarrow" "\\Downarrow" t "⇓" "[dbldownarrow]" "[dbldownarrow]" "⇓") - ("hArr" "\\Leftrightarrow" t "⇔" "<=>" "<=>" "⇔") - ("Leftrightarrow" "\\Leftrightarrow" t "⇔" "<=>" "<=>" "⇔") - ("forall" "\\forall" t "∀" "[for all]" "[for all]" "∀") - ("partial" "\\partial" t "∂" "[partial differential]" "[partial differential]" "∂") - ("exist" "\\exists" t "∃" "[there exists]" "[there exists]" "∃") - ("exists" "\\exists" t "∃" "[there exists]" "[there exists]" "∃") - ("empty" "\\empty" t "∅" "[empty set]" "[empty set]" "∅") - ("emptyset" "\\emptyset" t "∅" "[empty set]" "[empty set]" "∅") - ("nabla" "\\nabla" t "∇" "[nabla]" "[nabla]" "∇") - ("isin" "\\in" t "∈" "[element of]" "[element of]" "∈") - ("in" "\\in" t "∈" "[element of]" "[element of]" "∈") - ("notin" "\\notin" t "∉" "[not an element of]" "[not an element of]" "∉") - ("ni" "\\ni" t "∋" "[contains as member]" "[contains as member]" "∋") - ("prod" "\\prod" t "∏" "[product]" "[n-ary product]" "∏") - ("sum" "\\sum" t "∑" "[sum]" "[sum]" "∑") -; ("minus" "\\minus" t "−" "-" "-" "−") - ("minus" "-" t "−" "-" "-" "−") - ("lowast" "\\ast" t "∗" "*" "*" "∗") - ("ast" "\\ast" t "∗" "*" "*" "*") - ("radic" "\\sqrt{\\,}" t "√" "[square root]" "[square root]" "√") - ("prop" "\\propto" t "∝" "[proportional to]" "[proportional to]" "∝") - ("proptp" "\\propto" t "∝" "[proportional to]" "[proportional to]" "∝") ("infin" "\\propto" t "∞" "[infinity]" "[infinity]" "∞") ("infty" "\\infty" t "∞" "[infinity]" "[infinity]" "∞") - ("ang" "\\angle" t "∠" "[angle]" "[angle]" "∠") - ("angle" "\\angle" t "∠" "[angle]" "[angle]" "∠") - ("and" "\\wedge" t "∧" "[logical and]" "[logical and]" "∧") + ("prop" "\\propto" t "∝" "[proportional to]" "[proportional to]" "∝") + ("proptp" "\\propto" t "∝" "[proportional to]" "[proportional to]" "∝") + ("not" "\\textlnot{}" nil "¬" "[angled dash]" "¬" "¬") + ("land" "\\land" t "∧" "[logical and]" "[logical and]" "∧") ("wedge" "\\wedge" t "∧" "[logical and]" "[logical and]" "∧") - ("or" "\\vee" t "∨" "[logical or]" "[logical or]" "∨") + ("lor" "\\lor" t "∨" "[logical or]" "[logical or]" "∨") ("vee" "\\vee" t "∨" "[logical or]" "[logical or]" "∨") ("cap" "\\cap" t "∩" "[intersection]" "[intersection]" "∩") ("cup" "\\cup" t "∪" "[union]" "[union]" "∪") ("int" "\\int" t "∫" "[integral]" "[integral]" "∫") -; ("there4" "\\uptherefore" t "∴" "[therefore]" "[therefore]" "∴") ("there4" "\\therefore" t "∴" "[therefore]" "[therefore]" "∴") ("sim" "\\sim" t "∼" "~" "~" "∼") ("cong" "\\cong" t "≅" "[approx. equal to]" "[approx. equal to]" "≅") @@ -318,9 +336,20 @@ loaded, add these packages to `org-export-latex-packages-alist'." ("supset" "\\supset" t "⊃" "[superset of]" "[superset of]" "⊃") ("nsub" "\\not\\subset" t "⊄" "[not a subset of]" "[not a subset of" "⊄") ("sube" "\\subseteq" t "⊆" "[subset of or equal to]" "[subset of or equal to]" "⊆") + ("nsup" "\\not\\supset" t "⊅" "[not a superset of]" "[not a superset of]" "⊅") ("supe" "\\supseteq" t "⊇" "[superset of or equal to]" "[superset of or equal to]" "⊇") - ("oplus" "\\oplus" t "⊕" "[circled plus]" "[circled plus]" "⊕") - ("otimes" "\\otimes" t "⊗" "[circled times]" "[circled times]" "⊗") + ("forall" "\\forall" t "∀" "[for all]" "[for all]" "∀") + ("exist" "\\exists" t "∃" "[there exists]" "[there exists]" "∃") + ("exists" "\\exists" t "∃" "[there exists]" "[there exists]" "∃") + ("empty" "\\empty" t "∅" "[empty set]" "[empty set]" "∅") + ("emptyset" "\\emptyset" t "∅" "[empty set]" "[empty set]" "∅") + ("isin" "\\in" t "∈" "[element of]" "[element of]" "∈") + ("in" "\\in" t "∈" "[element of]" "[element of]" "∈") + ("notin" "\\notin" t "∉" "[not an element of]" "[not an element of]" "∉") + ("ni" "\\ni" t "∋" "[contains as member]" "[contains as member]" "∋") + ("nabla" "\\nabla" t "∇" "[nabla]" "[nabla]" "∇") + ("ang" "\\angle" t "∠" "[angle]" "[angle]" "∠") + ("angle" "\\angle" t "∠" "[angle]" "[angle]" "∠") ("perp" "\\perp" t "⊥" "[up tack]" "[up tack]" "⊥") ("sdot" "\\cdot" t "⋅" "[dot]" "[dot]" "⋅") ("cdot" "\\cdot" t "⋅" "[dot]" "[dot]" "⋅") @@ -330,56 +359,34 @@ loaded, add these packages to `org-export-latex-packages-alist'." ("rfloor" "\\rfloor" t "⌋" "[right floor]" "[right floor]" "⌋") ("lang" "\\langle" t "⟨" "<" "<" "⟨") ("rang" "\\rangle" t "⟩" ">" ">" "⟩") - ("loz" "\\diamond" t "◊" "[lozenge]" "[lozenge]" "◊") - ("Diamond" "\\diamond" t "⋄" "[diamond]" "[diamond]" "⋄") - ("spades" "\\spadesuit" t "♠" "[spades]" "[spades]" "♠") - ("spadesuit" "\\spadesuit" t "♠" "[spades]" "[spades]" "♠") - ("clubs" "\\clubsuit" t "♣" "[clubs]" "[clubs]" "♣") - ("clubsuit" "\\clubsuit" t "♣" "[clubs]" "[clubs]" "♣") - ("hearts" "\\heartsuit" t "♥" "[hearts]" "[hearts]" "♥") - ("heartsuit" "\\heartsuit" t "♥" "[hearts]" "[hearts]" "♥") - ("diamondsuit" "\\diamondsuit" t "♦" "[diamonds]" "[diamonds]" "♦") - ("diams" "\\diamondsuit" t "♦" "[diamonds]" "[diamonds]" "♦") - ("smile" "\\smile" t "☺" ":-)" ":-)" "⌣") - ("blacksmile" "\\blacksmiley{}" nil "☻" ":-)" ":-)" "☻") - ("sad" "\\frownie{}" nil "☹" ":-(" ":-(" "☹") - ("quot" "\\textquotedbl{}" nil """ "\"" "\"" "\"") - ("amp" "\\&" nil "&" "&" "&" "&") - ("lt" "\\textless{}" nil "<" "<" "<" "<") - ("gt" "\\textgreater{}" nil ">" ">" ">" ">") - ("OElig" "\\OE{}" nil "Œ" "OE" "OE" "Œ") - ("oelig" "\\oe{}" nil "œ" "oe" "oe" "œ") - ("Scaron" "\\v{S}" nil "Š" "S" "S" "Š") - ("scaron" "\\v{s}" nil "š" "s" "s" "š") - ("Yuml" "\\\"{Y}" nil "Ÿ" "Y" "Y" "Ÿ") - ("circ" "\\circ" t "ˆ" "^" "^" "ˆ") - ("tilde" "\\~{}" nil "˜" "~" "~" "~") - ("ensp" "\\hspace*{.5em}" nil " " " " " " " ") - ("emsp" "\\hspace*{1em}" nil " " " " " " " ") - ("thinsp" "\\hspace*{.2em}" nil " " " " " " " ") - ("zwnj" "\\/{}" nil "‌" "" "" "‌") - ("zwj" "" nil "‍" "" "" "‍") - ("lrm" "" nil "‎" "" "" "‎") - ("rlm" "" nil "‏" "" "" "‏") - ("ndash" "--" nil "–" "-" "-" "–") - ("mdash" "---" nil "—" "--" "--" "—") - ("lsquo" "\\textquoteleft{}" nil "‘" "`" "`" "‘") - ("rsquo" "\\textquoteright{}" nil "’" "'" "'" "’") - ("sbquo" "\\quotesinglbase{}" nil "‚" "," "," "‚") - ("ldquo" "\\textquotedblleft{}" nil "“" "\"" "\"" "“") - ("rdquo" "\\textquotedblright{}" nil "”" "\"" "\"" "”") - ("bdquo" "\\quotedblbase{}" nil "„" "\"" "\"" "„") - ("dagger" "\\textdagger{}" nil "†" "[dagger]" "[dagger]" "†") - ("Dagger" "\\textdaggerdbl{}" nil "‡" "[doubledagger]" "[doubledagger]" "‡") - ("permil" "\\textperthousand{}" nil "‰" "per thousand" "per thousand" "‰") - ("lsaquo" "\\guilsinglleft{}" nil "‹" "<" "<" "‹") - ("rsaquo" "\\guilsinglright{}" nil "›" ">" ">" "›") - ("euro" "\\texteuro{}" nil "€" "EUR" "EUR" "€") - ("EUR" "\\EUR{}" nil "€" "EUR" "EUR" "€") - ("EURdig" "\\EURdig{}" nil "€" "EUR" "EUR" "€") - ("EURhv" "\\EURhv{}" nil "€" "EUR" "EUR" "€") - ("EURcr" "\\EURcr{}" nil "€" "EUR" "EUR" "€") - ("EURtm" "\\EURtm{}" nil "€" "EUR" "EUR" "€") + + "** Arrows" + ("larr" "\\leftarrow" t "←" "<-" "<-" "←") + ("leftarrow" "\\leftarrow" t "←" "<-" "<-" "←") + ("gets" "\\gets" t "←" "<-" "<-" "←") + ("lArr" "\\Leftarrow" t "⇐" "<=" "<=" "⇐") + ("Leftarrow" "\\Leftarrow" t "⇐" "<=" "<=" "⇐") + ("uarr" "\\uparrow" t "↑" "[uparrow]" "[uparrow]" "↑") + ("uparrow" "\\uparrow" t "↑" "[uparrow]" "[uparrow]" "↑") + ("uArr" "\\Uparrow" t "⇑" "[dbluparrow]" "[dbluparrow]" "⇑") + ("Uparrow" "\\Uparrow" t "⇑" "[dbluparrow]" "[dbluparrow]" "⇑") + ("rarr" "\\rightarrow" t "→" "->" "->" "→") + ("to" "\\to" t "→" "->" "->" "→") + ("rightarrow" "\\rightarrow" t "→" "->" "->" "→") + ("rArr" "\\Rightarrow" t "⇒" "=>" "=>" "⇒") + ("Rightarrow" "\\Rightarrow" t "⇒" "=>" "=>" "⇒") + ("darr" "\\downarrow" t "↓" "[downarrow]" "[downarrow]" "↓") + ("downarrow" "\\downarrow" t "↓" "[downarrow]" "[downarrow]" "↓") + ("dArr" "\\Downarrow" t "⇓" "[dbldownarrow]" "[dbldownarrow]" "⇓") + ("Downarrow" "\\Downarrow" t "⇓" "[dbldownarrow]" "[dbldownarrow]" "⇓") + ("harr" "\\leftrightarrow" t "↔" "<->" "<->" "↔") + ("leftrightarrow" "\\leftrightarrow" t "↔" "<->" "<->" "↔") + ("hArr" "\\Leftrightarrow" t "⇔" "<=>" "<=>" "⇔") + ("Leftrightarrow" "\\Leftrightarrow" t "⇔" "<=>" "<=>" "⇔") + ("crarr" "\\hookleftarrow" t "↵" "<-'" "<-'" "↵") + ("hookleftarrow" "\\hookleftarrow" t "↵" "<-'" "<-'" "↵") + + "** Function names" ("arccos" "\\arccos" t "arccos" "arccos" "arccos" "arccos") ("arcsin" "\\arcsin" t "arcsin" "arcsin" "arcsin" "arcsin") ("arctan" "\\arctan" t "arctan" "arctan" "arctan" "arctan") @@ -412,15 +419,49 @@ loaded, add these packages to `org-export-latex-packages-alist'." ("sup" "\\sup" t "⊃" "sup" "sup" "sup") ("tan" "\\tan" t "tan" "tan" "tan" "tan") ("tanh" "\\tanh" t "tanh" "tanh" "tanh" "tanh") - ("frac12" "\\textonehalf{}" nil "½" "1/2" "½" "½") - ("frac14" "\\textonequarter{}" nil "¼" "1/4" "¼" "¼") - ("frac34" "\\textthreequarters{}" nil "¾" "3/4" "¾" "¾") - ("div" "\\textdiv{}" nil "÷" "/" "÷" "÷") - ("acute" "\\textasciiacute{}" nil "´" "'" "´" "´") - ("nsup" "\\not\\supset" t "⊅" "[not a superset of]" "[not a superset of]" "⊅") + + "** Signs & Symbols" + ("bull" "\\textbullet{}" nil "•" "*" "*" "•") + ("bullet" "\\textbullet{}" nil "•" "*" "*" "•") + ("star" "\\star" t "*" "*" "*" "⋆") + ("lowast" "\\ast" t "∗" "*" "*" "∗") + ("ast" "\\ast" t "∗" "*" "*" "*") + ("odot" "\\odot" t "o" "[circled dot]" "[circled dot]" "ʘ") + ("oplus" "\\oplus" t "⊕" "[circled plus]" "[circled plus]" "⊕") + ("otimes" "\\otimes" t "⊗" "[circled times]" "[circled times]" "⊗") + ("checkmark" "\\checkmark" t "✓" "[checkmark]" "[checkmark]" "✓") + + "** Miscellaneous (seldom used)" + ("para" "\\P{}" nil "¶" "[pilcrow]" "¶" "¶") + ("ordf" "\\textordfeminine{}" nil "ª" "_a_" "ª" "ª") + ("ordm" "\\textordmasculine{}" nil "º" "_o_" "º" "º") + ("cedil" "\\c{}" nil "¸" "[cedilla]" "¸" "¸") + ("oline" "\\overline{~}" t "‾" "[overline]" "¯" "‾") + ("uml" "\\textasciidieresis{}" nil "¨" "[diaeresis]" "¨" "¨") + ("zwnj" "\\/{}" nil "‌" "" "" "‌") + ("zwj" "" nil "‍" "" "" "‍") + ("lrm" "" nil "‎" "" "" "‎") + ("rlm" "" nil "‏" "" "" "‏") + + "** Smilies" + ("smile" "\\smile" t "☺" ":-)" ":-)" "⌣") ("smiley" "\\smiley{}" nil "☺" ":-)" ":-)" "☺") + ("blacksmile" "\\blacksmiley{}" nil "☻" ":-)" ":-)" "☻") + ("sad" "\\frownie{}" nil "☹" ":-(" ":-(" "☹") + + "** Suits" + ("clubs" "\\clubsuit" t "♣" "[clubs]" "[clubs]" "♣") + ("clubsuit" "\\clubsuit" t "♣" "[clubs]" "[clubs]" "♣") + ("spades" "\\spadesuit" t "♠" "[spades]" "[spades]" "♠") + ("spadesuit" "\\spadesuit" t "♠" "[spades]" "[spades]" "♠") + ("hearts" "\\heartsuit" t "♥" "[hearts]" "[hearts]" "♥") + ("heartsuit" "\\heartsuit" t "♥" "[hearts]" "[hearts]" "♥") + ("diams" "\\diamondsuit" t "♦" "[diamonds]" "[diamonds]" "♦") + ("diamondsuit" "\\diamondsuit" t "♦" "[diamonds]" "[diamonds]" "♦") + ("Diamond" "\\diamond" t "⋄" "[diamond]" "[diamond]" "⋄") + ("loz" "\\diamond" t "◊" "[lozenge]" "[lozenge]" "◊") ) - "Default entities used in Org-mode to preduce special characters. + "Default entities used in Org-mode to produce special characters. For details see `org-entities-user'.") (defsubst org-entity-get (name) @@ -457,37 +498,76 @@ Kind can be any of `latex', `html', `ascii', `latin1', or `utf8'." e latex mathp html latin utf8 name ascii) (insert "|Name|LaTeX code|LaTeX|HTML code |HTML|ASCII|Latin1|UTF-8\n|-\n") (while ll - (setq e (pop ll)) - (setq name (car e) - latex (nth 1 e) - mathp (nth 2 e) - html (nth 3 e) - ascii (nth 4 e) - latin (nth 5 e) - utf8 (nth 6 e)) - (if (equal ascii "|") (setq ascii "\\vert")) - (if (equal latin "|") (setq latin "\\vert")) - (if (equal utf8 "|") (setq utf8 "\\vert")) - (if (equal ascii "=>") (setq ascii "= >")) - (if (equal latin "=>") (setq latin "= >")) - (insert "|" name - "|" (format "=%s=" latex) - "|" (format (if mathp "$%s$" "$\\mbox{%s}$") - latex) - "|" (format "=%s=" html) "|" html - "|" ascii "|" latin "|" utf8 - "|\n")) + (when (listp e) + (setq e (pop ll)) + (setq name (car e) + latex (nth 1 e) + mathp (nth 2 e) + html (nth 3 e) + ascii (nth 4 e) + latin (nth 5 e) + utf8 (nth 6 e)) + (if (equal ascii "|") (setq ascii "\\vert")) + (if (equal latin "|") (setq latin "\\vert")) + (if (equal utf8 "|") (setq utf8 "\\vert")) + (if (equal ascii "=>") (setq ascii "= >")) + (if (equal latin "=>") (setq latin "= >")) + (insert "|" name + "|" (format "=%s=" latex) + "|" (format (if mathp "$%s$" "$\\mbox{%s}$") + latex) + "|" (format "=%s=" html) "|" html + "|" ascii "|" latin "|" utf8 + "|\n"))) (goto-char pos) (org-table-align))) +(defun org-entities-help () + "Create a Help buffer with all available entities." + (interactive) + (with-output-to-temp-buffer "*Org Entity Help*" + (princ "Org-mode entities\n=================\n\n") + (let ((ll (append '("* User-defined additions (variable org-entities-user)") + org-entities-user + org-entities)) + e latex mathp html latin utf8 name ascii + (lastwasstring t) + (head (concat + "\n" + " Symbol Org entity LaTeX code HTML code\n" + " -----------------------------------------------------------\n"))) + (while ll + (setq e (pop ll)) + (if (stringp e) + (progn + (princ e) + (princ "\n") + (setq lastwasstring t)) + (if lastwasstring (princ head)) + (setq lastwasstring nil) + (setq name (car e) + latex (nth 1 e) + html (nth 3 e) + utf8 (nth 6 e)) + (princ (format " %-8s \\%-16s %-22s %-13s\n" + utf8 name latex html)))))) + (with-current-buffer "*Org Entity Help*" + (org-mode)) + (select-window (get-buffer-window "*Org Entity Help*"))) + + (defun replace-amp () - "Postprocess HTML file to unescape the ampersant." + "Postprocess HTML file to unescape the ampersand." (interactive) (while (re-search-forward "&\\([^<;]+;\\)" nil t) (replace-match (concat "&" (match-string 1)) t t))) (provide 'org-entities) +;; Local variables: +;; coding: utf-8 +;; End: + ;; arch-tag: e6bd163f-7419-4009-9c93-a74623016424 ;;; org-entities.el ends here diff --git a/lisp/org/org-exp-blocks.el b/lisp/org/org-exp-blocks.el index 90cb610c538..4676f5b1aaf 100644 --- a/lisp/org/org-exp-blocks.el +++ b/lisp/org/org-exp-blocks.el @@ -4,7 +4,7 @@ ;; Free Software Foundation, Inc. ;; Author: Eric Schulte -;; Version: 6.35i +;; Version: 7.01 ;; This file is part of GNU Emacs. ;; @@ -68,6 +68,8 @@ ;; `org-export-blocks-add-block' to add your block type to ;; `org-export-blocks'. +;;; Code: + (eval-when-compile (require 'cl)) (require 'org) @@ -93,10 +95,10 @@ '((comment org-export-blocks-format-comment t) (ditaa org-export-blocks-format-ditaa nil) (dot org-export-blocks-format-dot nil)) - "Use this a-list to associate block types with block exporting -functions. The type of a block is determined by the text -immediately following the '#+BEGIN_' portion of the block header. -Each block export function should accept three argumets..." + "Use this alist to associate block types with block exporting functions. +The type of a block is determined by the text immediately +following the '#+BEGIN_' portion of the block header. Each block +export function should accept three arguments." :group 'org-export-general :type '(repeat (list @@ -106,14 +108,14 @@ Each block export function should accept three argumets..." :set 'org-export-blocks-set) (defun org-export-blocks-add-block (block-spec) - "Add a new block type to `org-export-blocks'. BLOCK-SPEC -should be a three element list the first element of which should -indicate the name of the block, the second element should be the -formatting function called by `org-export-blocks-preprocess' and -the third element a flag indicating whether these types of blocks -should be fontified in org-mode buffers (see -`org-protecting-blocks'). For example the BLOCK-SPEC for ditaa -blocks is as follows... + "Add a new block type to `org-export-blocks'. +BLOCK-SPEC should be a three element list the first element of +which should indicate the name of the block, the second element +should be the formatting function called by +`org-export-blocks-preprocess' and the third element a flag +indicating whether these types of blocks should be fontified in +org-mode buffers (see `org-protecting-blocks'). For example the +BLOCK-SPEC for ditaa blocks is as follows. (ditaa org-export-blocks-format-ditaa nil)" (unless (member block-spec org-export-blocks) @@ -122,25 +124,28 @@ blocks is as follows... (defcustom org-export-interblocks '() - "Use this a-list to associate block types with block exporting -functions. The type of a block is determined by the text -immediately following the '#+BEGIN_' portion of the block header. -Each block export function should accept three argumets..." + "Use this a-list to associate block types with block exporting functions. +The type of a block is determined by the text immediately +following the '#+BEGIN_' portion of the block header. Each block +export function should accept three arguments." :group 'org-export-general :type 'alist) (defcustom org-export-blocks-witheld '(hidden) - "List of block types (see `org-export-blocks') which should not -be exported." + "List of block types (see `org-export-blocks') which should not be exported." :group 'org-export-general :type 'list) -(defvar org-export-blocks-postblock-hooks nil "") +(defcustom org-export-blocks-postblock-hook nil + "Run after blocks have been processed with `org-export-blocks-preprocess'." + :group 'org-export-general + :type 'hook) (defun org-export-blocks-html-quote (body &optional open close) - "Protext BODY from org html export. The optional OPEN and -CLOSE tags will be inserted around BODY." + "Protect BODY from org html export. +The optional OPEN and CLOSE tags will be inserted around BODY." + (concat "\n#+BEGIN_HTML\n" (or open "") @@ -149,8 +154,8 @@ CLOSE tags will be inserted around BODY." "#+END_HTML\n")) (defun org-export-blocks-latex-quote (body &optional open close) - "Protext BODY from org latex export. The optional OPEN and -CLOSE tags will be inserted around BODY." + "Protect BODY from org latex export. +The optional OPEN and CLOSE tags will be inserted around BODY." (concat "\n#+BEGIN_LaTeX\n" (or open "") @@ -159,10 +164,9 @@ CLOSE tags will be inserted around BODY." "#+END_LaTeX\n")) (defun org-export-blocks-preprocess () - "Export all blocks according to the `org-export-blocks' block -exportation alist. Does not export block types specified in -specified in BLOCKS which default to the value of -`org-export-blocks-witheld'." + "Export all blocks according to the `org-export-blocks' block export alist. +Does not export block types specified in specified in BLOCKS +which defaults to the value of `org-export-blocks-witheld'." (interactive) (save-window-excursion (let ((case-fold-search t) @@ -174,7 +178,7 @@ specified in BLOCKS which default to the value of (goto-char (point-min)) (setq start (point)) (while (re-search-forward - "^\\([ \t]*\\)#\\+begin_\\(\\S-+\\)[ \t]*\\(.*\\)?[\r\n]\\([^\000]*?\\)[\r\n][ \t]*#\\+end_\\S-+.*" nil t) + "^\\([ \t]*\\)#\\+begin_\\(\\S-+\\)[ \t]*\\(.*\\)?[\r\n]\\([^\000]*?\\)[\r\n][ \t]*#\\+end_\\S-+.*[\r\n]?" nil t) (setq indentation (length (match-string 1))) (setq type (intern (downcase (match-string 2)))) (setq headers (save-match-data (org-split-string (match-string 3) "[ \t]+"))) @@ -194,7 +198,8 @@ specified in BLOCKS which default to the value of (indent-code-rigidly (match-beginning 0) (match-end 0) indentation))))) (setq start (match-end 0))) - (interblock start (point-max)))))) + (interblock start (point-max)) + (run-hooks 'org-export-blocks-postblock-hook))))) (add-hook 'org-export-preprocess-hook 'org-export-blocks-preprocess) @@ -212,7 +217,7 @@ specified in BLOCKS which default to the value of (expand-file-name "../contrib" (file-name-directory (or load-file-name buffer-file-name))))))) - "Path to the ditaa jar executable") + "Path to the ditaa jar executable.") (defun org-export-blocks-format-ditaa (body &rest headers) "Pass block BODY to the ditaa utility creating an image. @@ -222,13 +227,15 @@ passed to the ditaa utility as command line arguments." (message "ditaa-formatting...") (let* ((args (if (cdr headers) (mapconcat 'identity (cdr headers) " "))) (data-file (make-temp-file "org-ditaa")) - (hash (sha1 (prin1-to-string (list body args)))) - (raw-out-file (if headers (car headers))) - (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw-out-file) - (cons (match-string 1 raw-out-file) - (match-string 2 raw-out-file)) - (cons raw-out-file "png"))) - (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts)))) + (hash (progn + (set-text-properties 0 (length body) nil body) + (sha1 (prin1-to-string (list body args))))) + (raw-out-file (if headers (car headers))) + (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw-out-file) + (cons (match-string 1 raw-out-file) + (match-string 2 raw-out-file)) + (cons raw-out-file "png"))) + (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts)))) (unless (file-exists-p org-ditaa-jar-path) (error (format "Could not find ditaa.jar at %s" org-ditaa-jar-path))) (setq body (if (string-match "^\\([^:\\|:[^ ]\\)" body) @@ -282,13 +289,15 @@ digraph data_relationships { (message "dot-formatting...") (let* ((args (if (cdr headers) (mapconcat 'identity (cdr headers) " "))) (data-file (make-temp-file "org-ditaa")) - (hash (sha1 (prin1-to-string (list body args)))) - (raw-out-file (if headers (car headers))) - (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw-out-file) - (cons (match-string 1 raw-out-file) - (match-string 2 raw-out-file)) - (cons raw-out-file "png"))) - (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts)))) + (hash (progn + (set-text-properties 0 (length body) nil body) + (sha1 (prin1-to-string (list body args))))) + (raw-out-file (if headers (car headers))) + (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw-out-file) + (cons (match-string 1 raw-out-file) + (match-string 2 raw-out-file)) + (cons raw-out-file "png"))) + (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts)))) (cond ((or htmlp latexp docbookp) (unless (file-exists-p out-file) diff --git a/lisp/org/org-exp.el b/lisp/org/org-exp.el index 87ebfd20062..c3f27cf0e15 100644 --- a/lisp/org/org-exp.el +++ b/lisp/org/org-exp.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -26,11 +26,15 @@ ;; ;;; Commentary: +;;; Code: + (require 'org) (require 'org-macs) (require 'org-agenda) (require 'org-exp-blocks) +(require 'ob-exp) (require 'org-src) + (eval-when-compile (require 'cl)) @@ -42,6 +46,8 @@ (declare-function org-export-htmlize-region-for-paste "org-html" (beg end)) (declare-function htmlize-buffer "ext:htmlize" (&optional buffer)) (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ()) +(declare-function org-table-cookie-line-p "org-table" (line)) +(declare-function org-table-colgroup-line-p "org-table" (line)) (autoload 'org-export-generic "org-export-generic" "Export using the generic exporter" t) (defgroup org-export nil "Options for exporting org-listings." @@ -93,9 +99,10 @@ This works by starting up a separate Emacs process visiting the same file and doing the export from there. Not all export commands are affected by this - only the ones which actually write to a file, and that do not depend on the buffer state. - +\\ If this option is nil, you can still get background export by calling -`org-export' with a double prefix arg: `C-u C-u C-c C-e'. +`org-export' with a double prefix arg: \ +\\[universal-argument] \\[universal-argument] \\[org-export]. If this option is t, the double prefix can be used to exceptionally force an export command into the current process." @@ -231,7 +238,7 @@ This option can also be set with the +OPTIONS line, e.g. \"num:t\"." "Format of section numbers for export. The variable has two components. 1. A list of lists, each indicating a counter type and a separator. - The counter type can be any of \"1\", \"A\", \"a\", \"I\", or \"a\". + The counter type can be any of \"1\", \"A\", \"a\", \"I\", or \"i\". It causes causes numeric, alphabetic, or roman counters, respectively. The separator is only used if another counter for a subsection is being added. @@ -446,35 +453,6 @@ This option can also be set with the +OPTIONS line, e.g. \"f:nil\"." :group 'org-export-translation :type 'boolean) -(defcustom org-export-with-sub-superscripts t - "Non-nil means interpret \"_\" and \"^\" for export. -When this option is turned on, you can use TeX-like syntax for sub- and -superscripts. Several characters after \"_\" or \"^\" will be -considered as a single item - so grouping with {} is normally not -needed. For example, the following things will be parsed as single -sub- or superscripts. - - 10^24 or 10^tau several digits will be considered 1 item. - 10^-12 or 10^-tau a leading sign with digits or a word - x^2-y^3 will be read as x^2 - y^3, because items are - terminated by almost any nonword/nondigit char. - x_{i^2} or x^(2-i) braces or parenthesis do grouping. - -Still, ambiguity is possible - so when in doubt use {} to enclose the -sub/superscript. If you set this variable to the symbol `{}', -the braces are *required* in order to trigger interpretations as -sub/superscript. This can be helpful in documents that need \"_\" -frequently in plain text. - -Not all export backends support this, but HTML does. - -This option can also be set with the +OPTIONS line, e.g. \"^:nil\"." - :group 'org-export-translation - :type '(choice - (const :tag "Always interpret" t) - (const :tag "Only with braces" {}) - (const :tag "Never interpret" nil))) - (defcustom org-export-with-TeX-macros t "Non-nil means interpret simple TeX-like macros when exporting. For example, HTML export converts \\alpha to α and \\AA to Å. @@ -518,12 +496,6 @@ This option can also be set with the +OPTIONS line, e.g. \"::nil\"." :group 'org-export-translation :type 'boolean) -(defcustom org-match-sexp-depth 3 - "Number of stacked braces for sub/superscript matching. -This has to be set before loading org.el to be effective." - :group 'org-export-translation - :type 'integer) - (defgroup org-export-tables nil "Options for exporting tables in Org-mode." :tag "Org Export Tables" @@ -702,7 +674,7 @@ modified) list.") "LINK_UP" "LINK_HOME" "SETUPFILE" "STYLE" "LATEX_HEADER" "LATEX_CLASS" "EXPORT_SELECT_TAGS" "EXPORT_EXCLUDE_TAGS" - "KEYWORDS" "DESCRIPTION" "MACRO" "BIND") + "KEYWORDS" "DESCRIPTION" "MACRO" "BIND" "XSLT") (mapcar 'car org-export-inbuffer-options-extra)))) p key val text options a pr style latex-header latex-class macros letbind @@ -738,6 +710,8 @@ modified) list.") (setq options (concat val " " options))) ((string-equal key "BIND") (push (read (concat "(" val ")")) letbind)) + ((string-equal key "XSLT") + (setq p (plist-put p :xslt val))) ((string-equal key "LINK_UP") (setq p (plist-put p :link-up val))) ((string-equal key "LINK_HOME") @@ -873,7 +847,8 @@ in the background. This will be done only for commands that write to a file. For details see the docstring of `org-export-run-in-background'. The prefix argument ARG will be passed to the exporter. However, if -ARG is a double universal prefix `C-u C-u', that means to inverse the +ARG is a double universal prefix \\[universal-argument] \\[universal-argument], \ +that means to inverse the value of `org-export-run-in-background'." (interactive "P") (let* ((bg (org-xor (equal arg '(16)) org-export-run-in-background)) @@ -883,7 +858,7 @@ value of `org-export-run-in-background'." \[1] only export the current subtree \[SPC] publish enclosing subtree (with LaTeX_CLASS or EXPORT_FILE_NAME prop) -\[a/n/u] export as ASCII/Latin-1/UFT-8 [A/N/U] to temporary buffer +\[a/n/u] export as ASCII/Latin-1/UTF-8 [A/N/U] to temporary buffer \[h] export as HTML [H] to temporary buffer [R] export region \[b] export as HTML and open in browser @@ -893,6 +868,8 @@ value of `org-export-run-in-background'." \[D] export as DocBook [V] export as DocBook, process to PDF, and open +\[j] export as TaskJuggler [J] ... and open + \[m] export as Freemind mind map \[x] export as XOXO \[g] export using Wes Hardaker's generic exporter @@ -919,6 +896,8 @@ value of `org-export-run-in-background'." (?g org-export-generic t) (?D org-export-as-docbook t) (?V org-export-as-docbook-pdf-and-open t) + (?j org-export-as-taskjuggler t) + (?J org-export-as-taskjuggler-and-open t) (?m org-export-as-freemind t) (?l org-export-as-latex t) (?p org-export-as-pdf t) @@ -1003,7 +982,7 @@ value of `org-export-run-in-background'." (defvar org-export-id-target-alist nil "Alist of section id's with preferred aliases.") (defvar org-export-code-refs nil - "Alist of code references and line numbers") + "Alist of code references and line numbers.") (defun org-export-preprocess-string (string &rest parameters) "Cleanup STRING so that that the true exported has a more consistent source. @@ -1059,7 +1038,7 @@ on this string to produce the exported version." (untabify (point-min) (point-max)) ;; Handle include files, and call a hook - (org-export-handle-include-files) + (org-export-handle-include-files-recurse) (run-hooks 'org-export-preprocess-after-include-files-hook) ;; Get rid of archived trees @@ -1187,6 +1166,9 @@ on this string to produce the exported version." ;; Remove or replace comments (org-export-handle-comments (plist-get parameters :comments)) + ;; Remove #+TBLFM and #+TBLNAME lines + (org-export-handle-table-metalines) + ;; Run the final hook (run-hooks 'org-export-preprocess-final-hook) @@ -1205,43 +1187,48 @@ on this string to produce the exported version." (defun org-export-define-heading-targets (target-alist) "Find all headings and define the targets for them. -The new targets are added to TARGET-ALIST, which is also returned." +The new targets are added to TARGET-ALIST, which is also returned. +Also find all ID and CUSTOM_ID properties and store them." (goto-char (point-min)) (org-init-section-numbers) (let ((re (concat "^" org-outline-regexp - "\\| [ \t]*:\\(ID\\|CUSTOM_ID\\):[ \t]*\\([^ \t\r\n]+\\)")) + "\\|" + "^[ \t]*:\\(ID\\|CUSTOM_ID\\):[ \t]*\\([^ \t\r\n]+\\)")) level target last-section-target a id) (while (re-search-forward re nil t) - (if (match-end 2) - (progn - (setq id (org-match-string-no-properties 2)) - (push (cons id target) target-alist) - (setq a (or (assoc last-section-target org-export-target-aliases) - (progn - (push (list last-section-target) - org-export-target-aliases) - (car org-export-target-aliases)))) - (push (caar target-alist) (cdr a)) - (when (equal (match-string 1) "CUSTOM_ID") - (if (not (assoc last-section-target - org-export-preferred-target-alist)) - (push (cons last-section-target id) - org-export-preferred-target-alist))) - (when (equal (match-string 1) "ID") - (if (not (assoc last-section-target - org-export-id-target-alist)) - (push (cons last-section-target (concat "ID-" id)) - org-export-id-target-alist)))) - (setq level (org-reduced-level - (save-excursion (goto-char (point-at-bol)) - (org-outline-level)))) - (setq target (org-solidify-link-text - (format "sec-%s" (org-section-number level)))) - (setq last-section-target target) - (push (cons target target) target-alist) - (add-text-properties - (point-at-bol) (point-at-eol) - (list 'target target))))) + (org-if-unprotected-at (match-beginning 0) + (if (match-end 2) + (progn + (setq id (org-match-string-no-properties 2)) + (push (cons id target) target-alist) + (setq a (or (assoc last-section-target org-export-target-aliases) + (progn + (push (list last-section-target) + org-export-target-aliases) + (car org-export-target-aliases)))) + (push (caar target-alist) (cdr a)) + (when (equal (match-string 1) "CUSTOM_ID") + (if (not (assoc last-section-target + org-export-preferred-target-alist)) + (push (cons last-section-target id) + org-export-preferred-target-alist))) + (when (equal (match-string 1) "ID") + (if (not (assoc last-section-target + org-export-id-target-alist)) + (push (cons last-section-target (concat "ID-" id)) + org-export-id-target-alist)))) + (setq level (org-reduced-level + (save-excursion (goto-char (point-at-bol)) + (org-outline-level)))) + (setq target (org-solidify-link-text + (format "sec-%s" (replace-regexp-in-string + "\\." "_" + (org-section-number level))))) + (setq last-section-target target) + (push (cons target target) target-alist) + (add-text-properties + (point-at-bol) (point-at-eol) + (list 'target target)))))) target-alist) (defun org-export-handle-invisible-targets (target-alist) @@ -1338,9 +1325,9 @@ the current file." (defvar org-export-format-drawer-function nil "Function to be called to format the contents of a drawer. The function must accept three parameters: - BACKEND one of the symbols html, docbook, latex, ascii, xoxo NAME the drawer name, like \"PROPERTIES\" CONTENT the content of the drawer. + BACKEND one of the symbols html, docbook, latex, ascii, xoxo The function should return the text to be inserted into the buffer. If this is nil, `org-export-format-drawer' is used as a default.") @@ -1547,15 +1534,25 @@ from the buffer." (while formatters (setq fmt (pop formatters)) - (when (eq (car fmt) backend) - ;; This is selected code, put it into the file for real - (goto-char (point-min)) - (while (re-search-forward (concat "^\\([ \t]*\\)#\\+" (cadr fmt) - ":[ \t]*\\(.*\\)") nil t) + ;; Handle #+Backend: stuff + (goto-char (point-min)) + (while (re-search-forward (concat "^\\([ \t]*\\)#\\+" (cadr fmt) + ":[ \t]*\\(.*\\)") nil t) + (if (not (eq (car fmt) backend)) + (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max))) (replace-match "\\1\\2" t) (add-text-properties (point-at-bol) (min (1+ (point-at-eol)) (point-max)) '(org-protected t)))) + ;; Delete #+attr_Backend: stuff of another backend. Those + ;; matching the current backend will be taken care of by + ;; `org-export-attach-captions-and-attributes' + (goto-char (point-min)) + (while (re-search-forward (concat "^\\([ \t]*\\)#\\+attr_" (cadr fmt) + ":[ \t]*\\(.*\\)") nil t) + (when (not (eq (car fmt) backend)) + (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max))))) + ;; Handle #+begin_Backend and #+end_Backend stuff (goto-char (point-min)) (while (re-search-forward (concat "^[ \t]*#\\+" (caddr fmt) "\\>.*\n?") nil t) @@ -1589,8 +1586,8 @@ These special cookies will later be interpreted by the backend." (setq beg (match-beginning 0) beg1 (1+ (match-end 0))) (when (re-search-forward (concat "^[ \t]*#\\+end_" type "\\>.*") nil t) - (setq end (1+ (point-at-eol)) - end1 (1- (match-beginning 0))) + (setq end1 (1- (match-beginning 0)) + end (+ (point-at-eol) (if (looking-at "\n$") 1 0))) (setq content (org-remove-indentation (buffer-substring beg1 end1))) (setq content (concat "ORG-" (upcase t1) "-START\n" content "\n" @@ -1615,15 +1612,24 @@ table line. If it is a link, add it to the line containing the link." "^[ \t]*\\(|[^-]\\)" "\\|" "^[ \t]*\\[\\[.*\\]\\][ \t]*$")) - cap attr label end) + cap shortn attr label end) (while (re-search-forward re nil t) (cond ((match-end 1) - (setq cap (concat cap (if cap " " "") (org-trim (match-string 1))))) + (progn + (setq cap (concat cap (if cap " " "") (org-trim (match-string 1)))) + (when (string-match "\\[\\(.*\\)\\]{\\(.*\\)}" cap) + (setq shortn (match-string 1 cap) + cap (match-string 2 cap))) + (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max))))) ((match-end 2) - (setq attr (concat attr (if attr " " "") (org-trim (match-string 2))))) + (progn + (setq attr (concat attr (if attr " " "") (org-trim (match-string 2)))) + (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max))))) ((match-end 3) - (setq label (org-trim (match-string 3)))) + (progn + (setq label (org-trim (match-string 3))) + (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max))))) (t (setq end (if (match-end 4) (let ((ee (org-table-end))) @@ -1631,6 +1637,7 @@ table line. If it is a link, add it to the line containing the link." (point-at-eol))) (add-text-properties (point-at-bol) end (list 'org-caption cap + 'org-caption-shortn shortn 'org-attributes attr 'org-label label)) (if label (push (cons label label) target-alist)) @@ -1659,21 +1666,36 @@ table line. If it is a link, add it to the line containing the link." "Remove comments, or convert to backend-specific format. COMMENTSP can be a format string for publishing comments. When it is nil, all comments will be removed." - (let ((re "^\\(#\\|[ \t]*#\\+\\)\\(.*\n?\\)") + (let ((re "^\\(#\\|[ \t]*#\\+ \\)\\(.*\n?\\)") pos) (goto-char (point-min)) (while (or (looking-at re) (re-search-forward re nil t)) (setq pos (match-beginning 0)) - (if (and commentsp - (not (equal (char-before (match-end 1)) ?+))) - (progn (add-text-properties - (match-beginning 0) (match-end 0) '(org-protected t)) - (replace-match (format commentsp (match-string 2)) t t)) + (if (get-text-property pos 'org-protected) + (goto-char (1+ pos)) + (if (and commentsp + (not (equal (char-before (match-end 1)) ?+))) + (progn (add-text-properties + (match-beginning 0) (match-end 0) '(org-protected t)) + (replace-match (format commentsp (match-string 2)) t t)) + (goto-char (1+ pos)) + (replace-match "") + (goto-char (max (point-min) (1- pos)))))))) + +(defun org-export-handle-table-metalines () + "Remove table specific metalines #+TBLNAME: and #+TBLFM:." + (let ((re "^[ \t]*#\\+TBL\\(NAME\\|FM\\):\\(.*\n?\\)") + pos) + (goto-char (point-min)) + (while (or (looking-at re) + (re-search-forward re nil t)) + (setq pos (match-beginning 0)) + (if (get-text-property (point) 'org-protected) + (goto-char (1+ pos)) (goto-char (1+ pos)) - (org-if-unprotected - (replace-match "") - (goto-char (max (point-min) (1- pos)))))))) + (replace-match "") + (goto-char (max (point-min) (1- pos))))))) (defun org-export-mark-radio-links () "Find all matches for radio targets and turn them into internal links." @@ -1694,22 +1716,23 @@ When it is nil, all comments will be removed." "Remove tables lines that are used for internal purposes." (goto-char (point-min)) (while (re-search-forward "^[ \t]*|" nil t) - (beginning-of-line 1) - (if (or (looking-at "[ \t]*| *[!_^] *|") - (not - (memq - nil - (mapcar - (lambda (f) - (or (= (length f) 0) - (string-match - "\\`<\\([0-9]\\|[rl]\\|[rl][0-9]+\\)>\\'" f))) - (org-split-string ;; FIXME, can't we do this without splitting??? - (buffer-substring (point-at-bol) (point-at-eol)) - "[ \t]*|[ \t]*"))))) - (delete-region (max (point-min) (1- (point-at-bol))) - (point-at-eol)) - (end-of-line 1)))) + (org-if-unprotected-at (1- (point)) + (beginning-of-line 1) + (if (or (looking-at "[ \t]*| *[!_^] *|") + (not + (memq + nil + (mapcar + (lambda (f) + (or (= (length f) 0) + (string-match + "\\`<\\([0-9]\\|[rl]\\|[rl][0-9]+\\)>\\'" f))) + (org-split-string ;; FIXME, can't we do without splitting??? + (buffer-substring (point-at-bol) (point-at-eol)) + "[ \t]*|[ \t]*"))))) + (delete-region (max (point-min) (1- (point-at-bol))) + (point-at-eol)) + (end-of-line 1))))) (defun org-export-protect-sub-super (s) (save-match-data @@ -1990,7 +2013,7 @@ TYPE must be a string, any of: (defun org-export-handle-include-files () "Include the contents of include files, with proper formatting." (let ((case-fold-search t) - params file markup lang start end prefix prefix1 switches) + params file markup lang start end prefix prefix1 switches all) (goto-char (point-min)) (while (re-search-forward "^#\\+INCLUDE:?[ \t]+\\(.*\\)" nil t) (setq params (read (concat "(" (match-string 1) ")")) @@ -2007,6 +2030,7 @@ TYPE must be a string, any of: (not (file-exists-p file)) (not (file-readable-p file))) (insert (format "CANNOT INCLUDE FILE %s" file)) + (setq all (cons file all)) (when markup (if (equal (downcase markup) "src") (setq start (format "#+begin_src %s %s\n" @@ -2019,7 +2043,20 @@ TYPE must be a string, any of: (insert (org-get-file-contents (expand-file-name file) prefix prefix1 markup)) (or (bolp) (newline)) - (insert (or end "")))))) + (insert (or end "")))) + all)) + +(defun org-export-handle-include-files-recurse () + "Recursively include files aborting on circular inclusion." + (let ((now (list org-current-export-file)) all) + (while now + (setq all (append now all)) + (setq now (org-export-handle-include-files)) + (let ((intersection + (delq nil + (mapcar (lambda (el) (when (member el all) el)) now)))) + (when intersection + (error "Recursive #+INCLUDE: %S" intersection)))))) (defun org-get-file-contents (file &optional prefix prefix1 markup) "Get the contents of FILE and return them as a string. @@ -2034,7 +2071,7 @@ take care of the block they are in." (goto-char (point-min)) (while (not (eobp)) (insert (or prefix1 prefix)) - (setq prefix1 nil) + (setq prefix1 "") (beginning-of-line 2))) (buffer-string) (when (member markup '("src" "example")) @@ -2075,19 +2112,29 @@ in the list) and remove property and value from the list in LISTVAR." lang code trans opts indent caption) (goto-char (point-min)) (while (re-search-forward - "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?[ \t]+\\([^ \t\n]+\\)\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\n?\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\n?\\)" + "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?\\([ \t]+\\([^ \t\n]+\\)\\)?\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\n?\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\n?\\)" nil t) (if (match-end 1) - ;; src segments - (setq lang (match-string 3) - opts (match-string 4) - code (match-string 5) - indent (length (match-string 2)) - caption (get-text-property 0 'org-caption (match-string 0))) + (if (not (match-string 4)) + (error "Source block missing language specification: %s" + (let* ((body (match-string 6)) + (nothing (message "body:%s" body)) + (preview (or (and (string-match + "^[ \t]*\\([^\n\r]*\\)" body) + (match-string 1 body)) body))) + (if (> (length preview) 35) + (concat (substring preview 0 32) "...") + preview))) + ;; src segments + (setq lang (match-string 4) + opts (match-string 5) + code (match-string 6) + indent (length (match-string 2)) + caption (get-text-property 0 'org-caption (match-string 0)))) (setq lang nil - opts (match-string 8) - code (match-string 9) - indent (length (match-string 7)) + opts (match-string 9) + code (match-string 10) + indent (length (match-string 8)) caption (get-text-property 0 'org-caption (match-string 0)))) (setq trans (org-export-format-source-code-or-example @@ -2153,12 +2200,14 @@ INDENT was the original indentation of the block." (org-add-props (concat "\n") - '(org-protected t)) + '(org-protected t org-example t)) "#+END_DOCBOOK\n")) ((eq backend 'html) ;; We are exporting to HTML (when lang - (require 'htmlize nil t) + (if (featurep 'xemacs) + (require 'htmlize) + (require 'htmlize nil t)) (when (not (fboundp 'htmlize-region-for-paste)) ;; we do not have htmlize.el, or an old version of it (setq lang nil) @@ -2221,7 +2270,7 @@ INDENT was the original indentation of the block." cont rpllbl fmt))) (if (string-match "\\(\\`<[^>]*>\\)\n" rtn) (setq rtn (replace-match "\\1" t nil rtn))) - (concat "\n#+BEGIN_HTML\n" (org-add-props rtn '(org-protected t)) "\n#+END_HTML\n\n")) + (concat "\n#+BEGIN_HTML\n" (org-add-props rtn '(org-protected t org-example t)) "\n#+END_HTML\n\n")) ((eq backend 'latex) (setq rtn (org-export-number-lines rtn 'latex 0 0 num cont rpllbl fmt)) (concat "#+BEGIN_LaTeX\n" @@ -2245,7 +2294,7 @@ INDENT was the original indentation of the block." rtn "\\end{lstlisting}\n") (concat (car org-export-latex-verbatim-wrap) rtn (cdr org-export-latex-verbatim-wrap))) - '(org-protected t)) + '(org-protected t org-example t)) "#+END_LaTeX\n")) ((eq backend 'ascii) ;; This is not HTML or LaTeX, so just make it an example. @@ -2259,7 +2308,7 @@ INDENT was the original indentation of the block." (org-split-string rtn "\n") "\n") "\n") - '(org-protected t)) + '(org-protected t org-example t)) "#+END_ASCII\n")))) (org-add-props rtn nil 'original-indentation indent)))) @@ -2362,8 +2411,8 @@ INDENT was the original indentation of the block." (defun org-export-visible (type arg) "Create a copy of the visible part of the current buffer, and export it. The copy is created in a temporary buffer and removed after use. -TYPE is the final key (as a string) that also select the export command in -the `C-c C-e' export dispatcher. +TYPE is the final key (as a string) that also selects the export command in +the \\\\[org-export] export dispatcher. As a special case, if the you type SPC at the prompt, the temporary org-mode file will not be removed but presented to you so that you can continue to use it. The prefix arg ARG is passed through to the exporting @@ -2490,7 +2539,8 @@ directory." filename))) (backup-inhibited t) (buffer (find-file-noselect filename)) - (region (buffer-string))) + (region (buffer-string)) + str-ret) (save-excursion (switch-to-buffer buffer) (erase-buffer) @@ -2536,7 +2586,11 @@ directory." (write-file (concat filename ".html"))) (kill-buffer newbuf))) (set-buffer-modified-p nil) - (kill-buffer (current-buffer))))) + (if (equal to-buffer 'string) + (progn (setq str-ret (buffer-string)) + (kill-buffer (current-buffer)) + str-ret) + (kill-buffer (current-buffer)))))) (defvar org-archive-location) ;; gets loaded with the org-archive require. (defun org-get-current-options () @@ -2558,6 +2612,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff." #+EXPORT_EXCLUDE_TAGS: %s #+LINK_UP: %s #+LINK_HOME: %s +#+XSLT: #+CATEGORY: %s #+SEQ_TODO: %s #+TYP_TODO: %s @@ -2650,13 +2705,16 @@ If yes remove the column and the special lines." "^[ \t]*| *\\([\#!$*_^ /]\\) *|") x))) lines)) + ;; No special marking column (progn (setq org-table-clean-did-remove-column nil) (delq nil (mapcar (lambda (x) (cond - ((string-match "^[ \t]*| */ *|" x) + ((org-table-colgroup-line-p x) + ;; This line contains colgroup info, extract it + ;; and then discard the line (setq org-table-colgroup-info (mapcar (lambda (x) (cond ((member x '("<" "<")) :start) @@ -2665,14 +2723,20 @@ If yes remove the column and the special lines." (t nil))) (org-split-string x "[ \t]*|[ \t]*"))) nil) + ((org-table-cookie-line-p x) + ;; This line contains formatting cookies, discard it + nil) (t x))) lines))) + ;; there is a special marking column (setq org-table-clean-did-remove-column t) (delq nil (mapcar (lambda (x) (cond - ((string-match "^[ \t]*| */ *|" x) + ((org-table-colgroup-line-p x) + ;; This line contains colgroup info, extract it + ;; and then discard the line (setq org-table-colgroup-info (mapcar (lambda (x) (cond ((member x '("<" "<")) :start) @@ -2681,8 +2745,12 @@ If yes remove the column and the special lines." (t nil))) (cdr (org-split-string x "[ \t]*|[ \t]*")))) nil) + ((org-table-cookie-line-p x) + ;; This line contains formatting cookies, discard it + nil) ((string-match "^[ \t]*| *[!_^/] *|" x) - nil) ; ignore this line + ;; ignore this line + nil) ((or (string-match "^\\([ \t]*\\)|-+\\+" x) (string-match "^\\([ \t]*\\)|[^|]*|" x)) ;; remove the first column @@ -2704,41 +2772,6 @@ If yes remove the column and the special lines." (setq s (replace-match "" t t s))) s) -(defun org-create-multibrace-regexp (left right n) - "Create a regular expression which will match a balanced sexp. -Opening delimiter is LEFT, and closing delimiter is RIGHT, both given -as single character strings. -The regexp returned will match the entire expression including the -delimiters. It will also define a single group which contains the -match except for the outermost delimiters. The maximum depth of -stacked delimiters is N. Escaping delimiters is not possible." - (let* ((nothing (concat "[^" left right "]*?")) - (or "\\|") - (re nothing) - (next (concat "\\(?:" nothing left nothing right "\\)+" nothing))) - (while (> n 1) - (setq n (1- n) - re (concat re or next) - next (concat "\\(?:" nothing left next right "\\)+" nothing))) - (concat left "\\(" re "\\)" right))) - -(defvar org-match-substring-regexp - (concat - "\\([^\\]\\)\\([_^]\\)\\(" - "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)" - "\\|" - "\\(" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)" - "\\|" - "\\(\\(?:\\*\\|[-+]?[^-+*!@#$%^_ \t\r\n,:\"?<>~;./{}=()]+\\)\\)\\)") - "The regular expression matching a sub- or superscript.") - -(defvar org-match-substring-with-braces-regexp - (concat - "\\([^\\]\\)\\([_^]\\)\\(" - "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)" - "\\)") - "The regular expression matching a sub- or superscript, forcing braces.") - (defun org-get-text-property-any (pos prop &optional object) (or (get-text-property pos prop object) diff --git a/lisp/org/org-faces.el b/lisp/org/org-faces.el index f86d1b31cb9..740f2629f2b 100644 --- a/lisp/org/org-faces.el +++ b/lisp/org/org-faces.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -458,7 +458,7 @@ changes." (:foreground "green")) (((class color) (min-colors 8) (background dark)) (:foreground "yellow")))) - "Face for fixed-with text like code snippets." + "Face for fixed-width text like code snippets." :group 'org-faces :version "22.1") @@ -600,7 +600,7 @@ belong to the weekend." (defface org-agenda-dimmed-todo-face '((((background light)) (:foreground "grey50")) (((background dark)) (:foreground "grey50"))) - "Face used to dimm blocked tasks in the agenda." + "Face used to dim blocked tasks in the agenda." :group 'org-faces) (defface org-scheduled-previously diff --git a/lisp/org/org-feed.el b/lisp/org/org-feed.el index c06c7331cca..9d14daea9df 100644 --- a/lisp/org/org-feed.el +++ b/lisp/org/org-feed.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -45,7 +45,7 @@ ;; With this setup, the command `M-x org-feed-update-all' will ;; collect new entries in the feed at the given URL and create ;; entries as subheadings under the "ReQall Entries" heading in the -;; file "~/org-feeds.org". Each feed should normally have its own +;; file "~/org/feeds.org". Each feed should normally have its own ;; heading - however see the `:drawer' parameter. ;; ;; Besides these standard elements that need to be specified for each @@ -83,8 +83,8 @@ ;; ;; #+DRAWERS: PROPERTIES LOGBOOK FEEDSTATUS ;; -;; Acknowledgements -;; ---------------- +;; Acknowledgments +;; --------------- ;; ;; org-feed.el is based on ideas by Brad Bozarth who implemented a ;; similar mechanism using shell and awk scripts. @@ -99,6 +99,7 @@ (declare-function xml-get-children "xml" (node child-name)) (declare-function xml-get-attribute "xml" (node attribute)) (declare-function xml-get-attribute-or-nil "xml" (node attribute)) +(defvar xml-entity-alist) (defgroup org-feed nil "Options concerning RSS feeds as inputs for Org files." @@ -165,10 +166,11 @@ Here are the keyword-value pair allows in `org-feed-alist'. When the handler is called, point will be at the feed headline. :parse-feed function - This function gets passed a buffer, and should return a list of entries, - each being a property list containing the `:guid' and `:item-full-text' - keys. The default is `org-feed-parse-rss-feed'; `org-feed-parse-atom-feed' - is an alternative. + This function gets passed a buffer, and should return a list + of entries, each being a property list containing the + `:guid' and `:item-full-text' keys. The default is + `org-feed-parse-rss-feed'; `org-feed-parse-atom-feed' is an + alternative. :parse-entry function This function gets passed an entry as returned by the parse-feed @@ -199,12 +201,12 @@ Here are the keyword-value pair allows in `org-feed-alist'. (list :inline t :tag "Changed items" (const :changed-handler) (symbol :tag "Handler Function")) - (list :inline t :tag "Parse Feed" - (const :parse-feed) - (symbol :tag "Parse Feed Function")) - (list :inline t :tag "Parse Entry" - (const :parse-entry) - (symbol :tag "Parse Entry Function")) + (list :inline t :tag "Parse Feed" + (const :parse-feed) + (symbol :tag "Parse Feed Function")) + (list :inline t :tag "Parse Entry" + (const :parse-entry) + (symbol :tag "Parse Entry Function")) ))))) (defcustom org-feed-drawer "FEEDSTATUS" @@ -267,6 +269,17 @@ have been saved." (defvar org-feed-buffer "*Org feed*" "The buffer used to retrieve a feed.") +(defun org-feed-unescape (s) + "Unescape protected entities in S." + (require 'xml) + (let ((re (concat "&\\(" + (mapconcat 'car xml-entity-alist "\\|") + "\\);"))) + (while (string-match re s) + (setq s (replace-match + (cdr (assoc (match-string 1 s) xml-entity-alist)) nil nil s))) + s)) + ;;;###autoload (defun org-feed-update-all () "Get inbox items from all feeds in `org-feed-alist'." @@ -302,10 +315,10 @@ it can be a list structured like an entry in `org-feed-alist'." org-feed-default-template)) (drawer (or (nth 1 (memq :drawer feed)) org-feed-drawer)) - (parse-feed (or (nth 1 (memq :parse-feed feed)) - 'org-feed-parse-rss-feed)) - (parse-entry (or (nth 1 (memq :parse-entry feed)) - 'org-feed-parse-rss-entry)) + (parse-feed (or (nth 1 (memq :parse-feed feed)) + 'org-feed-parse-rss-feed)) + (parse-entry (or (nth 1 (memq :parse-entry feed)) + 'org-feed-parse-rss-entry)) feed-buffer inbox-pos new-formatted entries old-status status new changed guid-alist e guid olds) (setq feed-buffer (org-feed-get-feed url)) @@ -321,10 +334,11 @@ it can be a list structured like an entry in `org-feed-alist'." (setq old-status (org-feed-read-previous-status inbox-pos drawer)) ;; Add the "handled" status to the appropriate entries (setq entries (mapcar (lambda (e) - (setq e (plist-put e :handled - (nth 1 (assoc - (plist-get e :guid) - old-status))))) + (setq e + (plist-put e :handled + (nth 1 (assoc + (plist-get e :guid) + old-status))))) entries)) ;; Find out which entries are new and which are changed (dolist (e entries) @@ -579,11 +593,12 @@ Assumes headers are indeed present!" "Parse BUFFER for RSS feed entries. Returns a list of entries, with each entry a property list, containing the properties `:guid' and `:item-full-text'." - (let (entries beg end item guid entry) + (let ((case-fold-search t) + entries beg end item guid entry) (with-current-buffer buffer (widen) (goto-char (point-min)) - (while (re-search-forward "" nil t) + (while (re-search-forward ".*?>" nil t) (setq beg (point) end (and (re-search-forward "" nil t) (match-beginning 0))) @@ -605,7 +620,7 @@ containing the properties `:guid' and `:item-full-text'." nil t) (setq entry (plist-put entry (intern (concat ":" (match-string 1))) - (match-string 2)))) + (org-feed-unescape (match-string 2))))) (goto-char (point-min)) (unless (re-search-forward "isPermaLink[ \t]*=[ \t]*\"false\"" nil t) (setq entry (plist-put entry :guid-permalink t)))) @@ -618,14 +633,15 @@ containing the properties `:guid' and `:item-full-text'. The `:item-full-text' property actually contains the sexp formatted as a string, not the original XML data." + (require 'xml) (with-current-buffer buffer (widen) (let ((feed (car (xml-parse-region (point-min) (point-max))))) (mapcar (lambda (entry) - (list - :guid (car (xml-node-children (car (xml-get-children entry 'id)))) - :item-full-text (prin1-to-string entry))) + (list + :guid (car (xml-node-children (car (xml-get-children entry 'id)))) + :item-full-text (prin1-to-string entry))) (xml-get-children feed 'entry))))) (defun org-feed-parse-atom-entry (entry) @@ -633,28 +649,36 @@ formatted as a string, not the original XML data." (let ((xml (car (read-from-string (plist-get entry :item-full-text))))) ;; Get first . (setq entry (plist-put entry :link - (xml-get-attribute - (car (xml-get-children xml 'link)) - 'href))) + (xml-get-attribute + (car (xml-get-children xml 'link)) + 'href))) ;; Add as :title. (setq entry (plist-put entry :title - (car (xml-node-children - (car (xml-get-children xml 'title)))))) + (org-feed-unescape + (car (xml-node-children + (car (xml-get-children xml 'title))))))) (let* ((content (car (xml-get-children xml 'content))) - (type (xml-get-attribute-or-nil content 'type))) + (type (xml-get-attribute-or-nil content 'type))) (when content - (cond - ((string= type "text") - ;; We like plain text. - (setq entry (plist-put entry :description (car (xml-node-children content))))) - ((string= type "html") - ;; TODO: convert HTML to Org markup. - (setq entry (plist-put entry :description (car (xml-node-children content))))) - ((string= type "xhtml") - ;; TODO: convert XHTML to Org markup. - (setq entry (plist-put entry :description (prin1-to-string (xml-node-children content))))) - (t - (setq entry (plist-put entry :description (format "Unknown '%s' content." type))))))) + (cond + ((string= type "text") + ;; We like plain text. + (setq entry (plist-put entry :description + (org-feed-unescape + (car (xml-node-children content)))))) + ((string= type "html") + ;; TODO: convert HTML to Org markup. + (setq entry (plist-put entry :description + (org-feed-unescape + (car (xml-node-children content)))))) + ((string= type "xhtml") + ;; TODO: convert XHTML to Org markup. + (setq entry (plist-put entry :description + (prin1-to-string + (xml-node-children content))))) + (t + (setq entry (plist-put entry :description + (format "Unknown '%s' content." type))))))) entry)) (provide 'org-feed) diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el index 5964ef4ce2c..2a2c4c0f426 100644 --- a/lisp/org/org-footnote.el +++ b/lisp/org/org-footnote.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -65,6 +65,11 @@ (org-re "^\\(\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]\\)") "Regular expression matching the definition of a footnote.") +(defgroup org-footnote nil + "Footnotes in Org-mode." + :tag "Org Footnote" + :group 'org) + (defcustom org-footnote-section "Footnotes" "Outline heading containing footnote definitions before export. This can be nil, to place footnotes locally at the end of the current @@ -75,7 +80,7 @@ automatically, i.e. when creating the footnote, and when sorting the notes. However, by hand you may place definitions *anywhere*. If this is a string, during export, all subtrees starting with this heading will be removed after extracting footnote definitions." - :group 'org-footnotes + :group 'org-footnote :type '(choice (string :tag "Collect footnotes under heading") (const :tag "Define footnotes locally" nil))) @@ -87,7 +92,7 @@ as in Org-mode. Outside Org-mode, new footnotes are always placed at the end of the file. When you normalize the notes, any line containing only this tag will be removed, a new one will be inserted at the end of the file, followed by the collected and normalized footnotes." - :group 'org-footnotes + :group 'org-footnote :type 'string) (defcustom org-footnote-define-inline nil @@ -182,25 +187,25 @@ with start and label of the footnote if there is a definition at point." (org-show-context 'link-search) (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'.")))) -(defun org-footnote-goto-next-reference (label) - "Find the next reference of the footnote with label LABEL." +(defun org-footnote-goto-previous-reference (label) + "Find the next previous of the footnote with label LABEL." (interactive "sLabel: ") (org-mark-ring-push) (setq label (org-footnote-normalize-label label)) (let ((re (format ".\\[%s[]:]" label)) (p0 (point)) pos) (save-excursion - (setq pos (or (re-search-forward re nil t) - (and (goto-char (point-min)) - (re-search-forward re nil t)) + (setq pos (or (re-search-backward re nil t) + (and (goto-char (point-max)) + (re-search-backward re nil t)) (and (progn (widen) t) (goto-char p0) - (re-search-forward re nil t)) - (and (goto-char (point-min)) + (re-search-backward re nil t)) + (and (goto-char (point-max)) (re-search-forward re nil t))))) (if pos (progn - (goto-char pos) + (goto-char (match-end 0)) (org-show-context 'link-search)) (error "Cannot find reference of footnote %s" label)))) @@ -339,7 +344,7 @@ With prefix arg SPECIAL, offer additional commands in a menu." (org-footnote-goto-definition (nth 1 tmp)) (goto-char (match-beginning 4)))) ((setq tmp (org-footnote-at-definition-p)) - (org-footnote-goto-next-reference (nth 1 tmp))) + (org-footnote-goto-previous-reference (nth 1 tmp))) (t (org-footnote-new))))) ;;;###autoload diff --git a/lisp/org/org-gnus.el b/lisp/org/org-gnus.el index b431cad20fa..f2fca8c29f4 100644 --- a/lisp/org/org-gnus.el +++ b/lisp/org/org-gnus.el @@ -7,7 +7,7 @@ ;; Tassilo Horn <tassilo at member dot fsf dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -48,7 +48,7 @@ (defvaralias 'org-usenet-links-prefer-google 'org-gnus-prefer-web-links)) (defcustom org-gnus-prefer-web-links nil - "Non-nil means `org-store-link' will create web links to Google groups. + "If non-nil, `org-store-link' creates web links to Google groups or Gmane. When nil, Gnus will be used for such links. Using a prefix arg to the command \\[org-store-link] (`org-store-link') negates this setting for the duration of the command." @@ -120,22 +120,26 @@ If `org-store-link' was called with a prefix arg the meaning of ((memq major-mode '(gnus-summary-mode gnus-article-mode)) (let* ((group gnus-newsgroup-name) - (header (with-current-buffer gnus-summary-buffer + (header (with-current-buffer gnus-summary-buffer (gnus-summary-article-header))) (from (mail-header-from header)) (message-id (org-remove-angle-brackets (mail-header-id header))) (date (mail-header-date header)) - (subject (mail-header-subject header)) - (to (cdr (assq 'To (mail-header-extra header)))) - newsgroups x-no-archive desc link) + (subject (copy-sequence (mail-header-subject header))) + (to (cdr (assq 'To (mail-header-extra header)))) + newsgroups x-no-archive desc link) + ;; Remove text properties of subject string to avoid Emacs bug + ;; #3506 + (set-text-properties 0 (length subject) nil subject) + ;; Fetching an article is an expensive operation; newsgroup and ;; x-no-archive are only needed for web links. (when (org-xor current-prefix-arg org-gnus-prefer-web-links) - ;; Make sure the original article buffer is up-to-date - (save-window-excursion (gnus-summary-select-article)) - (setq to (or to (gnus-fetch-original-field "To")) - newsgroups (gnus-fetch-original-field "Newsgroups") - x-no-archive (gnus-fetch-original-field "x-no-archive"))) + ;; Make sure the original article buffer is up-to-date + (save-window-excursion (gnus-summary-select-article)) + (setq to (or to (gnus-fetch-original-field "To")) + newsgroups (gnus-fetch-original-field "Newsgroups") + x-no-archive (gnus-fetch-original-field "x-no-archive"))) (org-store-link-props :type "gnus" :from from :subject subject :message-id message-id :group group :to to) (setq desc (org-email-link-description) diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el index 93be08ca37b..71e0a9583f1 100644 --- a/lisp/org/org-habit.el +++ b/lisp/org/org-habit.el @@ -5,7 +5,7 @@ ;; Author: John Wiegley <johnw at gnu dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -27,11 +27,13 @@ ;; This file contains the habit tracking code for Org-mode +;;; Code: + (require 'org) (require 'org-agenda) + (eval-when-compile - (require 'cl) - (require 'calendar)) + (require 'cl)) (defgroup org-habit nil "Options concerning habit tracking in Org-mode." @@ -179,8 +181,10 @@ This list represents a \"habit\" for the rest of this module." (defsubst org-habit-deadline (habit) (let ((deadline (nth 2 habit))) (or deadline - (+ (org-habit-scheduled habit) - (1- (org-habit-scheduled-repeat habit)))))) + (if (nth 3 habit) + (+ (org-habit-scheduled habit) + (1- (org-habit-scheduled-repeat habit))) + (org-habit-scheduled habit))))) (defsubst org-habit-deadline-repeat (habit) (or (nth 3 habit) (org-habit-scheduled-repeat habit))) @@ -281,9 +285,16 @@ current time." donep))) markedp face) (if donep - (progn + (let ((done-time (time-add + starting + (days-to-time + (- start (time-to-days starting)))))) + (aset graph index ?*) (setq markedp t) + (put-text-property + index (1+ index) 'help-echo + (format-time-string (org-time-stamp-format) done-time) graph) (while (and done-dates (= start (car done-dates))) (setq last-done-date (car done-dates) diff --git a/lisp/org/org-html.el b/lisp/org/org-html.el index f891e5a85a5..e20b92147fc 100644 --- a/lisp/org/org-html.el +++ b/lisp/org/org-html.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -26,7 +26,10 @@ ;; ;;; Commentary: +;;; Code: + (require 'org-exp) + (eval-when-compile (require 'cl)) (declare-function org-id-find-id-file "org-id" (id)) @@ -57,7 +60,7 @@ by the footnotes themselves." :type 'string) (defcustom org-export-html-coding-system nil - "Coding system for HTML export, defaults to buffer-file-coding-system." + "Coding system for HTML export, defaults to `buffer-file-coding-system'." :group 'org-export-html :type 'coding-system) @@ -81,7 +84,7 @@ and corresponding declarations." (string :tag "Declaration"))))) (defcustom org-export-html-style-include-scripts t - "Non-nil means include the javascript snippets in exported HTML files. + "Non-nil means include the JavaScript snippets in exported HTML files. The actual script is defined in `org-export-html-scripts' and should not be modified." :group 'org-export-html @@ -110,7 +113,7 @@ not be modified." } /*]]>*///--> </script>" -"Basic javascript that is needed by HTML files produced by Org-mode.") +"Basic JavaScript that is needed by HTML files produced by Org-mode.") (defconst org-export-html-style-default "<style type=\"text/css\"> @@ -207,20 +210,20 @@ settings with <style>...</style> tags." (put 'org-export-html-style-extra 'safe-local-variable 'stringp) (defcustom org-export-html-tag-class-prefix "" - "Prefix to clas names for TODO keywords. + "Prefix to class names for TODO keywords. Each tag gets a class given by the tag itself, with this prefix. The default prefix is empty because it is nice to just use the keyword as a class name. But if you get into conflicts with other, existing -CSS classes, then this prefic can be very useful." +CSS classes, then this prefix can be very useful." :group 'org-export-html :type 'string) (defcustom org-export-html-todo-kwd-class-prefix "" - "Prefix to clas names for TODO keywords. + "Prefix to class names for TODO keywords. Each TODO keyword gets a class given by the keyword itself, with this prefix. The default prefix is empty because it is nice to just use the keyword as a class name. But if you get into conflicts with other, existing -CSS classes, then this prefic can be very useful." +CSS classes, then this prefix can be very useful." :group 'org-export-html :type 'string) @@ -235,10 +238,11 @@ CSS classes, then this prefic can be very useful." | <a accesskey=\"H\" href=\"%s\"> HOME </a> </div>" - "Snippet used to insert the HOME and UP links. This is a format, -the first %s will receive the UP link, the second the HOME link. -If both `org-export-html-link-up' and `org-export-html-link-home' are -empty, the entire snippet will be ignored." + "Snippet used to insert the HOME and UP links. +This is a format string, the first %s will receive the UP link, +the second the HOME link. If both `org-export-html-link-up' and +`org-export-html-link-home' are empty, the entire snippet will be +ignored." :group 'org-export-html :type 'string) @@ -340,7 +344,7 @@ When nil, also column one will use data tags." :type 'boolean) (defcustom org-export-html-validation-link nil - "Non-nil means add validationlink to postamble of HTML exported files." + "Non-nil means add validation link to postamble of HTML exported files." :group 'org-export-html :type '(choice (const :tag "Nothing" nil) @@ -349,9 +353,10 @@ When nil, also column one will use data tags." (defcustom org-export-html-with-timestamp nil - "If non-nil, write `org-export-html-html-helper-timestamp' -into the exported HTML text. Otherwise, the buffer will just be saved -to a file." + "If non-nil, write timestamp into the exported HTML text. +If non-nil Write `org-export-html-html-helper-timestamp' into the +exported HTML text. Otherwise, the buffer will just be saved to +a file." :group 'org-export-html :type 'boolean) @@ -405,10 +410,10 @@ with a link to this URL." ;;; Variables, constants, and parameter plists (defvar org-export-html-preamble nil - "Preamble, to be inserted just before <body>. Set by publishing functions. + "Preamble, to be inserted just after <body>. Set by publishing functions. This may also be a function, building and inserting the preamble.") (defvar org-export-html-postamble nil - "Preamble, to be inserted just after </body>. Set by publishing functions. + "Preamble, to be inserted just before </body>. Set by publishing functions. This may also be a function, building and inserting the postamble.") (defvar org-export-html-auto-preamble t "Should default preamble be inserted? Set by publishing functions.") @@ -426,14 +431,15 @@ This may also be a function, building and inserting the postamble.") ;;; HTML export (defun org-export-html-preprocess (parameters) - ;; Convert LaTeX fragments to images + "Convert LaTeX fragments to images." (when (and org-current-export-file (plist-get parameters :LaTeX-fragments)) (org-format-latex (concat "ltxpng/" (file-name-sans-extension (file-name-nondirectory org-current-export-file))) - org-current-export-dir nil "Creating LaTeX image %s")) + org-current-export-dir nil "Creating LaTeX image %s" + nil nil (eq (plist-get parameters :LaTeX-fragments) 'verbatim))) (goto-char (point-min)) (let (label l1) (while (re-search-forward "\\\\ref{\\([^{}\n]+\\)}" nil t) @@ -455,11 +461,12 @@ headlines. The default is 3. Lower levels will become bulleted lists." (org-export-as-html arg 'hidden) (org-open-file buffer-file-name) (when org-export-kill-product-buffer-when-displayed - (kill-buffer))) + (kill-buffer (current-buffer)))) ;;;###autoload (defun org-export-as-html-batch () - "Call `org-export-as-html', may be used in batch processing as + "Call the function `org-export-as-html'. +This function can be used in batch processing as: emacs --batch --load=$HOME/lib/emacs/org.el --eval \"(setq org-export-headline-levels 2)\" @@ -533,6 +540,131 @@ in a window. A non-interactive call will only return the buffer." (defvar html-table-tag nil) ; dynamically scoped into this. (defvar org-par-open nil) + +;;; org-html-cvt-link-fn +(defconst org-html-cvt-link-fn + nil + "Function to convert link URLs to exportable URLs. +Takes two arguments, TYPE and PATH. +Returns exportable url as (TYPE PATH), or nil to signal that it +didn't handle this case. +Intended to be locally bound around a call to `org-export-as-html'." ) + +(defun org-html-cvt-org-as-html (opt-plist type path) + "Convert an org filename to an equivalent html filename. +If TYPE is not file, just return `nil'. +See variable `org-export-html-link-org-files-as-html'" + + (save-match-data + (and + org-export-html-link-org-files-as-html + (string= type "file") + (string-match "\\.org$" path) + (progn + (list + "http" + (concat + (substring path 0 (match-beginning 0)) + "." + (plist-get opt-plist :html-extension))))))) + + +;;; org-html-should-inline-p +(defun org-html-should-inline-p (filename descp) + "Return non-nil if link FILENAME should be inlined. +The decision to inline the FILENAME link is based on the current +settings. DESCP is the boolean of whether there was a link +description. See variables `org-export-html-inline-images' and +`org-export-html-inline-image-extensions'." + (declare (special + org-export-html-inline-images + org-export-html-inline-image-extensions)) + (or + (eq t org-export-html-inline-images) + (and + org-export-html-inline-images + (not descp))) + (org-file-image-p + filename org-export-html-inline-image-extensions)) + +;;; org-html-make-link +(defun org-html-make-link (opt-plist type path fragment desc attr + may-inline-p) + "Make an HTML link. +OPT-PLIST is an options list. +TYPE is the device-type of the link (THIS://foo.html) +PATH is the path of the link (http://THIS#locationx) +FRAGMENT is the fragment part of the link, if any (foo.html#THIS) +DESC is the link description, if any. +ATTR is a string of other attributes of the a element. +MAY-INLINE-P allows inlining it as an image." + + (declare (special org-par-open)) + (save-match-data + (let* ((filename path) + ;;First pass. Just sanity stuff. + (components-1 + (cond + ((string= type "file") + (list + type + ;;Substitute just if original path was absolute. + ;;(Otherwise path must remain relative) + (if (file-name-absolute-p path) + (expand-file-name path) + path))) + ((string= type "") + (list nil path)) + (t (list type path)))) + + ;;Second pass. Components converted so they can refer + ;;to a remote site. + (components-2 + (or + (and org-html-cvt-link-fn + (apply org-html-cvt-link-fn + opt-plist components-1)) + (apply #'org-html-cvt-org-as-html + opt-plist components-1) + components-1)) + (type (first components-2)) + (thefile (second components-2))) + + + ;;Third pass. Build final link except for leading type + ;;spec. + (cond + ((or + (not type) + (string= type "http") + (string= type "https")) + (if fragment + (setq thefile (concat thefile "#" fragment)))) + + (t)) + + ;;Final URL-build, for all types. + (setq thefile + (let + ((str (org-export-html-format-href thefile))) + (if (and type (not (string= "file" type)) + (org-string-match-p "^//" str)) + (concat type ":" str) + str))) + + (if (and + may-inline-p + ;;Can't inline a URL with a fragment. + (not fragment)) + (progn + (message "image %s %s" thefile org-par-open) + (org-export-html-format-image thefile org-par-open)) + (concat + "<a href=\"" thefile "\"" attr ">" + (org-export-html-format-desc desc) + "</a>"))))) + +;;; org-export-as-html ;;;###autoload (defun org-export-as-html (arg &optional hidden ext-plist to-buffer body-only pub-dir) @@ -710,7 +842,7 @@ PUB-DIR is set, use this as the publishing directory." table-buffer table-orig-buffer ind item-type starter didclose rpl path attr desc descp desc1 desc2 link - snumber fnc item-tag + snumber fnc item-tag initial-number footnotes footref-seen id-file href ) @@ -789,7 +921,7 @@ lang=\"%s\" xml:lang=\"%s\"> "") (or charset "iso-8859-1")) language language - (org-html-expand title) + title (or charset "iso-8859-1") date author description keywords style @@ -871,7 +1003,9 @@ lang=\"%s\" xml:lang=\"%s\"> t t line))) (while (string-match "<\\(<\\)+\\|>\\(>\\)+" txt) (setq txt (replace-match "" t t txt))) - (setq href (format "sec-%s" snumber)) + (setq href + (replace-regexp-in-string + "\\." "_" (format "sec-%s" snumber))) (setq href (or (cdr (assoc href org-export-preferred-target-alist)) href)) (push (format @@ -959,10 +1093,12 @@ lang=\"%s\" xml:lang=\"%s\"> (when (equal "ORG-VERSE-START" line) (org-close-par-maybe) (insert "\n<p class=\"verse\">\n") + (setq org-par-open t) (setq inverse t) (throw 'nextline nil)) (when (equal "ORG-VERSE-END" line) (insert "</p>\n") + (setq org-par-open nil) (org-open-par) (setq inverse nil) (throw 'nextline nil)) @@ -1042,70 +1178,79 @@ lang=\"%s\" xml:lang=\"%s\"> desc2 (if (match-end 2) (concat type ":" path) path) descp (and desc1 (not (equal desc1 desc2))) desc (or desc1 desc2)) - ;; Make an image out of the description if that is so wanted + ;; Make an image out of the description if that is so wanted (when (and descp (org-file-image-p - desc org-export-html-inline-image-extensions)) - (save-match-data - (if (string-match "^file:" desc) - (setq desc (substring desc (match-end 0))))) - (setq desc (org-add-props + desc org-export-html-inline-image-extensions)) + (save-match-data + (if (string-match "^file:" desc) + (setq desc (substring desc (match-end 0))))) + (setq desc (org-add-props (concat "<img src=\"" desc "\"/>") '(org-protected t)))) - ;; FIXME: do we need to unescape here somewhere? (cond ((equal type "internal") - (setq rpl - (concat - "<a href=\"" - (if (= (string-to-char path) ?#) "" "#") - (org-solidify-link-text - (save-match-data (org-link-unescape path)) nil) - "\"" attr ">" - (org-export-html-format-desc desc) - "</a>"))) + (let + ((frag-0 + (if (= (string-to-char path) ?#) + (substring path 1) + path))) + (setq rpl + (org-html-make-link + opt-plist + "" + "" + (org-solidify-link-text + (save-match-data (org-link-unescape frag-0)) + nil) + desc attr nil)))) ((and (equal type "id") (setq id-file (org-id-find-id-file path))) ;; This is an id: link to another file (if it was the same file, ;; it would have become an internal link...) (save-match-data (setq id-file (file-relative-name - id-file (file-name-directory org-current-export-file))) - (setq id-file (concat (file-name-sans-extension id-file) - "." html-extension)) - (setq rpl (concat "<a href=\"" id-file "#" - (if (org-uuidgen-p path) "ID-") - path "\"" - attr ">" - (org-export-html-format-desc desc) - "</a>")))) + id-file + (file-name-directory org-current-export-file))) + (setq rpl + (org-html-make-link opt-plist + "file" id-file + (concat (if (org-uuidgen-p path) "ID-") path) + desc + attr + nil)))) ((member type '("http" "https")) - ;; standard URL, just check if we need to inline an image - (if (and (or (eq t org-export-html-inline-images) - (and org-export-html-inline-images (not descp))) - (org-file-image-p - path org-export-html-inline-image-extensions)) - (setq rpl (org-export-html-format-image - (concat type ":" path) org-par-open)) - (setq link (concat type ":" path)) - (setq rpl (concat "<a href=\"" - (org-export-html-format-href link) - "\"" attr ">" - (org-export-html-format-desc desc) - "</a>")))) + ;; standard URL, can inline as image + (setq rpl + (org-html-make-link opt-plist + type path nil + desc + attr + (org-html-should-inline-p path descp)))) ((member type '("ftp" "mailto" "news")) - ;; standard URL - (setq link (concat type ":" path)) - (setq rpl (concat "<a href=\"" - (org-export-html-format-href link) - "\"" attr ">" - (org-export-html-format-desc desc) - "</a>"))) + ;; standard URL, can't inline as image + (setq rpl + (org-html-make-link opt-plist + type path nil + desc + attr + nil))) ((string= type "coderef") - (setq rpl (format "<a href=\"#coderef-%s\" class=\"coderef\" onmouseover=\"CodeHighlightOn(this, 'coderef-%s');\" onmouseout=\"CodeHighlightOff(this, 'coderef-%s');\">%s</a>" - path path path - (format (org-export-get-coderef-format path (and descp desc)) - (cdr (assoc path org-export-code-refs)))))) + (let* + ((coderef-str (format "coderef-%s" path)) + (attr-1 + (format "class=\"coderef\" onmouseover=\"CodeHighlightOn(this, '%s');\" onmouseout=\"CodeHighlightOff(this, '%s');\"" + coderef-str coderef-str))) + (setq rpl + (org-html-make-link opt-plist + type "" coderef-str + (format + (org-export-get-coderef-format + path + (and descp desc)) + (cdr (assoc path org-export-code-refs))) + attr-1 + nil)))) ((functionp (setq fnc (nth 2 (assoc type org-link-protocols)))) ;; The link protocol has a function for format the link @@ -1114,52 +1259,55 @@ lang=\"%s\" xml:lang=\"%s\"> (funcall fnc (org-link-unescape path) desc1 'html)))) ((string= type "file") - ;; FILE link - (let* ((filename path) - (abs-p (file-name-absolute-p filename)) - thefile file-is-image-p search) + ;; FILE link (save-match-data - (if (string-match "::\\(.*\\)" filename) - (setq search (match-string 1 filename) - filename (replace-match "" t nil filename))) - (setq valid - (if (functionp link-validate) - (funcall link-validate filename current-dir) - t)) - (setq file-is-image-p - (org-file-image-p - filename org-export-html-inline-image-extensions)) - (setq thefile (if abs-p (expand-file-name filename) filename)) - (when (and org-export-html-link-org-files-as-html - (string-match "\\.org$" thefile)) - (setq thefile (concat (substring thefile 0 - (match-beginning 0)) - "." html-extension)) - (if (and search - ;; make sure this is can be used as target search - (not (string-match "^[0-9]*$" search)) - (not (string-match "^\\*" search)) - (not (string-match "^/.*/$" search))) - (setq thefile - (concat thefile - (if (= (string-to-char search) ?#) "" "#") - (org-solidify-link-text - (org-link-unescape search))))) - (when (string-match "^file:" desc) - (setq desc (replace-match "" t t desc)) - (if (string-match "\\.org$" desc) - (setq desc (replace-match "" t t desc)))))) - (setq rpl (if (and file-is-image-p - (or (eq t org-export-html-inline-images) - (and org-export-html-inline-images - (not descp)))) - (progn - (message "image %s %s" thefile org-par-open) - (org-export-html-format-image thefile org-par-open)) - (concat "<a href=\"" thefile "\"" attr ">" - (org-export-html-format-desc desc) - "</a>"))) - (if (not valid) (setq rpl desc)))) + (let* + ((components + (if + (string-match "::\\(.*\\)" path) + (list + (replace-match "" t nil path) + (match-string 1 path)) + (list path nil))) + + ;;The proper path, without a fragment + (path-1 + (first components)) + + ;;The raw fragment + (fragment-0 + (second components)) + + ;;Check the fragment. If it can't be used as + ;;target fragment we'll pass nil instead. + (fragment-1 + (if + (and fragment-0 + (not (string-match "^[0-9]*$" fragment-0)) + (not (string-match "^\\*" fragment-0)) + (not (string-match "^/.*/$" fragment-0))) + (org-solidify-link-text + (org-link-unescape fragment-0)) + nil)) + (desc-2 + ;;Description minus "file:" and ".org" + (if (string-match "^file:" desc) + (let + ((desc-1 (replace-match "" t t desc))) + (if (string-match "\\.org$" desc-1) + (replace-match "" t t desc-1) + desc-1)) + desc))) + + (setq rpl + (if + (and + (functionp link-validate) + (not (funcall link-validate path-1 current-dir))) + desc + (org-html-make-link opt-plist + "file" path-1 fragment-1 desc-2 attr + (org-html-should-inline-p path-1 descp))))))) (t ;; just publish the path, as default @@ -1280,7 +1428,11 @@ lang=\"%s\" xml:lang=\"%s\"> starter (if (match-beginning 2) (substring (match-string 2 line) 0 -1)) line (substring line (match-beginning 5)) + initial-number nil item-tag nil) + (if (string-match "\\`\\[@start:\\([0-9]+\\)\\][ \t]?" line) + (setq initial-number (match-string 1 line) + line (replace-match "" t t line))) (if (and starter (string-match "\\(.*?\\) ::[ \t]*" line)) (setq item-type "d" item-tag (match-string 1 line) @@ -1305,11 +1457,15 @@ lang=\"%s\" xml:lang=\"%s\"> ((and starter (or (not in-local-list) (> ind (car local-list-indent)))) + ;; check for a specified start number ;; Start new (level of) list (org-close-par-maybe) (insert (cond ((equal item-type "u") "<ul>\n<li>\n") - ((equal item-type "o") "<ol>\n<li>\n") + ((equal item-type "o") + (if initial-number + (format "<ol start=%s>\n<li>\n" initial-number) + "<ol>\n<li>\n")) ((equal item-type "d") (format "<dl>\n<dt>%s</dt><dd>\n" item-tag)))) (push item-type local-list-type) @@ -1621,7 +1777,7 @@ lang=\"%s\" xml:lang=\"%s\"> (lambda (x) (string-match "^[ \t]*|-" x)) (cdr lines))))) - (nline 0) fnum i + (nline 0) fnum nfields i tbopen line fields html gr colgropen rowstart rowend) (setq caption (and caption (org-html-do-expand caption))) (if splice (setq head nil)) @@ -1639,7 +1795,8 @@ lang=\"%s\" xml:lang=\"%s\"> (throw 'next-line t))) ;; Break the line into fields (setq fields (org-split-string line "[ \t]*|[ \t]*")) - (unless fnum (setq fnum (make-vector (length fields) 0))) + (unless fnum (setq fnum (make-vector (length fields) 0) + nfields (length fnum))) (setq nline (1+ nline) i -1 rowstart (eval (car org-export-table-row-tags)) rowend (eval (cdr org-export-table-row-tags))) @@ -1647,7 +1804,7 @@ lang=\"%s\" xml:lang=\"%s\"> (mapconcat (lambda (x) (setq i (1+ i)) - (if (and (< i nline) + (if (and (< i nfields) ; make sure no rogue line causes an error here (string-match org-table-number-regexp x)) (incf (aref fnum i))) (cond @@ -1867,7 +2024,7 @@ that uses these same face definitions." (goto-char (point-min))) (defun org-html-protect (s) - ;; convert & to &, < to < and > to > + "convert & to &, < to < and > to >" (let ((start 0)) (while (string-match "&" s start) (setq s (replace-match "&" t t s) @@ -1882,7 +2039,7 @@ that uses these same face definitions." s) (defun org-html-expand (string) - "Prepare STRING for HTML export. Applies all active conversions. + "Prepare STRING for HTML export. Apply all active conversions. If there are links in the string, don't modify these." (let* ((re (concat org-bracket-link-regexp "\\|" (org-re "[ \t]+\\(:[[:alnum:]_@:]+:\\)[ \t]*$"))) @@ -1996,10 +2153,18 @@ If there are links in the string, don't modify these." (defvar local-list-indent) (defvar local-list-type) (defun org-export-html-close-lists-maybe (line) - (let ((ind (or (get-text-property 0 'original-indentation line))) -; (and (string-match "\\S-" line) -; (org-get-indentation line)))) - didclose) + "Close local lists based on the original indentation of the line." + (let* ((rawhtml (and in-local-list + (get-text-property 0 'org-protected line) + (not (get-text-property 0 'org-example line)))) + ;; rawhtml means: This was between #+begin_html..#+end_html + ;; originally, thus it excludes stuff that was a source code example + ;; Actually, this code seems wrong, I don't know why it works, but + ;; it seems to work.... So keep it like this for now. + (ind (if rawhtml + (org-get-indentation line) + (get-text-property 0 'original-indentation line))) + didclose) (when ind (while (and in-local-list (<= ind (car local-list-indent))) @@ -2023,7 +2188,7 @@ When TITLE is nil, just close all open levels." (cdr (assoc target org-export-preferred-target-alist)))) (remove (or preferred target)) (l org-level-max) - snumber href suffix) + snumber snu href suffix) (setq extra-targets (remove remove extra-targets)) (setq extra-targets (mapconcat (lambda (x) @@ -2072,7 +2237,8 @@ When TITLE is nil, just close all open levels." extra-targets title "<br/>\n") (insert "<ul>\n<li>" title "<br/>\n")))) (aset org-levels-open (1- level) t) - (setq snumber (org-section-number level)) + (setq snumber (org-section-number level) + snu (replace-regexp-in-string "\\." "_" snumber)) (setq level (+ level org-export-html-toplevel-hlevel -1)) (if (and org-export-with-section-numbers (not body-only)) (setq title (concat @@ -2080,9 +2246,9 @@ When TITLE is nil, just close all open levels." level snumber) " " title))) (unless (= head-count 1) (insert "\n</div>\n")) - (setq href (cdr (assoc (concat "sec-" snumber) org-export-preferred-target-alist))) - (setq suffix (or href snumber)) - (setq href (or href (concat "sec-" snumber))) + (setq href (cdr (assoc (concat "sec-" snu) org-export-preferred-target-alist))) + (setq suffix (or href snu)) + (setq href (or href (concat "sec-" snu))) (insert (format "\n<div id=\"outline-container-%s\" class=\"outline-%d%s\">\n<h%d id=\"%s\">%s%s</h%d>\n<div class=\"outline-text-%d\" id=\"text-%s\">\n" suffix level (if extra-class (concat " " extra-class) "") level href diff --git a/lisp/org/org-icalendar.el b/lisp/org/org-icalendar.el index 144f261e42d..1c4d7d6ac5b 100644 --- a/lisp/org/org-icalendar.el +++ b/lisp/org/org-icalendar.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -26,8 +26,13 @@ ;; ;;; Commentary: +;;; Code: + (require 'org-exp) +(eval-when-compile + (require 'cl)) + (declare-function org-bbdb-anniv-export-ical "org-bbdb" nil) (defgroup org-export-icalendar nil @@ -47,6 +52,11 @@ The file name should be absolute, the file will be overwritten without warning." :group 'org-export-icalendar :type 'string) +(defcustom org-icalendar-combined-description nil + "Calendar description for the combined iCalendar representing all agenda files." + :group 'org-export-icalendar + :type 'string) + (defcustom org-icalendar-use-plain-timestamp t "Non-nil means make an event from every plain time stamp." :group 'org-export-icalendar @@ -157,7 +167,7 @@ The iCalendar standard requires that all entries have a unique identifier. Org will create these identifiers as needed. When this variable is non-nil, the created UIDs will be stored in the ID property of the entry. Then the next time this entry is exported, it will be exported with the same UID, -superceding the previous form of it. This is essential for +superseding the previous form of it. This is essential for synchronization services. This variable is not turned on by default because we want to avoid creating a property drawer in every entry if people are only playing with this feature, @@ -185,7 +195,7 @@ file, but with extension `.ics'." ;;;###autoload (defun org-export-icalendar-all-agenda-files () - "Export all files in `org-agenda-files' to iCalendar .ics files. + "Export all files in the variable `org-agenda-files' to iCalendar .ics files. Each iCalendar file will be located in the same directory as the Org-mode file, but with extension `.ics'." (interactive) @@ -511,11 +521,12 @@ whitespace, newlines, drawers, and timestamps, and cut it down to MAXLENGTH characters." (if (not s) nil - (when is-body + (if is-body (let ((re (concat "\\(" org-drawer-regexp "\\)[^\000]*?:END:.*\n?")) (re2 (concat "^[ \t]*" org-keyword-time-regexp ".*\n?"))) (while (string-match re s) (setq s (replace-match "" t t s))) - (while (string-match re2 s) (setq s (replace-match "" t t s))))) + (while (string-match re2 s) (setq s (replace-match "" t t s)))) + (setq s (replace-regexp-in-string "[[:space:]]+" " " s))) (let ((start 0)) (while (string-match "\\([,;]\\)" s start) (setq start (+ (match-beginning 0) 2) @@ -563,14 +574,16 @@ not used right now." (name (or name "unknown")) (timezone (if (> (length org-icalendar-timezone) 0) org-icalendar-timezone - (cadr (current-time-zone))))) + (cadr (current-time-zone)))) + (description org-icalendar-combined-description)) (princ (format "BEGIN:VCALENDAR VERSION:2.0 X-WR-CALNAME:%s PRODID:-//%s//Emacs with Org-mode//EN X-WR-TIMEZONE:%s -CALSCALE:GREGORIAN\n" name user timezone)))) +X-WR-CALDESC:%s +CALSCALE:GREGORIAN\n" name user timezone description)))) (defun org-finish-icalendar-file () "Finish an iCalendar file by inserting the END statement." @@ -581,22 +594,24 @@ CALSCALE:GREGORIAN\n" name user timezone)))) KEYWORD is added in front, to make a complete line like DTSTART.... When INC is non-nil, increase the hour by two (if time string contains a time), or the day by one (if it does not contain a time)." - (let ((t1 (org-parse-time-string s 'nodefault)) + (let ((t1 (ignore-errors (org-parse-time-string s 'nodefault))) t2 fmt have-time time) - (if (and (car t1) (nth 1 t1) (nth 2 t1)) - (setq t2 t1 have-time t) - (setq t2 (org-parse-time-string s))) - (let ((s (car t2)) (mi (nth 1 t2)) (h (nth 2 t2)) - (d (nth 3 t2)) (m (nth 4 t2)) (y (nth 5 t2))) - (when inc - (if have-time - (if org-agenda-default-appointment-duration - (setq mi (+ org-agenda-default-appointment-duration mi)) - (setq h (+ 2 h))) - (setq d (1+ d)))) - (setq time (encode-time s mi h d m y))) - (setq fmt (if have-time ":%Y%m%dT%H%M%S" ";VALUE=DATE:%Y%m%d")) - (concat keyword (format-time-string fmt time)))) + (if (not t1) + "" + (if (and (car t1) (nth 1 t1) (nth 2 t1)) + (setq t2 t1 have-time t) + (setq t2 (org-parse-time-string s))) + (let ((s (car t2)) (mi (nth 1 t2)) (h (nth 2 t2)) + (d (nth 3 t2)) (m (nth 4 t2)) (y (nth 5 t2))) + (when inc + (if have-time + (if org-agenda-default-appointment-duration + (setq mi (+ org-agenda-default-appointment-duration mi)) + (setq h (+ 2 h))) + (setq d (1+ d)))) + (setq time (encode-time s mi h d m y))) + (setq fmt (if have-time ":%Y%m%dT%H%M%S" ";VALUE=DATE:%Y%m%d")) + (concat keyword (format-time-string fmt time))))) (provide 'org-icalendar) diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el index d0bb53456e9..d16e5d81c8e 100644 --- a/lisp/org/org-id.el +++ b/lisp/org/org-id.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -37,8 +37,9 @@ ;; time of the ID, with microsecond accuracy. This virtually ;; guarantees globally unique identifiers, even if several people are ;; creating IDs at the same time in files that will eventually be used -;; together. As an external method `uuidgen' is supported, if installed -;; on the system. +;; together. +;; +;; By default Org uses UUIDs as global unique identifiers. ;; ;; This file defines the following API: ;; @@ -68,6 +69,8 @@ ;; Find the location of an entry with specific id. ;; +;;; Code: + (require 'org) (declare-function message-make-fqdn "message" ()) @@ -84,18 +87,9 @@ :group 'org-id :type 'string) -(defcustom org-id-method - (condition-case nil - (if (string-match "\\`[-0-9a-fA-F]\\{36\\}\\'" - (org-trim (shell-command-to-string - org-id-uuid-program))) - 'uuidgen - 'org) - (error 'org)) +(defcustom org-id-method 'uuid "The method that should be used to create new IDs. -If `uuidgen' is available on the system, it will be used as the default method. -if not, the method `org' is used. An ID will consist of the optional prefix specified in `org-id-prefix', and a unique part created by the method this variable specifies. @@ -105,11 +99,13 @@ org Org's own internal method, using an encoding of the current time to microsecond accuracy, and optionally the current domain of the computer. See the variable `org-id-include-domain'. -uuidgen Call the external command uuidgen." +uuid Create random (version 4) UUIDs. If the program defined in + `org-id-uuid-program' is available it is used to create the ID. + Otherwise an internal functions is used." :group 'org-id :type '(choice (const :tag "Org's internal method" org) - (const :tag "external: uuidgen" uuidgen))) + (const :tag "external: uuidgen" uuid))) (defcustom org-id-prefix nil "The prefix for IDs. @@ -306,8 +302,10 @@ So a typical ID could look like \"Org:4nd91V40HI\"." unique) (if (equal prefix ":") (setq prefix "")) (cond - ((eq org-id-method 'uuidgen) - (setq unique (org-trim (shell-command-to-string org-id-uuid-program)))) + ((memq org-id-method '(uuidgen uuid)) + (setq unique (org-trim (shell-command-to-string org-id-uuid-program))) + (unless (org-uuidgen-p unique) + (setq unique (org-id-uuid)))) ((eq org-id-method 'org) (let* ((etime (org-id-reverse-string (org-id-time-to-b36))) (postfix (if org-id-include-domain @@ -318,6 +316,30 @@ So a typical ID could look like \"Org:4nd91V40HI\"." (t (error "Invalid `org-id-method'"))) (concat prefix unique))) +(defun org-id-uuid () + "Return string with random (version 4) UUID." + (let ((rnd (md5 (format "%s%s%s%s%s%s%s" + (random t) + (current-time) + (user-uid) + (emacs-pid) + (user-full-name) + user-mail-address + (recent-keys))))) + (format "%s-%s-4%s-%s%s-%s" + (substring rnd 0 8) + (substring rnd 8 12) + (substring rnd 13 16) + (format "%x" + (logior + #b10000000 + (logand + #b10111111 + (string-to-number + (substring rnd 16 18) 16)))) + (substring rnd 18 20) + (substring rnd 20 32)))) + (defun org-id-reverse-string (s) (mapconcat 'char-to-string (nreverse (string-to-list s)) "")) diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el index 7fb4e421dcc..d88688d19ba 100644 --- a/lisp/org/org-indent.el +++ b/lisp/org/org-indent.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -29,22 +29,24 @@ ;; by adding text properties to a buffer to make sure lines are ;; indented according to outline structure. +;;; Code: + (require 'org-macs) (require 'org-compat) (require 'org) + (eval-when-compile (require 'cl)) - (defgroup org-indent nil "Options concerning dynamic virtual outline indentation." :tag "Org Indent" :group 'org) (defconst org-indent-max 40 - "Maximum indentation in characters") + "Maximum indentation in characters.") (defconst org-indent-max-levels 40 - "Maximum indentation in characters") + "Maximum indentation in characters.") (defvar org-indent-strings nil "Vector with all indentation strings. @@ -53,7 +55,7 @@ It will be set in `org-indent-initialize'.") "Vector with all indentation star strings. It will be set in `org-indent-initialize'.") (defvar org-hide-leading-stars-before-indent-mode nil - "Used locally") + "Used locally.") (defcustom org-indent-boundary-char ?\ ; comment to protect space char "The end of the virtual indentation strings, a single-character string. @@ -67,13 +69,15 @@ it may be prettier to customize the org-indent face." :type 'character) (defcustom org-indent-mode-turns-off-org-adapt-indentation t - "Non-nil means turning on `org-indent-mode' turns off indentation adaptation. + "Non-nil means setting the variable `org-indent-mode' will \ +turn off indentation adaptation. For details see the variable `org-adapt-indentation'." :group 'org-indent :type 'boolean) (defcustom org-indent-mode-turns-on-hiding-stars t - "Non-nil means turning on `org-indent-mode' turns on `org-hide-leading-stars'." + "Non-nil means setting the variable `org-indent-mode' will \ +turn on `org-hide-leading-stars'." :group 'org-indent :type 'boolean) @@ -127,44 +131,57 @@ Internally this works by adding `line-prefix' properties to all non-headlines. These properties are updated locally in idle time. FIXME: How to update when broken?" nil " Ind" nil - (if (org-bound-and-true-p org-inhibit-startup) - (setq org-indent-mode nil) - (if org-indent-mode - (progn - (or org-indent-strings (org-indent-initialize)) - (when org-indent-mode-turns-off-org-adapt-indentation - (org-set-local 'org-adapt-indentation nil)) - (when org-indent-mode-turns-on-hiding-stars - (org-set-local 'org-hide-leading-stars-before-indent-mode - org-hide-leading-stars) - (org-set-local 'org-hide-leading-stars t)) - (make-local-variable 'buffer-substring-filters) - (add-to-list 'buffer-substring-filters - 'org-indent-remove-properties-from-string) - (org-add-hook 'org-after-demote-entry-hook - 'org-indent-refresh-section nil 'local) - (org-add-hook 'org-after-promote-entry-hook - 'org-indent-refresh-section nil 'local) - (org-add-hook 'org-font-lock-hook - 'org-indent-refresh-to nil 'local) - (and font-lock-mode (org-restart-font-lock)) - ) - (save-excursion - (save-restriction - (org-indent-remove-properties (point-min) (point-max)) - (kill-local-variable 'org-adapt-indentation) - (when (boundp 'org-hide-leading-stars-before-indent-mode) - (org-set-local 'org-hide-leading-stars - org-hide-leading-stars-before-indent-mode)) - (setq buffer-substring-filters - (delq 'org-indent-remove-properties-from-string - buffer-substring-filters)) - (remove-hook 'org-after-promote-entry-hook - 'org-indent-refresh-section 'local) - (remove-hook 'org-after-demote-entry-hook - 'org-indent-refresh-section 'local) - (and font-lock-mode (org-restart-font-lock)) - (redraw-display)))))) + (cond + ((org-bound-and-true-p org-inhibit-startup) + (setq org-indent-mode nil)) + ((and org-indent-mode (featurep 'xemacs)) + (message "org-indent-mode does not work in XEmacs - refused to turn it on") + (setq org-indent-mode nil)) + ((and org-indent-mode + (not (org-version-check "23.1.50" "Org Indent mode" :predicate))) + (message "org-indent-mode is can crash Emacs 23.1 - refused to turn it on!") + (ding) + (sit-for 1) + (setq org-indent-mode nil)) + (org-indent-mode + ;; mode was turned on. + (org-set-local 'indent-tabs-mode nil) + (or org-indent-strings (org-indent-initialize)) + (when org-indent-mode-turns-off-org-adapt-indentation + (org-set-local 'org-adapt-indentation nil)) + (when org-indent-mode-turns-on-hiding-stars + (org-set-local 'org-hide-leading-stars-before-indent-mode + org-hide-leading-stars) + (org-set-local 'org-hide-leading-stars t)) + (make-local-variable 'buffer-substring-filters) + (add-to-list 'buffer-substring-filters + 'org-indent-remove-properties-from-string) + (org-add-hook 'org-after-demote-entry-hook + 'org-indent-refresh-section nil 'local) + (org-add-hook 'org-after-promote-entry-hook + 'org-indent-refresh-section nil 'local) + (org-add-hook 'org-font-lock-hook + 'org-indent-refresh-to nil 'local) + (and font-lock-mode (org-restart-font-lock)) + ) + (t + ;; mode was turned off (or we refused to turn it on) + (save-excursion + (save-restriction + (org-indent-remove-properties (point-min) (point-max)) + (kill-local-variable 'org-adapt-indentation) + (when (boundp 'org-hide-leading-stars-before-indent-mode) + (org-set-local 'org-hide-leading-stars + org-hide-leading-stars-before-indent-mode)) + (setq buffer-substring-filters + (delq 'org-indent-remove-properties-from-string + buffer-substring-filters)) + (remove-hook 'org-after-promote-entry-hook + 'org-indent-refresh-section 'local) + (remove-hook 'org-after-demote-entry-hook + 'org-indent-refresh-section 'local) + (and font-lock-mode (org-restart-font-lock)) + (redraw-display)))))) (defface org-indent diff --git a/lisp/org/org-info.el b/lisp/org/org-info.el index e33adf43ee0..3c6bf7d2ca4 100644 --- a/lisp/org/org-info.el +++ b/lisp/org/org-info.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-inlinetask.el b/lisp/org/org-inlinetask.el index 5232f2c264b..43d59b0b558 100644 --- a/lisp/org/org-inlinetask.el +++ b/lisp/org/org-inlinetask.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; This file is part of GNU Emacs. @@ -33,7 +33,7 @@ ;; and properties. However, these nodes are treated specially by the ;; visibility cycling and export commands. ;; -;; Visibility cycling exempts these nodes from cycling. So whenever their +;; Visibility cycling exempts these nodes from cycling. So whenever their ;; parent is opened, so are these tasks. This will only work with ;; `org-cycle', so if you are also using other commands to show/hide ;; entries, you will occasionally find these tasks to behave like @@ -74,8 +74,7 @@ ;; ;; C-c C-x t Insert a new inline task with END line - -;;; Code +;;; Code: (require 'org) @@ -105,12 +104,28 @@ When nil, they will not be exported." (defvar org-complex-heading-regexp) (defvar org-property-end-re) -(defun org-inlinetask-insert-task () - "Insert an inline task." - (interactive) +(defcustom org-inlinetask-defaut-state nil + "Non-nil means make inline tasks have a TODO keyword initially. +This should be the state `org-inlinetask-insert-task' should use by +default, or nil of no state should be assigned." + :group 'org-inlinetask + :type '(choice + (const :tag "No state" nil) + (string :tag "Specific state"))) + +(defun org-inlinetask-insert-task (&optional no-state) + "Insert an inline task. +If prefix arg NO-STATE is set, ignore `org-inlinetask-defaut-state'." + (interactive "P") (or (bolp) (newline)) - (insert (make-string org-inlinetask-min-level ?*) " \n" - (make-string org-inlinetask-min-level ?*) " END\n") + (let ((indent org-inlinetask-min-level)) + (if org-odd-levels-only + (setq indent (- (* 2 indent) 1))) + (insert (make-string indent ?*) + (if (or no-state (not org-inlinetask-defaut-state)) + " \n" + (concat " " org-inlinetask-defaut-state " \n")) + (make-string indent ?*) " END\n")) (end-of-line -1)) (define-key org-mode-map "\C-c\C-xt" 'org-inlinetask-insert-task) diff --git a/lisp/org/org-irc.el b/lisp/org/org-irc.el index 2639e303e85..3e3631ae979 100644 --- a/lisp/org/org-irc.el +++ b/lisp/org/org-irc.el @@ -4,7 +4,7 @@ ;; ;; Author: Philip Jackson <emacs@shellarchive.co.uk> ;; Keywords: erc, irc, link, org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-jsinfo.el b/lisp/org/org-jsinfo.el index 61d225e8276..de0f46d5293 100644 --- a/lisp/org/org-jsinfo.el +++ b/lisp/org/org-jsinfo.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -26,12 +26,12 @@ ;; ;;; Commentary: -;; This file implements the support for Sebastian Rose's Javascript +;; This file implements the support for Sebastian Rose's JavaScript ;; org-info.js to display an org-mode file exported to HTML in an ;; Info-like way, or using folding similar to the outline structure ;; org org-mode itself. -;; Documentation for using this module is in the Org manual. The script +;; Documentation for using this module is in the Org manual. The script ;; itself is documented by Sebastian Rose in a file distributed with ;; the script. FIXME: Accurate pointers! @@ -87,7 +87,7 @@ line in the buffer. See also the variable `org-infojs-options'." (defcustom org-infojs-options (mapcar (lambda (x) (cons (car x) (nth 2 x))) org-infojs-opts-table) - "Options settings for the INFOJS Javascript. + "Options settings for the INFOJS JavaScript. Each of the options must have an entry in `org-export-html/infojs-opts-table'. The value can either be a string that will be passed to the script, or a property. This property is then assumed to be a property that is defined diff --git a/lisp/org/org-latex.el b/lisp/org/org-latex.el index 4241fd20f7f..55444c08bbe 100644 --- a/lisp/org/org-latex.el +++ b/lisp/org/org-latex.el @@ -4,7 +4,7 @@ ;; ;; Emacs Lisp Archive Entry ;; Filename: org-latex.el -;; Version: 6.35i +;; Version: 7.01 ;; Author: Bastien Guerry <bzg AT altern DOT org> ;; Maintainer: Carsten Dominik <carsten.dominik AT gmail DOT com> ;; Keywords: org, wp, tex @@ -144,10 +144,11 @@ class, you can use the following macro-like placeholders. [DEFAULT-PACKAGES] \\usepackage statements for default packages [NO-DEFAULT-PACKAGES] do not include any of the default packages - [PACKAGES] \\usepackage statements for packages + [PACKAGES] \\usepackage statements for packages [NO-PACKAGES] do not include the packages [EXTRA] the stuff from #+LaTeX_HEADER [NO-EXTRA] do not include #+LaTeX_HEADER stuff + [BEAMER-HEADER-EXTRA] the beamer extra headers So a header like @@ -384,7 +385,7 @@ for example using customize, or with something like (shell-script "bash") (gnuplot "Gnuplot") (ocaml "Caml") (caml "Caml") - (sql "SQL")) + (sql "SQL") (sqlite "sql")) "Alist mapping languages to their listing language counterpart. The key is a symbol, the major mode symbol without the \"-mode\". The value is the string that should be inserted as the language parameter @@ -399,7 +400,7 @@ hurt if it is present." (defcustom org-export-latex-remove-from-headlines '(:todo nil :priority nil :tags nil) - "A plist of keywords to remove from headlines. OBSOLETE. + "A plist of keywords to remove from headlines. OBSOLETE. Non-nil means remove this keyword type from the headline. Don't remove the keys, just change their values. @@ -415,6 +416,11 @@ and `org-export-with-tags' instead." :group 'org-export-latex :type 'string) +(defcustom org-export-latex-tabular-environment "tabular" + "Default environment used to build tables." + :group 'org-export-latex + :type 'string) + (defcustom org-export-latex-inline-image-extensions '("pdf" "jpeg" "jpg" "png" "ps" "eps") "Extensions of image files that can be inlined into LaTeX. @@ -426,7 +432,7 @@ allowed. The default we use here encompasses both." :type '(repeat (string :tag "Extension"))) (defcustom org-export-latex-coding-system nil - "Coding system for the exported LaTex file." + "Coding system for the exported LaTeX file." :group 'org-export-latex :type 'coding-system) @@ -580,10 +586,11 @@ non-nil, create a buffer with that name and export to that buffer. If TO-BUFFER is the symbol `string', don't leave any buffer behind but just return the resulting LaTeX as a string. When BODY-ONLY is set, don't produce the file header and footer, -simply return the content of \begin{document}...\end{document}, -without even the \begin{document} and \end{document} commands. +simply return the content of \\begin{document}...\\end{document}, +without even the \\begin{document} and \\end{document} commands. when PUB-DIR is set, use this as the publishing directory." (interactive "P") + (when (and (not body-only) arg (listp arg)) (setq body-only t)) (run-hooks 'org-export-first-hook) ;; Make sure we have a file name when we need it. @@ -649,7 +656,7 @@ when PUB-DIR is set, use this as the publishing directory." (org-entry-get rbeg "EXPORT_FILE_NAME" t)) (file-name-nondirectory ;sans-extension (or buffer-file-name - (error "Don't know which export file to use."))))) + (error "Don't know which export file to use"))))) ".tex"))) (filename (and filename @@ -792,7 +799,9 @@ when PUB-DIR is set, use this as the publishing directory." (replace-match "\n"))) (run-hooks 'org-export-latex-final-hook) - (or to-buffer (save-buffer)) + (if to-buffer + (unless (eq major-mode 'latex-mode) (latex-mode)) + (save-buffer)) (org-export-latex-fix-inputenc) (run-hooks 'org-export-latex-after-save-hook) (goto-char (point-min)) @@ -827,7 +836,7 @@ when PUB-DIR is set, use this as the publishing directory." (with-current-buffer outbuf (erase-buffer)) (message "Processing LaTeX file...") (if (and cmds (symbolp cmds)) - (funcall cmds file) + (funcall cmds (shell-quote-argument file)) (while cmds (setq cmd (pop cmds)) (while (string-match "%b" cmd) @@ -1085,7 +1094,7 @@ LEVEL indicates the default depth for export." (save-restriction (widen) (goto-char (point-min)) - (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\([a-zA-Z]+\\)" nil t) + (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\(-[a-zA-Z]+\\)" nil t) (match-string 1)))) (plist-get org-export-latex-options-plist :latex-class) org-export-latex-default-class) @@ -1127,7 +1136,7 @@ LEVEL indicates the default depth for export." (defvar org-export-latex-format-toc-function 'org-export-latex-format-toc-default - "The function formatting returning the string to createthe table of contents. + "The function formatting returning the string to create the table of contents. The function mus take one parameter, the depth of the table of contents.") (defun org-export-latex-make-header (title opt-plist) @@ -1144,7 +1153,7 @@ OPT-PLIST is the options plist for current buffer." (org-splice-latex-header (org-export-apply-macros-in-string org-export-latex-header) org-export-latex-default-packages-alist - org-export-latex-packages-alist + org-export-latex-packages-alist nil (org-export-apply-macros-in-string (plist-get opt-plist :latex-header-extra))) ;; append another special variable @@ -1212,9 +1221,16 @@ If END is non-nil, it is the end of the region." :timestamps (plist-get opt-plist :timestamps) :footnotes (plist-get opt-plist :footnotes))) (org-unmodified - (let ((inhibit-read-only t)) - (add-text-properties pt (max pt (1- end)) - '(:org-license-to-kill t)))))))) + (let ((inhibit-read-only t) + (limit (max pt (1- end)))) + (add-text-properties pt limit + '(:org-license-to-kill t)) + (save-excursion + (goto-char pt) + (while (re-search-forward "^[ \t]*#+.*\n?" limit t) + (remove-text-properties (match-beginning 0) (match-end 0) + '(:org-license-to-kill t)))))))))) + (defvar org-export-latex-header-defs nil "The header definitions that might be used in the LaTeX body.") @@ -1286,7 +1302,8 @@ links, keywords, lists, tables, fixed-width" (cdr todo-markup) (car todo-markup))) (t (cdr (or (assoc (match-string 1) todo-markup) (car todo-markup)))))) - (replace-match (format fmt (match-string 1)) t t))) + (replace-match (org-export-latex-protect-string + (format fmt (match-string 1))) t t))) ;; convert priority string (when (re-search-forward "\\[\\\\#.\\]" nil t) (if (plist-get remove-list :priority) @@ -1323,7 +1340,7 @@ links, keywords, lists, tables, fixed-width" (unless (or ;; check for comment line (save-excursion (goto-char (match-beginning 0)) - (equal (char-after (point-at-bol)) ?#)) + (org-in-indented-comment-line)) ;; Check if this is a defined entity, so that is may need conversion (org-entity-get (match-string 1))) (add-text-properties (match-beginning 0) (match-end 0) @@ -1469,7 +1486,9 @@ Convert CHAR depending on STRING-BEFORE and STRING-AFTER." ((and (> (length string-after) 1) (or (eq subsup t) (and (equal subsup '{}) (eq (string-to-char string-after) ?\{))) - (string-match "[({]?\\([^)}]+\\)[)}]?" string-after)) + (or (string-match "[{]?\\([^}]+\\)[}]?" string-after) + (string-match "[(]?\\([^)]+\\)[)]?" string-after))) + (org-export-latex-protect-string (format "%s$%s{%s}$" string-before char (if (and (> (match-end 1) (1+ (match-beginning 1))) @@ -1531,20 +1550,20 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." "When OPT is non-nil convert fixed-width sections to LaTeX." (goto-char (point-min)) (while (re-search-forward "^[ \t]*:\\([ \t]\\|$\\)" nil t) - (if opt - (progn (goto-char (match-beginning 0)) - (insert "\\begin{verbatim}\n") - (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$") - (replace-match (concat (match-string 1) - (match-string 2)) t t) - (forward-line)) - (insert "\\end{verbatim}\n\n")) - (progn (goto-char (match-beginning 0)) - (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$") - (replace-match (concat "%" (match-string 1) - (match-string 2)) t t) - (forward-line)))))) - + (unless (get-text-property (point) 'org-example) + (if opt + (progn (goto-char (match-beginning 0)) + (insert "\\begin{verbatim}\n") + (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$") + (replace-match (concat (match-string 1) + (match-string 2)) t t) + (forward-line)) + (insert "\\end{verbatim}\n\n")) + (progn (goto-char (match-beginning 0)) + (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$") + (replace-match (concat "%" (match-string 1) + (match-string 2)) t t) + (forward-line))))))) (defvar org-table-last-alignment) ; defined in org-table.el (defvar org-table-last-column-widths) ; defined in org-table.el @@ -1570,7 +1589,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (org-table-last-column-widths (copy-sequence org-table-last-column-widths)) fnum fields line lines olines gr colgropen line-fmt align - caption label attr floatp longtblp) + caption shortn label attr floatp longtblp) (if org-export-latex-tables-verbatim (let* ((tbl (concat "\\begin{verbatim}\n" raw-table "\\end{verbatim}\n"))) @@ -1579,6 +1598,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (progn (setq caption (org-find-text-property-in-string 'org-caption raw-table) + shortn (org-find-text-property-in-string + 'org-caption-shortn raw-table) attr (org-find-text-property-in-string 'org-attributes raw-table) label (org-find-text-property-in-string @@ -1586,7 +1607,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." longtblp (and attr (stringp attr) (string-match "\\<longtable\\>" attr)) align (and attr (stringp attr) - (string-match "\\<align=\\([^ \t\n\r,]+\\)" attr) + (string-match "\\<align=\\([^ \t\n\r]+\\)" attr) (match-string 1 attr)) floatp (or caption label)) (setq caption (and caption (org-export-latex-fontify-headline caption))) @@ -1646,13 +1667,15 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (if floatp "\\begin{table}[htb]\n")) (if floatp (format - "\\caption{%s%s}" - (if label (concat "\\\label{" label "}") "") + "\\caption%s{%s}" + (if shortn (concat "[" shortn "]") "") (or caption ""))) (if (and longtblp caption) "\\\\\n" "\n") (if (and org-export-latex-tables-centered (not longtblp)) "\\begin{center}\n") - (if (not longtblp) (concat "\\begin{tabular}{" align "}\n")) + (if (not longtblp) + (format "\\begin{%s}{%s}\n" + org-export-latex-tabular-environment align)) (orgtbl-to-latex lines `(:tstart nil :tend nil @@ -1664,7 +1687,9 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." \\endfoot \\endlastfoot" (length org-table-last-alignment)) nil))) - (if (not longtblp) (concat "\n\\end{tabular}")) + (if (not longtblp) + (format "\n\\end{%s}" + org-export-latex-tabular-environment)) (if longtblp "\n" (if org-export-latex-tables-centered "\n\\end{center}\n" "\n")) (if longtblp @@ -1674,10 +1699,11 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (defun org-export-latex-convert-table.el-table () "Replace table.el table at point with LaTeX code." - (let (tbl caption label line floatp attr align rmlines) + (let (tbl caption shortn label line floatp attr align rmlines) (setq line (buffer-substring (point-at-bol) (point-at-eol)) label (org-get-text-property-any 0 'org-label line) caption (org-get-text-property-any 0 'org-caption line) + shortn (org-get-text-property-any 0 'org-caption-shortn line) attr (org-get-text-property-any 0 'org-attributes line) align (and attr (stringp attr) (string-match "\\<align=\\([^ \t\n\r,]+\\)" attr) @@ -1715,7 +1741,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (setq tbl (concat "\\begin{center}\n" tbl "\\end{center}"))) (when floatp (setq tbl (concat "\\begin{table}\n" - (format "\\caption{%s%s}\n" + (format "\\caption%s{%s%s}\n" + (if shortn (format "[%s]" shortn) "") (if label (format "\\label{%s}" label) "") (or caption "")) tbl @@ -1738,6 +1765,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (unless (or (and (get-text-property (- (point) 2) 'org-protected) (not (get-text-property (- (point) 2) 'org-verbatim-emph))) + (equal (char-after (match-beginning 3)) + (char-after (1+ (match-beginning 3)))) (save-excursion (goto-char (match-beginning 1)) (save-match-data @@ -1814,10 +1843,11 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." "file"))) (coderefp (equal type "coderef")) (caption (org-find-text-property-in-string 'org-caption raw-path)) + (shortn (org-find-text-property-in-string 'org-caption-shortn raw-path)) (attr (or (org-find-text-property-in-string 'org-attributes raw-path) (plist-get org-export-latex-options-plist :latex-image-options))) (label (org-find-text-property-in-string 'org-label raw-path)) - imgp radiop + imgp radiop fnc ;; define the path of the link (path (cond ((member type '("coderef")) @@ -1851,7 +1881,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (plist-get org-export-latex-options-plist :inline-images)) ;; OK, we need to inline an image (insert - (org-export-latex-format-image raw-path caption label attr))) + (org-export-latex-format-image raw-path caption label attr shortn))) (coderefp (insert (format (org-export-get-coderef-format path desc) @@ -1871,19 +1901,28 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (setq path (org-export-latex-protect-amp path) desc (org-export-latex-protect-amp desc))) (insert (format org-export-latex-hyperref-format path desc))) + + ((functionp (setq fnc (nth 2 (assoc type org-link-protocols)))) + ;; The link protocol has a function for formatting the link + (insert + (save-match-data + (funcall fnc (org-link-unescape raw-path) desc 'latex)))) + (t (insert "\\texttt{" desc "}"))))))) -(defun org-export-latex-format-image (path caption label attr) +(defun org-export-latex-format-image (path caption label attr &optional shortn) "Format the image element, depending on user settings." - (let (ind floatp wrapp placement figenv) + (let (ind floatp wrapp multicolumnp placement figenv) (setq floatp (or caption label)) (setq ind (org-get-text-property-any 0 'original-indentation path)) (when (and attr (stringp attr)) (if (string-match "[ \t]*\\<wrap\\>" attr) (setq wrapp t floatp nil attr (replace-match "" t t attr))) (if (string-match "[ \t]*\\<float\\>" attr) - (setq wrapp nil floatp t attr (replace-match "" t t attr)))) + (setq wrapp nil floatp t attr (replace-match "" t t attr))) + (if (string-match "[ \t]*\\<multicolumn\\>" attr) + (setq multicolumnp t attr (replace-match "" t t attr)))) (setq placement (cond @@ -1905,8 +1944,13 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (wrapp "\\begin{wrapfigure}%placement \\centering \\includegraphics[%attr]{%path} -\\caption{%labelcmd%caption} +\\caption%shortn{%labelcmd%caption} \\end{wrapfigure}") + (multicolumnp "\\begin{figure*}%placement +\\centering +\\includegraphics[%attr]{%path} +\\caption{%labelcmd%caption} +\\end{figure*}") (floatp "\\begin{figure}%placement \\centering \\includegraphics[%attr]{%path} @@ -1931,6 +1975,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (expand-file-name path) path)) (cons "attr" attr) + (cons "shortn" (if shortn (format "[%s]" shortn) "")) (cons "labelcmd" (if label (format "\\label{%s}" label)"")) (cons "caption" (or caption "")) @@ -1949,7 +1994,6 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." s)) (defvar org-latex-entities) ; defined below (defvar org-latex-entities-regexp) ; defined below -(defvar org-latex-entities-exceptions) ; defined below (defun org-export-latex-preprocess (parameters) "Clean stuff in the LaTeX export." @@ -1962,7 +2006,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." ;; Preserve latex environments (goto-char (point-min)) (while (re-search-forward "^[ \t]*\\\\begin{\\([a-zA-Z]+\\*?\\)}" nil t) - (let* ((start (progn (beginning-of-line) (point))) + (org-if-unprotected + (let* ((start (progn (beginning-of-line) (point))) (end (and (re-search-forward (concat "^[ \t]*\\\\end{" (regexp-quote (match-string 1)) @@ -1970,7 +2015,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (point-at-eol)))) (if end (add-text-properties start end '(org-protected t)) - (goto-char (point-at-eol))))) + (goto-char (point-at-eol)))))) ;; Preserve math snippets @@ -2052,25 +2097,28 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." "\\(?:<[^<>\n]*>\\)*" "\\(" (org-create-multibrace-regexp "{" "}" 3) "\\)\\{1,3\\}"))) (while (re-search-forward re nil t) - (unless (or + (unless (or ;; check for comment line (save-excursion (goto-char (match-beginning 0)) - (equal (char-after (point-at-bol)) ?#)) + (org-in-indented-comment-line)) ;; Check if this is a defined entity, so that is may need conversion (org-entity-get (match-string 1)) ) (add-text-properties (match-beginning 0) (match-end 0) '(org-protected t))))) + ;; Special case for \nbsp + (goto-char (point-min)) + (while (re-search-forward "\\\\nbsp\\({}\\|\\>\\)" nil t) + (org-if-unprotected + (replace-match (org-export-latex-protect-string "~")))) + ;; Protect LaTeX entities (goto-char (point-min)) - (let (a) - (while (re-search-forward org-latex-entities-regexp nil t) - (if (setq a (assoc (match-string 0) org-latex-entities-exceptions)) - (replace-match (org-add-props (nth 1 a) nil 'org-protected t) - t t) - (add-text-properties (match-beginning 0) (match-end 0) - '(org-protected t))))) + (while (re-search-forward org-latex-entities-regexp nil t) + (org-if-unprotected + (add-text-properties (match-beginning 0) (match-end 0) + '(org-protected t)))) ;; Replace radio links (goto-char (point-min)) @@ -2142,7 +2190,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (replace-match ""))))) (defun org-export-latex-fix-inputenc () - "Set the codingsystem in inputenc to what the buffer is." + "Set the coding system in inputenc to what the buffer is." (let* ((cs buffer-file-coding-system) (opt (or (ignore-errors (latexenc-coding-system-to-inputenc cs)) "utf8"))) @@ -2163,13 +2211,22 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (defun org-export-latex-lists () "Convert plain text lists in current buffer into LaTeX lists." - (goto-char (point-min)) - (while (re-search-forward org-list-beginning-re nil t) - (org-if-unprotected - (beginning-of-line) - (insert (org-list-to-latex (org-list-parse-list t) - org-export-latex-list-parameters)) - "\n"))) + (let (res) + (goto-char (point-min)) + (while (org-re-search-forward-unprotected org-list-beginning-re nil t) + (beginning-of-line) + (setq res (org-list-to-latex (org-list-parse-list t) + org-export-latex-list-parameters)) + (while (string-match "^\\(\\\\item[ \t]+\\)\\[@start:\\([0-9]+\\)\\]" + res) + (setq res (replace-match + (concat (format "\\setcounter{enumi}{%d}" + (1- (string-to-number + (match-string 2 res)))) + "\n" + (match-string 1 res)) + t t res))) + (insert res "\n")))) (defconst org-latex-entities '("\\!" @@ -2276,7 +2333,6 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." "\\medskip" "\\multicolumn" "\\multiput" - ("\\nbsp" "~") "\\newcommand" "\\newcounter" "\\newenvironment" @@ -2348,14 +2404,9 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." "\\vspace") "A list of LaTeX commands to be protected when performing conversion.") -(defvar org-latex-entities-exceptions nil) - (defconst org-latex-entities-regexp (let (names rest) (dolist (x org-latex-entities) - (when (consp x) - (add-to-list 'org-latex-entities-exceptions x) - (setq x (car x))) (if (string-match "[a-zA-Z]$" x) (push x names) (push x rest))) diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index 84eb78c1303..f1d6520fe51 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/org-list.el @@ -7,7 +7,7 @@ ;; Bastien Guerry <bzg AT altern DOT org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -31,6 +31,8 @@ ;;; Code: +(eval-when-compile + (require 'cl)) (require 'org-macs) (require 'org-compat) @@ -84,7 +86,29 @@ heading will be exposed in a children' view." (defcustom org-list-demote-modify-bullet nil "Default bullet type installed when demoting an item. This is an association list, for each bullet type, this alist will point -to the bulled that should be used when this item is demoted." +to the bullet that should be used when this item is demoted. +For example, + + (setq org-list-demote-modify-bullet + '((\"+\" . \"-\") (\"-\" . \"+\") (\"*\" . \"+\"))) + +will make + + + Movies + + Silence of the Lambs + + My Cousin Vinny + + Books + + The Hunt for Red October + + The Road to Omaha + +into + + + Movies + - Silence of the Lambs + - My Cousin Vinny + + Books + - The Hunt for Red October + - The Road to Omaha" :group 'org-plain-lists :type '(repeat (cons @@ -119,7 +143,7 @@ When a string, it will be used as a regular expression. When the bullet type of a list is changed, the new bullet type will be matched against this regexp. If it matches, there will be two spaces instead of one after the bullet in each item of he list." - :group 'org-plain-list + :group 'org-plain-lists :type '(choice (const :tag "never" nil) (regexp))) @@ -171,19 +195,19 @@ When the indentation would be larger than this, it will become % END RECEIVE ORGLST %n \\begin{comment} #+ORGLST: SEND %n org-list-to-latex -| | | +- \\end{comment}\n") (texinfo-mode "@c BEGIN RECEIVE ORGLST %n @c END RECEIVE ORGLST %n @ignore #+ORGLST: SEND %n org-list-to-texinfo -| | | +- @end ignore\n") (html-mode "<!-- BEGIN RECEIVE ORGLST %n --> <!-- END RECEIVE ORGLST %n --> <!-- #+ORGLST: SEND %n org-list-to-html -| | | +- -->\n")) "Templates for radio lists in different major modes. All occurrences of %n in a template will be replaced with the name of the @@ -197,17 +221,25 @@ list, obtained by prompting the user." ;;; Plain list items +(defun org-item-re (&optional general) + "Return the correct regular expression for plain lists. +If GENERAL is non-nil, return the general regexp independent of the value +of `org-plain-list-ordered-item-terminator'." + (cond + ((or general (eq org-plain-list-ordered-item-terminator t)) + "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + ((= org-plain-list-ordered-item-terminator ?.) + "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + ((= org-plain-list-ordered-item-terminator ?\)) + "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))) + (defun org-at-item-p () "Is point in a line starting a hand-formatted item?" - (let ((llt org-plain-list-ordered-item-terminator)) - (save-excursion - (goto-char (point-at-bol)) - (looking-at - (cond - ((eq llt t) "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") - ((= llt ?.) "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") - ((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") - (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))))))) + + (save-excursion + (goto-char (point-at-bol)) + (looking-at (org-item-re)))) (defun org-at-item-bullet-p () "Is point at the bullet of a plain list item?" @@ -216,7 +248,7 @@ list, obtained by prompting the user." (< (point) (match-end 0)))) (defun org-in-item-p () - "It the cursor inside a plain list item. + "Is the cursor inside a plain list item. Does not have to be the first line." (save-excursion (condition-case nil @@ -590,6 +622,17 @@ If the cursor is not in an item, throw an error." (goto-char pos) (error "Not in an item")))) +(defun org-end-of-item-text-before-children () + "Move to the end of the item text, stops before the first child if any. +Assumes that the cursor is in the first line of an item." + (goto-char + (min (save-excursion (org-end-of-item) (point)) + (save-excursion + (goto-char (point-at-eol)) + (if (re-search-forward (concat "^" (org-item-re t)) nil 'move) + (match-beginning 0) + (point-max)))))) + (defun org-next-item () "Move to the beginning of the next item in the current plain list. Error if not at a plain list, or if this is the last item in the list." @@ -823,6 +866,10 @@ with something like \"1.\" or \"2)\"." (setq bobp (bobp)) (looking-at "[ \t]*[0-9]+\\([.)]\\)") (setq fmt (concat "%d" (or (match-string 1) "."))) + (save-excursion + (goto-char (match-end 0)) + (if (looking-at "[ \t]*\\[@start:\\([0-9]+\\)") + (setq n (1- (string-to-number (match-string 1)))))) (beginning-of-line 0) ;; walk forward and replace these numbers (catch 'exit @@ -961,12 +1008,24 @@ I.e. to the text after the last item." (defvar org-last-indent-end-marker (make-marker)) (defun org-outdent-item (arg) - "Outdent a local list item." + "Outdent a local list item, but not its children." (interactive "p") - (org-indent-item (- arg))) + (org-indent-item-tree (- arg) 'no-subtree)) (defun org-indent-item (arg) - "Indent a local list item." + "Indent a local list item, but not its children." + (interactive "p") + (org-indent-item-tree arg 'no-subtree)) + +(defun org-outdent-item-tree (arg &optional no-subtree) + "Outdent a local list item including its children. +If NO-SUBTREE is set, only outdent the item itself, not its children." + (interactive "p") + (org-indent-item-tree (- arg) no-subtree)) + +(defun org-indent-item-tree (arg &optional no-subtree) + "Indent a local list item including its children. +If NO-SUBTREE is set, only indent the item itself, not its children." (interactive "p") (and (org-region-active-p) (org-cursor-to-region-beginning)) (unless (org-at-item-p) @@ -975,12 +1034,15 @@ I.e. to the text after the last item." (setq firstp (org-first-list-item-p)) (save-excursion (setq end (and (org-region-active-p) (region-end))) - (if (memq last-command '(org-shiftmetaright org-shiftmetaleft)) + (if (and (memq last-command '(org-shiftmetaright org-shiftmetaleft)) + (memq this-command '(org-shiftmetaright org-shiftmetaleft))) (setq beg org-last-indent-begin-marker end org-last-indent-end-marker) (org-beginning-of-item) (setq beg (move-marker org-last-indent-begin-marker (point))) - (org-end-of-item) + (if no-subtree + (org-end-of-item-text-before-children) + (org-end-of-item)) (setq end (move-marker org-last-indent-end-marker (or end (point))))) (goto-char beg) (setq ind-bul (org-item-indent-positions) @@ -1108,7 +1170,7 @@ sublevels as a list of strings." (match-beginning 0)) end)))) (item (buffer-substring (point) - (or (and (re-search-forward + (or (and (org-re-search-forward-unprotected org-list-beginning-re end t) (goto-char (match-beginning 0))) (goto-char end)))) @@ -1215,36 +1277,34 @@ this list." (save-excursion (org-list-goto-true-beginning) (beginning-of-line 0) - (unless (looking-at "#\\+ORGLST: *SEND +\\([a-zA-Z0-9_]+\\) +\\([^ \t\r\n]+\\)\\( +.*\\)?") + (unless (looking-at "[ \t]*#\\+ORGLST[: \t][ \t]*SEND[ \t]+\\([^ \t\r\n]+\\)[ \t]+\\([^ \t\r\n]+\\)\\([ \t]+.*\\)?") (if maybe (throw 'exit nil) (error "Don't know how to transform this list")))) (let* ((name (match-string 1)) (transform (intern (match-string 2))) (item-beginning (org-list-item-beginning)) - (txt (buffer-substring-no-properties - (car item-beginning) - (org-list-end (cdr item-beginning)))) - (list (org-list-parse-list)) - beg) + (list (save-excursion (org-list-goto-true-beginning) + (org-list-parse-list))) + txt beg) (unless (fboundp transform) (error "No such transformation function %s" transform)) - (setq txt (funcall transform list)) - ;; Find the insertion place - (save-excursion - (goto-char (point-min)) - (unless (re-search-forward - (concat "BEGIN RECEIVE ORGLST +" name "\\([ \t]\\|$\\)") nil t) - (error "Don't know where to insert translated list")) - (goto-char (match-beginning 0)) - (beginning-of-line 2) - (setq beg (point)) - (unless (re-search-forward (concat "END RECEIVE ORGLST +" name) nil t) - (error "Cannot find end of insertion region")) - (beginning-of-line 1) - (delete-region beg (point)) - (goto-char beg) - (insert txt "\n")) + (let ((txt (funcall transform list))) + ;; Find the insertion place + (save-excursion + (goto-char (point-min)) + (unless (re-search-forward + (concat "BEGIN RECEIVE ORGLST +" name "\\([ \t]\\|$\\)") nil t) + (error "Don't know where to insert translated list")) + (goto-char (match-beginning 0)) + (beginning-of-line 2) + (setq beg (point)) + (unless (re-search-forward (concat "END RECEIVE ORGLST +" name) nil t) + (error "Cannot find end of insertion region")) + (beginning-of-line 1) + (delete-region beg (point)) + (goto-char beg) + (insert txt "\n"))) (message "List converted and installed at receiver location")))) (defun org-list-to-generic (list params) @@ -1326,7 +1386,7 @@ Valid parameters PARAMS are (defun org-list-to-latex (list &optional params) "Convert LIST into a LaTeX list. -LIST is as returnd by `org-list-parse-list'. PARAMS is a property list +LIST is as returned by `org-list-parse-list'. PARAMS is a property list with overruling parameters for `org-list-to-generic'." (org-list-to-generic list @@ -1343,7 +1403,7 @@ with overruling parameters for `org-list-to-generic'." (defun org-list-to-html (list &optional params) "Convert LIST into a HTML list. -LIST is as returnd by `org-list-parse-list'. PARAMS is a property list +LIST is as returned by `org-list-parse-list'. PARAMS is a property list with overruling parameters for `org-list-to-generic'." (org-list-to-generic list @@ -1360,7 +1420,7 @@ with overruling parameters for `org-list-to-generic'." (defun org-list-to-texinfo (list &optional params) "Convert LIST into a Texinfo list. -LIST is as returnd by `org-list-parse-list'. PARAMS is a property list +LIST is as returned by `org-list-parse-list'. PARAMS is a property list with overruling parameters for `org-list-to-generic'." (org-list-to-generic list diff --git a/lisp/org/org-mac-message.el b/lisp/org/org-mac-message.el index b5b380e4072..06591703da9 100644 --- a/lisp/org/org-mac-message.el +++ b/lisp/org/org-mac-message.el @@ -5,7 +5,7 @@ ;; Author: John Wiegley <johnw@gnu.org> ;; Christopher Suckling <suckling at gmail dot com> -;; Version: 6.35i +;; Version: 7.01 ;; Keywords: outlines, hypermedia, calendar, wp ;; This file is part of GNU Emacs. @@ -39,7 +39,7 @@ ;; messages selected in Mail.app. ;; (org-mac-message-insert-flagged) searches within an org-mode buffer -;; for a specific heading, creating it if it doesn't exist. Any +;; for a specific heading, creating it if it doesn't exist. Any ;; message:// links within the first level of the heading are deleted ;; and replaced with links to flagged messages. @@ -53,7 +53,7 @@ :group 'org-link) (defcustom org-mac-mail-account "customize" - "The Mail.app account in which to search for flagged messages" + "The Mail.app account in which to search for flagged messages." :group 'org-mac-flagged-mail :type 'string) @@ -81,7 +81,7 @@ This will use the command `open' with the message URL." "open" (concat "message://<" (substring message-id 2) ">"))) (defun as-get-selected-mail () - "AppleScript to create links to selected messages in Mail.app" + "AppleScript to create links to selected messages in Mail.app." (do-applescript (concat "tell application \"Mail\"\n" @@ -97,7 +97,7 @@ This will use the command `open' with the message URL." "end tell"))) (defun as-get-flagged-mail () - "AppleScript to create links to flagged messages in Mail.app" + "AppleScript to create links to flagged messages in Mail.app." (do-applescript (concat ;; Is Growl installed? @@ -179,7 +179,7 @@ The Org-syntax text will be pushed to the kill ring, and also returned." (defun org-mac-message-insert-selected () "Insert a link to the messages currently selected in Mail.app. -This will use applescript to get the message-id and the subject of the +This will use AppleScript to get the message-id and the subject of the active mail in Mail.app and make a link out of it." (interactive) (insert (org-mac-message-get-links "s"))) diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index 562715fc680..abcdcdc94eb 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -43,6 +43,11 @@ "Return the value of symbol VAR if it is bound, else nil." `(and (boundp (quote ,var)) ,var)) +(defun org-not-nil (v) + "If V not nil, and also not the string \"nil\", then return V. +Otherwise return nil." + (and v (not (equal v "nil")) v)) + (defmacro org-unmodified (&rest body) "Execute body without changing `buffer-modified-p'. Also, do not record undo information." @@ -87,7 +92,7 @@ Also, do not record undo information." (defmacro org-maybe-intangible (props) "Add '(intangible t) to PROPS if Emacs version is earlier than Emacs 22. -In emacs 21, invisible text is not avoided by the command loop, so the +In Emacs 21, invisible text is not avoided by the command loop, so the intangible property is needed to make sure point skips this text. In Emacs 22, this is not necessary. The intangible text property has led to problems with flyspell. These problems are fixed in flyspell.el, @@ -162,7 +167,8 @@ We use a macro so that the test can happen at compilation time." `(let ((inhibit-read-only t)) ,@body)) (defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t - rear-nonsticky t mouse-map t fontified t) + rear-nonsticky t mouse-map t fontified t + org-emphasis t) "Properties to remove when a string without properties is wanted.") (defsubst org-match-string-no-properties (num &optional string) @@ -270,7 +276,6 @@ This is in contrast to merely setting it to 0." (setq plist (cddr plist))) p)) - (defun org-replace-match-keep-properties (newtext &optional fixedcase literal string) "Like `replace-match', but add the text properties found original text." @@ -287,7 +292,7 @@ This is in contrast to merely setting it to 0." (defvar org-inlinetask-min-level) ; defined in org-inlinetask.el (defun org-get-limited-outline-regexp () "Return outline-regexp with limited number of levels. -The number of levels is controlled by " +The number of levels is controlled by `org-inlinetask-min-level'" (if (or (not (org-mode-p)) (not (featurep 'org-inlinetask))) outline-regexp diff --git a/lisp/org/org-mew.el b/lisp/org/org-mew.el index 7e9ce1e31f3..92ac2342dae 100644 --- a/lisp/org/org-mew.el +++ b/lisp/org/org-mew.el @@ -5,7 +5,7 @@ ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; This file is part of GNU Emacs. diff --git a/lisp/org/org-mhe.el b/lisp/org/org-mhe.el index dd6519475ad..91551cd828f 100644 --- a/lisp/org/org-mhe.el +++ b/lisp/org/org-mhe.el @@ -6,7 +6,7 @@ ;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-mks.el b/lisp/org/org-mks.el new file mode 100644 index 00000000000..4a567614af3 --- /dev/null +++ b/lisp/org/org-mks.el @@ -0,0 +1,137 @@ +;;; org-mks.el --- Multi-key-selection for Org-mode + +;; Copyright (C) 2010 Free Software Foundation, Inc. + +;; Author: Carsten Dominik <carsten at orgmode dot org> +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: http://orgmode.org +;; Version: 7.01 +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +;;; Commentary: +;; + +;;; Code: + +(require 'org) +(eval-when-compile + (require 'cl)) + +(defun org-mks (table title &optional prompt specials) + "Select a member of an alist with multiple keys. +TABLE is the alist which should contain entries where the car is a string. +There should be two types of entries. + +1. prefix descriptions like (\"a\" \"Description\") + This indicates that `a' is a prefix key for multi-letter selection, and + that there are entries following with keys like \"ab\", \"ax\"... + +2. Selectable members must have more than two elements, with the first + being the string of keys that lead to selecting it, and the second a + short description string of the item. + +The command will then make a temporary buffer listing all entries +that can be selected with a single key, and all the single key +prefixes. When you press the key for a single-letter entry, it is selected. +When you press a prefix key, the commands (and maybe further prefixes) +under this key will be shown and offered for selection. + +TITLE will be placed over the selection in the temporary buffer, +PROMPT will be used when prompting for a key. SPECIAL is an alist with +also (\"key\" \"description\") entries. When one of these is selection, +only the bare key is returned." + (setq prompt (or prompt "Select: ")) + (let (tbl orig-table dkey ddesc des-keys allowed-keys + current prefix rtn re pressed buffer (inhibit-quit t)) + (save-window-excursion + (setq buffer (org-switch-to-buffer-other-window "*Org Select*")) + (setq orig-table table) + (catch 'exit + (while t + (erase-buffer) + (insert title "\n\n") + (setq tbl table + des-keys nil + allowed-keys nil) + (setq prefix (if current (concat current " ") "")) + (while tbl + (cond + ((and (= 2 (length (car tbl))) (= (length (caar tbl)) 1)) + ;; This is a description on this level + (setq dkey (caar tbl) ddesc (cadar tbl)) + (pop tbl) + (push dkey des-keys) + (push dkey allowed-keys) + (insert prefix "[" dkey "]" "..." " " ddesc "..." "\n") + ;; Skip keys which are below this prefix + (setq re (concat "\\`" (regexp-quote dkey))) + (while (and tbl (string-match re (caar tbl))) (pop tbl))) + ((= 2 (length (car tbl))) + ;; Not yet a usable description, skip it + ) + (t + ;; usable entry on this level + (insert prefix "[" (caar tbl) "]" " " (nth 1 (car tbl)) "\n") + (push (caar tbl) allowed-keys) + (pop tbl)))) + (when specials + (insert "-------------------------------------------------------------------------------\n") + (let ((sp specials)) + (while sp + (insert (format "[%s] %s\n" + (caar sp) (nth 1 (car sp)))) + (push (caar sp) allowed-keys) + (pop sp)))) + (push "\C-g" allowed-keys) + (goto-char (point-min)) + (if (not (pos-visible-in-window-p (point-max))) + (org-fit-window-to-buffer)) + (message prompt) + (setq pressed (char-to-string (read-char-exclusive))) + (while (not (member pressed allowed-keys)) + (message "Invalid key `%s'" pressed) (sit-for 1) + (message prompt) + (setq pressed (char-to-string (read-char-exclusive)))) + (when (equal pressed "\C-g") + (kill-buffer buffer) + (error "Abort")) + (when (and (not (assoc pressed table)) + (not (member pressed des-keys)) + (assoc pressed specials)) + (throw 'exit (setq rtn pressed))) + (unless (member pressed des-keys) + (throw 'exit (setq rtn (rassoc (cdr (assoc pressed table)) + orig-table)))) + (setq current (concat current pressed)) + (setq table (mapcar + (lambda (x) + (if (and (> (length (car x)) 1) + (equal (substring (car x) 0 1) pressed)) + (cons (substring (car x) 1) (cdr x)) + nil)) + table)) + (setq table (remove nil table))))) + (when buffer (kill-buffer buffer)) + rtn)) + +(provide 'org-mks) + +;; arch-tag: 4ea90d0e-c6e4-4684-bd61-baf878712f9f + +;;; org-mks.el ends here diff --git a/lisp/org/org-mobile.el b/lisp/org/org-mobile.el index 8492280c07c..e9c1ad2bf3f 100644 --- a/lisp/org/org-mobile.el +++ b/lisp/org/org-mobile.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -33,6 +33,8 @@ (require 'org) (require 'org-agenda) +;;; Code: + (eval-when-compile (require 'cl)) (defgroup org-mobile nil @@ -66,18 +68,19 @@ org-agenda-text-search-extra-files :type 'directory) (defcustom org-mobile-use-encryption nil - "Non-nil means keep only encrypted files on the webdav server. + "Non-nil means keep only encrypted files on the WebDAV server. Encryption uses AES-256, with a password given in `org-mobile-encryption-password'. When nil, plain files are kept on the server. Turning on encryption requires to set the same password in the MobileOrg -application." +application. Before turning this on, check of MobileOrg does already +support it - at the time of this writing it did not yet." :group 'org-mobile :type 'boolean) (defcustom org-mobile-encryption-tempfile "~/orgtmpcrypt" "File that is being used as a temporary file for encryption. -This must be local file on your local machine (not on the webdav server). +This must be local file on your local machine (not on the WebDAV server). You might want to put this file into a directory where only you have access." :group 'org-mobile :type 'directory) @@ -87,7 +90,7 @@ You might want to put this file into a directory where only you have access." This is a single password which is used for AES-256 encryption. The same password must also be set in the MobileOrg application. All Org files, including mobileorg.org will be encrypted using this password. -Note that, whe Org runs the encryption commands, the password could +Note that, when Org runs the encryption commands, the password could be visible on your system with the `ps' command. So this method is only intended to keep the files secure on the server, not on your own machine." :group 'org-mobile @@ -349,15 +352,18 @@ agenda view showing the flagged items." (file-name-directory org-mobile-inbox-for-pull))) (error "Variable `org-mobile-inbox-for-pull' must point to a file in an existing directory")) + (unless (and org-mobile-checksum-binary + (string-match "\\S-" org-mobile-checksum-binary)) + (error "No executable found to compute checksums")) (when org-mobile-use-encryption (unless (string-match "\\S-" org-mobile-encryption-password) (error "To use encryption, you must set `org-mobile-encryption-password'")) (unless (file-writable-p org-mobile-encryption-tempfile) - (error "Cannot write to entryption tempfile %s" + (error "Cannot write to encryption tempfile %s" org-mobile-encryption-tempfile)) (unless (executable-find "openssl") - (error "openssl is needed to encrypt files.")))) + (error "openssl is needed to encrypt files")))) (defun org-mobile-create-index-file () "Write the index file in the WebDAV directory." @@ -898,42 +904,6 @@ FIXME: Hmmm, not sure if we can make his work against the auto-correction feature. Needs a bit more thinking. So this function is currently a noop.") - -(defun org-find-olp (path) - "Return a marker pointing to the entry at outline path OLP. -If anything goes wrong, the return value will instead an error message, -as a string." - (let* ((file (pop path)) - (buffer (find-file-noselect file)) - (level 1) - (lmin 1) - (lmax 1) - limit re end found pos heading cnt) - (unless buffer (error "File not found :%s" file)) - (with-current-buffer buffer - (save-excursion - (save-restriction - (widen) - (setq limit (point-max)) - (goto-char (point-min)) - (while (setq heading (pop path)) - (setq re (format org-complex-heading-regexp-format - (regexp-quote heading))) - (setq cnt 0 pos (point)) - (while (re-search-forward re end t) - (setq level (- (match-end 1) (match-beginning 1))) - (if (and (>= level lmin) (<= level lmax)) - (setq found (match-beginning 0) cnt (1+ cnt)))) - (when (= cnt 0) (error "Heading not found on level %d: %s" - lmax heading)) - (when (> cnt 1) (error "Heading not unique on level %d: %s" - lmax heading)) - (goto-char found) - (setq lmin (1+ level) lmax (+ lmin (if org-odd-levels-only 1 0))) - (setq end (save-excursion (org-end-of-subtree t t)))) - (when (org-on-heading-p) - (move-marker (make-marker) (point)))))))) - (defun org-mobile-locate-entry (link) (if (string-match "\\`id:\\(.*\\)$" link) (org-id-find (match-string 1 link) 'marker) @@ -1033,7 +1003,6 @@ be returned that indicates what went wrong." t) (t (error "Body was changed in MobileOrg and on the computer"))))))) - (defun org-mobile-tags-same-p (list1 list2) "Are the two tag lists the same?" (not (or (org-delete-all list1 list2) diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el index d3a7dd155c8..12a7dcb85af 100644 --- a/lisp/org/org-mouse.el +++ b/lisp/org/org-mouse.el @@ -4,7 +4,7 @@ ;; ;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com> ;; Maintainer: Carsten Dominik <carsten at orgmode dot org> -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -137,6 +137,8 @@ ;; ;; Versions 0.01 -- 0.07: (I don't remember) +;;; Code: + (eval-when-compile (require 'cl)) (require 'org) @@ -225,7 +227,7 @@ this function is called. Otherwise, the current major mode menu is used." (mouse-save-then-kill event))) (defun org-mouse-line-position () - "Returns `:beginning' or `:middle' or `:end', depending on the point position. + "Return `:beginning' or `:middle' or `:end', depending on the point position. If the point is at the end of the line, return `:end'. If the point is separated from the beginning of the line only by white @@ -290,7 +292,7 @@ ITEMFORMAT governs formatting of the elements of KEYWORDS. If it is a function, it is invoked with the keyword as the only argument. If it is a string, it is interpreted as the format string to (format ITEMFORMAT keyword). If it is neither a string -nor a function, elements of KEYWORDS are used directly. " +nor a function, elements of KEYWORDS are used directly." (mapcar `(lambda (keyword) (vector (cond @@ -342,8 +344,7 @@ ITEMFORMAT governs formatting of the elements of KEYWORDS. If it is a function, it is invoked with the keyword as the only argument. If it is a string, it is interpreted as the format string to (format ITEMFORMAT keyword). If it is neither a string -nor a function, elements of KEYWORDS are used directly. -" +nor a function, elements of KEYWORDS are used directly." (setq group (or group 0)) (let ((replace (org-mouse-match-closure (if nosurround 'replace-match @@ -432,7 +433,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" (lambda (kwd) (equal state kwd)))))) (defun org-mouse-tag-menu () ;todo - "Create the tags menu" + "Create the tags menu." (append (let ((tags (org-get-tags))) (org-mouse-keyword-menu @@ -585,7 +586,8 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" (org-next-item))))) (defun org-mouse-bolp () - "Returns true if there only spaces, tabs, and '*', between the beginning of line and the point" + "Return true if there only spaces, tabs, and '*' before point. +This means, between the beginning of line and the point." (save-excursion (skip-chars-backward " \t*") (bolp))) @@ -909,18 +911,18 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" (setq org-mouse-context-menu-function 'org-mouse-context-menu) (when (memq 'context-menu org-mouse-features) - (define-key org-mouse-map (if (featurep 'xemacs) [button3] [mouse-3]) nil) - (define-key org-mode-map [mouse-3] 'org-mouse-show-context-menu)) - (define-key org-mode-map [down-mouse-1] 'org-mouse-down-mouse) + (org-defkey org-mouse-map [mouse-3] nil) + (org-defkey org-mode-map [mouse-3] 'org-mouse-show-context-menu)) + (org-defkey org-mode-map [down-mouse-1] 'org-mouse-down-mouse) (when (memq 'context-menu org-mouse-features) - (define-key org-mouse-map [C-drag-mouse-1] 'org-mouse-move-tree) - (define-key org-mouse-map [C-down-mouse-1] 'org-mouse-move-tree-start)) + (org-defkey org-mouse-map [C-drag-mouse-1] 'org-mouse-move-tree) + (org-defkey org-mouse-map [C-down-mouse-1] 'org-mouse-move-tree-start)) (when (memq 'yank-link org-mouse-features) - (define-key org-mode-map [S-mouse-2] 'org-mouse-yank-link) - (define-key org-mode-map [drag-mouse-3] 'org-mouse-yank-link)) + (org-defkey org-mode-map [S-mouse-2] 'org-mouse-yank-link) + (org-defkey org-mode-map [drag-mouse-3] 'org-mouse-yank-link)) (when (memq 'move-tree org-mouse-features) - (define-key org-mouse-map [drag-mouse-3] 'org-mouse-move-tree) - (define-key org-mouse-map [down-mouse-3] 'org-mouse-move-tree-start)) + (org-defkey org-mouse-map [drag-mouse-3] 'org-mouse-move-tree) + (org-defkey org-mouse-map [down-mouse-3] 'org-mouse-move-tree-start)) (when (memq 'activate-stars org-mouse-features) (font-lock-add-keywords @@ -1131,13 +1133,11 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" (add-hook 'org-agenda-mode-hook '(lambda () (setq org-mouse-context-menu-function 'org-mouse-agenda-context-menu) - (define-key org-agenda-mode-map - (if (featurep 'xemacs) [button3] [mouse-3]) - 'org-mouse-show-context-menu) - (define-key org-agenda-mode-map [down-mouse-3] 'org-mouse-move-tree-start) - (define-key org-agenda-mode-map (if (featurep 'xemacs) [(control mouse-4)] [C-mouse-4]) 'org-agenda-earlier) - (define-key org-agenda-mode-map (if (featurep 'xemacs) [(control mouse-5)] [C-mouse-5]) 'org-agenda-later) - (define-key org-agenda-mode-map [drag-mouse-3] + (org-defkey org-agenda-mode-map [mouse-3] 'org-mouse-show-context-menu) + (org-defkey org-agenda-mode-map [down-mouse-3] 'org-mouse-move-tree-start) + (org-defkey org-agenda-mode-map [C-mouse-4] 'org-agenda-earlier) + (org-defkey org-agenda-mode-map [C-mouse-5] 'org-agenda-later) + (org-defkey org-agenda-mode-map [drag-mouse-3] '(lambda (event) (interactive "e") (case (org-mouse-get-gesture event) (:left (org-agenda-earlier 1)) @@ -1147,4 +1147,4 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" ;; arch-tag: ff1ae557-3529-41a3-95c6-baaebdcc280f -;;; org-mouse.el ends-here +;;; org-mouse.el ends here diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el index a0a24dcfecd..c6953f11d37 100644 --- a/lisp/org/org-plot.el +++ b/lisp/org/org-plot.el @@ -5,7 +5,7 @@ ;; Author: Eric Schulte <schulte dot eric at gmail dot com> ;; Keywords: tables, plotting ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -44,7 +44,7 @@ '((:plot-type . 2d) (:with . lines) (:ind . 0)) - "Default options to gnuplot used by `org-plot/gnuplot'") + "Default options to gnuplot used by `org-plot/gnuplot'.") (defvar org-plot-timestamp-fmt nil) @@ -272,7 +272,7 @@ manner suitable for prepending to a user-specified script." ;; facade functions ;;;###autoload (defun org-plot/gnuplot (&optional params) - "Plot table using gnuplot. Gnuplot options can be specified with PARAMS. + "Plot table using gnuplot. Gnuplot options can be specified with PARAMS. If not given options will be taken from the +PLOT line directly before or after the table." (interactive) diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el index 1b32f515f79..2c6345ab817 100644 --- a/lisp/org/org-protocol.el +++ b/lisp/org/org-protocol.el @@ -9,7 +9,7 @@ ;; Author: Ross Patterson <me AT rpatterson DOT net> ;; Maintainer: Sebastian Rose <sebastian_rose AT gmx DOT de> ;; Keywords: org, emacsclient, wp -;; Version: 6.35i +;; Version: 7.01 ;; This file is part of GNU Emacs. ;; @@ -31,8 +31,8 @@ ;; ;; Intercept calls from emacsclient to trigger custom actions. ;; -;; This is done by advising `server-visit-files' to scann the list of filenames -;; for `org-protocol-the-protocol' and sub-procols defined in +;; This is done by advising `server-visit-files' to scan the list of filenames +;; for `org-protocol-the-protocol' and sub-protocols defined in ;; `org-protocol-protocol-alist' and `org-protocol-protocol-alist-default'. ;; ;; Any application that supports calling external programs with an URL @@ -58,7 +58,7 @@ ;; (setq org-protocol-protocol-alist ;; '(("my-protocol" ;; :protocol "my-protocol" -;; :function my-protocol-handler-fuction))) +;; :function my-protocol-handler-function))) ;; ;; A "sub-protocol" will be found in URLs like this: ;; @@ -84,15 +84,20 @@ ;; URLs to local filenames defined in `org-protocol-project-alist'. ;; ;; * `org-protocol-store-link' stores an Org-link (if Org-mode is present) and -;; pushes the browsers URL to the `kill-ring' for yanking. This handler is +;; pushes the browsers URL to the `kill-ring' for yanking. This handler is ;; triggered through the sub-protocol \"store-link\". ;; -;; * Call `org-protocol-remember' by using the sub-protocol \"remember\". If -;; Org-mode is loaded, emacs will pop-up a remember buffer and fill the -;; template with the data provided. I.e. the browser's URL is inserted as an -;; Org-link of which the page title will be the description part. If text +;; * Call `org-protocol-capture' by using the sub-protocol \"capture\". If +;; Org-mode is loaded, Emacs will pop-up a capture buffer and fill the +;; template with the data provided. I.e. the browser's URL is inserted as an +;; Org-link of which the page title will be the description part. If text ;; was select in the browser, that text will be the body of the entry. ;; +;; * Call `org-protocol-remember' by using the sub-protocol \"remember\". +;; This is provided for backward compatibility. +;; You may read `org-capture' as `org-remember' throughout this file if +;; you still use `org-remember'. +;; ;; You may use the same bookmark URL for all those standard handlers and just ;; adjust the sub-protocol used: ;; @@ -101,7 +106,7 @@ ;; encodeURIComponent(document.title)+'/'+ ;; encodeURIComponent(window.getSelection()) ;; -;; The handler for the sub-protocol \"remember\" detects an optional template +;; The handler for the sub-protocol \"capture\" detects an optional template ;; char that, if present, triggers the use of a special template. ;; Example: ;; @@ -121,8 +126,6 @@ (eval-when-compile (require 'cl)) -(declare-function org-publish-initialize-files-alist "org-publish" - (&optional refresh)) (declare-function org-publish-get-project-from-filename "org-publish" (filename &optional up)) (declare-function server-edit "server" (&optional arg)) @@ -143,6 +146,7 @@ for `org-protocol-the-protocol' and sub-procols defined in (defconst org-protocol-protocol-alist-default '(("org-remember" :protocol "remember" :function org-protocol-remember :kill-client t) + ("org-capture" :protocol "capture" :function org-protocol-capture :kill-client t) ("org-store-link" :protocol "store-link" :function org-protocol-store-link) ("org-open-source" :protocol "open-source" :function org-protocol-open-source)) "Default protocols to use. @@ -151,18 +155,19 @@ See `org-protocol-protocol-alist' for a description of this variable.") (defconst org-protocol-the-protocol "org-protocol" "This is the protocol to detect if org-protocol.el is loaded. -`org-protocol-protocol-alist-default' and `org-protocol-protocol-alist' hold the -sub-protocols that trigger the required action. You will have to define just one -protocol handler OS-wide (MS-Windows) or per application (Linux). That protocol -handler should call emacsclient.") +`org-protocol-protocol-alist-default' and `org-protocol-protocol-alist' hold +the sub-protocols that trigger the required action. You will have to define +just one protocol handler OS-wide (MS-Windows) or per application (Linux). +That protocol handler should call emacsclient.") ;;; User variables: (defcustom org-protocol-reverse-list-of-files t - "* The filenames passed on the commandline are passed to the emacs-server in -reversed order. Set to `t' (default) to re-reverse the list, i.e. use the -sequence on the command line. If nil, the sequence of the filenames is + "* Non-nil means re-reverse the list of filenames passed on the command line. +The filenames passed on the command line are passed to the emacs-server in +reverse order. Set to t (default) to re-reverse the list, i.e. use the +sequence on the command line. If nil, the sequence of the filenames is unchanged." :group 'org-protocol :type 'boolean) @@ -225,7 +230,7 @@ protocol - protocol to detect in a filename without trailing colon and slashes. If you define a protocol \"my-protocol\", `org-protocol-check-filename-for-protocol' will search filenames for \"org-protocol:/my-protocol:/\" and trigger your action for every match. `org-protocol' is defined in - `org-protocol-the-protocol'. Double and tripple slashes are compressed + `org-protocol-the-protocol'. Double and triple slashes are compressed to one by emacsclient. function - function that handles requests with protocol and takes exactly one @@ -239,7 +244,7 @@ function - function that handles requests with protocol and takes exactly one kill-client - If t, kill the client immediately, once the sub-protocol is detected. This is necessary for actions that can be interrupted by - `C-g' to avoid dangeling emacsclients. Note, that all other command + `C-g' to avoid dangling emacsclients. Note, that all other command line arguments but the this one will be discarded, greedy handlers still receive the whole list of arguments though. @@ -248,10 +253,10 @@ Here is an example: (setq org-protocol-protocol-alist '((\"my-protocol\" :protocol \"my-protocol\" - :function my-protocol-handler-fuction) + :function my-protocol-handler-function) (\"your-protocol\" :protocol \"your-protocol\" - :function your-protocol-handler-fuction)))" + :function your-protocol-handler-function)))" :group 'org-protocol :type '(alist)) @@ -260,11 +265,10 @@ Here is an example: :group 'org-protocol :type 'string) - ;;; Helper functions: (defun org-protocol-sanitize-uri (uri) - "emacsclient compresses double and tripple slashes. + "emacsclient compresses double and triple slashes. Slashes are sanitized to double slashes here." (when (string-match "^\\([a-z]+\\):/" uri) (let* ((splitparts (split-string uri "/+"))) @@ -273,12 +277,13 @@ Slashes are sanitized to double slashes here." (defun org-protocol-split-data(data &optional unhexify separator) - "Split, what a org-protocol handler function gets as only argument. -data is that one argument. Data is splitted at each occurrence of separator - (regexp). If no separator is specified or separator is nil, assume \"/+\". -The results of that splitting are return as a list. If unhexify is non-nil, -hex-decode each split part. If unhexify is a function, use that function to -decode each split part." + "Split, what an org-protocol handler function gets as only argument. +DATA is that one argument. DATA is split at each occurrence of +SEPARATOR (regexp). If no SEPARATOR is specified or SEPARATOR is +nil, assume \"/+\". The results of that splitting are returned +as a list. If UNHEXIFY is non-nil, hex-decode each split part. If +UNHEXIFY is a function, use that function to decode each split +part." (let* ((sep (or separator "/+")) (split-parts (split-string data sep))) (if unhexify @@ -316,7 +321,7 @@ encodeURIComponent. E.g. `%C3%B6' is the german Umlaut `ü'." (defun org-protocol-unhex-compound (hex) - "Unhexify unicode hex-chars. E.g. `%C3%B6' is the german Umlaut `ü'." + "Unhexify unicode hex-chars. E.g. `%C3%B6' is the German Umlaut `ü'." (let* ((bytes (remove "" (split-string hex "%"))) (ret "") (eat 0) @@ -412,9 +417,9 @@ This function transforms it into a flat list." ;;; Standard protocol handlers: (defun org-protocol-store-link (fname) - "Process an org-protocol://store-link:// style url -and store a browser URL as an org link. Also pushes the links URL to the -`kill-ring'. + "Process an org-protocol://store-link:// style url. +Additionally store a browser URL as an org link. Also pushes the +link's URL to the `kill-ring'. The location for a browser's bookmark has to look like this: @@ -443,10 +448,6 @@ The sub-protocol used to reach this function is set in (defun org-protocol-remember (info) "Process an org-protocol://remember:// style url. -The sub-protocol used to reach this function is set in -`org-protocol-protocol-alist'. - -This function detects an URL, title and optional text, separated by '/' The location for a browser's bookmark has to look like this: javascript:location.href='org-protocol://remember://'+ \\ @@ -454,40 +455,68 @@ The location for a browser's bookmark has to look like this: encodeURIComponent(document.title)+'/'+ \\ encodeURIComponent(window.getSelection()) -By default, it uses the character `org-protocol-default-template-key', -which should be associated with a template in `org-remember-templates'. -But you may prepend the encoded URL with a character and a slash like so: - - javascript:location.href='org-protocol://org-store-link://b/'+ ... - -Now template ?b will be used." +See the docs for `org-protocol-capture' for more information." (if (and (boundp 'org-stored-links) - (fboundp 'org-remember)) - (let* ((parts (org-protocol-split-data info t)) - (template (or (and (= 1 (length (car parts))) (pop parts)) - org-protocol-default-template-key)) - (url (org-protocol-sanitize-uri (car parts))) - (type (if (string-match "^\\([a-z]+\\):" url) - (match-string 1 url))) - (title (or (cadr parts) "")) - (region (or (caddr parts) "")) - (orglink (org-make-link-string - url (if (string-match "[^[:space:]]" title) title url))) - remember-annotation-functions) - (setq org-stored-links - (cons (list url title) org-stored-links)) - (kill-new orglink) - (org-store-link-props :type type - :link url - :description title - :initial region) - (raise-frame) - (org-remember nil (string-to-char template))) - - (message "Org-mode not loaded.")) + (or (fboundp 'org-capture)) + (org-protocol-do-capture info 'org-remember)) + (message "Org-mode not loaded.")) nil) +(defun org-protocol-capture (info) + "Process an org-protocol://capture:// style url. + +The sub-protocol used to reach this function is set in +`org-protocol-protocol-alist'. + +This function detects an URL, title and optional text, separated by '/' +The location for a browser's bookmark has to look like this: + + javascript:location.href='org-protocol://capture://'+ \\ + encodeURIComponent(location.href)+'/' \\ + encodeURIComponent(document.title)+'/'+ \\ + encodeURIComponent(window.getSelection()) + +By default, it uses the character `org-protocol-default-template-key', +which should be associated with a template in `org-capture-templates'. +But you may prepend the encoded URL with a character and a slash like so: + + javascript:location.href='org-protocol://capture://b/'+ ... + +Now template ?b will be used." + (if (and (boundp 'org-stored-links) + (or (fboundp 'org-capture)) + (org-protocol-do-capture info 'org-capture)) + (message "Org-mode not loaded.")) + nil) + +(defun org-protocol-do-capture (info capture-func) + "Support `org-capture' and `org-remember' alike. +CAPTURE-FUNC is either the symbol `org-remember' or `org-capture'." + (let* ((parts (org-protocol-split-data info t)) + (template (or (and (= 1 (length (car parts))) (pop parts)) + org-protocol-default-template-key)) + (url (org-protocol-sanitize-uri (car parts))) + (type (if (string-match "^\\([a-z]+\\):" url) + (match-string 1 url))) + (title(or (cadr parts) "")) + (region (or (caddr parts) "")) + (orglink (org-make-link-string + url (if (string-match "[^[:space:]]" title) title url))) + (org-capture-link-is-already-stored t) ;; avoid call to org-store-link + remember-annotation-functions) + (setq org-stored-links + (cons (list url title) org-stored-links)) + (kill-new orglink) + (org-store-link-props :type type + :link url + :description title + :annotation orglink + :initial region) + (raise-frame) + (funcall capture-func nil template))) + + (defun org-protocol-open-source (fname) "Process an org-protocol://open-source:// style url. @@ -561,7 +590,7 @@ This is, how the matching is done: protocol and sub-protocol are regexp-quoted. -If a matching protcol is found, the protcol is stripped from fname and the +If a matching protocol is found, the protocol is stripped from fname and the result is passed to the protocols function as the only parameter. If the function returns nil, the filename is removed from the list of filenames passed from emacsclient to the server. @@ -614,11 +643,10 @@ as filename." (defun org-protocol-create-for-org () "Create a org-protocol project for the current file's Org-mode project. This works, if the file visited is part of a publishing project in -`org-publish-project-alist'. This functions calls `org-protocol-create' to do +`org-publish-project-alist'. This function calls `org-protocol-create' to do most of the work." (interactive) (require 'org-publish) - (org-publish-initialize-files-alist) (let ((all (or (org-publish-get-project-from-filename buffer-file-name)))) (if all (org-protocol-create (cdr all)) (message "Not in an org-project. Did mean %s?" diff --git a/lisp/org/org-publish.el b/lisp/org/org-publish.el index 79655235505..943bbca6b7b 100644 --- a/lisp/org/org-publish.el +++ b/lisp/org/org-publish.el @@ -5,7 +5,7 @@ ;; Author: David O'Toole <dto@gnu.org> ;; Maintainer: Carsten Dominik <carsten DOT dominik AT gmail DOT com> ;; Keywords: hypermedia, outlines, wp -;; Version: 6.35i +;; Version: 7.01 ;; This file is part of GNU Emacs. ;; @@ -174,12 +174,26 @@ sitemap of files or summary page for a given project. of the titles of the files involved) or `tree' (the directory structure of the source files is reflected in the sitemap). Defaults to - `tree'." + `tree'. + + If you create a sitemap file, adjust the sorting like this: + + :sitemap-sort-folders Where folders should appear in the sitemap. + Set this to `first' (default) or `last' to + display folders first or last, respectively. + Any other value will mix files and folders. + :sitemap-alphabetically The site map is normally sorted alphabetically. + Set this explicitly to nil to turn off sorting. + :sitemap-ignore-case Should sorting be case-sensitive? Default nil. + +The following properties control the creation of a concept index. + + :makeindex Create a concept index." :group 'org-publish :type 'alist) (defcustom org-publish-use-timestamps-flag t - "When non-nil, use timestamp checking to publish only changed files. + "Non-nil means use timestamp checking to publish only changed files. When nil, do no timestamp checking and always publish all files." :group 'org-publish :type 'boolean) @@ -208,6 +222,34 @@ Any changes made by this hook will be saved." :group 'org-publish :type 'hook) +(defcustom org-publish-sitemap-sort-alphabetically t + "Should sitemaps be sorted alphabetically by default? + +You can overwrite this default per project in your +`org-publish-project-alist', using `:sitemap-alphabetically'." + :group 'org-publish + :type 'boolean) + +(defcustom org-publish-sitemap-sort-folders 'first + "A symbol, denoting if folders are sorted first in sitemaps. +Possible values are `first', `last', and nil. +If `first', folders will be sorted before files. +If `last', folders are sorted to the end after the files. +Any other value will not mix files and folders. + +You can overwrite this default per project in your +`org-publish-project-alist', using `:sitemap-sort-folders'." + :group 'org-publish + :type 'symbol) + +(defcustom org-publish-sitemap-sort-ignore-case nil + "Sort sitemaps case insensitively by default? + +You can overwrite this default per project in your +`org-publish-project-alist', using `:sitemap-ignore-case'." + :group 'org-publish + :type 'boolean) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Timestamp-related functions @@ -215,29 +257,19 @@ Any changes made by this hook will be saved." "Return path to timestamp file for filename FILENAME." (setq filename (concat filename "::" (or pub-dir "") "::" (format "%s" (or pub-func "")))) - (concat (file-name-as-directory org-publish-timestamp-directory) - "X" (if (fboundp 'sha1) (sha1 filename) (md5 filename)))) + (concat "X" (if (fboundp 'sha1) (sha1 filename) (md5 filename)))) (defun org-publish-needed-p (filename &optional pub-dir pub-func true-pub-dir) - "Return `t' if FILENAME should be published in PUB-DIR using PUB-FUNC. -TRUE-PUB-DIR is there the file will truely end up. Currently we are not using + "Return t if FILENAME should be published in PUB-DIR using PUB-FUNC. +TRUE-PUB-DIR is where the file will truly end up. Currently we are not using this - maybe it can eventually be used to check if the file is present at the target location, and how old it is. Right ow we cannot do this, because we do not know under what file name the file will be stored - the publishing function can still decide about that independently." (let ((rtn (if org-publish-use-timestamps-flag - (if (file-exists-p org-publish-timestamp-directory) - ;; first handle possible wrong timestamp directory - (if (not (file-directory-p org-publish-timestamp-directory)) - (error "Org publish timestamp: %s is not a directory" - org-publish-timestamp-directory) - ;; there is a timestamp, check if FILENAME is newer - (file-newer-than-file-p - filename (org-publish-timestamp-filename - filename pub-dir pub-func))) - (make-directory org-publish-timestamp-directory) - t) + (org-publish-cache-file-needs-publishing + filename pub-dir pub-func) ;; don't use timestamps, always return t t))) (if rtn @@ -249,55 +281,33 @@ function can still decide about that independently." (defun org-publish-update-timestamp (filename &optional pub-dir pub-func) "Update publishing timestamp for file FILENAME. If there is no timestamp, create one." - (let ((timestamp-file (org-publish-timestamp-filename - filename pub-dir pub-func)) - newly-created-timestamp) - (if (not (file-exists-p timestamp-file)) - ;; create timestamp file if needed - (with-temp-buffer - (make-directory (file-name-directory timestamp-file) t) - (write-file timestamp-file) - (setq newly-created-timestamp t))) - ;; Emacs 21 doesn't have `set-file-times' - (if (and (fboundp 'set-file-times) - (not newly-created-timestamp)) - (set-file-times timestamp-file) - (call-process "touch" nil 0 nil (expand-file-name timestamp-file))))) + (let ((key (org-publish-timestamp-filename filename pub-dir pub-func)) + (stamp (org-publish-cache-ctime-of-src filename))) + (org-publish-cache-set key stamp))) (defun org-publish-remove-all-timestamps () - "Remove all files in the timstamp directory." + "Remove all files in the timestamp directory." (let ((dir org-publish-timestamp-directory) files) (when (and (file-exists-p dir) (file-directory-p dir)) - (mapc 'delete-file (directory-files dir 'full "[^.]\\'"))))) + (mapc 'delete-file (directory-files dir 'full "[^.]\\'")) + (org-publish-reset-cache)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Mapping files to project names - -(defvar org-publish-files-alist nil - "Alist of files and their parent projects. -Each element of this alist is of the form: - - (file-name . project-name)") +;;; (defvar org-publish-initial-buffer nil "The buffer `org-publish' has been called from.") (defvar org-publish-temp-files nil "Temporary list of files to be published.") -(defun org-publish-initialize-files-alist (&optional refresh) - "Set `org-publish-files-alist' if it is not set. -Also set it if the optional argument REFRESH is non-nil." - (interactive "P") - (when (or refresh (not org-publish-files-alist)) - (setq org-publish-files-alist - (org-publish-get-files org-publish-project-alist)))) +;; Here, so you find the variable right before it's used the first time: +(defvar org-publish-cache nil + "This will cache timestamps and titles for files in publishing projects. +Blocks could hash sha1 values here.") -(defun org-publish-validate-link (link &optional directory) - "Check if LINK points to a file in the current project." - (assoc (expand-file-name link directory) org-publish-files-alist)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Compatibility aliases @@ -325,23 +335,6 @@ This is a compatibility function for Emacsen without `delete-dups'." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Getting project information out of org-publish-project-alist -(defun org-publish-get-files (projects-alist &optional no-exclusion) - "Return the list of all publishable files for PROJECTS-ALIST. -If NO-EXCLUSION is non-nil, don't exclude files." - (let (all-files) - ;; add all projects - (mapc - (lambda(p) - (let* ((exclude (plist-get (cdr p) :exclude)) - (files (and p (org-publish-get-base-files p exclude)))) - ;; add all files from this project - (mapc (lambda(f) - (add-to-list 'all-files - (cons (expand-file-name f) (car p)))) - files))) - (org-publish-expand-projects projects-alist)) - all-files)) - (defun org-publish-expand-projects (projects-alist) "Expand projects in PROJECTS-ALIST. This splices all the components into the list." @@ -355,6 +348,42 @@ This splices all the components into the list." (push p rtn))) (nreverse (org-publish-delete-dups (delq nil rtn))))) + +(defvar sitemap-alphabetically) +(defvar sitemap-sort-folders) +(defvar sitemap-ignore-case) +(defvar sitemap-requested) +(defun org-publish-compare-directory-files (a b) + "Predicate for `sort', that sorts folders-first/last and alphabetically." + (let ((retval t)) + (when (or sitemap-alphabetically sitemap-sort-folders) + ;; First we sort alphabetically: + (when sitemap-alphabetically + (let* ((adir (file-directory-p a)) + (aorg (and (string-match "\\.org$" a) (not adir))) + (bdir (file-directory-p b)) + (borg (and (string-match "\\.org$" b) (not bdir))) + (A (if aorg + (concat (file-name-directory a) + (org-publish-find-title a)) a)) + (B (if borg + (concat (file-name-directory b) + (org-publish-find-title b)) b))) + (setq retval (if sitemap-ignore-case + (not (string-lessp (upcase B) (upcase A))) + (not (string-lessp B A)))))) + + ;; Directory-wise wins: + (when sitemap-sort-folders + ;; a is directory, b not: + (cond + ((and (file-directory-p a) (not (file-directory-p b))) + (setq retval (equal sitemap-sort-folders 'first))) + ;; a is not a directory, but b is: + ((and (not (file-directory-p a)) (file-directory-p b)) + (setq retval (equal sitemap-sort-folders 'last)))))) + retval)) + (defun org-publish-get-base-files-1 (base-dir &optional recurse match skip-file skip-dir) "Set `org-publish-temp-files' with files from BASE-DIR directory. If RECURSE is non-nil, check BASE-DIR recursively. If MATCH is @@ -373,8 +402,12 @@ matching the regexp SKIP-DIR when recursing through BASE-DIR." (and skip-file (string-match skip-file fnd)) (not (file-exists-p (file-truename f))) (not (string-match match fnd))) + (pushnew f org-publish-temp-files))))) - (directory-files base-dir t (unless recurse match)))) + (if sitemap-requested + (sort (directory-files base-dir t (unless recurse match)) + 'org-publish-compare-directory-files) + (directory-files base-dir t (unless recurse match))))) (defun org-publish-get-base-files (project &optional exclude-regexp) "Return a list of all files in PROJECT. @@ -386,9 +419,29 @@ matching filenames." (include-list (plist-get project-plist :include)) (recurse (plist-get project-plist :recursive)) (extension (or (plist-get project-plist :base-extension) "org")) + ;; sitemap-... variables are dynamically scoped for + ;; org-publish-compare-directory-files: + (sitemap-requested + (plist-get project-plist :auto-sitemap)) + (sitemap-sort-folders + (if (plist-member project-plist :sitemap-sort-folders) + (plist-get project-plist :sitemap-sort-folders) + org-publish-sitemap-sort-folders)) + (sitemap-alphabetically + (if (plist-member project-plist :sitemap-alphabetically) + (plist-get project-plist :sitemap-alphabetically) + org-publish-sitemap-sort-alphabetically)) + (sitemap-ignore-case + (if (plist-member project-plist :sitemap-ignore-case) + (plist-get project-plist :sitemap-ignore-case) + org-publish-sitemap-sort-ignore-case)) (match (if (eq extension 'any) "^[^\\.]" (concat "^[^\\.].*\\.\\(" extension "\\)$")))) + ;; Make sure sitemap-sort-folders' has an accepted value + (unless (memq sitemap-sort-folders '(first last)) + (setq sitemap-sort-folders nil)) + (setq org-publish-temp-files nil) (org-publish-get-base-files-1 base-dir recurse match ;; FIXME distinguish exclude regexp @@ -402,9 +455,27 @@ matching filenames." org-publish-temp-files)) (defun org-publish-get-project-from-filename (filename &optional up) - "Return the project FILENAME belongs." - (let* ((project-name (cdr (assoc (expand-file-name filename) - org-publish-files-alist)))) + "Return the project that FILENAME belongs to." + (let* ((filename (expand-file-name filename)) + project-name) + + (catch 'p-found + (dolist (prj org-publish-project-alist) + (unless (plist-get (cdr prj) :components) + ;; [[info:org:Selecting%20files]] shows how this is supposed to work: + (let* ((r (plist-get (cdr prj) :recursive)) + (b (expand-file-name (plist-get (cdr prj) :base-directory))) + (x (or (plist-get (cdr prj) :base-extension) "org")) + (e (plist-get (cdr prj) :exclude)) + (i (plist-get (cdr prj) :include)) + (xm (concat "^" b (if r ".+" "[^/]+") "\\.\\(" x "\\)$"))) + (when (or + (and i (string-match i filename)) + (and + (not (and e (string-match e filename))) + (string-match xm filename))) + (setq project-name (car prj)) + (throw 'p-found project-name)))))) (when up (dolist (prj org-publish-project-alist) (if (member project-name (plist-get (cdr prj) :components)) @@ -502,20 +573,17 @@ See `org-publish-org-to' to the list of arguments." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Publishing files, sets of files, and indices -(defun org-publish-file (filename &optional project) - "Publish file FILENAME from PROJECT." +(defun org-publish-file (filename &optional project no-cache) + "Publish file FILENAME from PROJECT. +If NO-CACHE is not nil, do not initialize org-publish-cache and +write it to disk. This is needed, since this function is used to +publish single files, when entire projects are published. +See `org-publish-projects'." (let* ((project (or project (or (org-publish-get-project-from-filename filename) - (if (y-or-n-p - (format "%s is not in a project. Re-read the list of projects files? " - (abbreviate-file-name filename))) - ;; If requested, re-initialize the list of projects files - (progn (org-publish-initialize-files-alist t) - (or (org-publish-get-project-from-filename filename) - (error "File %s not part of any known project" - (abbreviate-file-name filename)))) - (error "Can't publish file outside of a project"))))) + (error "File %s not part of any known project" + (abbreviate-file-name filename))))) (project-plist (cdr project)) (ftname (file-truename filename)) (publishing-function @@ -526,6 +594,10 @@ See `org-publish-org-to' to the list of arguments." (pub-dir (file-name-as-directory (file-truename (plist-get project-plist :publishing-directory)))) tmp-pub-dir) + + (unless no-cache + (org-publish-initialize-cache (car project))) + (setq tmp-pub-dir (file-name-directory (concat pub-dir @@ -542,7 +614,8 @@ See `org-publish-org-to' to the list of arguments." tmp-pub-dir) (funcall publishing-function project-plist filename tmp-pub-dir) (org-publish-update-timestamp - filename pub-dir publishing-function))))) + filename pub-dir publishing-function))) + (unless no-cache (org-publish-write-cache-file)))) (defun org-publish-projects (projects) "Publish all files belonging to the PROJECTS alist. @@ -550,6 +623,8 @@ If :auto-sitemap is set, publish the sitemap too. If :makeindex is set, also produce a file theindex.org." (mapc (lambda (project) + ;; Each project uses it's own cache file: + (org-publish-initialize-cache (car project)) (let* ((project-plist (cdr project)) (exclude-regexp (plist-get project-plist :exclude)) @@ -564,19 +639,20 @@ If :makeindex is set, also produce a file theindex.org." (when preparation-function (run-hooks 'preparation-function)) (if sitemap-p (funcall sitemap-function project sitemap-filename)) (while (setq file (pop files)) - (org-publish-file file project)) + (org-publish-file file project t)) (when (plist-get project-plist :makeindex) (org-publish-index-generate-theindex.inc (plist-get project-plist :base-directory)) (org-publish-file (expand-file-name "theindex.org" (plist-get project-plist :base-directory)) - project)) - (when completion-function (run-hooks 'completion-function)))) + project t)) + (when completion-function (run-hooks 'completion-function)) + (org-publish-write-cache-file))) (org-publish-expand-projects projects))) (defun org-publish-org-sitemap (project &optional sitemap-filename) - "Create an sitemap of pages in set defined by PROJECT. + "Create a sitemap of pages in set defined by PROJECT. Optionally set the filename of the sitemap with SITEMAP-FILENAME. Default for SITEMAP-FILENAME is 'sitemap.org'." (let* ((project-plist (cdr project)) @@ -639,8 +715,10 @@ Default for SITEMAP-FILENAME is 'sitemap.org'." (or visiting (kill-buffer sitemap-buffer)))) (defun org-publish-find-title (file) - "Find the title of file in project." - (let* ((visiting (find-buffer-visiting file)) + "Find the title of FILE in project." + (or + (org-publish-cache-get-file-property file :title nil t) + (let* ((visiting (find-buffer-visiting file)) (buffer (or visiting (find-file-noselect file))) title) (with-current-buffer buffer @@ -654,7 +732,8 @@ Default for SITEMAP-FILENAME is 'sitemap.org'." (file-name-nondirectory (file-name-sans-extension file)))))) (unless visiting (kill-buffer buffer)) - title)) + (org-publish-cache-set-file-property file :title title) + title))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Interactive publishing functions @@ -676,7 +755,12 @@ Default for SITEMAP-FILENAME is 'sitemap.org'." (save-window-excursion (let* ((org-publish-use-timestamps-flag (if force nil org-publish-use-timestamps-flag))) - (org-publish-projects (list project))))) + (org-publish-projects + (if (stringp project) + ;; If this function is called in batch mode, + ;; project is still a string here. + (list (assoc project org-publish-project-alist)) + (list project)))))) ;;;###autoload (defun org-publish-all (&optional force) @@ -686,7 +770,7 @@ directory and force publishing all files." (interactive "P") (when force (org-publish-remove-all-timestamps)) - (org-publish-initialize-files-alist force) + ;; (org-publish-initialize-files-alist force) (save-window-excursion (let ((org-publish-use-timestamps-flag (if force nil org-publish-use-timestamps-flag))) @@ -698,7 +782,6 @@ directory and force publishing all files." "Publish the current file. With prefix argument, force publish the file." (interactive "P") - (org-publish-initialize-files-alist force) (save-window-excursion (let ((org-publish-use-timestamps-flag (if force nil org-publish-use-timestamps-flag))) @@ -710,13 +793,13 @@ With prefix argument, force publish the file." With a prefix argument, force publishing of all files in the project." (interactive "P") - (org-publish-initialize-files-alist force) (save-window-excursion (let ((project (org-publish-get-project-from-filename (buffer-file-name) 'up)) (org-publish-use-timestamps-flag (if force nil org-publish-use-timestamps-flag))) (if (not project) (error "File %s is not part of any known project" (buffer-file-name))) + ;; FIXME: force is not used here? (org-publish project)))) @@ -736,11 +819,11 @@ the project." (when (eq backend 'latex) (replace-match (format "\\index{%s}" entry) t t)) (save-excursion - (org-back-to-heading t) + (ignore-errors (org-back-to-heading t)) (setq target (get-text-property (point) 'target)) (setq target (or (cdr (assoc target org-export-preferred-target-alist)) (cdr (assoc target org-export-id-target-alist)) - target)) + target "")) (push (cons entry target) index))) (with-temp-file (concat (file-name-sans-extension org-current-export-file) ".orgx") @@ -760,7 +843,7 @@ the project." full-files)) (default-directory directory) index origfile buf target entry ibuffer - main last-main letter last-letter file sub link) + main last-main letter last-letter file sub link tgext) ;; `files' contains the list of relative file names (dolist (file files) (setq origfile (substring file 0 -1)) @@ -781,6 +864,9 @@ the project." (setq last-letter nil) (dolist (idx index) (setq entry (car idx) file (nth 1 idx) target (nth 2 idx)) + (if (and (stringp target) (string-match "\\S-" target)) + (setq tgext (concat "::#" target)) + (setq tgext "")) (setq letter (upcase (substring entry 0 1))) (when (not (equal letter last-letter)) (insert "** " letter "\n") @@ -792,7 +878,7 @@ the project." (when (and main (not (equal main last-main))) (insert " - " main "\n") (setq last-main main)) - (setq link (concat "[[file:" file "::#" target "]" + (setq link (concat "[[file:" file tgext "]" "[" (or sub entry) "]]")) (if (and main sub) (insert " - " link "\n") @@ -809,8 +895,143 @@ the project." (save-buffer)) (kill-buffer ibuffer))))) -(provide 'org-publish) +;; Caching functions: + +(defun org-publish-write-cache-file (&optional free-cache) + "Write `org-publish-cache' to file. +If FREE-CACHE, empty the cache." + (unless org-publish-cache + (error "%s" "`org-publish-write-cache-file' called, but no cache present")) + + (let ((cache-file (org-publish-cache-get ":cache-file:"))) + (unless cache-file + (error + "%s" "Cannot find cache-file name in `org-publish-write-cache-file'")) + (with-temp-file cache-file + (let ((print-level nil) + (print-length nil)) + (insert "(setq org-publish-cache (make-hash-table :test 'equal :weakness nil :size 100))\n") + (maphash (lambda (k v) + (insert + (format (concat "(puthash %S " + (if (or (listp v) (symbolp v)) + "'" "") + "%S org-publish-cache)\n") k v))) + org-publish-cache))) + (when free-cache (org-publish-reset-cache)))) + +(defun org-publish-initialize-cache (project-name) + "Initialize the projects cache if not initialized yet and return it." + + (unless project-name + (error "%s%s" "Cannot initialize `org-publish-cache' without projects name" + " in `org-publish-initialize-cache'")) + + (unless (file-exists-p org-publish-timestamp-directory) + (make-directory org-publish-timestamp-directory t)) + (if (not (file-directory-p org-publish-timestamp-directory)) + (error "Org publish timestamp: %s is not a directory" + org-publish-timestamp-directory)) + + (unless (and org-publish-cache + (string= (org-publish-cache-get ":project:") project-name)) + (let* ((cache-file (concat + (expand-file-name org-publish-timestamp-directory) + project-name + ".cache")) + (cexists (file-exists-p cache-file))) + + (when org-publish-cache + (org-publish-reset-cache)) + + (if cexists + (load-file cache-file) + (setq org-publish-cache + (make-hash-table :test 'equal :weakness nil :size 100)) + (org-publish-cache-set ":project:" project-name) + (org-publish-cache-set ":cache-file:" cache-file)) + (unless cexists (org-publish-write-cache-file nil)))) + org-publish-cache) + +(defun org-publish-reset-cache () + "Empty org-publish-cache and reset it nil." + (message "%s" "Resetting org-publish-cache") + (if (hash-table-p org-publish-cache) + (clrhash org-publish-cache)) + (setq org-publish-cache nil)) + +(defun org-publish-cache-file-needs-publishing (filename &optional pub-dir pub-func) + "Check the timestamp of the last publishing of FILENAME. +Return `t', if the file needs publishing" + (unless org-publish-cache + (error "%s" "`org-publish-cache-file-needs-publishing' called, but no cache present")) + (let* ((key (org-publish-timestamp-filename filename pub-dir pub-func)) + (pstamp (org-publish-cache-get key))) + (if (null pstamp) + t + (let ((ctime (org-publish-cache-ctime-of-src filename))) + (< pstamp ctime))))) + +(defun org-publish-cache-set-file-property (filename property value &optional project-name) + "Set the VALUE for a PROPERTY of file FILENAME in publishing cache to VALUE. +Use cache file of PROJECT-NAME. If the entry does not exist, it will be +created. Return VALUE." + ;; Evtl. load the requested cache file: + (if project-name (org-publish-initialize-cache project-name)) + (let ((pl (org-publish-cache-get filename))) + (if pl + (progn + (plist-put pl property value) + value) + (org-publish-cache-get-file-property + filename property value nil project-name)))) + +(defun org-publish-cache-get-file-property + (filename property &optional default no-create project-name) + "Return the value for a PROPERTY of file FILENAME in publishing cache. +Use cache file of PROJECT-NAME. Return the value of that PROPERTY or +DEFAULT, if the value does not yet exist. +If the entry will be created, unless NO-CREATE is not nil." + ;; Evtl. load the requested cache file: + (if project-name (org-publish-initialize-cache project-name)) + (let ((pl (org-publish-cache-get filename)) + (retval nil)) + (if pl + (if (plist-member pl property) + (setq retval (plist-get pl property)) + (setq retval default)) + ;; no pl yet: + (unless no-create + (org-publish-cache-set filename (list property default))) + (setq retval default)) + retval)) + +(defun org-publish-cache-get (key) + "Return the value stored in `org-publish-cache' for key KEY. +Returns nil, if no value or nil is found, or the cache does not +exist." + (unless org-publish-cache + (error "%s" "`org-publish-cache-get' called, but no cache present")) + (gethash key org-publish-cache)) + +(defun org-publish-cache-set (key value) + "Store KEY VALUE pair in `org-publish-cache'. +Returns value on success, else nil." + (unless org-publish-cache + (error "%s" "`org-publish-cache-set' called, but no cache present")) + (puthash key value org-publish-cache)) + +(defun org-publish-cache-ctime-of-src (filename) + "Get the files ctime as integer." + (let ((src-attr (file-attributes filename))) + (+ + (lsh (car (nth 5 src-attr)) 16) + (cadr (nth 5 src-attr))))) + + + +(provide 'org-publish) ;; arch-tag: 72807f3c-8af0-4a6b-8dca-c3376eb25adb diff --git a/lisp/org/org-remember.el b/lisp/org/org-remember.el index a20539dd85a..d8252b65c3d 100644 --- a/lisp/org/org-remember.el +++ b/lisp/org/org-remember.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -54,14 +54,15 @@ :group 'org) (defcustom org-remember-store-without-prompt t - "Non-nil means `C-c C-c' stores remember note without further prompts. + "Non-nil means \\<org-remember-mode-map>\\[org-remember-finalize] \ +stores the remember note without further prompts. It then uses the file and headline specified by the template or (if the template does not specify them) by the variables `org-default-notes-file' and `org-remember-default-headline'. To force prompting anyway, use -`C-u C-c C-c' to file the note. +\\[universal-argument] \\[org-remember-finalize] to file the note. -When this variable is nil, `C-c C-c' gives you the prompts, and -`C-u C-c C-c' triggers the fasttrack." +When this variable is nil, \\[org-remember-finalize] gives you the prompts, and +\\[universal-argument] \\[org-remember-finalize] triggers the fasttrack." :group 'org-remember :type 'boolean) @@ -94,10 +95,10 @@ You can set this on a per-template basis with the variable (defcustom org-remember-templates nil "Templates for the creation of remember buffers. When nil, just let remember make the buffer. -When non-nil, this is a list of 5-element lists. In each entry, the first -element is the name of the template, which should be a single short word. -The second element is a character, a unique key to select this template. -The third element is the template. +When non-nil, this is a list of (up to) 6-element lists. In each entry, +the first element is the name of the template, which should be a single +short word. The second element is a character, a unique key to select +this template. The third element is the template. The fourth element is optional and can specify a destination file for remember items created with this template. The default file is given @@ -114,41 +115,44 @@ An optional sixth element specifies the contexts in which the template will be offered to the user. This element can be a list of major modes or a function, and the template will only be offered if `org-remember' is called from a mode in the list, or if the function returns t. -Templates that specify t or nil for the context will be always be added +Templates that specify t or nil for the context will always be added to the list of selectable templates. The template specifies the structure of the remember buffer. It should have a first line starting with a star, to act as the org-mode headline. Furthermore, the following %-escapes will be replaced with content: - %^{prompt} Prompt the user for a string and replace this sequence with it. - A default value and a completion table ca be specified like this: + %^{PROMPT} prompt the user for a string and replace this sequence with it. + A default value and a completion table can be specified like this: %^{prompt|default|completion2|completion3|...} + The arrow keys access a prompt-specific history. + %a annotation, normally the link created with `org-store-link' + %A like %a, but prompt for the description part + %i initial content, copied from the active region. If %i is + indented, the entire inserted text will be indented as well. %t time stamp, date only %T time stamp with date and time %u, %U like the above, but inactive time stamps %^t like %t, but prompt for date. Similarly %^T, %^u, %^U. - You may define a prompt like %^{Please specify birthday + You may define a prompt like %^{Please specify birthday}t %n user name (taken from `user-full-name') - %a annotation, normally the link created with org-store-link - %i initial content, copied from the active region. If %i is - indented, the entire inserted text will be indented as well. %c current kill ring head %x content of the X clipboard - %^C Interactive selection of which kill or clip to use - %^L Like %^C, but insert as link - %k title of currently clocked task - %K link to currently clocked task - %^g prompt for tags, with completion on tags in target file - %^G prompt for tags, with completion all tags in all agenda files - %^{prop}p Prompt the user for a value for property `prop' %:keyword specific information for certain link types, see below - %[pathname] insert the contents of the file given by `pathname' - %(sexp) evaluate elisp `(sexp)' and replace with the result - %! Store this note immediately after filling the template - %& Visit note immediately after storing it - - %? After completing the template, position cursor here. + %^C interactive selection of which kill or clip to use + %^L like %^C, but insert as link + %k title of the currently clocked task + %K link to the currently clocked task + %^g prompt for tags, completing tags in the target file + %^G prompt for tags, completing all tags in all agenda files + %^{PROP}p Prompt the user for a value for property PROP + %[PATHNAME] insert the contents of the file given by PATHNAME + %(SEXP) evaluate elisp `(SEXP)' and replace with the result + %! store this note immediately after completing the template\ + \\<org-remember-mode-map> + (skipping the \\[org-remember-finalize] that normally triggers storing) + %& jump to target location immediately after storing note + %? after completing the template, position cursor here. Apart from these general escapes, you can access information specific to the link type that is created. For example, calling `remember' in emails or gnus @@ -211,7 +215,7 @@ The remember buffer is still current when this hook runs." :type 'hook) (defvar org-remember-mode-map (make-sparse-keymap) - "Keymap for org-remember-mode, a minor mode. + "Keymap for `org-remember-mode', a minor mode. Use this map to set additional keybindings for when Org-mode is used for a Remember buffer.") (defvar org-remember-mode-hook nil @@ -229,7 +233,7 @@ for a Remember buffer.") This only applies if the clock is running in the remember buffer. If the clock is not stopped, it continues to run in the storage location. Instead of nil or t, this may also be the symbol `query' to prompt the -user each time a remember buffer with a running clock is filed away. " +user each time a remember buffer with a running clock is filed away." :group 'org-remember :type '(choice (const :tag "Never" nil) @@ -265,7 +269,7 @@ Set this to nil if you find that you don't need the warning. If you cancel remember calls frequently and know when they contain useful information (because you know that you made an -error or emacs crashed, for example) nil is more useful. In the +error or Emacs crashed, for example) nil is more useful. In the opposite case, the default, t, is more useful." :group 'org-remember :type 'boolean) @@ -388,12 +392,6 @@ RET at beg-of-buf -> Append to file as level 2 headline char0)))))) (cddr (assoc char templates))))) -(defun org-get-x-clipboard (value) - "Get the value of the x clipboard, compatible with XEmacs, and GNU Emacs 21." - (if (eq window-system 'x) - (let ((x (org-get-x-clipboard-compat value))) - (if x (org-no-properties x))))) - ;;;###autoload (defun org-remember-apply-template (&optional use-char skip-interactive) "Initialize *remember* buffer with template, invoke `org-mode'. @@ -727,9 +725,11 @@ from that hook." If there is an active region, make sure remember uses it as initial content of the remember buffer. -When called interactively with a `C-u' prefix argument GOTO, don't remember +When called interactively with a \\[universal-argument] \ +prefix argument GOTO, don't remember anything, just go to the file/headline where the selected template usually -stores its notes. With a double prefix arg `C-u C-u', go to the last +stores its notes. With a double prefix argument \ +\\[universal-argument] \\[universal-argument], go to the last note stored by remember. Lisp programs can set ORG-FORCE-REMEMBER-TEMPLATE-CHAR to a character @@ -801,21 +801,24 @@ The user is queried for the template." When the template has specified a file and a headline, the entry is filed there, or in the location defined by `org-default-notes-file' and `org-remember-default-headline'. - +\\<org-remember-mode-map> If no defaults have been defined, or if the current prefix argument -is 1 (so you must use `C-1 C-c C-c' to exit remember), an interactive +is 1 (using C-1 \\[org-remember-finalize] to exit remember), an interactive process is used to select the target location. -When the prefix is 0 (i.e. when remember is exited with `C-0 C-c C-c'), +When the prefix is 0 (i.e. when remember is exited with \ +C-0 \\[org-remember-finalize]), the entry is filed to the same location as the previous note. -When the prefix is 2 (i.e. when remember is exited with `C-2 C-c C-c'), +When the prefix is 2 (i.e. when remember is exited with \ +C-2 \\[org-remember-finalize]), the entry is filed as a subentry of the entry where the clock is currently running. -When `C-u' has been used as prefix argument, the note is stored and emacs -moves point to the new location of the note, so that editing can be -continued there (similar to inserting \"%&\" into the template). +When \\[universal-argument] has been used as prefix argument, the +note is stored and Emacs moves point to the new location of the +note, so that editing can be continued there (similar to +inserting \"%&\" into the template). Before storing the note, the function ensures that the text has an org-mode-style headline, i.e. a first line that starts with diff --git a/lisp/org/org-rmail.el b/lisp/org/org-rmail.el index 28e991f0214..4ddfadaafa5 100644 --- a/lisp/org/org-rmail.el +++ b/lisp/org/org-rmail.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index 395c592e696..453f3b0b534 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el @@ -8,7 +8,7 @@ ;; Dan Davison <davison at stats dot ox dot ac dot uk> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -63,7 +63,7 @@ there are kept outside the narrowed region." "The default coderef format. This format string will be used to search for coderef labels in literal examples (EXAMPLE and SRC blocks). The format can be overwritten in -an individual literal example with the -f option, like +an individual literal example with the -l option, like #+BEGIN_SRC pascal +n -r -l \"((%s))\" ... @@ -87,10 +87,11 @@ These are the regions where each line starts with a colon." (function :tag "Other (specify)"))) (defcustom org-src-preserve-indentation nil - "If non-nil, leading whitespace characters in source code -blocks are preserved on export, and when switching between the -org buffer and the language mode edit buffer. If this variable -is nil then, after editing with \\[org-edit-src-code], the + "If non-nil preserve leading whitespace characters on export. +If non-nil leading whitespace characters in source code blocks +are preserved on export, and when switching between the org +buffer and the language mode edit buffer. If this variable is nil +then, after editing with \\[org-edit-src-code], the minimum (across-lines) number of leading whitespace characters are removed from all lines, and the code block is uniformly indented according to the value of `org-edit-src-content-indentation'." @@ -101,7 +102,7 @@ indented according to the value of `org-edit-src-content-indentation'." "Indentation for the content of a source code block. This should be the number of spaces added to the indentation of the #+begin line in order to compute the indentation of the block content after -editing it with \\[org-edit-src-code]. Has no effect if +editing it with \\[org-edit-src-code]. Has no effect if `org-src-preserve-indentation' is non-nil." :group 'org-edit-structure :type 'integer) @@ -146,7 +147,7 @@ but which mess up the display of a snippet in Org exported files.") (defcustom org-src-lang-modes '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist) - ("asymptote" . asy) ("dot" . fundamental)) + ("asymptote" . asy) ("dot" . fundamental) ("sqlite" . sql)) "Alist mapping languages to their major mode. The key is the language name, the value is the string that should be inserted as the name of the major mode. For many languages this is @@ -166,6 +167,7 @@ For example, there is no ocaml-mode in Emacs, but the mode to use is (define-key org-src-mode-map "\C-c'" 'org-edit-src-exit) (defvar org-edit-src-force-single-line nil) (defvar org-edit-src-from-org-mode nil) +(defvar org-edit-src-allow-write-back-p t) (defvar org-edit-src-picture nil) (defvar org-edit-src-beg-marker nil) (defvar org-edit-src-end-marker nil) @@ -187,7 +189,7 @@ This minor mode is turned on in two situations: There is a mode hook, and keybindings for `org-edit-src-exit' and `org-edit-src-save'") -(defun org-edit-src-code (&optional context) +(defun org-edit-src-code (&optional context code edit-buffer-name) "Edit the source code example at point. The example is copied to a separate buffer, and that buffer is switched to the correct language mode. When done, exit with \\[org-edit-src-exit]. @@ -200,19 +202,22 @@ the edited version. Optional argument CONTEXT is used by (let ((line (org-current-line)) (col (current-column)) (case-fold-search t) - (msg (substitute-command-keys - "Edit, then exit with C-c ' (C-c and single quote)")) (info (org-edit-src-find-region-and-lang)) (org-mode-p (eq major-mode 'org-mode)) (beg (make-marker)) (end (make-marker)) (preserve-indentation org-src-preserve-indentation) - block-nindent total-nindent ovl lang lang-f single lfmt code begline buffer) + (allow-write-back-p (null code)) + block-nindent total-nindent ovl lang lang-f single lfmt begline buffer msg) (if (not info) nil (setq beg (move-marker beg (nth 0 info)) end (move-marker end (nth 1 info)) - code (buffer-substring-no-properties beg end) + msg (if allow-write-back-p + (substitute-command-keys + "Edit, then exit with C-c ' (C-c and single quote)") + "Exit with C-c ' (C-c and single quote)") + code (or code (buffer-substring-no-properties beg end)) lang (or (cdr (assoc (nth 2 info) org-src-lang-modes)) (nth 2 info)) lang (if (symbolp lang) (symbol-name lang) lang) @@ -238,20 +243,21 @@ the edited version. Optional argument CONTEXT is used by (when buffer (with-current-buffer buffer (if (boundp 'org-edit-src-overlay) - (org-delete-overlay org-edit-src-overlay))) + (delete-overlay org-edit-src-overlay))) (kill-buffer buffer)) (setq buffer (generate-new-buffer - (org-src-construct-edit-buffer-name (buffer-name) lang))) - (setq ovl (org-make-overlay beg end)) - (org-overlay-put ovl 'edit-buffer buffer) - (org-overlay-put ovl 'help-echo "Click with mouse-1 to switch to buffer editing this segment") - (org-overlay-put ovl 'face 'secondary-selection) - (org-overlay-put ovl - 'keymap - (let ((map (make-sparse-keymap))) - (define-key map [mouse-1] 'org-edit-src-continue) - map)) - (org-overlay-put ovl :read-only "Leave me alone") + (or edit-buffer-name + (org-src-construct-edit-buffer-name (buffer-name) lang)))) + (setq ovl (make-overlay beg end)) + (overlay-put ovl 'edit-buffer buffer) + (overlay-put ovl 'help-echo "Click with mouse-1 to switch to buffer editing this segment") + (overlay-put ovl 'face 'secondary-selection) + (overlay-put ovl + 'keymap + (let ((map (make-sparse-keymap))) + (define-key map [mouse-1] 'org-edit-src-continue) + map)) + (overlay-put ovl :read-only "Leave me alone") (org-src-switch-to-buffer buffer 'edit) (if (eq single 'macro-definition) (setq code (replace-regexp-in-string "\\\\n" "\n" code t t))) @@ -264,6 +270,7 @@ the edited version. Optional argument CONTEXT is used by (funcall lang-f)) (set (make-local-variable 'org-edit-src-force-single-line) single) (set (make-local-variable 'org-edit-src-from-org-mode) org-mode-p) + (set (make-local-variable 'org-edit-src-allow-write-back-p) allow-write-back-p) (set (make-local-variable 'org-src-preserve-indentation) preserve-indentation) (when lfmt (set (make-local-variable 'org-coderef-label-format) lfmt)) @@ -320,7 +327,7 @@ the edited version. Optional argument CONTEXT is used by (switch-to-buffer buffer)))) (defun org-src-construct-edit-buffer-name (org-buffer-name lang) - "Construct the buffer name for a source editing buffer" + "Construct the buffer name for a source editing buffer." (concat "*Org Src " org-buffer-name "[ " lang " ]*")) (defun org-edit-src-find-buffer (beg end) @@ -381,22 +388,22 @@ the fragment in the Org-mode buffer." (when buffer (with-current-buffer buffer (if (boundp 'org-edit-src-overlay) - (org-delete-overlay org-edit-src-overlay))) + (delete-overlay org-edit-src-overlay))) (kill-buffer buffer)) (setq buffer (generate-new-buffer (org-src-construct-edit-buffer-name (buffer-name) "Fixed Width"))) - (setq ovl (org-make-overlay beg end)) - (org-overlay-put ovl 'face 'secondary-selection) - (org-overlay-put ovl 'edit-buffer buffer) - (org-overlay-put ovl 'help-echo "Click with mouse-1 to switch to buffer editing this segment") - (org-overlay-put ovl 'face 'secondary-selection) - (org-overlay-put ovl + (setq ovl (make-overlay beg end)) + (overlay-put ovl 'face 'secondary-selection) + (overlay-put ovl 'edit-buffer buffer) + (overlay-put ovl 'help-echo "Click with mouse-1 to switch to buffer editing this segment") + (overlay-put ovl 'face 'secondary-selection) + (overlay-put ovl 'keymap (let ((map (make-sparse-keymap))) (define-key map [mouse-1] 'org-edit-src-continue) map)) - (org-overlay-put ovl :read-only "Leave me alone") + (overlay-put ovl :read-only "Leave me alone") (switch-to-buffer buffer) (insert code) (remove-text-properties (point-min) (point-max) @@ -406,7 +413,7 @@ the fragment in the Org-mode buffer." ((eq org-edit-fixed-width-region-mode 'artist-mode) (fundamental-mode) (artist-mode 1)) - (t (funcall org-edit-fixed-width-region-mode))) + (t (funcall org-edit-fixed-width-region-mode))) (set (make-local-variable 'org-edit-src-force-single-line) nil) (set (make-local-variable 'org-edit-src-from-org-mode) org-mode-p) (set (make-local-variable 'org-edit-src-picture) t) @@ -459,15 +466,6 @@ the language, a switch telling if the content should be in a single line." (pos (point)) re1 re2 single beg end lang lfmt match-re1 ind entry) (catch 'exit - (when (org-at-table.el-p) - (re-search-backward "^[\t]*[^ \t|\\+]" nil t) - (setq beg (1+ (point-at-eol))) - (goto-char beg) - (or (re-search-forward "^[\t]*[^ \t|\\+]" nil t) - (progn (goto-char (point-max)) (newline))) - (setq end (point-at-bol)) - (setq ind (org-edit-src-get-indentation beg)) - (throw 'exit (list beg end 'table.el nil nil ind))) (while (setq entry (pop re-list)) (setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry) single (nth 3 entry)) @@ -498,7 +496,16 @@ the language, a switch telling if the content should be in a single line." (throw 'exit (list (match-end 0) end (org-edit-src-get-lang lang) - single lfmt ind)))))))))))) + single lfmt ind))))))))) + (when (org-at-table.el-p) + (re-search-backward "^[\t]*[^ \t|\\+]" nil t) + (setq beg (1+ (point-at-eol))) + (goto-char beg) + (or (re-search-forward "^[\t]*[^ \t|\\+]" nil t) + (progn (goto-char (point-max)) (newline))) + (setq end (point-at-bol)) + (setq ind (org-edit-src-get-indentation beg)) + (throw 'exit (list beg end 'table.el nil nil ind)))))) (defun org-edit-src-get-lang (lang) "Extract the src language." @@ -521,7 +528,7 @@ the language, a switch telling if the content should be in a single line." (match-string 1 s)))) (defun org-edit-src-get-indentation (pos) - "Count leading whitespace characters on line" + "Count leading whitespace characters on line." (save-match-data (goto-char pos) (org-get-indentation))) @@ -529,8 +536,8 @@ the language, a switch telling if the content should be in a single line." (defun org-edit-src-exit (&optional context) "Exit special edit and protect problematic lines." (interactive) - (unless org-edit-src-from-org-mode - (error "This is not a sub-editing buffer, something is wrong...")) + (unless (org-bound-and-true-p org-edit-src-from-org-mode) + (error "This is not a sub-editing buffer, something is wrong")) (widen) (let* ((beg org-edit-src-beg-marker) (end org-edit-src-end-marker) @@ -541,61 +548,65 @@ the language, a switch telling if the content should be in a single line." (total-nindent (+ (or org-edit-src-block-indentation 0) org-edit-src-content-indentation)) (preserve-indentation org-src-preserve-indentation) + (allow-write-back-p (org-bound-and-true-p org-edit-src-allow-write-back-p)) (delta 0) code line col indent) - (unless preserve-indentation (untabify (point-min) (point-max))) - (save-excursion - (goto-char (point-min)) - (if (looking-at "[ \t\n]*\n") (replace-match "")) - (unless macro - (if (re-search-forward "\n[ \t\n]*\\'" nil t) (replace-match "")))) + (when allow-write-back-p + (unless preserve-indentation (untabify (point-min) (point-max))) + (save-excursion + (goto-char (point-min)) + (if (looking-at "[ \t\n]*\n") (replace-match "")) + (unless macro + (if (re-search-forward "\n[ \t\n]*\\'" nil t) (replace-match ""))))) (setq line (if (org-bound-and-true-p org-edit-src-force-single-line) 1 (org-current-line)) col (current-column)) - (when single - (goto-char (point-min)) - (if (re-search-forward "\\s-+\\'" nil t) (replace-match "")) - (goto-char (point-min)) - (let ((cnt 0)) - (while (re-search-forward "\n" nil t) - (setq cnt (1+ cnt)) - (replace-match (if macro "\\n" " ") t t)) - (when (and macro (> cnt 0)) - (goto-char (point-max)) (insert "\\n"))) - (goto-char (point-min)) - (if (looking-at "\\s-*") (replace-match " "))) - (when (org-bound-and-true-p org-edit-src-from-org-mode) - (goto-char (point-min)) - (while (re-search-forward - (if (org-mode-p) "^\\(.\\)" "^\\([*]\\|[ \t]*#\\+\\)") nil t) - (if (eq (org-current-line) line) (setq delta (1+ delta))) - (replace-match ",\\1"))) - (when (org-bound-and-true-p org-edit-src-picture) - (setq preserve-indentation nil) - (untabify (point-min) (point-max)) - (goto-char (point-min)) - (while (re-search-forward "^" nil t) - (replace-match ": "))) - (unless (or single preserve-indentation (= total-nindent 0)) - (setq indent (make-string total-nindent ?\ )) - (goto-char (point-min)) - (while (re-search-forward "^" nil t) - (replace-match indent))) - (if (org-bound-and-true-p org-edit-src-picture) - (setq total-nindent (+ total-nindent 2))) - (setq code (buffer-string)) - (set-buffer-modified-p nil) + (when allow-write-back-p + (when single + (goto-char (point-min)) + (if (re-search-forward "\\s-+\\'" nil t) (replace-match "")) + (goto-char (point-min)) + (let ((cnt 0)) + (while (re-search-forward "\n" nil t) + (setq cnt (1+ cnt)) + (replace-match (if macro "\\n" " ") t t)) + (when (and macro (> cnt 0)) + (goto-char (point-max)) (insert "\\n"))) + (goto-char (point-min)) + (if (looking-at "\\s-*") (replace-match " "))) + (when (org-bound-and-true-p org-edit-src-from-org-mode) + (goto-char (point-min)) + (while (re-search-forward + (if (org-mode-p) "^\\(.\\)" "^\\([*]\\|[ \t]*#\\+\\)") nil t) + (if (eq (org-current-line) line) (setq delta (1+ delta))) + (replace-match ",\\1"))) + (when (org-bound-and-true-p org-edit-src-picture) + (setq preserve-indentation nil) + (untabify (point-min) (point-max)) + (goto-char (point-min)) + (while (re-search-forward "^" nil t) + (replace-match ": "))) + (unless (or single preserve-indentation (= total-nindent 0)) + (setq indent (make-string total-nindent ?\ )) + (goto-char (point-min)) + (while (re-search-forward "^" nil t) + (replace-match indent))) + (if (org-bound-and-true-p org-edit-src-picture) + (setq total-nindent (+ total-nindent 2))) + (setq code (buffer-string)) + (set-buffer-modified-p nil)) (org-src-switch-to-buffer (marker-buffer beg) (or context 'exit)) (kill-buffer buffer) (goto-char beg) - (delete-region beg end) - (insert code) - (goto-char beg) - (if single (just-one-space)) + (when allow-write-back-p + (delete-region beg end) + (insert code) + (goto-char beg) + (if single (just-one-space))) (if (memq t (mapcar (lambda (overlay) - (eq (org-overlay-get overlay 'invisible) + (eq (overlay-get overlay 'invisible) 'org-hide-block)) - (org-overlays-at (point)))) + (overlays-at (point)))) ;; Block is hidden; put point at start of block (beginning-of-line 0) ;; Block is visible, put point where it was in the code buffer @@ -625,15 +636,21 @@ the language, a switch telling if the content should be in a single line." (message (or msg "")))) (defun org-src-mode-configure-edit-buffer () - (when org-edit-src-from-org-mode - (setq buffer-offer-save t) - (setq buffer-file-name - (concat (buffer-file-name (marker-buffer org-edit-src-beg-marker)) - "[" (buffer-name) "]")) - (set (if (featurep 'xemacs) 'write-contents-hooks 'write-contents-functions) - '(org-edit-src-save)) + (when (org-bound-and-true-p org-edit-src-from-org-mode) (org-add-hook 'kill-buffer-hook - '(lambda () (org-delete-overlay org-edit-src-overlay)) nil 'local))) + '(lambda () (delete-overlay org-edit-src-overlay)) nil 'local) + (if (org-bound-and-true-p org-edit-src-allow-write-back-p) + (progn + (setq buffer-offer-save t) + (setq buffer-file-name + (concat (buffer-file-name (marker-buffer org-edit-src-beg-marker)) + "[" (buffer-name) "]")) + (if (featurep 'xemacs) + (progn + (make-variable-buffer-local 'write-contents-hooks) ; needed only for 21.4 + (setq write-contents-hooks '(org-edit-src-save))) + (setq write-contents-functions '(org-edit-src-save)))) + (setq buffer-read-only t)))) (org-add-hook 'org-src-mode-hook 'org-src-mode-configure-edit-buffer) diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index bbf9f10bc25..6a7120e0e55 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -196,7 +196,7 @@ t: accept as input and present for editing" calc-date-format (YYYY "-" MM "-" DD " " Www (" " hh ":" mm)) calc-display-working-message t ) - "List with Calc mode settings for use in calc-eval for table formulas. + "List with Calc mode settings for use in `calc-eval' for table formulas. The list must contain alternating symbols (Calc modes variables and values). Don't remove any of the default settings, just change the values. Org-mode relies on the variables to be present in the list." @@ -276,10 +276,11 @@ portability of tables." :group 'org-table) (defcustom org-table-export-default-format "orgtbl-to-tsv" - "Default export parameters for org-table-export. These can be -overridden on for a specific table by setting the TABLE_EXPORT_FORMAT -property. See the manual section on orgtbl radio tables for the different -export transformations and available parameters." + "Default export parameters for `org-table-export'. +These can be overridden for a specific table by setting the +TABLE_EXPORT_FORMAT property. See the manual section on orgtbl +radio tables for the different export transformations and +available parameters." :group 'org-table-import-export :type 'string) @@ -290,8 +291,7 @@ export transformations and available parameters." (defconst org-table-calculate-mark-regexp "^[ \t]*| *[!$^_#*] *\\(|\\|$\\)" "Detects a table line marked for automatic recalculation.") (defconst org-table-border-regexp "^[ \t]*[^| \t]" - "Searching from within a table (any type) this finds the first line -outside the table.") + "Searching from within a table (any type) this finds the first line outside the table.") (defvar org-table-last-highlighted-reference nil) (defvar org-table-formula-history nil) @@ -305,11 +305,11 @@ outside the table.") "Alist with locations of named fields.") (defvar org-table-current-line-types nil - "Table row types, non-nil only for the duration of a comand.") + "Table row types, non-nil only for the duration of a command.") (defvar org-table-current-begin-line nil - "Table begin line, non-nil only for the duration of a comand.") + "Table begin line, non-nil only for the duration of a command.") (defvar org-table-current-begin-pos nil - "Table begin position, non-nil only for the duration of a comand.") + "Table begin position, non-nil only for the duration of a command.") (defvar org-table-dlines nil "Vector of data line line numbers in the current table.") (defvar org-table-hlines nil @@ -327,6 +327,33 @@ outside the table.") "\\(" "@?[-0-9I$&]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\|" "\\$[a-zA-Z0-9]+" "\\)") "Match a range for reference display.") +(defun org-table-colgroup-line-p (line) + "Is this a table line colgroup information?" + (save-match-data + (and (string-match "[<>]\\|&[lg]t;" line) + (string-match "\\`[ \t]*|[ \t]*/[ \t]*\\(|[ \t<>0-9|lgt&;]+\\)\\'" + line) + (not (delq + nil + (mapcar + (lambda (s) + (not (member s '("" "<" ">" "<>" "<" ">" "<>")))) + (org-split-string (match-string 1 line) "[ \t]*|[ \t]*"))))))) + +(defun org-table-cookie-line-p (line) + "Is this a table line with only alignment/width cookies?" + + (save-match-data + (and (string-match "[<>]\\|&[lg]t;" line) + (or (string-match "\\`[ \t]*|[ \t]*/[ \t]*\\(|[ \t<>0-9|lgt&;]+\\)\\'" line) + (string-match "\\(\\`[ \t<>lr0-9|gt&;]+\\'\\)" line)) + (not (delq nil (mapcar + (lambda (s) + (not (or (equal s "") + (string-match "\\`<\\([lr]?[0-9]+\\|[lr]\\)>\\'" s) + (string-match "\\`<\\([lr]?[0-9]+\\|[lr]\\)>\\'" s)))) + (org-split-string (match-string 1 line) "[ \t]*|[ \t]*"))))))) + (defconst org-table-translate-regexp (concat "\\(" "@[-0-9I$]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\)") "Match a reference that needs translation, for reference display.") @@ -470,7 +497,7 @@ FILE can be the output file name. If not given, it will be taken from a TABLE_EXPORT_FILE property in the current entry or higher up in the hierarchy, or the user will be prompted for a file name. FORMAT can be an export format, of the same kind as it used when -orgtbl-mode sends a table in a different format. The default format can +`orgtbl-mode' sends a table in a different format. The default format can be found in the variable `org-table-export-default-format', but the function first checks if there is an export format specified in a TABLE_EXPORT_FORMAT property, locally or anywhere up in the hierarchy." @@ -602,7 +629,8 @@ When nil, simply write \"#ERROR\" in corrupted fields.") (make-string sp2 ?\ ) "%%%s%ds" (make-string sp1 ?\ ) "|")) (hfmt1 (concat (make-string sp2 ?-) "%s" (make-string sp1 ?-) "+")) - emptystrings links dates emph narrow falign falign1 fmax f1 len c e) + emptystrings links dates emph raise narrow + falign falign1 fmax f1 len c e space) (untabify beg end) (remove-text-properties beg end '(org-cwidth t org-dwidth t display t)) ;; Check if we have links or dates @@ -612,6 +640,9 @@ When nil, simply write \"#ERROR\" in corrupted fields.") (setq emph (and org-hide-emphasis-markers (re-search-forward org-emph-re end t))) (goto-char beg) + (setq raise (and org-use-sub-superscripts + (re-search-forward org-match-substring-regexp end t))) + (goto-char beg) (setq dates (and org-display-custom-times (re-search-forward org-ts-regexp-both end t))) ;; Make sure the link properties are right @@ -619,6 +650,7 @@ When nil, simply write \"#ERROR\" in corrupted fields.") ;; Make sure the date properties are right (when dates (goto-char beg) (while (org-activate-dates end))) (when emph (goto-char beg) (while (org-do-emphasis-faces end))) + (when raise (goto-char beg) (while (org-raise-scripts end))) ;; Check if we are narrowing any columns (goto-char beg) @@ -709,16 +741,22 @@ When nil, simply write \"#ERROR\" in corrupted fields.") ;; With invisible characters, `format' does not get the field width right ;; So we need to make these fields wide by hand. - (when (or links emph) + (when (or links emph raise) (loop for i from 0 upto (1- maxfields) do (setq len (nth i lengths)) (loop for j from 0 upto (1- (length fields)) do (setq c (nthcdr i (car (nthcdr j fields)))) (if (and (stringp (car c)) - (text-property-any 0 (length (car c)) 'invisible 'org-link (car c)) -; (string-match org-bracket-link-regexp (car c)) + (or (text-property-any 0 (length (car c)) + 'invisible 'org-link (car c)) + (text-property-any 0 (length (car c)) + 'org-dwidth t (car c))) (< (org-string-width (car c)) len)) - (setcar c (concat (car c) (make-string (- len (org-string-width (car c))) ?\ ))))))) + (progn + (setq space (make-string (- len (org-string-width (car c))) ?\ )) + (setcar c (if (nth i typenums) + (concat space (car c)) + (concat (car c) space)))))))) ;; Compute the formats needed for output of the table (setq rfmt (concat indent "|") hfmt (concat indent "|")) @@ -764,14 +802,6 @@ When nil, simply write \"#ERROR\" in corrupted fields.") (setq org-table-may-need-update nil) )) - - - - - - - - (defun org-table-begin (&optional table-type) "Find the beginning of the table and return its position. With argument TABLE-TYPE, go to the beginning of a table.el-type table." @@ -830,6 +860,7 @@ Optional argument NEW may specify text to replace the current field content." (if (<= (length new) l) ;; FIXME: length -> str-width? (setq n (format f new)) (setq n (concat new "|") org-table-may-need-update t))) + (if (equal (string-to-char n) ?-) (setq n (concat " " n))) (or (equal n o) (let (org-table-may-need-update) (replace-match n t t)))) @@ -1021,7 +1052,7 @@ If column is nil, use the current column." (defun org-table-put (line column value &optional align) "Put VALUE into line LINE, column COLUMN. -When ALIGN is set, als realign the table." +When ALIGN is set, also realign the table." (setq column (or column (org-table-current-column))) (prog1 (save-excursion (and (or (not line) (org-table-goto-line line)) @@ -1128,7 +1159,7 @@ is always the old value." (defun org-table-current-dline () "Find out what table data line we are in. -Only datalines count for this." +Only data lines count for this." (interactive) (if (interactive-p) (org-table-check-inside-data-field)) (save-excursion @@ -1189,7 +1220,7 @@ However, when FORCE is non-nil, create new columns if necessary." (org-table-fix-formulas "$LR" nil (1- col) 1))) (defun org-table-find-dataline () - "Find a dataline in the current table, which is needed for column commands." + "Find a data line in the current table, which is needed for column commands." (if (and (org-at-table-p) (not (org-at-table-hline-p))) t @@ -1729,23 +1760,6 @@ the table and kill the editing buffer." (org-table-align) (message "New field value inserted"))) - - - - - - - - - - - - - - - - - (defvar org-timecnt) ; dynamically scoped parameter (defun org-table-sum (&optional beg end nlast) @@ -1830,7 +1844,7 @@ If NLAST is a number, only the NLAST fields will actually be summed." "Return the formula active for the current field. Assumes that specials are in place. If KEY is given, return the key to this formula. -Otherwise return the formula preceeded with \"=\" or \":=\"." +Otherwise return the formula preceded with \"=\" or \":=\"." (let* ((name (car (rassoc (list (org-current-line) (org-table-current-column)) org-table-named-field-locations))) @@ -2372,7 +2386,7 @@ $1-> %s\n" orig formula form0 form)) (org-fit-window-to-buffer bw) (unless (and (interactive-p) (not ndown)) (unless (let (inhibit-redisplay) - (y-or-n-p "Debugging Formula. Continue to next? ")) + (y-or-n-p "Debugging Formula. Continue to next? ")) (org-table-align) (error "Abort")) (delete-window bw) @@ -2469,7 +2483,7 @@ and TABLE is a vector with line types." ;; 1 2 3 4 5 6 (and (not (match-end 3)) (not (match-end 6))) (and (match-end 3) (match-end 6) (not (match-end 5)))) - (error "invalid row descriptor `%s'" desc)) + (error "Invalid row descriptor `%s'" desc)) (let* ((hdir (and (match-end 2) (match-string 2 desc))) (hn (if (match-end 3) (- (match-end 3) (match-beginning 3)) nil)) (odir (and (match-end 5) (match-string 5 desc))) @@ -2483,7 +2497,7 @@ and TABLE is a vector with line types." (setq i 0 hdir "+") (if (eq (aref table 0) 'hline) (setq hn (1- hn))))) (if (and (not hn) on (not odir)) - (error "should never happen");;(aref org-table-dlines on) + (error "Should never happen");;(aref org-table-dlines on) (if (and hn (> hn 0)) (setq i (org-table-find-row-type table i 'hline (equal hdir "-") nil hn cline desc))) @@ -2554,7 +2568,8 @@ LISPP means to return something appropriate for a Lisp list." (defun org-table-recalculate (&optional all noalign) "Recalculate the current table line by applying all stored formulas. With prefix arg ALL, do this for all lines in the table. -With the prefix argument ALL is `(16)' (a double `C-c C-u' prefix), or if +With the prefix argument ALL is `(16)' \ +\(a double \\[universal-prefix] \\[universal-prefix] prefix), or if it is the symbol `iterate', recompute the table until it no longer changes. If NOALIGN is not nil, do not re-align the table after the computations are done. This is typically used internally to save time, if it is @@ -2682,6 +2697,36 @@ known that the table will be realigned a little later anyway." (throw 'exit t))) (error "No convergence after %d iterations" i)))) +(defun org-table-recalculate-buffer-tables () + "Recalculate all tables in the current buffer." + (interactive) + (save-excursion + (save-restriction + (widen) + (org-table-map-tables (lambda () (org-table-recalculate t)) t)))) + +(defun org-table-iterate-buffer-tables () + "Iterate all tables in the buffer, to converge inter-table dependencies." + (interactive) + (let* ((imax 10) + (checksum (md5 (buffer-string))) + + c1 + (i imax)) + (save-excursion + (save-restriction + (widen) + (catch 'exit + (while (> i 0) + (setq i (1- i)) + (org-table-map-tables (lambda () (org-table-recalculate t)) t) + (if (equal checksum (setq c1 (md5 (buffer-string)))) + (progn + (message "Convergence after %d iterations" (- imax i)) + (throw 'exit t)) + (setq checksum c1))) + (error "No convergence after %d iterations" imax)))))) + (defun org-table-formula-substitute-names (f) "Replace $const with values in string F." (let ((start 0) a (f1 f) (pp (/= (string-to-char f) ?'))) @@ -2720,6 +2765,7 @@ Parameters get priority." (org-defkey map "\C-x\C-s" 'org-table-fedit-finish) (org-defkey map "\C-c\C-s" 'org-table-fedit-finish) (org-defkey map "\C-c\C-c" 'org-table-fedit-finish) + (org-defkey map "\C-c'" 'org-table-fedit-finish) (org-defkey map "\C-c\C-q" 'org-table-fedit-abort) (org-defkey map "\C-c?" 'org-table-show-reference) (org-defkey map [(meta shift up)] 'org-table-fedit-line-up) @@ -2816,7 +2862,7 @@ Parameters get priority." (if (eq org-table-use-standard-references t) (org-table-fedit-toggle-ref-type)) (org-goto-line startline) - (message "Edit formulas and finish with `C-c C-c'. See menu for more commands."))) + (message "Edit formulas, finish with `C-c C-c' or `C-c ' '. See menu for more commands."))) (defun org-table-fedit-post-command () (when (not (memq this-command '(lisp-complete-symbol))) @@ -2964,7 +3010,7 @@ For example: 28 -> AB." (org-rematch-and-replace 5 (eq dir 'left)))))) (defun org-rematch-and-replace (n &optional decr hline) - "Re-match the group N, and replace it with the shifted refrence." + "Re-match the group N, and replace it with the shifted reference." (or (match-end n) (error "Cannot shift reference in this direction")) (goto-char (match-beginning n)) (and (looking-at (regexp-quote (match-string n))) @@ -2972,7 +3018,7 @@ For example: 28 -> AB." t t))) (defun org-table-shift-refpart (ref &optional decr hline) - "Shift a refrence part REF. + "Shift a reference part REF. If DECR is set, decrease the references row/column, else increase. If HLINE is set, this may be a hline reference, it certainly is not a translation reference." @@ -3040,7 +3086,7 @@ With prefix ARG, apply the new formulas to the table." (select-window sel-win) (goto-char pos) (unless (org-at-table-p) - (error "Lost table position - cannot install formulae")) + (error "Lost table position - cannot install formulas")) (org-table-store-formulas eql) (move-marker pos nil) (kill-buffer "*Edit Formulas*") @@ -3282,8 +3328,8 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line." (defun org-table-add-rectangle-overlay (beg end &optional face) "Add a new overlay." - (let ((ov (org-make-overlay beg end))) - (org-overlay-put ov 'face (or face 'secondary-selection)) + (let ((ov (make-overlay beg end))) + (overlay-put ov 'face (or face 'secondary-selection)) (push ov org-table-rectangle-overlays))) (defun org-table-highlight-rectangle (&optional beg end face) @@ -3318,7 +3364,7 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line." "Remove the rectangle overlays." (unless org-inhibit-highlight-removal (remove-hook 'before-change-functions 'org-table-remove-rectangle-highlight) - (mapc 'org-delete-overlay org-table-rectangle-overlays) + (mapc 'delete-overlay org-table-rectangle-overlays) (setq org-table-rectangle-overlays nil))) (defvar org-table-coordinate-overlays nil @@ -3328,14 +3374,14 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line." (defun org-table-overlay-coordinates () "Add overlays to the table at point, to show row/column coordinates." (interactive) - (mapc 'org-delete-overlay org-table-coordinate-overlays) + (mapc 'delete-overlay org-table-coordinate-overlays) (setq org-table-coordinate-overlays nil) (save-excursion (let ((id 0) (ih 0) hline eol s1 s2 str ic ov beg) (goto-char (org-table-begin)) (while (org-at-table-p) (setq eol (point-at-eol)) - (setq ov (org-make-overlay (point-at-bol) (1+ (point-at-bol)))) + (setq ov (make-overlay (point-at-bol) (1+ (point-at-bol)))) (push ov org-table-coordinate-overlays) (setq hline (looking-at org-table-hline-regexp)) (setq str (if hline (format "I*%-2d" (setq ih (1+ ih))) @@ -3349,7 +3395,7 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line." s1 (concat "$" (int-to-string ic)) s2 (org-number-to-letters ic) str (if (eq org-table-use-standard-references t) s2 s1)) - (setq ov (org-make-overlay beg (+ beg (length str)))) + (setq ov (make-overlay beg (+ beg (length str)))) (push ov org-table-coordinate-overlays) (org-overlay-display ov str 'org-special-keyword 'evaporate))) (beginning-of-line 2))))) @@ -3363,7 +3409,7 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line." (if (and (org-at-table-p) org-table-overlay-coordinates) (org-table-align)) (unless org-table-overlay-coordinates - (mapc 'org-delete-overlay org-table-coordinate-overlays) + (mapc 'delete-overlay org-table-coordinate-overlays) (setq org-table-coordinate-overlays nil))) (defun org-table-toggle-formula-debugger () @@ -3401,6 +3447,7 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line." ;; active, this binding is ignored inside tables and replaced with a ;; modified self-insert. + (defvar orgtbl-mode-map (make-keymap) "Keymap for `orgtbl-mode'.") @@ -3410,7 +3457,7 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line." (orgtbl-mode 1)) (defvar org-old-auto-fill-inhibit-regexp nil - "Local variable used by `orgtbl-mode'") + "Local variable used by `orgtbl-mode'.") (defconst orgtbl-line-start-regexp "[ \t]*\\(|\\|#\\+\\(TBLFM\\|ORGTBL\\|TBLNAME\\):\\)" @@ -3419,11 +3466,12 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line." (defconst orgtbl-extra-font-lock-keywords (list (list (concat "^" orgtbl-line-start-regexp ".*") 0 (quote 'org-table) 'prepend)) - "Extra font-lock-keywords to be added when orgtbl-mode is active.") + "Extra `font-lock-keywords' to be added when `orgtbl-mode' is active.") ;; Install it as a minor mode. (put 'orgtbl-mode :included t) (put 'orgtbl-mode :menu-tag "Org Table Mode") + ;;;###autoload (define-minor-mode orgtbl-mode "The `org-mode' table editor as a minor mode for use in other modes." @@ -3451,7 +3499,7 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line." (concat orgtbl-line-start-regexp "\\|" auto-fill-inhibit-regexp) orgtbl-line-start-regexp)) - (org-add-to-invisibility-spec '(org-cwidth)) + (add-to-invisibility-spec '(org-cwidth)) (when (fboundp 'font-lock-add-keywords) (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords) (org-restart-font-lock)) @@ -3785,13 +3833,13 @@ overwritten, and the table is not marked as requiring realignment." (funcall func table nil))) (defun orgtbl-gather-send-defs () - "Gathers a plist of :name, :transform, :params for each destination before + "Gather a plist of :name, :transform, :params for each destination before a radio table." (save-excursion (goto-char (org-table-begin)) (let (rtn) (beginning-of-line 0) - (while (looking-at "[ \t]*#\\+ORGTBL[: \t][ \t]*SEND +\\([a-zA-Z0-9_]+\\) +\\([^ \t\r\n]+\\)\\( +.*\\)?") + (while (looking-at "[ \t]*#\\+ORGTBL[: \t][ \t]*SEND[ \t]+\\([^ \t\r\n]+\\)[ \t]+\\([^ \t\r\n]+\\)\\([ \t]+.*\\)?") (let ((name (org-no-properties (match-string 1))) (transform (intern (match-string 2))) (params (if (match-end 3) @@ -3942,17 +3990,17 @@ First element has index 0, or I0 if given." (defvar *orgtbl-rtn* nil "Formatting routines push the output lines here.") ;; Formatting parameters for the current table section. -(defvar *orgtbl-hline* nil "Text used for horizontal lines") -(defvar *orgtbl-sep* nil "Text used as a column separator") -(defvar *orgtbl-default-fmt* nil "Default format for each entry") -(defvar *orgtbl-fmt* nil "Format for each entry") -(defvar *orgtbl-efmt* nil "Format for numbers") -(defvar *orgtbl-lfmt* nil "Format for an entire line, overrides fmt") -(defvar *orgtbl-llfmt* nil "Specializes lfmt for the last row") -(defvar *orgtbl-lstart* nil "Text starting a row") -(defvar *orgtbl-llstart* nil "Specializes lstart for the last row") -(defvar *orgtbl-lend* nil "Text ending a row") -(defvar *orgtbl-llend* nil "Specializes lend for the last row") +(defvar *orgtbl-hline* nil "Text used for horizontal lines.") +(defvar *orgtbl-sep* nil "Text used as a column separator.") +(defvar *orgtbl-default-fmt* nil "Default format for each entry.") +(defvar *orgtbl-fmt* nil "Format for each entry.") +(defvar *orgtbl-efmt* nil "Format for numbers.") +(defvar *orgtbl-lfmt* nil "Format for an entire line, overrides fmt.") +(defvar *orgtbl-llfmt* nil "Specializes lfmt for the last row.") +(defvar *orgtbl-lstart* nil "Text starting a row.") +(defvar *orgtbl-llstart* nil "Specializes lstart for the last row.") +(defvar *orgtbl-lend* nil "Text ending a row.") +(defvar *orgtbl-llend* nil "Specializes lend for the last row.") (defsubst orgtbl-get-fmt (fmt i) "Retrieve the format from FMT corresponding to the Ith column." @@ -4072,6 +4120,7 @@ directly by `orgtbl-send-table'. See manual." (let* ((splicep (plist-get params :splice)) (hline (plist-get params :hline)) (remove-nil-linesp (plist-get params :remove-nil-lines)) + (remove-newlines (plist-get params :remove-newlines)) (*orgtbl-hline* hline) (*orgtbl-table* table) (*orgtbl-sep* (plist-get params :sep)) @@ -4126,9 +4175,13 @@ directly by `orgtbl-send-table'. See manual." (let ((tend (orgtbl-eval-str (plist-get params :tend)))) (if tend (push tend *orgtbl-rtn*))))) - (mapconcat 'identity (nreverse (if remove-nil-linesp - (remq nil *orgtbl-rtn*) - *orgtbl-rtn*)) "\n"))) + (mapconcat (if remove-newlines + (lambda (tend) + (replace-regexp-in-string "[\n\r\t\f]" "\\\\n" tend)) + 'identity) + (nreverse (if remove-nil-linesp + (remq nil *orgtbl-rtn*) + *orgtbl-rtn*)) "\n"))) (defun orgtbl-to-tsv (table params) "Convert the orgtbl-mode table to TAB separated material." @@ -4179,7 +4232,7 @@ this function is called." (orgtbl-to-generic table (org-combine-plists params2 params)))) (defun orgtbl-to-html (table params) - "Convert the orgtbl-mode TABLE to LaTeX. + "Convert the orgtbl-mode TABLE to HTML. TABLE is a list, each entry either the symbol `hline' for a horizontal separator line, or a list of fields for that line. PARAMS is a property list of parameters that can influence the conversion. @@ -4254,6 +4307,7 @@ and :tend suppress strings without splicing; they can be set to provide ORGTBL directives for the generated table." (let* ((params2 (list + :remove-newlines t :tstart nil :tend nil :hline "|---" :sep " | " @@ -4301,23 +4355,23 @@ list of the fields in the rectangle ." (setq buffer (marker-buffer id-loc) loc (marker-position id-loc)) (move-marker id-loc nil))) - (switch-to-buffer buffer) - (save-excursion - (save-restriction - (widen) - (goto-char loc) - (forward-char 1) - (unless (and (re-search-forward "^\\(\\*+ \\)\\|[ \t]*|" nil t) - (not (match-beginning 1))) - (error "Cannot find a table at NAME or ID %s" name-or-id)) - (setq tbeg (point-at-bol)) - (org-table-get-specials) - (setq form (org-table-formula-substitute-names form)) - (if (and (string-match org-table-range-regexp form) - (> (length (match-string 0 form)) 1)) - (save-match-data - (org-table-get-range (match-string 0 form) tbeg 1)) - form)))))))) + (with-current-buffer buffer + (save-excursion + (save-restriction + (widen) + (goto-char loc) + (forward-char 1) + (unless (and (re-search-forward "^\\(\\*+ \\)\\|[ \t]*|" nil t) + (not (match-beginning 1))) + (error "Cannot find a table at NAME or ID %s" name-or-id)) + (setq tbeg (point-at-bol)) + (org-table-get-specials) + (setq form (org-table-formula-substitute-names form)) + (if (and (string-match org-table-range-regexp form) + (> (length (match-string 0 form)) 1)) + (save-match-data + (org-table-get-range (match-string 0 form) tbeg 1)) + form))))))))) (provide 'org-table) diff --git a/lisp/org/org-taskjuggler.el b/lisp/org/org-taskjuggler.el new file mode 100644 index 00000000000..da9e156870e --- /dev/null +++ b/lisp/org/org-taskjuggler.el @@ -0,0 +1,648 @@ +;;; org-taskjuggler.el --- TaskJuggler exporter for org-mode +;; +;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; +;; Emacs Lisp Archive Entry +;; Filename: org-taskjuggler.el +;; Version: 7.01 +;; Author: Christian Egli +;; Maintainer: Christian Egli +;; Keywords: org, taskjuggler, project planning +;; Description: Converts an org-mode buffer into a taskjuggler project plan +;; URL: + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + +;; Commentary: +;; +;; This library implements a TaskJuggler exporter for org-mode. +;; TaskJuggler uses a text format to define projects, tasks and +;; resources, so it is a natural fit for org-mode. It can produce all +;; sorts of reports for tasks or resources in either HTML, CSV or PDF. +;; The current version of TaskJuggler requires KDE but the next +;; version is implemented in Ruby and should therefore run on any +;; platform. +;; +;; The exporter is a bit different from other exporters, such as the +;; HTML and LaTeX exporters for example, in that it does not export +;; all the nodes of a document or strictly follow the order of the +;; nodes in the document. +;; +;; Instead the TaskJuggler exporter looks for a tree that defines the +;; tasks and a optionally tree that defines the resources for this +;; project. It then creates a TaskJuggler file based on these trees +;; and the attributes defined in all the nodes. +;; +;; * Installation +;; +;; Put this file into your load-path and the following line into your +;; ~/.emacs: +;; +;; (require 'org-taskjuggler) +;; +;; The interactive functions are similar to those of the HTML and LaTeX +;; exporters: +;; +;; M-x `org-export-as-taskjuggler' +;; M-x `org-export-as-taskjuggler-and-open' +;; +;; * Tasks +;; +;; Let's illustrate the usage with a small example. Create your tasks +;; as you usually do with org-mode. Assign efforts to each task using +;; properties (it's easiest to do this in the column view). You should +;; end up with something similar to the example by Peter Jones in +;; http://www.contextualdevelopment.com/static/artifacts/articles/2008/project-planning/project-planning.org. +;; Now mark the top node of your tasks with a tag named +;; "taskjuggler_project" (or whatever you customized +;; `org-export-taskjuggler-project-tag' to). You are now ready to +;; export the project plan with `org-export-as-taskjuggler-and-open' +;; which will export the project plan and open a gant chart in +;; TaskJugglerUI. +;; +;; * Resources +;; +;; Next you can define resources and assign those to work on specific +;; tasks. You can group your resources hierarchically. Tag the top +;; node of the resources with "taskjuggler_resource" (or whatever you +;; customized `org-export-taskjuggler-resource-tag' to). You can +;; optionally assign an identifier (named "resource_id") to the +;; resources (using the standard org properties commands) or you can +;; let the exporter generate identifiers automatically (the exporter +;; picks the first word of the headline as the identifier as long as +;; it is unique, see the documentation of +;; `org-taskjuggler-get-unique-id'). Using that identifier you can +;; then allocate resources to tasks. This is again done with the +;; "allocate" property on the tasks. Do this in column view or when on +;; the task type +;; +;; C-c C-x p allocate RET <resource_id> RET +;; +;; Once the allocations are done you can again export to TaskJuggler +;; and check in the Resource Allocation Graph which person is working +;; on what task at what time. +;; +;; * Export of properties +;; +;; The exporter also takes TODO state information into consideration, +;; i.e. if a task is marked as done it will have the corresponding +;; attribute in TaskJuggler ("complete 100"). Also it will export any +;; property on a task resource or resource node which is known to +;; TaskJuggler, such as limits, vacation, shift, booking, efficiency, +;; journalentry, rate for resources or account, start, note, duration, +;; end, journalentry, milestone, reference, responsible, scheduling, +;; etc for tasks. +;; +;; * Dependencies +;; +;; The exporter will handle dependencies that are defined in the tasks +;; either with the ORDERED attribute (see TODO dependencies in the Org +;; mode manual) or with the BLOCKER attribute (see org-depend.el) or +;; alternatively with a depends attribute. Both the BLOCKER and the +;; depends attribute can be either "previous-sibling" or a reference +;; to an identifier (named "task_id") which is defined for another +;; task in the project. BLOCKER and the depends attribute can define +;; multiple dependencies separated by either space or comma. You can +;; also specify optional attributes on the dependency by simply +;; appending it. The following examples should illustrate this: +;; +;; * Training material +;; :PROPERTIES: +;; :task_id: training_material +;; :ORDERED: t +;; :END: +;; ** Markup Guidelines +;; :PROPERTIES: +;; :Effort: 2.0 +;; :END: +;; ** Workflow Guidelines +;; :PROPERTIES: +;; :Effort: 2.0 +;; :END: +;; * Presentation +;; :PROPERTIES: +;; :Effort: 2.0 +;; :BLOCKER: training_material { gapduration 1d } some_other_task +;; :END: +;; +;;;; * TODO +;; - Use SCHEDULED and DEADLINE information (not just start and end +;; properties). +;; - Look at org-file-properties, org-global-properties and +;; org-global-properties-fixed +;; - What about property inheritance and org-property-inherit-p? +;; - Use TYPE_TODO as an way to assign resources +;; - Make sure multiple dependency definitions (i.e. BLOCKER on +;; previous-sibling and on a specific task_id) in multiple +;; attributes are properly exported. +;; +;;; Code: + +(eval-when-compile + (require 'cl)) + +(require 'org) +(require 'org-exp) + +;;; User variables: + +(defgroup org-export-taskjuggler nil + "Options for exporting Org-mode files to TaskJuggler." + :tag "Org Export TaskJuggler" + :group 'org-export) + +(defcustom org-export-taskjuggler-extension ".tjp" + "Extension of TaskJuggler files." + :group 'org-export-taskjuggler + :type 'string) + +(defcustom org-export-taskjuggler-project-tag "taskjuggler_project" + "Tag, property or todo used to find the tree containing all +the tasks for the project." + :group 'org-export-taskjuggler + :type 'string) + +(defcustom org-export-taskjuggler-resource-tag "taskjuggler_resource" + "Tag, property or todo used to find the tree containing all the +resources for the project." + :group 'org-export-taskjuggler + :type 'string) + +(defcustom org-export-taskjuggler-default-project-version "1.0" + "Default version string for the project." + :group 'org-export-taskjuggler + :type 'string) + +(defcustom org-export-taskjuggler-default-project-duration 280 + "Default project duration if no start and end date have been defined +in the root node of the task tree, i.e. the tree that has been marked +with `org-export-taskjuggler-project-tag'" + :group 'org-export-taskjuggler + :type 'integer) + +(defcustom org-export-taskjuggler-default-reports + '("taskreport \"Gantt Chart\" { + headline \"Project Gantt Chart\" + columns hierarchindex, name, start, end, effort, duration, completed, chart + timeformat \"%Y-%m-%d\" + hideresource 1 + loadunit shortauto +}" +"resourcereport \"Resource Graph\" { + headline \"Resource Allocation Graph\" + columns no, name, utilization, freeload, chart + loadunit shortauto + sorttasks startup + hidetask ~isleaf() +}") + "Default reports for the project." + :group 'org-export-taskjuggler + :type '(repeat (string :tag "Report"))) + +(defcustom org-export-taskjuggler-default-global-properties + "shift s40 \"Part time shift\" { + workinghours wed, thu, fri off +} +" + "Default global properties for the project. Here you typically +define global properties such as shifts, accounts, rates, +vacation, macros and flags. Any property that is allowed within +the TaskJuggler file can be inserted. You could for example +include another TaskJuggler file. + +The global properties are inserted after the project declaration +but before any resource and task declarations." + :group 'org-export-taskjuggler + :type '(string :tag "Preamble")) + +;;; Hooks + +(defvar org-export-taskjuggler-final-hook nil + "Hook run at the end of TaskJuggler export, in the new buffer.") + +;;; Autoload functions: + +;; avoid compiler warning about free variable +(defvar org-export-taskjuggler-old-level) + +;;;###autoload +(defun org-export-as-taskjuggler () + "Export parts of the current buffer as a TaskJuggler file. +The exporter looks for a tree with tag, property or todo that +matches `org-export-taskjuggler-project-tag' and takes this as +the tasks for this project. The first node of this tree defines +the project properties such as project name and project period. +If there is a tree with tag, property or todo that matches +`org-export-taskjuggler-resource-tag' this three is taken as +resources for the project. If no resources are specified, a +default resource is created and allocated to the project. Also +the taskjuggler project will be created with default reports as +defined in `org-export-taskjuggler-default-reports'." + (interactive) + + (message "Exporting...") + (setq-default org-done-keywords org-done-keywords) + (let* ((tasks + (org-taskjuggler-resolve-dependencies + (org-taskjuggler-assign-task-ids + (org-map-entries + '(org-taskjuggler-components) + org-export-taskjuggler-project-tag nil 'archive 'comment)))) + (resources + (org-taskjuggler-assign-resource-ids + (org-map-entries + '(org-taskjuggler-components) + org-export-taskjuggler-resource-tag nil 'archive 'comment))) + (filename (expand-file-name + (concat + (file-name-sans-extension + (file-name-nondirectory buffer-file-name)) + org-export-taskjuggler-extension))) + (buffer (find-file-noselect filename)) + (org-export-taskjuggler-old-level 0) + task resource) + (unless tasks + (error "No tasks specified")) + ;; add a default resource + (unless resources + (setq resources + `((("resource_id" . ,(user-login-name)) + ("headline" . ,user-full-name) + ("level" . 1))))) + ;; add a default allocation to the first task if none was given + (unless (assoc "allocate" (car tasks)) + (let ((task (car tasks)) + (resource-id (cdr (assoc "resource_id" (car resources))))) + (setcar tasks (push (cons "allocate" resource-id) task)))) + ;; add a default start date to the first task if none was given + (unless (assoc "start" (car tasks)) + (let ((task (car tasks)) + (time-string (format-time-string "%Y-%m-%d"))) + (setcar tasks (push (cons "start" time-string) task)))) + ;; add a default version if none was given + (unless (assoc "version" (car tasks)) + (let ((task (car tasks)) + (version org-export-taskjuggler-default-project-version)) + (setcar tasks (push (cons "version" version) task)))) + (with-current-buffer buffer + (erase-buffer) + (org-taskjuggler-open-project (car tasks)) + (insert org-export-taskjuggler-default-global-properties) + (insert "\n") + (dolist (resource resources) + (let ((level (cdr (assoc "level" resource)))) + (org-taskjuggler-close-maybe level) + (org-taskjuggler-open-resource resource) + (setq org-export-taskjuggler-old-level level))) + (org-taskjuggler-close-maybe 1) + (setq org-export-taskjuggler-old-level 0) + (dolist (task tasks) + (let ((level (cdr (assoc "level" task)))) + (org-taskjuggler-close-maybe level) + (org-taskjuggler-open-task task) + (setq org-export-taskjuggler-old-level level))) + (org-taskjuggler-close-maybe 1) + (org-taskjuggler-insert-reports) + (save-buffer) + (or (org-export-push-to-kill-ring "TaskJuggler") + (message "Exporting... done")) + (current-buffer)))) + +;;;###autoload +(defun org-export-as-taskjuggler-and-open () + "Export the current buffer as a TaskJuggler file and open it +with the TaskJuggler GUI." + (interactive) + (let* ((file-name (buffer-file-name (org-export-as-taskjuggler))) + (process-name "TaskJugglerUI") + (command (concat process-name " " file-name))) + (start-process-shell-command process-name nil command))) + +(defun org-taskjuggler-parent-is-ordered-p () + "Return true if the parent of the current node has a property +\"ORDERED\". Return nil otherwise." + (save-excursion + (and (org-up-heading-safe) (org-entry-get (point) "ORDERED")))) + +(defun org-taskjuggler-components () + "Return an alist containing all the pertinent information for +the current node such as the headline, the level, todo state +information, all the properties, etc." + (let* ((props (org-entry-properties)) + (components (org-heading-components)) + (level (nth 1 components)) + (headline (nth 4 components)) + (parent-ordered (org-taskjuggler-parent-is-ordered-p))) + (push (cons "level" level) props) + (push (cons "headline" headline) props) + (push (cons "parent-ordered" parent-ordered) props))) + +(defun org-taskjuggler-assign-task-ids (tasks) + "Given a list of tasks return the same list assigning a unique id +and the full path to each task. Taskjuggler takes hierarchical ids. +For that reason we have to make ids locally unique and we have to keep +a path to the current task." + (let ((previous-level 0) + unique-ids unique-id + path + task resolved-tasks tmp) + (dolist (task tasks resolved-tasks) + (let ((level (cdr (assoc "level" task)))) + (cond + ((< previous-level level) + (setq unique-id (org-taskjuggler-get-unique-id task (car unique-ids))) + (dotimes (tmp (- level previous-level)) + (push (list unique-id) unique-ids) + (push unique-id path))) + ((= previous-level level) + (setq unique-id (org-taskjuggler-get-unique-id task (car unique-ids))) + (push unique-id (car unique-ids)) + (setcar path unique-id)) + ((> previous-level level) + (dotimes (tmp (- previous-level level)) + (pop unique-ids) + (pop path)) + (setq unique-id (org-taskjuggler-get-unique-id task (car unique-ids))) + (push unique-id (car unique-ids)) + (setcar path unique-id))) + (push (cons "unique-id" unique-id) task) + (push (cons "path" (mapconcat 'identity (reverse path) ".")) task) + (setq previous-level level) + (setq resolved-tasks (append resolved-tasks (list task))))))) + +(defun org-taskjuggler-assign-resource-ids (resources &optional unique-ids) + "Given a list of resources return the same list, assigning a +unique id to each resource." + (cond + ((null resources) nil) + (t + (let* ((resource (car resources)) + (unique-id (org-taskjuggler-get-unique-id resource unique-ids))) + (push (cons "unique-id" unique-id) resource) + (cons resource + (org-taskjuggler-assign-resource-ids (cdr resources) + (cons unique-id unique-ids))))))) + +(defun org-taskjuggler-resolve-dependencies (tasks) + (let ((previous-level 0) + siblings + task resolved-tasks) + (dolist (task tasks resolved-tasks) + (let* ((level (cdr (assoc "level" task))) + (depends (cdr (assoc "depends" task))) + (parent-ordered (cdr (assoc "parent-ordered" task))) + (blocker (cdr (assoc "BLOCKER" task))) + (blocked-on-previous + (and blocker (string-match "previous-sibling" blocker))) + (dependencies + (org-taskjuggler-resolve-explicit-dependencies + (append + (and depends (org-taskjuggler-tokenize-dependencies depends)) + (and blocker (org-taskjuggler-tokenize-dependencies blocker))) + tasks)) + previous-sibling) + ; update previous sibling info + (cond + ((< previous-level level) + (dotimes (tmp (- level previous-level)) + (push task siblings))) + ((= previous-level level) + (setq previous-sibling (car siblings)) + (setcar siblings task)) + ((> previous-level level) + (dotimes (tmp (- previous-level level)) + (pop siblings)) + (setq previous-sibling (car siblings)) + (setcar siblings task))) + ; insert a dependency on previous sibling if the parent is + ; ordered or if the tasks has a BLOCKER attribute with value "previous-sibling" + (when (or (and previous-sibling parent-ordered) blocked-on-previous) + (push (format "!%s" (cdr (assoc "unique-id" previous-sibling))) dependencies)) + ; store dependency information + (when dependencies + (push (cons "depends" (mapconcat 'identity dependencies ", ")) task)) + (setq previous-level level) + (setq resolved-tasks (append resolved-tasks (list task))))))) + +(defun org-taskjuggler-tokenize-dependencies (dependencies) + "Split a dependency property value DEPENDENCIES into the +individual dependencies and return them as a list while keeping +the optional arguments (such as gapduration) for the +dependencies. A dependency will have to match `[-a-zA-Z0-9_]+'." + (cond + ((string-match "^ *$" dependencies) nil) + ((string-match "^[ \t]*\\([-a-zA-Z0-9_]+\\([ \t]*{[^}]+}\\)?\\)[ \t,]*" dependencies) + (cons + (substring dependencies (match-beginning 1) (match-end 1)) + (org-taskjuggler-tokenize-dependencies (substring dependencies (match-end 0))))) + (t (error (format "invalid dependency id %s" dependencies))))) + +(defun org-taskjuggler-resolve-explicit-dependencies (dependencies tasks) + "For each dependency in DEPENDENCIES try to find a +corresponding task with a matching property \"task_id\" in TASKS. +Return a list containing the resolved links for all DEPENDENCIES +where a matching tasks was found. If the dependency is +\"previous-sibling\" it is ignored (as this is dealt with in +`org-taskjuggler-resolve-dependencies'). If there is no matching +task the dependency is ignored and a warning is displayed ." + (unless (null dependencies) + (let* + ;; the dependency might have optional attributes such as "{ + ;; gapduration 5d }", so only use the first string as id for the + ;; dependency + ((dependency (car dependencies)) + (id (car (split-string dependency))) + (optional-attributes + (mapconcat 'identity (cdr (split-string dependency)) " ")) + (path (org-taskjuggler-find-task-with-id id tasks))) + (cond + ;; ignore previous sibling dependencies + ((equal (car dependencies) "previous-sibling") + (org-taskjuggler-resolve-explicit-dependencies (cdr dependencies) tasks)) + ;; if the id is found in another task use its path + ((not (null path)) + (cons (mapconcat 'identity (list path optional-attributes) " ") + (org-taskjuggler-resolve-explicit-dependencies + (cdr dependencies) tasks))) + ;; warn about dangling dependency but otherwise ignore it + (t (display-warning + 'org-export-taskjuggler + (format "No task with matching property \"task_id\" found for id %s" id)) + (org-taskjuggler-resolve-explicit-dependencies (cdr dependencies) tasks)))))) + +(defun org-taskjuggler-find-task-with-id (id tasks) + "Find ID in tasks. If found return the path of task. Otherwise +return nil." + (let ((task-id (cdr (assoc "task_id" (car tasks)))) + (path (cdr (assoc "path" (car tasks))))) + (cond + ((null tasks) nil) + ((equal task-id id) path) + (t (org-taskjuggler-find-task-with-id id (cdr tasks)))))) + +(defun org-taskjuggler-get-unique-id (item unique-ids) + "Return a unique id for an ITEM which can be a task or a resource. +The id is derived from the headline and made unique against +UNIQUE-IDS. If the (downcased) first token of the headline is not +unique try to add more (downcased) tokens of the headline or +finally add more underscore characters (\"_\")." + (let* ((headline (cdr (assoc "headline" item))) + (parts (split-string headline)) + (id (org-taskjuggler-clean-id (downcase (pop parts))))) + ; try to add more parts of the headline to make it unique + (while (member id unique-ids) + (setq id (concat id "_" (org-taskjuggler-clean-id (downcase (pop parts)))))) + ; if its still not unique add "_" + (while (member id unique-ids) + (setq id (concat id "_"))) + id)) + +(defun org-taskjuggler-clean-id (id) + "Clean and return ID to make it acceptable for taskjuggler." + (and id (replace-regexp-in-string "[^a-zA-Z0-9_]" "_" id))) + +(defun org-taskjuggler-open-project (project) + "Insert the beginning of a project declaration. All valid +attributes from the PROJECT alist are inserted. If no end date is +specified it is calculated +`org-export-taskjuggler-default-project-duration' days from now." + (let* ((unique-id (cdr (assoc "unique-id" project))) + (headline (cdr (assoc "headline" project))) + (version (cdr (assoc "version" project))) + (start (cdr (assoc "start" project))) + (end (cdr (assoc "end" project)))) + (insert + (format "project %s \"%s\" \"%s\" %s +%sd {\n }\n" + unique-id headline version start + org-export-taskjuggler-default-project-duration)))) + +(defun org-taskjuggler-filter-and-join (items) + "Filter all nil elements from ITEMS and join the remaining ones +with separator \"\n\"." + (let ((filtered-items (remq nil items))) + (and filtered-items (mapconcat 'identity filtered-items "\n")))) + +(defun org-taskjuggler-get-attributes (item attributes) + "Return all attribute as a single formated string. ITEM is an +alist representing either a resource or a task. ATTRIBUTES is a +list of symbols. Only entries from ITEM are considered that are +listed in ATTRIBUTES." + (org-taskjuggler-filter-and-join + (mapcar + (lambda (attribute) + (org-taskjuggler-filter-and-join + (org-taskjuggler-get-attribute item attribute))) + attributes))) + +(defun org-taskjuggler-get-attribute (item attribute) + "Return a list of strings containing the properly formatted +taskjuggler declaration for a given ATTRIBUTE in ITEM (an alist). +If the ATTRIBUTE is not in ITEM return nil." + (cond + ((null item) nil) + ((equal (symbol-name attribute) (car (car item))) + (cons (format "%s %s" (symbol-name attribute) (cdr (car item))) + (org-taskjuggler-get-attribute (cdr item) attribute))) + (t (org-taskjuggler-get-attribute (cdr item) attribute)))) + +(defun org-taskjuggler-open-resource (resource) + "Insert the beginning of a resource declaration. All valid +attributes from the RESOURCE alist are inserted. If the RESOURCE +defines a property \"resource_id\" it will be used as the id for +this resource. Otherwise it will use the ID property. If neither +is defined it will calculate a unique id for the resource using +`org-taskjuggler-get-unique-id'." + (let ((id (org-taskjuggler-clean-id + (or (cdr (assoc "resource_id" resource)) + (cdr (assoc "ID" resource)) + (cdr (assoc "unique-id" resource))))) + (headline (cdr (assoc "headline" resource))) + (attributes '(limits vacation shift booking efficiency journalentry rate))) + (insert + (concat + "resource " id " \"" headline "\" {\n " + (org-taskjuggler-get-attributes resource attributes) "\n")))) + +(defun org-taskjuggler-clean-effort (effort) + "Translate effort strings into a format acceptable to taskjuggler, +i.e. REAL UNIT. If the effort string is something like 5:30 it +will be assumed to be hours and will be translated into 5.5h. +Otherwise if it contains something like 3.0 it is assumed to be +days and will be translated into 3.0d. Other formats that +taskjuggler supports (like weeks, months and years) are currently +not supported." + (cond + ((null effort) effort) + ((string-match "\\([0-9]+\\):\\([0-9]+\\)" effort) + (let ((hours (string-to-number (match-string 1 effort))) + (minutes (string-to-number (match-string 2 effort)))) + (format "%dh" (+ hours (/ minutes 60.0))))) + ((string-match "\\([0-9]+\\).\\([0-9]+\\)" effort) (concat effort "d")) + (t (error "Not a valid effort (%s)" effort)))) + +(defun org-taskjuggler-get-priority (priority) + "Return a priority between 1 and 1000 based on PRIORITY, an +org-mode priority string." + (max 1 (/ (* 1000 (- org-lowest-priority (string-to-char priority))) + (- org-lowest-priority org-highest-priority)))) + +(defun org-taskjuggler-open-task (task) + (let* ((unique-id (cdr (assoc "unique-id" task))) + (headline (cdr (assoc "headline" task))) + (effort (org-taskjuggler-clean-effort (cdr (assoc org-effort-property task)))) + (depends (cdr (assoc "depends" task))) + (allocate (cdr (assoc "allocate" task))) + (priority-raw (cdr (assoc "PRIORITY" task))) + (priority (and priority-raw (org-taskjuggler-get-priority priority-raw))) + (state (cdr (assoc "TODO" task))) + (complete (or (and (member state org-done-keywords) "100") + (cdr (assoc "complete" task)))) + (parent-ordered (cdr (assoc "parent-ordered" task))) + (previous-sibling (cdr (assoc "previous-sibling" task))) + (attributes + '(account start note duration endbuffer endcredit end + flags journalentry length maxend maxstart milestone + minend minstart period reference responsible + scheduling startbuffer startcredit statusnote))) + (insert + (concat + "task " unique-id " \"" headline "\" {\n" + (if (and parent-ordered previous-sibling) + (format " depends %s\n" previous-sibling) + (and depends (format " depends %s\n" depends))) + (and allocate (format " purge allocations\n allocate %s\n" allocate)) + (and complete (format " complete %s\n" complete)) + (and effort (format " effort %s\n" effort)) + (and priority (format " priority %s\n" priority)) + + (org-taskjuggler-get-attributes task attributes) + "\n")))) + +(defun org-taskjuggler-close-maybe (level) + (while (> org-export-taskjuggler-old-level level) + (insert "}\n") + (setq org-export-taskjuggler-old-level (1- org-export-taskjuggler-old-level))) + (when (= org-export-taskjuggler-old-level level) + (insert "}\n"))) + +(defun org-taskjuggler-insert-reports () + (let (report) + (dolist (report org-export-taskjuggler-default-reports) + (insert report "\n")))) + +(provide 'org-taskjuggler) + +;;; org-taskjuggler.el ends here diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el index 91664eb7b1a..b773274e93b 100644 --- a/lisp/org/org-timer.el +++ b/lisp/org/org-timer.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -27,6 +27,8 @@ ;; This file contains the relative timer code for Org-mode +;;; Code: + (require 'org) (declare-function org-show-notification "org-clock" (parameters)) @@ -48,6 +50,12 @@ the value of the relative timer." :group 'org-time :type 'string) +(defcustom org-timer-default-timer 0 + "The default timer when a timer is set. +When 0, the user is prompted for a value." + :group 'org-time + :type 'number) + (defvar org-timer-start-hook nil "Hook run after relative timer is started.") @@ -96,7 +104,7 @@ the region 0:00:00." (setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s))))) (setq org-timer-start-time (seconds-to-time - (- (org-float-time) (org-timer-hms-to-secs s))))) + (- (org-float-time) delta)))) (org-timer-set-mode-line 'on) (message "Timer start time set to %s, current value is %s" (format-time-string "%T" org-timer-start-time) @@ -104,7 +112,8 @@ the region 0:00:00." (run-hooks 'org-timer-start-hook)))) (defun org-timer-pause-or-continue (&optional stop) - "Pause or continue the relative timer. With prefix arg, stop it entirely." + "Pause or continue the relative timer. +With prefix arg STOP, stop it entirely." (interactive "P") (cond (stop (org-timer-stop)) @@ -139,8 +148,9 @@ the region 0:00:00." (defun org-timer (&optional restart) "Insert a H:MM:SS string from the timer into the buffer. The first time this command is used, the timer is started. When used with -a `C-u' prefix, force restarting the timer. -When used with a double prefix arg `C-u C-u', change all the timer string +a \\[universal-argument] prefix, force restarting the timer. +When used with a double prefix argument \ +\\[universal-argument] \\universal-argument], change all the timer string in the region by a fixed amount. This can be used to recalibrate a timer that was not started at the correct moment." (interactive "P") @@ -299,12 +309,37 @@ VALUE can be `on', `off', or `pause'." (message "%d minute(s) %d seconds left before next time out" rmins rsecs)))) +(defun bzg-test (&optional test) + (interactive "P") + test) + ;;;###autoload -(defun org-timer-set-timer (minutes) - "Set a timer." - (interactive "sTime out in (min)? ") - (if (not (string-match "[0-9]+" minutes)) - (org-timer-show-remaining-time) +(defun org-timer-set-timer (&optional opt) + "Prompt for a duration and set a timer. + +If `org-timer-default-timer' is not zero, suggest this value as +the default duration for the timer. If a timer is already set, +prompt the use if she wants to replace it. + +Called with a numeric prefix argument, use this numeric value as +the duration of the timer. + +Called with a `C-u' prefix arguments, use `org-timer-default-timer' +without prompting the user for a duration. + +With two `C-u' prefix arguments, use `org-timer-default-timer' +without prompting the user for a duration and automatically +replace any running timer." + (interactive "P") + (let ((minutes (or (and (numberp opt) (number-to-string opt)) + (and (listp opt) (not (null opt)) + (number-to-string org-timer-default-timer)) + (read-from-minibuffer + "How many minutes left? " + (if (not (eq org-timer-default-timer 0)) + (number-to-string org-timer-default-timer)))))) + (if (not (string-match "[0-9]+" minutes)) + (org-timer-show-remaining-time) (let* ((mins (string-to-number (match-string 0 minutes))) (secs (* mins 60)) (hl (cond @@ -323,15 +358,21 @@ VALUE can be `on', `off', or `pause'." (org-get-heading)) (t (error "Not in an Org buffer")))) timer-set) - (if org-timer-current-timer - (error "You cannot run several timers at the same time") - (setq org-timer-current-timer - (run-with-timer - secs nil `(lambda () - (setq org-timer-current-timer nil) - (org-notify ,(format "%s: time out" hl) t) - (run-hooks 'org-timer-done-hook)))) - (run-hooks 'org-timer-set-hook))))) + (if (or (and org-timer-current-timer + (or (equal opt '(16)) + (y-or-n-p "Replace current timer? "))) + (not org-timer-current-timer)) + (progn + (when org-timer-current-timer + (cancel-timer org-timer-current-timer)) + (setq org-timer-current-timer + (run-with-timer + secs nil `(lambda () + (setq org-timer-current-timer nil) + (org-notify ,(format "%s: time out" hl) t) + (run-hooks 'org-timer-done-hook)))) + (run-hooks 'org-timer-set-hook)) + (message "No timer set")))))) (provide 'org-timer) diff --git a/lisp/org/org-vm.el b/lisp/org/org-vm.el index 5677fe74644..4a28df6caa0 100644 --- a/lisp/org/org-vm.el +++ b/lisp/org/org-vm.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-w3m.el b/lisp/org/org-w3m.el index 24b5f4e7c3c..b457156f573 100644 --- a/lisp/org/org-w3m.el +++ b/lisp/org/org-w3m.el @@ -5,7 +5,7 @@ ;; Author: Andy Stewart <lazycat dot manatee at gmail dot com> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -28,11 +28,11 @@ ;; This file implements copying HTML content from a w3m buffer and ;; transforming the text on the fly so that it can be pasted into ;; an org-mode buffer with hot links. It will also work for regions -;; in gnus buffers that have ben washed with w3m. +;; in gnus buffers that have been washed with w3m. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; -;;; Acknowledgements: +;;; Acknowledgments: ;; Richard Riley <rileyrgdev at googlemail dot com> ;; @@ -40,8 +40,9 @@ ;; proposed by Richard, I'm just coding it. ;; +;;; Code: + (require 'org) -(declare-function w3m-anchor "ext:w3m-util" (position)) (defun org-w3m-copy-for-org-mode () "Copy current buffer content or active region with `org-mode' style links. @@ -68,7 +69,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly." ;; store current point before jump next anchor (setq temp-position (point)) ;; move to next anchor when current point is not at anchor - (or (w3m-anchor (point)) (org-w3m-get-next-link-start)) + (or (get-text-property (point) 'w3m-href-anchor) (org-w3m-get-next-link-start)) (if (<= (point) transform-end) ; if point is inside transform bound (progn ;; get content between two links. @@ -77,7 +78,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly." (buffer-substring temp-position (point))))) ;; get link location at current point. - (setq link-location (w3m-anchor (point))) + (setq link-location (get-text-property (point) 'w3m-href-anchor)) ;; get link title at current point. (setq link-title (buffer-substring (point) (org-w3m-get-anchor-end))) @@ -115,7 +116,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly." (while (next-single-property-change (point) 'w3m-anchor-sequence) ;; jump to next anchor (goto-char (next-single-property-change (point) 'w3m-anchor-sequence)) - (when (w3m-anchor (point)) + (when (get-text-property (point) 'w3m-href-anchor) ;; return point when current is valid link (throw 'reach nil)))) (point)) @@ -126,7 +127,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly." (while (previous-single-property-change (point) 'w3m-anchor-sequence) ;; jump to previous anchor (goto-char (previous-single-property-change (point) 'w3m-anchor-sequence)) - (when (w3m-anchor (point)) + (when (get-text-property (point) 'w3m-href-anchor) ;; return point when current is valid link (throw 'reach nil)))) (point)) diff --git a/lisp/org/org-wl.el b/lisp/org/org-wl.el index e0b438f0111..4d2f8ec1280 100644 --- a/lisp/org/org-wl.el +++ b/lisp/org/org-wl.el @@ -4,9 +4,10 @@ ;; Free Software Foundation, Inc. ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp> +;; David Maus <dmaus at ictsoc dot de> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -40,9 +41,36 @@ :group 'org-link) (defcustom org-wl-link-to-refile-destination t - "Create a link to the refile destination if the message is marked as refile." - :group 'org-wl - :type 'boolean) + "Create a link to the refile destination if the message is marked as refile." + :group 'org-wl + :type 'boolean) + +(defcustom org-wl-link-remove-filter nil + "Remove filter condition if message is filter folder." + :group 'org-wl + :type 'boolean) + +(defcustom org-wl-shimbun-prefer-web-links nil + "If non-nil create web links for shimbun messages." + :group 'org-wl + :type 'boolean) + +(defcustom org-wl-nntp-prefer-web-links nil + "If non-nil create web links for nntp messages. +When folder name contains string \"gmane\" link to gmane, +googlegroups otherwise." + :type 'boolean + :group 'org-wl) + +(defcustom org-wl-disable-folder-check t + "Disable check for new messages when open a link." + :type 'boolean + :group 'org-wl) + +(defcustom org-wl-namazu-default-index nil + "Default namazu search index." + :type 'directory + :group 'org-wl) ;; Declare external functions and variables (declare-function elmo-folder-exists-p "ext:elmo" (folder) t) @@ -63,84 +91,185 @@ (declare-function wl-summary-registered-temp-mark "ext:wl-action" (number)) (declare-function wl-folder-goto-folder-subr "ext:wl-folder" (&optional folder sticky)) +(declare-function wl-folder-get-petname "ext:wl-folder" (name)) +(declare-function wl-folder-get-entity-from-buffer "ext:wl-folder" + (&optional getid)) +(declare-function wl-folder-buffer-group-p "ext:wl-folder") (defvar wl-init) (defvar wl-summary-buffer-elmo-folder) (defvar wl-summary-buffer-folder-name) +(defvar wl-folder-group-regexp) +(defvar wl-auto-check-folder-name) + +(defconst org-wl-folder-types + '(("%" . imap) ("-" . nntp) ("+" . mh) ("=" . spool) + ("$" . archive) ("&" . pop) ("@" . shimbun) ("[" . search) + ("*" . multi) ("/" . filter) ("|" . pipe) ("'" . internal)) + "List of folder indicators. See Wanderlust manual, section 3.") ;; Install the link type (org-add-link-type "wl" 'org-wl-open) (add-hook 'org-store-link-functions 'org-wl-store-link) ;; Implementation -(defun org-wl-store-link () - "Store a link to a WL folder or message." - (when (eq major-mode 'wl-summary-mode) - (let* ((msgnum (wl-summary-message-number)) - (mark-info (wl-summary-registered-temp-mark msgnum)) - (folder-name - (if (and org-wl-link-to-refile-destination - mark-info - (equal (nth 1 mark-info) "o")) ; marked as refile - (nth 2 mark-info) - wl-summary-buffer-folder-name)) - (message-id (elmo-message-field wl-summary-buffer-elmo-folder - msgnum 'message-id)) - (wl-message-entity - (if (fboundp 'elmo-message-entity) - (elmo-message-entity - wl-summary-buffer-elmo-folder msgnum) - (elmo-msgdb-overview-get-entity - msgnum (wl-summary-buffer-msgdb)))) - (from (let ((from-field (elmo-message-entity-field wl-message-entity - 'from))) - (if (listp from-field) - (car from-field) - from-field))) - (to (let ((to-field (elmo-message-entity-field wl-message-entity - 'to))) - (if (listp to-field) - (car to-field) - to-field))) - (subject (let (wl-thr-indent-string wl-parent-message-entity) - (wl-summary-line-subject))) - desc link) - ;; remove text properties of subject string to avoid possible bug - ;; when formatting the subject - (set-text-properties 0 (length subject) nil subject) - (org-store-link-props :type "wl" :from from :to to - :subject subject :message-id message-id) - (setq message-id (org-remove-angle-brackets message-id)) - (setq desc (org-email-link-description)) - (setq link (org-make-link "wl:" folder-name - "#" message-id)) - (org-add-link-props :link link :description desc) - link))) +(defun org-wl-folder-type (folder) + "Return symbol that indicates the type of FOLDER. +FOLDER is the wanderlust folder name. The first character of the +folder name determines the the folder type." + (let* ((indicator (substring folder 0 1)) + (type (cdr (assoc indicator org-wl-folder-types)))) + ;; maybe access or file folder + (when (not type) + (setq type + (cond + ((and (>= (length folder) 5) + (string= (substring folder 0 5) "file:")) + 'file) + ((and (>= (length folder) 7) + (string= (substring folder 0 7) "access:")) + 'access) + (t + nil)))) + type)) + +(defun org-wl-message-field (field entity) + "Return content of FIELD in ENTITY. +FIELD is a symbol of a rfc822 message header field. +ENTITY is a message entity." + (let ((content (elmo-message-entity-field entity field))) + (if (listp content) (car content) content))) + +(defun org-wl-store-link () + "Store a link to a WL message or folder." + (cond + ((memq major-mode '(wl-summary-mode mime-view-mode)) + (org-wl-store-link-message)) + ((eq major-mode 'wl-folder-mode) + (org-wl-store-link-folder)) + (t + nil))) + +(defun org-wl-store-link-folder () + "Store a link to a WL folder." + (let* ((folder (wl-folder-get-entity-from-buffer)) + (petname (wl-folder-get-petname folder)) + (link (org-make-link "wl:" folder))) + (save-excursion + (beginning-of-line) + (unless (and (wl-folder-buffer-group-p) + (looking-at wl-folder-group-regexp)) + (org-store-link-props :type "wl" :description petname + :link link) + link)))) + +(defun org-wl-store-link-message () + "Store a link to a WL message." + (save-excursion + (let ((buf (if (eq major-mode 'wl-summary-mode) + (current-buffer) + (and (boundp 'wl-message-buffer-cur-summary-buffer) + wl-message-buffer-cur-summary-buffer)))) + (when buf + (with-current-buffer buf + (let* ((msgnum (wl-summary-message-number)) + (mark-info (wl-summary-registered-temp-mark msgnum)) + (folder-name + (if (and org-wl-link-to-refile-destination + mark-info + (equal (nth 1 mark-info) "o")) ; marked as refile + (nth 2 mark-info) + wl-summary-buffer-folder-name)) + (folder-type (org-wl-folder-type folder-name)) + (wl-message-entity + (if (fboundp 'elmo-message-entity) + (elmo-message-entity + wl-summary-buffer-elmo-folder msgnum) + (elmo-msgdb-overview-get-entity + msgnum (wl-summary-buffer-msgdb)))) + (message-id + (org-wl-message-field 'message-id wl-message-entity)) + (from (org-wl-message-field 'from wl-message-entity)) + (to (org-wl-message-field 'to wl-message-entity)) + (xref (org-wl-message-field 'xref wl-message-entity)) + (subject (org-wl-message-field 'subject wl-message-entity)) + desc link) + + ;; remove text properties of subject string to avoid possible bug + ;; when formatting the subject + ;; (Emacs bug #5306, fixed) + (set-text-properties 0 (length subject) nil subject) + + ;; maybe remove filter condition + (when (and (eq folder-type 'filter) org-wl-link-remove-filter) + (while (eq (org-wl-folder-type folder-name) 'filter) + (setq folder-name + (replace-regexp-in-string "^/[^/]+/" "" folder-name)))) + + ;; maybe create http link + (cond + ((and (eq folder-type 'shimbun) + org-wl-shimbun-prefer-web-links xref) + (org-store-link-props :type "http" :link xref :description subject + :from from :to to :message-id message-id + :subject subject)) + ((and (eq folder-type 'nntp) org-wl-nntp-prefer-web-links) + (setq link + (format + (if (string-match "gmane\\." folder-name) + "http://mid.gmane.org/%s" + "http://groups.google.com/groups/search?as_umsgid=%s") + (org-fixup-message-id-for-http message-id))) + (org-store-link-props :type "http" :link link :description subject + :from from :to to :message-id message-id + :subject subject)) + (t + (org-store-link-props :type "wl" :from from :to to + :subject subject :message-id message-id) + (setq message-id (org-remove-angle-brackets message-id)) + (setq desc (org-email-link-description)) + (setq link (org-make-link "wl:" folder-name "#" message-id)) + (org-add-link-props :link link :description desc))) + (or link xref))))))) (defun org-wl-open (path) - "Follow the WL message link specified by PATH." - (require 'wl) - (unless wl-init (wl)) - ;; XXX: The imap-uw's MH folder names start with "%#". - (if (not (string-match "\\`\\(\\(?:%#\\)?[^#]+\\)\\(#\\(.*\\)\\)?" path)) - (error "Error in Wanderlust link")) - (let ((folder (match-string 1 path)) - (article (match-string 3 path))) - (if (not (elmo-folder-exists-p (org-no-warnings - (wl-folder-get-elmo-folder folder)))) - (error "No such folder: %s" folder)) - (let ((old-buf (current-buffer)) - (old-point (point-marker))) - (wl-folder-goto-folder-subr folder) - (save-excursion - ;; XXX: `wl-folder-goto-folder-subr' moves point to the - ;; beginning of the current line. So, restore the point - ;; in the old buffer. - (set-buffer old-buf) - (goto-char old-point)) - (and (wl-summary-jump-to-msg-by-message-id (org-add-angle-brackets - article)) - (wl-summary-redisplay))))) + "Follow the WL message link specified by PATH. +When called with one prefix, open message in namazu search folder +with `org-wl-namazu-default-index' as search index. When called +with two prefixes or `org-wl-namazu-default-index' is nil, ask +for namazu index." + (require 'wl) + (let ((wl-auto-check-folder-name + (if org-wl-disable-folder-check + 'none + wl-auto-check-folder-name))) + (unless wl-init (wl)) + ;; XXX: The imap-uw's MH folder names start with "%#". + (if (not (string-match "\\`\\(\\(?:%#\\)?[^#]+\\)\\(#\\(.*\\)\\)?" path)) + (error "Error in Wanderlust link")) + (let ((folder (match-string 1 path)) + (article (match-string 3 path))) + ;; maybe open message in namazu search folder + (when current-prefix-arg + (setq folder (concat "[" article "]" + (if (and (equal current-prefix-arg '(4)) + org-wl-namazu-default-index) + org-wl-namazu-default-index + (read-directory-name "Namazu index: "))))) + (if (not (elmo-folder-exists-p (org-no-warnings + (wl-folder-get-elmo-folder folder)))) + (error "No such folder: %s" folder)) + (let ((old-buf (current-buffer)) + (old-point (point-marker))) + (wl-folder-goto-folder-subr folder) + (with-current-buffer old-buf + ;; XXX: `wl-folder-goto-folder-subr' moves point to the + ;; beginning of the current line. So, restore the point + ;; in the old buffer. + (goto-char old-point)) + (and article (wl-summary-jump-to-msg-by-message-id (org-add-angle-brackets + article)) + (wl-summary-redisplay)))))) (provide 'org-wl) diff --git a/lisp/org/org-xoxo.el b/lisp/org/org-xoxo.el index 6a907f2267a..af501058e86 100644 --- a/lisp/org/org-xoxo.el +++ b/lisp/org/org-xoxo.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -25,11 +25,12 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Commentary: +;; XOXO export + +;;; Code: (require 'org-exp) -;;; XOXO export - (defvar org-export-xoxo-final-hook nil "Hook run after XOXO export, in the new buffer.") diff --git a/lisp/org/org.el b/lisp/org/org.el index 7aa385fee9d..5b37e0aa260 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.35i +;; Version: 7.01 ;; ;; This file is part of GNU Emacs. ;; @@ -72,8 +72,20 @@ (eval-when-compile (require 'cl) - (require 'gnus-sum) - (require 'calendar)) + (require 'gnus-sum)) + +(require 'calendar) +;; Emacs 22 calendar compatibility: Make sure the new variables are available +(when (fboundp 'defvaralias) + (unless (boundp 'calendar-view-holidays-initially-flag) + (defvaralias 'calendar-view-holidays-initially-flag + 'view-calendar-holidays-initially)) + (unless (boundp 'calendar-view-diary-initially-flag) + (defvaralias 'calendar-view-diary-initially-flag + 'view-diary-entries-initially)) + (unless (boundp 'diary-fancy-buffer) + (defvaralias 'diary-fancy-buffer 'fancy-diary-buffer))) + ;; For XEmacs, noutline is not yet provided by outline.el, so arrange for ;; the file noutline.el being loaded. (if (featurep 'xemacs) (condition-case nil (require 'noutline))) @@ -83,6 +95,7 @@ (require 'time-date) (unless (fboundp 'time-subtract) (defalias 'time-subtract 'subtract-time)) (require 'easymenu) +(require 'overlay) (require 'org-macs) (require 'org-entities) @@ -92,11 +105,86 @@ (require 'org-src) (require 'org-footnote) +;; babel +(require 'ob) +(require 'ob-table) +(require 'ob-lob) +(require 'ob-ref) +(require 'ob-tangle) +(require 'ob-comint) +(require 'ob-keys) + +;; load languages based on value of `org-babel-load-languages' +(defvar org-babel-load-languages) +;;;###autoload +(defun org-babel-do-load-languages (sym value) + "Load the languages defined in `org-babel-load-languages'." + (set-default sym value) + (mapc (lambda (pair) + (let ((active (cdr pair)) (lang (symbol-name (car pair)))) + (if active + (progn + (require (intern (concat "ob-" lang)))) + (progn + (funcall 'fmakunbound + (intern (concat "org-babel-execute:" lang))) + (funcall 'fmakunbound + (intern (concat "org-babel-expand-body:" lang))))))) + org-babel-load-languages)) + +(defcustom org-babel-load-languages '((emacs-lisp . t)) + "Languages which can be evaluated in Org-mode buffers. +This list can be used to load support for any of the languages +below, note that each language will depend on a different set of +system executables and/or Emacs modes. When a language is +\"loaded\", then code blocks in that language can be evaluated +with `org-babel-execute-src-block' bound by default to C-c +C-c (note the `org-babel-no-eval-on-ctrl-c-ctrl-c' variable can +be set to remove code block evaluation from the C-c C-c +keybinding. By default only Emacs Lisp (which has no +requirements) is loaded." + :group 'org-babel + :set 'org-babel-do-load-languages + :type '(alist :tag "Babel Languages" + :key-type + (choice + (const :tag "C" C) + (const :tag "R" R) + (const :tag "Asymptote" asymptote) + (const :tag "Clojure" clojure) + (const :tag "CSS" css) + (const :tag "Ditaa" ditaa) + (const :tag "Dot" dot) + (const :tag "Emacs Lisp" emacs-lisp) + (const :tag "Gnuplot" gnuplot) + (const :tag "Haskell" haskell) + (const :tag "Latex" latex) + (const :tag "Matlab" matlab) + (const :tag "Mscgen" mscgen) + (const :tag "Ocaml" ocaml) + (const :tag "Octave" octave) + (const :tag "Perl" perl) + (const :tag "Python" python) + (const :tag "Ruby" ruby) + (const :tag "Sass" sass) + (const :tag "Screen" screen) + (const :tag "Shell Script" sh) + (const :tag "Sql" sql) + (const :tag "Sqlite" sqlite)) + :value-type (boolean :tag "Activate" :value t))) + ;;;; Customization variables +(defcustom org-clone-delete-id nil + "Remove ID property of clones of a subtree. +When non-nil, clones of a subtree don't inherit the ID property. +Otherwise they inherit the ID property with a new unique +identifier." + :type 'boolean + :group 'org-id) ;;; Version -(defconst org-version "6.35i" +(defconst org-version "7.01" "The version number of the file org.el.") (defun org-version (&optional here) @@ -228,6 +316,7 @@ to add the symbol `xyz', and the package must have a call to (const :tag "C learn: SuperMemo's incremental learning algorithm" org-learn) (const :tag "C mairix: Hook mairix search into Org-mode for different MUAs" org-mairix) (const :tag "C mac-iCal Imports events from iCal.app to the Emacs diary" org-mac-iCal) + (const :tag "C mac-link-grabber Grab links and URLs from various Mac applications" org-mac-link-grabber) (const :tag "C man: Support for links to manpages in Org-mode" org-man) (const :tag "C mtags: Support for muse-like tags" org-mtags) (const :tag "C panel: Simple routines for us with bad memory" org-panel) @@ -239,13 +328,14 @@ to add the symbol `xyz', and the package must have a call to (const :tag "C sqlinsert: Convert Org-mode tables to SQL insertions" orgtbl-sqlinsert) (const :tag "C toc: Table of contents for Org-mode buffer" org-toc) (const :tag "C track: Keep up with Org-mode development" org-track) + (const :tag "C TaskJuggler: Export tasks to a TaskJuggler project" org-taskjuggler) (repeat :tag "External packages" :inline t (symbol :tag "Package")))) (defcustom org-support-shift-select nil "Non-nil means make shift-cursor commands select text when possible. In Emacs 23, when `shift-select-mode' is on, shifted cursor keys start -selecting a region, or enlarge thusly regions started in this way. +selecting a region, or enlarge regions started in this way. In Org-mode, in special contexts, these same keys are used for other purposes, important enough to compete with shift selection. Org tries to balance these needs by supporting `shift-select-mode' outside these @@ -324,6 +414,40 @@ the following lines anywhere in the buffer: (const :tag "Not" nil) (const :tag "Globally (slow on startup in large files)" t))) +(defcustom org-use-sub-superscripts t + "Non-nil means interpret \"_\" and \"^\" for export. +When this option is turned on, you can use TeX-like syntax for sub- and +superscripts. Several characters after \"_\" or \"^\" will be +considered as a single item - so grouping with {} is normally not +needed. For example, the following things will be parsed as single +sub- or superscripts. + + 10^24 or 10^tau several digits will be considered 1 item. + 10^-12 or 10^-tau a leading sign with digits or a word + x^2-y^3 will be read as x^2 - y^3, because items are + terminated by almost any nonword/nondigit char. + x_{i^2} or x^(2-i) braces or parenthesis do grouping. + +Still, ambiguity is possible - so when in doubt use {} to enclose the +sub/superscript. If you set this variable to the symbol `{}', +the braces are *required* in order to trigger interpretations as +sub/superscript. This can be helpful in documents that need \"_\" +frequently in plain text. + +Not all export backends support this, but HTML does. + +This option can also be set with the +OPTIONS line, e.g. \"^:nil\"." + :group 'org-startup + :group 'org-export-translation + :type '(choice + (const :tag "Always interpret" t) + (const :tag "Only with braces" {}) + (const :tag "Never interpret" nil))) + +(if (fboundp 'defvaralias) + (defvaralias 'org-export-with-sub-superscripts 'org-use-sub-superscripts)) + + (defcustom org-startup-with-beamer-mode nil "Non-nil means turn on `org-beamer-mode' on startup. This can also be configured on a per-file basis by adding one of @@ -371,10 +495,10 @@ become effective." :type 'boolean) (defcustom org-use-extra-keys nil - "Non-nil means use extra key sequence definitions for certain -commands. This happens automatically if you run XEmacs or if -window-system is nil. This variable lets you do the same -manually. You must set it before loading org. + "Non-nil means use extra key sequence definitions for certain commands. +This happens automatically if you run XEmacs or if `window-system' +is nil. This variable lets you do the same manually. You must +set it before loading org. Example: on Carbon Emacs 22 running graphically, with an external keyboard on a Powerbook, the default way of setting M-left might @@ -405,14 +529,17 @@ therefore you'll have to restart Emacs to apply it after changing." (defun org-key (key) "Select key according to `org-replace-disputed-keys' and `org-disputed-keys'. -Or return the original if not disputed." - (if org-replace-disputed-keys - (let* ((nkey (key-description key)) - (x (org-find-if (lambda (x) - (equal (key-description (car x)) nkey)) - org-disputed-keys))) - (if x (cdr x) key)) - key)) +Or return the original if not disputed. +Also apply the translations defined in `org-xemacs-key-equivalents'." + (when org-replace-disputed-keys + (let* ((nkey (key-description key)) + (x (org-find-if (lambda (x) + (equal (key-description (car x)) nkey)) + org-disputed-keys))) + (setq key (if x (cdr x) key)))) + (when (featurep 'xemacs) + (setq key (or (cdr (assoc key org-xemacs-key-equivalents)) key))) + key) (defun org-find-if (predicate seq) (catch 'exit @@ -625,7 +752,7 @@ The cdr is either a command to be called interactively, a function to be called, or a form to be evaluated. An entry that is just a list with a single string will be interpreted as a descriptive headline that will be added when listing the speed -copmmands in the Help buffer using the `?' speed command." +commands in the Help buffer using the `?' speed command." :group 'org-structure :type '(repeat :value ("k" . ignore) (choice :value ("k" . ignore) @@ -691,7 +818,8 @@ This can also be set in on a per-file basis with (defcustom org-cycle-global-at-bob nil "Cycle globally if cursor is at beginning of buffer and not at a headline. This makes it possible to do global cycling without having to use S-TAB or -C-u TAB. For this special case to work, the first line of the buffer +\\[universal-argument] TAB. For this special case to work, the first line \ +of the buffer must not be a headline - it may be empty or some other text. When used in this way, `org-cycle-hook' is disables temporarily, to make sure the cursor stays at the beginning of the buffer. @@ -705,7 +833,7 @@ of the buffer." When the cursor is at the end of an empty headline, i.e with only stars and maybe a TODO keyword, TAB will then switch the entry to become a child, -and then all possible anchestor states, before returning to the original state. +and then all possible ancestor states, before returning to the original state. This makes data entry extremely fast: M-RET to create a new headline, on TAB to make it a child, two or more tabs to make it a (grand-)uncle. @@ -868,6 +996,18 @@ When t, the following will happen while the cursor is in the headline: :group 'org-edit-structure :type 'boolean) +(defcustom org-ctrl-k-protect-subtree nil + "Non-nil means, do not delete a hidden subtree with C-k. +When set to the symbol `error', simply throw an error when C-k is +used to kill (part-of) a headline that has hidden text behind it. +Any other non-nil value will result in a query to the user, if it is +OK to kill that hidden subtree. When nil, kill without remorse." + :group 'org-edit-structure + :type '(choice + (const :tag "Do not protect hidden subtrees" nil) + (const :tag "Protect hidden subtrees with a security query" t) + (const :tag "Never kill a hidden subtree with C-k" error))) + (defcustom org-yank-folded-subtrees t "Non-nil means when yanking subtrees, fold them. If the kill is a single subtree, or a sequence of subtrees, i.e. if @@ -951,9 +1091,8 @@ See also the QUOTE keyword." :group 'org-edit-structure :type 'boolean) - (defcustom org-goto-auto-isearch t - "Non-nil means typing characters in org-goto starts incremental search." + "Non-nil means typing characters in `org-goto' starts incremental search." :group 'org-edit-structure :type 'boolean) @@ -1139,11 +1278,11 @@ Changing this variable requires a restart of Emacs to become effective." (const :tag "Footnotes" footnote))) (defcustom org-make-link-description-function nil - "Function to use to generate link descriptions from links. If -nil the link location will be used. This function must take two -parameters; the first is the link and the second the description -org-insert-link has generated, and should return the description -to use." + "Function to use to generate link descriptions from links. +If nil the link location will be used. This function must take +two parameters; the first is the link and the second the +description `org-insert-link' has generated, and should return the +description to use." :group 'org-link :type 'function) @@ -1280,8 +1419,7 @@ implementation is bad." :type 'boolean) (defcustom org-return-follows-link nil - "Non-nil means on links RET will follow the link. -Needs to be set before org.el is loaded." + "Non-nil means on links RET will follow the link." :group 'org-link-follow :type 'boolean) @@ -1294,15 +1432,16 @@ Needs to be set before org.el is loaded." :type 'boolean) (defcustom org-mark-ring-length 4 - "Number of different positions to be recorded in the ring + "Number of different positions to be recorded in the ring. Changing this requires a restart of Emacs to work correctly." :group 'org-link-follow :type 'integer) (defcustom org-link-frame-setup '((vm . vm-visit-folder-other-frame) - (gnus . gnus-other-frame) - (file . find-file-other-window)) + (gnus . org-gnus-no-new-news) + (file . find-file-other-window) + (wl . wl-other-frame)) "Setup the frame configuration for following links. When following a link with Emacs, it may often be useful to display this link in another window or frame. This variable can be used to @@ -1318,6 +1457,9 @@ For FILE, use any of `find-file' `find-file-other-window' `find-file-other-frame' +For Wanderlust use any of + `wl' + `wl-other-frame' For the calendar, use the variable `calendar-setup'. For BBDB, it is currently only possible to display the matches in another window." @@ -1337,13 +1479,18 @@ another window." (choice (const find-file) (const find-file-other-window) - (const find-file-other-frame))))) + (const find-file-other-frame))) + (cons (const wl) + (choice + (const wl) + (const wl-other-frame))))) (defcustom org-display-internal-link-with-indirect-buffer nil "Non-nil means use indirect buffer to display infile links. Activating internal links (from one location in a file to another location in the same file) normally just jumps to the location. When the link is -activated with a C-u prefix (or with mouse-3), the link is displayed in +activated with a \\[universal-argument] prefix (or with mouse-3), the link \ +is displayed in another window. When this option is set, the other window actually displays an indirect buffer clone of the current buffer, to avoid any visibility changes to the current buffer." @@ -1368,7 +1515,7 @@ window on that directory." (defcustom org-link-mailto-program '(browse-url "mailto:%a?subject=%s") "Function and arguments to call for following mailto links. -This is a list with the first element being a lisp function, and the +This is a list with the first element being a Lisp function, and the remaining elements being arguments to the function. In string arguments, %a will be replaced by the address, and %s will be replaced by the subject if one was given like in <mailto:arthur@galaxy.org::this subject>." @@ -1395,6 +1542,9 @@ single keystroke rather than having to type \"yes\"." (const :tag "with yes-or-no (safer)" yes-or-no-p) (const :tag "with y-or-n (faster)" y-or-n-p) (const :tag "no confirmation (dangerous)" nil))) +(put 'org-confirm-shell-link-function + 'safe-local-variable + '(lambda (x) (member x '(yes-or-no-p y-or-n-p)))) (defcustom org-confirm-elisp-link-function 'yes-or-no-p "Non-nil means ask for confirmation before executing Emacs Lisp links. @@ -1412,6 +1562,9 @@ single keystroke rather than having to type \"yes\"." (const :tag "with yes-or-no (safer)" yes-or-no-p) (const :tag "with y-or-n (faster)" y-or-n-p) (const :tag "no confirmation (dangerous)" nil))) +(put 'org-confirm-shell-link-function + 'safe-local-variable + '(lambda (x) (member x '(yes-or-no-p y-or-n-p)))) (defconst org-file-apps-defaults-gnu '((remote . emacs) @@ -1463,10 +1616,37 @@ you can use this variable to set the application for a given file extension. The entries in this list are cons cells where the car identifies files and the cdr the corresponding command. Possible values for the file identifier are - \"regex\" Regular expression matched against the file: link. For - backward compatibility, this can also be a string with only - alphanumeric characters, which is then interpreted as an - extension. + \"string\" A string as a file identifier can be interpreted in different + ways, depending on its contents: + + - Alphanumeric characters only: + Match links with this file extension. + Example: (\"pdf\" . \"evince %s\") + to open PDFs with evince. + + - Regular expression: Match links where the + filename matches the regexp. If you want to + use groups here, use shy groups. + + Example: (\"\\.x?html\\'\" . \"firefox %s\") + (\"\\(?:xhtml\\|html\\)\" . \"firefox %s\") + to open *.html and *.xhtml with firefox. + + - Regular expression which contains (non-shy) groups: + Match links where the whole link, including \"::\", and + anything after that, matches the regexp. + In a custom command string, %1, %2, etc. are replaced with + the parts of the link that were matched by the groups. + For backwards compatibility, if a command string is given + that does not use any of the group matches, this case is + handled identically to the second one (i.e. match against + file name only). + In a custom lisp form, you can access the group matches with + (match-string n link). + + Example: (\"\\.pdf::\\(\\d+\\)\\'\" . \"evince -p %1 %s\") + to open [[file:document.pdf::5]] with evince at page 5. + `directory' Matches a directory `remote' Matches a remote file, accessible through tramp or efs. Remote files most likely should be visited through Emacs @@ -1480,7 +1660,7 @@ file identifier are `system' The system command to open files, like `open' on Windows and Mac OS X, and mailcap under GNU/Linux. This is the command that will be selected if you call `C-c C-o' with a double - `C-u C-u' prefix. + \\[universal-argument] \\[universal-argument] prefix. Possible values for the command are: `emacs' The file will be visited by the current Emacs process. @@ -1495,13 +1675,9 @@ Possible values for the command are: does define this command, but you can overrule/replace it here. string A command to be executed by a shell; %s will be replaced - by the path to the file. If the file identifier is a regex, - %n will be replaced by the match of the nth match group. + by the path to the file. sexp A Lisp form which will be evaluated. The file path will - be available in the Lisp variable `file', the link itself - in the Lisp variable `link'. If the file identifier is a regex, - the original match data will be restored, so subexpression - matches are accessible using (match-string n link). + be available in the Lisp variable `file'. For more examples, see the system specific constants `org-file-apps-defaults-macosx' `org-file-apps-defaults-windowsnt' @@ -1523,6 +1699,8 @@ For more examples, see the system specific constants (string :tag "Command") (sexp :tag "Lisp form"))))) + + (defgroup org-refile nil "Options concerning refiling entries in Org-mode." :tag "Org Refile" @@ -1546,10 +1724,8 @@ following situations: (defcustom org-default-notes-file (convert-standard-filename "~/.notes") "Default target for storing notes. -Used by the hooks for remember.el. This can be a string, or nil to mean -the value of `remember-data-file'. -You can set this on a per-template basis with the variable -`org-remember-templates'." +Used as a fall back file for org-remember.el and org-capture.el, for +templates that do not specify a target file." :group 'org-refile :group 'org-remember :type '(choice @@ -1571,7 +1747,7 @@ outline-path-completion Headlines in the current buffer are offered via (const :tag "Outline-path-completion" outline-path-completion))) (defcustom org-goto-max-level 5 - "Maximum level to be considered when running org-goto with refile interface." + "Maximum target level when running `org-goto' with refile interface." :group 'org-refile :type 'integer) @@ -1640,7 +1816,7 @@ This is list of cons cells. Each cell contains: order in hierarchy, not to the number of stars. You can set the variable `org-refile-target-verify-function' to a function -to verify each headline found by the simple critery above. +to verify each headline found by the simple criteria above. When this variable is nil, all top-level headlines in the current buffer are used, equivalent to the value `((nil . (:level . 1))'." @@ -1672,6 +1848,17 @@ of the subtree." :group 'org-refile :type 'function) +(defcustom org-refile-use-cache nil + "Non-nil means cache refile targets to speed up the process. +The cache for a particular file will be updated automatically when +the buffer has been killed, or when any of the marker used for flagging +refile targets no longer points at a live buffer. +If you have added new entries to a buffer that might themselves be targets, +you need to clear the cache manually by pressing `C-0 C-c C-w' or, if you +find that easier, `C-u C-u C-u C-c C-w'." + :group 'org-refile + :type 'boolean) + (defcustom org-refile-use-outline-path nil "Non-nil means provide refile targets as paths. So a level 3 headline will be available as level1/level2/level3. @@ -1731,9 +1918,8 @@ heading." '( (:tag "Sequence (cycling hits every state)" sequence) (:tag "Type (cycling directly to DONE)" type)) - "The available interpretation symbols for customizing - `org-todo-keywords'. - Interested libraries should add to this list.") + "The available interpretation symbols for customizing `org-todo-keywords'. +Interested libraries should add to this list.") (defcustom org-todo-keywords '((sequence "TODO" "DONE")) "List of TODO entry keyword sequences and their interpretation. @@ -1759,7 +1945,7 @@ Each keyword can optionally specify a character for fast state selection \(in combination with the variable `org-use-fast-todo-selection') and specifiers for state change logging, using the same syntax that is used in the \"#+TODO:\" lines. For example, \"WAIT(w)\" says -that the WAIT state can be selected with the \"w\" key. \"WAIT(w!)\" +that the WAIT state can be selected with the \"w\" key. \"WAIT(w!)\" indicates to record a time stamp each time this state is selected. Each keyword may also specify if a timestamp or a note should be @@ -2103,6 +2289,7 @@ The value is an alist, with the car being a symbol indicating the note context, and the cdr is the heading to be used. The heading may also be the empty string. %t in the heading will be replaced by a time stamp. +%T will be an active time stamp instead the default inactive one %s will be replaced by the new TODO state, in double quotes. %S will be replaced by the old TODO state, in double quotes. %u will be replaced by the user name. @@ -2184,10 +2371,19 @@ When nil, the state change notes will be ordered according to time." :group 'org-progress :type 'boolean) +(defcustom org-todo-repeat-to-state nil + "The TODO state to which a repeater should return the repeating task. +By default this is the first task in a TODO sequence, or the previous state +in a TODO_TYP set. But you can specify another task here. +alternatively, set the :REPEAT_TO_STATE: property of the entry." + :group 'org-todo + :type '(choice (const :tag "Head of sequence" nil) + (string :tag "Specific state"))) + (defcustom org-log-repeat 'time "Non-nil means record moving through the DONE state when triggering repeat. An auto-repeating task is immediately switched back to TODO when -marked DONE. If you are not logging state changes (by adding \"@\" +marked DONE. If you are not logging state changes (by adding \"@\" or \"!\" to the TODO keyword definition), or set `org-log-done' to record a closing note, there will be no record of the task moving through DONE. This variable forces taking a note anyway. @@ -2276,12 +2472,12 @@ of N minutes, as given by the second value. When a setting is 0 or 1, insert the time unmodified. Useful rounding numbers should be factors of 60, so for example 5, 10, 15. -When this is larger than 1, you can still force an exact time-stamp by using -a double prefix argument to a time-stamp command like `C-c .' or `C-c !', +When this is larger than 1, you can still force an exact time stamp by using +a double prefix argument to a time stamp command like `C-c .' or `C-c !', and by using a prefix arg to `S-up/down' to specify the exact number of minutes to shift." :group 'org-time - :get '(lambda (var) ; Make sure all entries have 5 elements + :get '(lambda (var) ; Make sure both elements are there (if (integerp (default-value var)) (list (default-value var) 5) (default-value var))) @@ -2324,8 +2520,8 @@ commands, if custom time display is turned on at the time of export." f))) (defcustom org-time-clocksum-format "%d:%02d" - "The format string used when creating CLOCKSUM lines, or when -org-mode generates a time duration." + "The format string used when creating CLOCKSUM lines. +This is also used when org-mode generates a time duration." :group 'org-time :type 'string) @@ -2356,8 +2552,8 @@ Custom commands can set this variable in the options section." "Non-nil means assume future for incomplete date input from user. This affects the following situations: 1. The user gives a month but not a year. - For example, if it is april and you enter \"feb 2\", this will be read - as feb 2, *next* year. \"May 5\", however, will be this year. + For example, if it is April and you enter \"feb 2\", this will be read + as Feb 2, *next* year. \"May 5\", however, will be this year. 2. The user gives a day, but no month. For example, if today is the 15th, and you enter \"3\", Org-mode will read this as the third of *next* month. However, if you enter \"17\", @@ -2607,7 +2803,7 @@ is better to limit inheritance to certain tags using the variables (const :tag "List them, indented with leading dots" indented))) (defcustom org-tags-sort-function nil - "When set, tags are sorted using this function as a comparator" + "When set, tags are sorted using this function as a comparator." :group 'org-tags :type '(choice (const :tag "No sorting" nil) @@ -2638,7 +2834,7 @@ lined-up with respect to each other." (defcustom org-use-property-inheritance nil "Non-nil means properties apply also for sublevels. -This setting is chiefly used during property searches. Turning it on can +This setting is chiefly used during property searches. Turning it on can cause significant overhead when doing a search, which is why it is not on by default. @@ -2937,32 +3133,49 @@ will be appended." (defvar org-format-latex-header-extra nil) +(defun org-set-packages-alist (var val) + "Set the packages alist and make sure it has 3 elements per entry." + (set var (mapcar (lambda (x) + (if (and (consp x) (= (length x) 2)) + (list (car x) (nth 1 x) t) + x)) + val))) + +(defun org-get-packages-alist (var) + + "Get the packages alist and make sure it has 3 elements per entry." + (mapcar (lambda (x) + (if (and (consp x) (= (length x) 2)) + (list (car x) (nth 1 x) t) + x)) + (default-value var))) + ;; The following variables are defined here because is it also used ;; when formatting latex fragments. Originally it was part of the ;; LaTeX exporter, which is why the name includes "export". (defcustom org-export-latex-default-packages-alist - '(("AUTO" "inputenc") - ("T1" "fontenc") - ("" "fixltx2e") - ("" "graphicx") - ("" "longtable") - ("" "float") - ("" "wrapfig") - ("" "soul") - ("" "t1enc") - ("" "textcomp") - ("" "marvosym") - ("" "wasysym") - ("" "latexsym") - ("" "amssymb") - ("" "hyperref") + '(("AUTO" "inputenc" t) + ("T1" "fontenc" t) + ("" "fixltx2e" nil) + ("" "graphicx" t) + ("" "longtable" nil) + ("" "float" nil) + ("" "wrapfig" nil) + ("" "soul" t) + ("" "t1enc" t) + ("" "textcomp" t) + ("" "marvosym" t) + ("" "wasysym" t) + ("" "latexsym" t) + ("" "amssymb" t) + ("" "hyperref" nil) "\\tolerance=1000" ) "Alist of default packages to be inserted in the header. Change this only if one of the packages here causes an incompatibility with another package you are using. The packages in this list are needed by one part or another of Org-mode -to function properly. +to function properly. - inputenc, fontenc, t1enc: for basic font and character selection - textcomp, marvosymb, wasysym, latexsym, amssym: for various symbols used @@ -2976,31 +3189,42 @@ to function properly. Therefore you should not modify this variable unless you know what you are doing. The one reason to change it anyway is that you might be loading some other package that conflicts with one of the default packages. -Each cell is of the format \( \"options\" \"package\" \)." +Each cell is of the format \( \"options\" \"package\" snippet-flag\). +If SNIPPET-FLAG is t, the package also needs to be included when +compiling LaTeX snippets into images for inclusion into HTML." :group 'org-export-latex + :set 'org-set-packages-alist + :get 'org-get-packages-alist :type '(repeat - (choice - (string :tag "A line of LaTeX") + (choice (list :tag "options/package pair" (string :tag "options") - (string :tag "package"))))) + (string :tag "package") + (boolean :tag "Snippet")) + (string :tag "A line of LaTeX")))) (defcustom org-export-latex-packages-alist nil - "Alist of packages to be inserted in every LaTeX the header. + "Alist of packages to be inserted in every LaTeX header. These will be inserted after `org-export-latex-default-packages-alist'. -Each cell is of the format \( \"options\" \"package\" \). -Make sure that you only lis packages here which: +Each cell is of the format \( \"options\" \"package\" snippet-flag \). +SNIPPET-FLAG, when t, indicates that this package is also needed when +turning LaTeX snippets into images for inclusion into HTML. +Make sure that you only list packages here which: - you want in every file - do not conflict with the default packages in `org-export-latex-default-packages-alist' - do not conflict with the setup in `org-format-latex-header'." :group 'org-export-latex + :set 'org-set-packages-alist + :get 'org-get-packages-alist :type '(repeat - (choice - (string :tag "A line of LaTeX") + (choice (list :tag "options/package pair" (string :tag "options") - (string :tag "package"))))) + (string :tag "package") + (boolean :tag "Snippet")) + (string :tag "A line of LaTeX")))) + (defgroup org-appearance nil "Settings for Org-mode appearance." @@ -3073,8 +3297,25 @@ org-level-* faces." :group 'org-appearance :type 'boolean) +(defcustom org-pretty-entities nil + "Non-nil means show entities as UTF8 characters. +When nil, the \\name form remains in the buffer." + :group 'org-appearance + :type 'boolean) + +(defcustom org-pretty-entities-include-sub-superscripts t + "Non-nil means, pretty entity display includes formatting sub/superscripts." + :group 'org-appearance + :type 'boolean) + (defvar org-emph-re nil - "Regular expression for matching emphasis.") + "Regular expression for matching emphasis. +After a match, the match groups contain these elements: +1 The character before the proper match, or empty at beginning of line +2 The proper match, including the leading and trailing markers +3 The leading marker like * or /, indicating the type of highlighting +4 The text between the emphasis markers, not including the markers +5 The character after the match, empty at the end of a line") (defvar org-verbatim-re nil "Regular expression for matching verbatim text.") (defvar org-emphasis-regexp-components) ; defined just below @@ -3176,6 +3417,7 @@ example *bold*, _underlined_ and /italic/. This variable sets the marker characters, the face to be used by font-lock for highlighting in Org-mode Emacs buffers, and the HTML tags to be used for this. For LaTeX export, see the variable `org-export-latex-emphasis-alist'. +For DocBook export, see the variable `org-export-docbook-emphasis-alist'. Use customize to modify this, or restart Emacs after changing it." :group 'org-appearance :set 'org-set-emph-re @@ -3271,6 +3513,7 @@ Normal means no org-mode-specific context." (declare-function org-indent-mode "org-indent" (&optional arg)) (declare-function parse-time-string "parse-time" (string)) (declare-function org-attach-reveal "org-attach" (&optional if-exists)) +(declare-function org-export-latex-fix-inputenc "org-latex" ()) (defvar remember-data-file) (defvar texmathp-why) (declare-function speedbar-line-directory "speedbar" (&optional depth)) @@ -3287,18 +3530,18 @@ Normal means no org-mode-specific context." ;; by the functions setting up org-mode or checking for table context. (defconst org-table-any-line-regexp "^[ \t]*\\(|\\|\\+-[-+]\\)" - "Detects an org-type or table-type table.") + "Detect an org-type or table-type table.") (defconst org-table-line-regexp "^[ \t]*|" - "Detects an org-type table line.") + "Detect an org-type table line.") (defconst org-table-dataline-regexp "^[ \t]*|[^-]" - "Detects an org-type table line.") + "Detect an org-type table line.") (defconst org-table-hline-regexp "^[ \t]*|-" - "Detects an org-type table hline.") + "Detect an org-type table hline.") (defconst org-table1-hline-regexp "^[ \t]*\\+-[-+]" - "Detects a table-type table hline.") + "Detect a table-type table hline.") (defconst org-table-any-border-regexp "^[ \t]*[^|+ \t]" - "Searching from within a table (any type) this finds the first line -outside the table.") + "Detect the first line outside a table when searching from within it. +This works for both table types.") ;; Autoload the functions in org-table.el that are needed by functions here. @@ -3325,7 +3568,9 @@ outside the table.") org-table-rotate-recalc-marks org-table-sort-lines org-table-sum org-table-toggle-coordinate-overlays org-table-toggle-formula-debugger org-table-wrap-region - orgtbl-mode turn-on-orgtbl org-table-to-lisp))) + orgtbl-mode turn-on-orgtbl org-table-to-lisp + orgtbl-to-generic orgtbl-to-tsv orgtbl-to-csv orgtbl-to-latex + orgtbl-to-orgtbl orgtbl-to-html orgtbl-to-texinfo))) (defun org-at-table-p (&optional table-type) "Return t if the cursor is inside an org-type table. @@ -3365,7 +3610,7 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables." (message "recognizing table.el table...") (table-recognize-table) (message "recognizing table.el table...done"))) - (error "This should not happen...")) + (error "This should not happen")) t) nil) nil)) @@ -3380,21 +3625,22 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables." (defvar org-table-clean-did-remove-column nil) -(defun org-table-map-tables (function) +(defun org-table-map-tables (function &optional quietly) "Apply FUNCTION to the start of all tables in the buffer." (save-excursion (save-restriction (widen) (goto-char (point-min)) (while (re-search-forward org-table-any-line-regexp nil t) - (message "Mapping tables: %d%%" (/ (* 100.0 (point)) (buffer-size))) + (unless quietly + (message "Mapping tables: %d%%" (/ (* 100.0 (point)) (buffer-size)))) (beginning-of-line 1) (when (looking-at org-table-line-regexp) (save-excursion (funcall function)) (or (looking-at org-table-line-regexp) (forward-char 1))) (re-search-forward org-table-any-border-regexp nil 1)))) - (message "Mapping tables: done")) + (unless quietly (message "Mapping tables: done"))) ;; Declare and autoload functions from org-exp.el & Co @@ -3448,6 +3694,11 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables." '(org-remember-insinuate org-remember-annotation org-remember-apply-template org-remember org-remember-handler))) +(eval-and-compile + (org-autoload "org-capture" + '(org-capture org-capture-insert-template-here + org-capture-import-remember-templates))) + ;; Autoload org-clock.el @@ -3814,7 +4065,7 @@ Also put tags into group 4 if tags are present.") "Matches any of the 3 keywords, together with the time stamp.") (make-variable-buffer-local 'org-keyword-time-not-clock-regexp) (defvar org-maybe-keyword-time-regexp nil - "Matches a timestamp, possibly preceeded by a keyword.") + "Matches a timestamp, possibly preceded by a keyword.") (make-variable-buffer-local 'org-maybe-keyword-time-regexp) (defvar org-planning-or-clock-line-re nil "Matches a line with planning or clock info.") @@ -3910,7 +4161,9 @@ After a match, the following groups carry important information: ("noptag" org-tag-persistent-alist nil) ("hideblocks" org-hide-block-startup t) ("nohideblocks" org-hide-block-startup nil) - ("beamer" org-startup-with-beamer-mode t)) + ("beamer" org-startup-with-beamer-mode t) + ("entitiespretty" org-pretty-entities t) + ("entitiesplain" org-pretty-entities nil)) "Variable associated with STARTUP options for org-mode. Each element is a list of three items: The startup options as written in the #+STARTUP line, the corresponding variable, and the value to @@ -3933,9 +4186,11 @@ means to push this value onto the list in the variable.") (let ((re (org-make-options-regexp '("CATEGORY" "TODO" "COLUMNS" "STARTUP" "ARCHIVE" "FILETAGS" "TAGS" "LINK" "PRIORITIES" - "CONSTANTS" "PROPERTY" "DRAWERS" "SETUPFILE" "LATEX_CLASS") + "CONSTANTS" "PROPERTY" "DRAWERS" "SETUPFILE" "LATEX_CLASS" + "OPTIONS") "\\(?:[a-zA-Z][0-9a-zA-Z_]*_TODO\\)")) (splitre "[ \t]+") + (scripts org-use-sub-superscripts) kwds kws0 kwsa key log value cat arch tags const links hw dws tail sep kws1 prio props ftags drawers beamer-p ext-setup-or-nil setup-contents (start 0)) @@ -3950,10 +4205,9 @@ means to push this value onto the list in the variable.") (re-search-forward re nil t))) (setq key (upcase (match-string 1 ext-setup-or-nil)) value (org-match-string-no-properties 2 ext-setup-or-nil)) + (if (stringp value) (setq value (org-trim value))) (cond ((equal key "CATEGORY") - (if (string-match "[ \t]+$" value) - (setq value (replace-match "" t t value))) (setq cat value)) ((member key '("SEQ_TODO" "TODO")) (push (cons 'sequence (org-split-string value splitre)) kwds)) @@ -4004,12 +4258,14 @@ means to push this value onto the list in the variable.") (set (make-local-variable var) (symbol-value var)) (add-to-list var val)))))) ((equal key "ARCHIVE") - (string-match " *$" value) - (setq arch (replace-match "" t t value)) + (setq arch value) (remove-text-properties 0 (length arch) '(face t fontified t) arch)) ((equal key "LATEX_CLASS") (setq beamer-p (equal value "beamer"))) + ((equal key "OPTIONS") + (if (string-match "\\([ \t]\\|\\`\\)\\^:\\(t\\|nil\\|{}\\)" value) + (setq scripts (read (match-string 2 value))))) ((equal key "SETUPFILE") (setq setup-contents (org-file-contents (expand-file-name @@ -4022,6 +4278,7 @@ means to push this value onto the list in the variable.") "\n" setup-contents "\n" (substring ext-setup-or-nil start))))) )))) + (org-set-local 'org-use-sub-superscripts scripts) (when cat (org-set-local 'org-category (intern cat)) (push (cons "CATEGORY" cat) props)) @@ -4148,7 +4405,11 @@ means to push this value onto the list in the variable.") org-complex-heading-regexp-format (concat "^\\(\\*+\\)[ \t]+\\(?:\\(" (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") - "\\)\\>\\)?\\(?:[ \t]*\\(\\[#.\\]\\)\\)?[ \t]*\\(%s\\)" + "\\)\\>\\)?" + "\\(?:[ \t]*\\(\\[#.\\]\\)\\)?" + "\\(?:[ \t]*\\(?:\\[[0-9%%/]+\\]\\)\\)?" ;; stats cookie + "[ \t]*\\(%s\\)" + "\\(?:[ \t]*\\(?:\\[[0-9%%/]+\\]\\)\\)?" ;; stats cookie "\\(?:[ \t]+\\(:[[:alnum:]_@:]+:\\)\\)?[ \t]*$") org-nl-done-regexp (concat "\n\\*+[ \t]+" @@ -4211,10 +4472,10 @@ means to push this value onto the list in the variable.") (not (file-readable-p file))) (if noerror (progn - (message "Cannot read file %s" file) + (message "Cannot read file \"%s\"" file) (ding) (sit-for 2) "") - (error "Cannot read file %s" file)) + (error "Cannot read file \"%s\"" file)) (with-temp-buffer (insert-file-contents file) (buffer-string)))) @@ -4287,7 +4548,7 @@ This is for getting out of special buffers like remember.") ;;;; Define the Org-mode (if (and (not (keymapp outline-mode-map)) (featurep 'allout)) - (error "Conflict with outdated version of allout.el. Load org.el before allout.el, or upgrade to newer allout, for example by switching to Emacs 22.")) + (error "Conflict with outdated version of allout.el. Load org.el before allout.el, or upgrade to newer allout, for example by switching to Emacs 22")) ;; We use a before-change function to check if a table might need @@ -4334,7 +4595,7 @@ The following commands are available: ;; we switch another buffer into org-mode. (if (featurep 'xemacs) (when (boundp 'outline-mode-menu-heading) - ;; Assume this is Greg's port, it used easymenu + ;; Assume this is Greg's port, it uses easymenu (easy-menu-remove outline-mode-menu-heading) (easy-menu-remove outline-mode-menu-show) (easy-menu-remove outline-mode-menu-hide)) @@ -4346,9 +4607,9 @@ The following commands are available: (easy-menu-add org-org-menu) (easy-menu-add org-tbl-menu) (org-install-agenda-files-menu) - (if org-descriptive-links (org-add-to-invisibility-spec '(org-link))) - (org-add-to-invisibility-spec '(org-cwidth)) - (org-add-to-invisibility-spec '(org-hide-block . t)) + (if org-descriptive-links (add-to-invisibility-spec '(org-link))) + (add-to-invisibility-spec '(org-cwidth)) + (add-to-invisibility-spec '(org-hide-block . t)) (when (featurep 'xemacs) (org-set-local 'line-move-ignore-invisible t)) (org-set-local 'outline-regexp org-outline-regexp) @@ -4371,7 +4632,6 @@ The following commands are available: (org-set-tag-faces 'org-tag-faces org-tag-faces)) ;; Calc embedded (org-set-local 'calc-embedded-open-mode "# ") - (modify-syntax-entry ?# "<") (modify-syntax-entry ?@ "w") (if org-startup-truncated (setq truncate-lines t)) (org-set-local 'font-lock-unfontify-region-function @@ -4386,6 +4646,9 @@ The following commands are available: (org-set-autofill-regexps) (setq indent-line-function 'org-indent-line-function) (org-update-radio-target-regexp) + ;; Beginning/end of defun + (org-set-local 'beginning-of-defun-function 'org-beginning-of-defun) + (org-set-local 'end-of-defun-function 'org-end-of-defun) ;; Make sure dependence stuff works reliably, even for users who set it ;; too late :-( (if org-enforce-todo-dependencies @@ -4400,7 +4663,7 @@ The following commands are available: 'org-block-todo-from-checkboxes)) ;; Comment characters -; (org-set-local 'comment-start "#") ;; FIXME: this breaks wrapping + (org-set-local 'comment-start "#") (org-set-local 'comment-padding " ") ;; Align options lines @@ -4434,7 +4697,7 @@ The following commands are available: (unless org-inhibit-startup (when org-startup-align-all-tables (let ((bmp (buffer-modified-p))) - (org-table-map-tables 'org-table-align) + (org-table-map-tables 'org-table-align 'quietly) (set-buffer-modified-p bmp))) (when org-startup-indented (require 'org-indent) @@ -4461,10 +4724,8 @@ The following commands are available: ;;;; Font-Lock stuff, including the activators (defvar org-mouse-map (make-sparse-keymap)) -(org-defkey org-mouse-map - (if (featurep 'xemacs) [button2] [mouse-2]) 'org-open-at-mouse) -(org-defkey org-mouse-map - (if (featurep 'xemacs) [button3] [mouse-3]) 'org-find-file-at-mouse) +(org-defkey org-mouse-map [mouse-2] 'org-open-at-mouse) +(org-defkey org-mouse-map [mouse-3] 'org-find-file-at-mouse) (when org-mouse-1-follows-link (org-defkey org-mouse-map [follow-link] 'mouse-face)) (when org-tab-follows-link @@ -4475,7 +4736,7 @@ The following commands are available: (defconst org-non-link-chars "]\t\n\r<>") (defvar org-link-types '("http" "https" "ftp" "mailto" "file" "news" - "shell" "elisp")) + "shell" "elisp" "doi")) (defvar org-link-types-re nil "Matches a link that has a url-like prefix like \"http:\"") (defvar org-link-re-with-space nil @@ -4499,10 +4760,51 @@ Here is what the match groups contain after a match: 4: [desc] 5: desc") (defvar org-bracket-link-analytic-regexp++ nil - "Like org-bracket-link-analytic-regexp, but include coderef internal type.") + "Like `org-bracket-link-analytic-regexp', but include coderef internal type.") (defvar org-any-link-re nil "Regular expression matching any link.") +(defcustom org-match-sexp-depth 3 + "Number of stacked braces for sub/superscript matching. +This has to be set before loading org.el to be effective." + :group 'org-export-translation ; ??????????????????????????/ + :type 'integer) + +(defun org-create-multibrace-regexp (left right n) + "Create a regular expression which will match a balanced sexp. +Opening delimiter is LEFT, and closing delimiter is RIGHT, both given +as single character strings. +The regexp returned will match the entire expression including the +delimiters. It will also define a single group which contains the +match except for the outermost delimiters. The maximum depth of +stacked delimiters is N. Escaping delimiters is not possible." + (let* ((nothing (concat "[^" left right "]*?")) + (or "\\|") + (re nothing) + (next (concat "\\(?:" nothing left nothing right "\\)+" nothing))) + (while (> n 1) + (setq n (1- n) + re (concat re or next) + next (concat "\\(?:" nothing left next right "\\)+" nothing))) + (concat left "\\(" re "\\)" right))) + +(defvar org-match-substring-regexp + (concat + "\\([^\\]\\)\\([_^]\\)\\(" + "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)" + "\\|" + "\\(" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)" + "\\|" + "\\(\\(?:\\*\\|[-+]?[^-+*!@#$%^_ \t\r\n,:\"?<>~;./{}=()]+\\)\\)\\)") + "The regular expression matching a sub- or superscript.") + +(defvar org-match-substring-with-braces-regexp + (concat + "\\([^\\]\\)\\([_^]\\)\\(" + "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)" + "\\)") + "The regular expression matching a sub- or superscript, forcing braces.") + (defun org-make-link-regexps () "Update the link regular expressions. This should be called after the variable `org-link-types' has changed." @@ -4607,7 +4909,7 @@ The time stamps may be either active or inactive.") (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0))) (add-text-properties (match-beginning 2) (match-end 2) - '(font-lock-multiline t)) + '(font-lock-multiline t org-emphasis t)) (when org-hide-emphasis-markers (add-text-properties (match-end 4) (match-beginning 5) '(invisible org-link)) @@ -4724,7 +5026,7 @@ will be prompted for." '(font-lock-fontified t face org-block)) t) ((and (match-end 4) (equal dc3 "begin")) - ;; Truely a block + ;; Truly a block (setq block-type (downcase (match-string 5)) quoting (member block-type org-protecting-blocks)) (when (re-search-forward @@ -4766,7 +5068,8 @@ will be prompted for." '(font-lock-fontified t face org-meta-line)) t) ((or (member dc1 '("begin:" "end:" "caption:" "label:" - "orgtbl:" "tblfm:" "tblname:")) + "orgtbl:" "tblfm:" "tblname:" "result:" + "results:" "source:" "srcname:" "call:")) (and (match-end 4) (equal dc3 "attr"))) (add-text-properties beg (match-end 0) @@ -4944,13 +5247,17 @@ will be prompted for." (if org-export-with-TeX-macros (list (concat "\\\\" (regexp-opt - (append (mapcar 'car (append org-entities-user - org-entities)) - (if (boundp 'org-latex-entities) - (mapcar (lambda (x) - (or (car-safe x) x)) - org-latex-entities) - nil)) + (append + + (delq nil + (mapcar 'car-safe + (append org-entities-user + org-entities))) + (if (boundp 'org-latex-entities) + (mapcar (lambda (x) + (or (car-safe x) x)) + org-latex-entities) + nil)) 'words))) ; FIXME )) ;; (list "\\\\\\(?:[a-zA-Z]+\\)"))) @@ -4989,7 +5296,7 @@ will be prompted for." rtn))) (defun org-restart-font-lock () - "Restart font-lock-mode, to force refontification." + "Restart `font-lock-mode', to force refontification." (when (and (boundp 'font-lock-mode) font-lock-mode) (font-lock-mode -1) (font-lock-mode 1))) @@ -5034,7 +5341,7 @@ between words." (defun org-outline-level () "Compute the outline level of the heading at point. This function assumes that the cursor is at the beginning of a line matched -by outline-regexp. Otherwise it returns garbage. +by `outline-regexp'. Otherwise it returns garbage. If this is called at a normal headline, the level is the number of stars. Use `org-reduced-level' to remove the effect of `org-odd-levels'. For plain list items, if they are matched by `outline-regexp', this returns @@ -5134,6 +5441,8 @@ For plain list items, if they are matched by `outline-regexp', this returns '(1 'org-archived prepend)) ;; Specials '(org-do-latex-and-special-faces) + '(org-fontify-entities) + '(org-raise-scripts) ;; Code '(org-activate-code (1 'org-code t)) ;; COMMENT @@ -5151,8 +5460,41 @@ For plain list items, if they are matched by `outline-regexp', this returns '(org-font-lock-keywords t nil nil backward-paragraph)) (kill-local-variable 'font-lock-keywords) nil)) +(defun org-toggle-pretty-entities () + "Toggle the composition display of entities as UTF8 characters." + (interactive) + (org-set-local 'org-pretty-entities (not org-pretty-entities)) + (org-restart-font-lock) + (if org-pretty-entities + (message "Entities are displayed as UTF8 characers") + (save-restriction + (widen) + (decompose-region (point-min) (point-max)) + (message "Entities are displayed plain")))) + +(defun org-fontify-entities (limit) + "Find an entity to fontify." + (let (ee) + (when org-pretty-entities + (catch 'match + (while (re-search-forward + "\\\\\\([a-zA-Z][a-zA-Z0-9]*\\)\\($\\|[^[:alnum:]\n]\\)" + limit t) + (if (and (not (org-in-indented-comment-line)) + (setq ee (org-entity-get (match-string 1))) + (= (length (nth 6 ee)) 1)) + (progn + (add-text-properties + (match-beginning 0) (match-end 1) + (list 'font-lock-fontified t)) + (compose-region (match-beginning 0) (match-end 1) + (nth 6 ee) nil) + (backward-char 1) + (throw 'match t)))) + nil)))) + (defun org-fontify-like-in-org-mode (s &optional odd-levels) - "Fontify string S like in Org-mode" + "Fontify string S like in Org-mode." (with-temp-buffer (insert s) (let ((org-odd-levels-only odd-levels)) @@ -5227,6 +5569,7 @@ If KWD is a number, get the corresponding match group." (inhibit-read-only t) (inhibit-point-motion-hooks t) (inhibit-modification-hooks t) deactivate-mark buffer-file-name buffer-file-truename) + (decompose-region beg end) (remove-text-properties beg end (if org-indent-mode @@ -5234,10 +5577,69 @@ If KWD is a number, get the corresponding match group." '(mouse-face t keymap t org-linked-text t invisible t intangible t line-prefix t wrap-prefix t - org-no-flyspell t) + org-no-flyspell t org-emphasis t) '(mouse-face t keymap t org-linked-text t invisible t intangible t - org-no-flyspell t))))) + org-no-flyspell t org-emphasis t))) + (org-remove-font-lock-display-properties beg end))) + +(defconst org-script-display '(((raise -0.3) (height 0.7)) + ((raise 0.3) (height 0.7)) + ((raise -0.5)) + ((raise 0.5))) + "Display properties for showing superscripts and subscripts.") + +(defun org-remove-font-lock-display-properties (beg end) + "Remove specific display properties that have been added by font lock. +The will remove the raise properties that are used to show superscripts +and subscripts." + (let (next prop) + (while (< beg end) + (setq next (next-single-property-change beg 'display nil end) + prop (get-text-property beg 'display)) + (if (member prop org-script-display) + (put-text-property beg next 'display nil)) + (setq beg next)))) + +(defun org-raise-scripts (limit) + "Add raise properties to sub/superscripts." + (when (and org-pretty-entities org-pretty-entities-include-sub-superscripts) + (if (re-search-forward + (if (eq org-use-sub-superscripts t) + org-match-substring-regexp + org-match-substring-with-braces-regexp) + limit t) + (let* ((pos (point)) table-p comment-p + (mpos (match-beginning 3)) + (emph-p (get-text-property mpos 'org-emphasis)) + (link-p (get-text-property mpos 'mouse-face)) + (keyw-p (eq 'org-special-keyword (get-text-property mpos 'face)))) + (goto-char (point-at-bol)) + (setq table-p (org-looking-at-p org-table-dataline-regexp) + comment-p (org-looking-at-p "[ \t]*#")) + (goto-char pos) + ;; FIXME: Should we go back one character here, for a_b^c + ;; (goto-char (1- pos)) ;???????????????????? + (if (or comment-p emph-p link-p keyw-p) + t + (put-text-property (match-beginning 3) (match-end 0) + 'display + (if (equal (char-after (match-beginning 2)) ?^) + (nth (if table-p 3 1) org-script-display) + (nth (if table-p 2 0) org-script-display))) + (add-text-properties (match-beginning 2) (match-end 2) + (list 'invisible t + 'org-dwidth t 'org-dwidth-n 1)) + (if (and (eq (char-after (match-beginning 3)) ?{) + (eq (char-before (match-end 3)) ?})) + (progn + (add-text-properties + (match-beginning 3) (1+ (match-beginning 3)) + (list 'invisible t 'org-dwidth t 'org-dwidth-n 1)) + (add-text-properties + (1- (match-end 3)) (match-end 3) + (list 'invisible t 'org-dwidth t 'org-dwidth-n 1)))) + t))))) ;;;; Visibility cycling, including org-goto and indirect buffer @@ -5284,7 +5686,7 @@ in special contexts. - When point is at the beginning of an empty headline and the variable `org-cycle-level-after-item/entry-creation' is set, cycle the level of the headline by demoting and promoting it to likely levels. This - speeds up creation document structure by presing TAB once or several + speeds up creation document structure by pressing TAB once or several times right after creating a new headline. - When there is a numeric prefix, go up to a heading with level ARG, do @@ -5462,7 +5864,6 @@ in special contexts. (while (and (not (eobp)) ;; this is like `next-line' (get-char-property (1- (point)) 'invisible)) (goto-char (next-single-char-property-change (point) 'invisible)) -;;;??? (or (bolp) (beginning-of-line 2)))) (and (eolp) (beginning-of-line 2)))) (setq eol (point))) (outline-end-of-heading) (setq eoh (point)) @@ -5524,7 +5925,7 @@ in special contexts. ;;;###autoload (defun org-global-cycle (&optional arg) "Cycle the global visibility. For details see `org-cycle'. -With C-u prefix arg, switch to startup visibility. +With \\[universal-argument] prefix arg, switch to startup visibility. With a numeric prefix, show all headlines up to that level." (interactive "P") (let ((org-cycle-include-plain-lists @@ -5553,7 +5954,7 @@ With a numeric prefix, show all headlines up to that level." (org-set-visibility-according-to-property 'no-cleanup) (org-cycle-hide-archived-subtrees 'all) (org-cycle-hide-drawers 'all) - (org-cycle-show-empty-lines 'all))) + (org-cycle-show-empty-lines t))) (defun org-set-visibility-according-to-property (&optional no-cleanup) "Switch subtree visibilities according to :VISIBILITY: property." @@ -5637,11 +6038,11 @@ This function is the default value of the hook `org-cycle-hook'." "Remove outline overlays that do not contain non-white stuff." (mapc (lambda (o) - (and (eq 'outline (org-overlay-get o 'invisible)) - (not (string-match "\\S-" (buffer-substring (org-overlay-start o) - (org-overlay-end o)))) - (org-delete-overlay o))) - (org-overlays-at pos))) + (and (eq 'outline (overlay-get o 'invisible)) + (not (string-match "\\S-" (buffer-substring (overlay-start o) + (overlay-end o)))) + (delete-overlay o))) + (overlays-at pos))) (defun org-clean-visibility-after-subtree-move () "Fix visibility issues after moving a subtree." @@ -5794,7 +6195,7 @@ Optional argument N means put the headline into the Nth line of the window." (defun org-outline-overlay-data (&optional use-markers) "Return a list of the locations of all outline overlays. The are overlays with the `invisible' property value `outline'. -The return valus is a list of cons cells, with start and stop +The return values is a list of cons cells, with start and stop positions for each overlay. If USE-MARKERS is set, return the positions as markers." (let (beg end) @@ -5803,15 +6204,15 @@ If USE-MARKERS is set, return the positions as markers." (widen) (delq nil (mapcar (lambda (o) - (when (eq (org-overlay-get o 'invisible) 'outline) - (setq beg (org-overlay-start o) - end (org-overlay-end o)) + (when (eq (overlay-get o 'invisible) 'outline) + (setq beg (overlay-start o) + end (overlay-end o)) (and beg end (> end beg) (if use-markers (cons (move-marker (make-marker) beg) (move-marker (make-marker) end)) (cons beg end))))) - (org-overlays-in (point-min) (point-max)))))))) + (overlays-in (point-min) (point-max)))))))) (defun org-set-outline-overlay-data (data) "Create visibility overlays for all positions in DATA. @@ -5822,8 +6223,8 @@ DATA should have been made by `org-outline-overlay-data'." (widen) (show-all) (mapc (lambda (c) - (setq o (org-make-overlay (car c) (cdr c))) - (org-overlay-put o 'invisible 'outline)) + (setq o (make-overlay (car c) (cdr c))) + (overlay-put o 'invisible 'outline)) data))))) (defmacro org-save-outline-visibility (use-markers &rest body) @@ -5833,6 +6234,7 @@ This means that the buffer may change while running BODY, but it also means that the buffer should stay alive during the operation, because otherwise all these markers will point nowhere." + (declare (indent 1)) `(let ((data (org-outline-overlay-data ,use-markers))) (unwind-protect (progn @@ -5857,9 +6259,8 @@ point nowhere." (make-variable-buffer-local 'org-hide-block-overlays) (defun org-block-map (function &optional start end) - "Call func at the head of all source blocks in the current -buffer. Optional arguments START and END can be used to limit -the range." + "Call FUNCTION at the head of all source blocks in the current buffer. +Optional arguments START and END can be used to limit the range." (let ((start (or start (point-min))) (end (or end (point-max)))) (save-excursion @@ -5882,7 +6283,8 @@ the range." (defun org-show-block-all () "Unfold all blocks in the current buffer." - (mapc 'org-delete-overlay org-hide-block-overlays) + (interactive) + (mapc 'delete-overlay org-hide-block-overlays) (setq org-hide-block-overlays nil)) (defun org-hide-block-toggle-maybe () @@ -5906,30 +6308,30 @@ the range." (end (match-end 0)) ;; end of entire body ov) (if (memq t (mapcar (lambda (overlay) - (eq (org-overlay-get overlay 'invisible) + (eq (overlay-get overlay 'invisible) 'org-hide-block)) - (org-overlays-at start))) + (overlays-at start))) (if (or (not force) (eq force 'off)) (mapc (lambda (ov) (when (member ov org-hide-block-overlays) (setq org-hide-block-overlays (delq ov org-hide-block-overlays))) - (when (eq (org-overlay-get ov 'invisible) + (when (eq (overlay-get ov 'invisible) 'org-hide-block) - (org-delete-overlay ov))) - (org-overlays-at start))) - (setq ov (org-make-overlay start end)) - (org-overlay-put ov 'invisible 'org-hide-block) + (delete-overlay ov))) + (overlays-at start))) + (setq ov (make-overlay start end)) + (overlay-put ov 'invisible 'org-hide-block) ;; make the block accessible to isearch - (org-overlay-put + (overlay-put ov 'isearch-open-invisible (lambda (ov) (when (member ov org-hide-block-overlays) (setq org-hide-block-overlays (delq ov org-hide-block-overlays))) - (when (eq (org-overlay-get ov 'invisible) + (when (eq (overlay-get ov 'invisible) 'org-hide-block) - (org-delete-overlay ov)))) + (delete-overlay ov)))) (push ov org-hide-block-overlays))) (error "Not looking at a source block")))) @@ -6146,10 +6548,12 @@ With numerical prefix ARG, go up to this level and then take that tree. If ARG is negative, go up that many levels. If `org-indirect-buffer-display' is not `new-frame', the command removes the indirect buffer previously made with this command, to avoid proliferation of -indirect buffers. However, when you call the command with a `C-u' prefix, or +indirect buffers. However, when you call the command with a \ +\\[universal-argument] prefix, or when `org-indirect-buffer-display' is `new-frame', the last buffer is kept so that you can work with several indirect buffers at the same time. -If `org-indirect-buffer-display' is `dedicated-frame', the C-u prefix also +If `org-indirect-buffer-display' is `dedicated-frame', the \ +\\[universal-argument] prefix also requests that a new frame be made for the new buffer, so that the dedicated frame is not changed." (interactive "P") @@ -6634,7 +7038,7 @@ After top level, it switches back to sibling level." (funcall fun))))) (defun org-fixup-indentation (diff) - "Change the indentation in the current entry by DIFF + "Change the indentation in the current entry by DIFF. However, if any line in the current entry has no indentation, or if it would end up with no indentation after the change, nothing at all is done." (save-excursion @@ -6672,10 +7076,11 @@ level 5 etc." (end-of-line 1)))))) (defun org-convert-to-oddeven-levels () - "Convert an org-mode file with only odd levels to one with odd and even levels. -This promotes level 3 to level 2, level 5 to level 3 etc. If the file contains a -section with an even level, conversion would destroy the structure of the file. An error -is signaled in this case." + "Convert an org-mode file with only odd levels to one with odd/even levels. +This promotes level 3 to level 2, level 5 to level 3 etc. If the +file contains a section with an even level, conversion would +destroy the structure of the file. An error is signaled in this +case." (interactive) (goto-char (point-min)) ;; First check if there are no even levels @@ -7014,18 +7419,22 @@ If yes, remember the marker and the distance to BEG." (if (org-on-heading-p) (backward-char 1)) (point)))))) +(eval-when-compile + (defvar org-property-drawer-re)) + (defun org-clone-subtree-with-time-shift (n &optional shift) "Clone the task (subtree) at point N times. The clones will be inserted as siblings. -In interactive use, the user will be prompted for the number of clones -to be produced, and for a time SHIFT, which may be a repeater as used -in time stamps, for example `+3d'. +In interactive use, the user will be prompted for the number of +clones to be produced, and for a time SHIFT, which may be a +repeater as used in time stamps, for example `+3d'. -When a valid repeater is given and the entry contains any time stamps, -the clones will become a sequence in time, with time stamps in the -subtree shifted for each clone produced. If SHIFT is nil or the -empty string, time stamps will be left alone. +When a valid repeater is given and the entry contains any time +stamps, the clones will become a sequence in time, with time +stamps in the subtree shifted for each clone produced. If SHIFT +is nil or the empty string, time stamps will be left alone. The +ID property of the original subtree is removed. If the original subtree did contain time stamps with a repeater, the following will happen: @@ -7039,7 +7448,7 @@ the following will happen: I this way you can spell out a number of instances of a repeating task, and still retain the repeater to cover future instances of the task." (interactive "nNumber of clones to produce: \nsDate shift per clone (e.g. +1w, empty to copy unchanged): ") - (let (beg end template task + (let (beg end template task idprop shift-n shift-what doshift nmin nmax (n-no-remove -1)) (if (not (and (integerp n) (> n 0))) (error "Invalid number of replications %s" n)) @@ -7056,6 +7465,7 @@ and still retain the repeater to cover future instances of the task." (setq nmin 1 nmax n) (org-back-to-heading t) (setq beg (point)) + (setq idprop (org-entry-get nil "ID")) (org-end-of-subtree t t) (or (bolp) (insert "\n")) (setq end (point)) @@ -7067,12 +7477,18 @@ and still retain the repeater to cover future instances of the task." (setq nmin 0 nmax (1+ nmax) n-no-remove nmax)) (goto-char end) (loop for n from nmin to nmax do - (if (not doshift) - (setq task template) - (with-temp-buffer - (insert template) - (org-mode) - (goto-char (point-min)) + ;; prepare clone + (with-temp-buffer + (insert template) + (org-mode) + (goto-char (point-min)) + (and idprop (if org-clone-delete-id + (org-entry-delete nil "ID") + (org-id-get-create t))) + (while (re-search-forward org-property-drawer-re nil t) + (org-remove-empty-drawer-at "PROPERTIES" (point))) + (goto-char (point-min)) + (when doshift (while (re-search-forward org-ts-regexp-both nil t) (org-timestamp-change (* n shift-n) shift-what)) (unless (= n n-no-remove) @@ -7081,8 +7497,8 @@ and still retain the repeater to cover future instances of the task." (save-excursion (goto-char (match-beginning 0)) (if (looking-at "<[^<>\n]+\\( +\\+[0-9]+[dwmy]\\)") - (delete-region (match-beginning 1) (match-end 1)))))) - (setq task (buffer-string)))) + (delete-region (match-beginning 1) (match-end 1))))))) + (setq task (buffer-string))) (insert task)) (goto-char beg))) @@ -7126,7 +7542,7 @@ Sorting can be alphabetically, numerically, by date/time as given by a time stamp, by a property or by priority. The command prompts for the sorting type unless it has been given to the -function through the SORTING-TYPE argument, which needs to a character, +function through the SORTING-TYPE argument, which needs to be a character, \(?n ?N ?a ?A ?t ?T ?s ?S ?d ?D ?p ?P ?r ?R ?f ?F). Here is the precise meaning of each character: @@ -7419,15 +7835,15 @@ If WITH-CASE is non-nil, the sorting will be case-sensitive." "Keymap for the minor `orgstruct-mode'.") (defvar org-local-vars nil - "List of local variables, for use by `orgstruct-mode'") + "List of local variables, for use by `orgstruct-mode'.") ;;;###autoload (define-minor-mode orgstruct-mode - "Toggle the minor more `orgstruct-mode'. -This mode is for using Org-mode structure commands in other modes. -The following key behave as if Org-mode was active, if the cursor -is on a headline, or on a plain list item (both in the definition -of Org-mode). + "Toggle the minor mode `orgstruct-mode'. +This mode is for using Org-mode structure commands in other +modes. The following keys behave as if Org-mode were active, if +the cursor is on a headline, or on a plain list item (both as +defined by Org-mode). M-up Move entry/item up M-down Move entry/item down @@ -7478,7 +7894,7 @@ major mode, for example with \\[normal-mode]." (org-set-local 'orgstruct-is-++ t)))) (defvar orgstruct-is-++ nil - "Is orgstruct-mode in ++ version in the current-buffer?") + "Is `orgstruct-mode' in ++ version in the current-buffer?") (make-variable-buffer-local 'orgstruct-is-++) ;;;###autoload @@ -7720,7 +8136,7 @@ If yes, it should return a non-nil value after a calling `org-store-link-props' with a list of properties and values. Special properties are: -:type The link prefix. like \"http\". This must be given. +:type The link prefix, like \"http\". This must be given. :link The link, like \"http://www.astro.uva.nl/~dominik\". This is obligatory as well. :description Optional default description for the second pair @@ -7806,7 +8222,9 @@ For file links, arg negates `org-context-in-file-links'." (get-text-property (point) 'org-marker)))) (when m (org-with-point-at m - (call-interactively 'org-store-link))))) + (if (interactive-p) + (call-interactively 'org-store-link) + (org-store-link nil)))))) ((eq major-mode 'calendar-mode) (let ((cd (calendar-cursor-to-date))) @@ -8117,6 +8535,12 @@ This is the list that is used before handing over to the browser.") (defun org-fixup-message-id-for-http (s) "Replace special characters in a message id, so it can be used in an http query." + (when (string-match "%" s) + (setq s (mapconcat (lambda (c) + (if (eq c ?%) + "%25" + (char-to-string c))) + s ""))) (while (string-match "<" s) (setq s (replace-match "%3C" t t s))) (while (string-match ">" s) @@ -8284,8 +8708,9 @@ Use TAB to complete link prefixes, then RET for type-specific completion support (t (save-match-data (if (string-match (concat "^" (regexp-quote - (file-name-as-directory - (expand-file-name ".")))) + (expand-file-name + (file-name-as-directory + default-directory)))) (expand-file-name path)) ;; We are linking a file with relative path name. (setq path (substring (expand-file-name path) @@ -8316,7 +8741,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support (setq file (read-file-name "File: ")) (let ((pwd (file-name-as-directory (expand-file-name "."))) (pwd1 (file-name-as-directory (abbreviate-file-name - default-directory)))) + (expand-file-name "."))))) (cond ((equal arg '(16)) (setq link (org-make-link @@ -8554,6 +8979,8 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file. With a double prefix argument, try to open outside of Emacs, in the application the system uses for this file type." (interactive "P") + ;; if in a code block, then open the block's results + (unless (call-interactively #'org-babel-open-src-block-result) (org-load-modules-maybe) (move-marker org-open-link-marker (point)) (setq org-window-config-before-follow-link (current-window-configuration)) @@ -8660,6 +9087,11 @@ application the system uses for this file type." (browse-url (concat type ":" (org-link-escape path org-link-escape-chars-browser)))) + ((string= type "doi") + (browse-url (concat "http://dx.doi.org/" + (org-link-escape + path org-link-escape-chars-browser)))) + ((member type '("message")) (browse-url (concat type ":" path))) @@ -8730,7 +9162,7 @@ application the system uses for this file type." (t (browse-url-at-point))))))) (move-marker org-open-link-marker nil) - (run-hook-with-args 'org-follow-link-hook)) + (run-hook-with-args 'org-follow-link-hook))) (defun org-offer-links-in-entry (&optional nth zero) "Offer links in the current entry and follow the selected link. @@ -8800,10 +9232,10 @@ there is one, offer it as link number zero." (org-add-link-type "file+sys" 'org-open-file-with-system) (org-add-link-type "file+emacs" 'org-open-file-with-emacs) (defun org-open-file-with-system (path) - "Open file at PATH using the system way of opeing it." + "Open file at PATH using the system way of opening it." (org-open-file path 'system)) (defun org-open-file-with-emacs (path) - "Open file at PATH in emacs." + "Open file at PATH in Emacs." (org-open-file path 'emacs)) (defun org-remove-file-link-modifiers () "Remove the file link modifiers in `file+sys:' and `file+emacs:' links." @@ -8829,8 +9261,8 @@ These functions are called in turn with point at the location to which the link should point. A function in the hook should first test if it would like to -handle this file type, for example by checking the major-mode or -the file extension. If it decides not to handle this file, it +handle this file type, for example by checking the `major-mode' +or the file extension. If it decides not to handle this file, it should just return nil to give other functions a chance. If it does handle the file, it must return the search string to be used when following the link. The search string will be part of the @@ -8851,8 +9283,8 @@ buffer with \\[org-insert-link].") Functions added to this hook must accept a single argument, the search string that was part of the file link, the part after the double colon. The function must first check if it would like to -handle this search, for example by checking the major-mode or the -file extension. If it decides not to handle this search, it +handle this search, for example by checking the `major-mode' or +the file extension. If it decides not to handle this search, it should just return nil to give other functions a chance. If it does handle the search, it must return a non-nil value to keep other functions from trying. @@ -9124,20 +9556,23 @@ entry for this file type, and if yes, the corresponding command is launched. If no application is found, Emacs simply visits the file. With optional prefix argument IN-EMACS, Emacs will visit the file. -With a double C-c C-u prefix arg, Org tries to avoid opening in Emacs +With a double \\[universal-argument] \\[universal-argument] \ +prefix arg, Org tries to avoid opening in Emacs and to use an external application to visit the file. -Optional LINE specifies a line to go to, optional SEARCH a string to -search for. If LINE or SEARCH is given, but IN-EMACS is nil, it will -be assumed that org-open-file was called to open a file: link, and the -original link to match against org-file-apps will be reconstructed -from PATH and whichever of LINE or SEARCH is given. - +Optional LINE specifies a line to go to, optional SEARCH a string +to search for. If LINE or SEARCH is given, the file will be +opened in Emacs, unless an entry from org-file-apps that makes +use of groups in a regexp matches. If the file does not exist, an error is thrown." (let* ((file (if (equal path "") buffer-file-name (substitute-in-file-name (expand-file-name path)))) - (apps (append org-file-apps (org-default-apps))) + (file-apps (append org-file-apps (org-default-apps))) + (apps (org-remove-if + 'org-file-apps-entry-match-against-dlink-p file-apps)) + (apps-dlink (org-remove-if-not + 'org-file-apps-entry-match-against-dlink-p file-apps)) (remp (and (assq 'remote apps) (org-file-remote-p file))) (dirp (if remp nil (file-directory-p file))) (file (if (and dirp org-open-directory-means-index-dot-org) @@ -9169,21 +9604,19 @@ If the file does not exist, an error is thrown." (t (setq cmd (or (and remp (cdr (assoc 'remote apps))) (and dirp (cdr (assoc 'directory apps))) - ;; if we find a match in org-file-apps, store the match - ;; data for later - (let* ((re-list1 (org-apps-regexp-alist apps nil)) - (re-list2 - (if a-m-a-p - (org-apps-regexp-alist apps a-m-a-p) - re-list1)) - (private-match - (assoc-default dlink re-list1 'string-match)) - (general-match - (assoc-default dfile re-list2 'string-match))) - (if private-match + ; first, try matching against apps-dlink + ; if we get a match here, store the match data for later + (let ((match (assoc-default dlink apps-dlink + 'string-match))) + (if match (progn (setq link-match-data (match-data)) - private-match) - general-match)) + match) + (progn (setq in-emacs (or in-emacs line search)) + nil))) ; if we have no match in apps-dlink, + ; always open the file in emacs if line or search + ; is given (for backwards compatibility) + (assoc-default dfile (org-apps-regexp-alist apps a-m-a-p) + 'string-match) (cdr (assoc ext apps)) (cdr (assoc t apps)))))) (when (eq cmd 'system) @@ -9213,6 +9646,7 @@ If the file does not exist, an error is thrown." (shell-quote-argument (convert-standard-filename file))) t t cmd))) + ;; Replace "%1", "%2" etc. in command with group matches from regex (save-match-data (let ((match-index 1) @@ -9246,6 +9680,25 @@ If the file does not exist, an error is thrown." (not (equal old-pos (point)))) (org-mark-ring-push old-pos old-buffer)))) +(defun org-file-apps-entry-match-against-dlink-p (entry) + "This function returns non-nil if `entry' uses a regular +expression which should be matched against the whole link by +org-open-file. + +It assumes that is the case when the entry uses a regular +expression which has at least one grouping construct and the +action is either a lisp form or a command string containing +'%1', i.e. using at least one subexpression match as a +parameter." + (let ((selector (car entry)) + (action (cdr entry))) + (if (stringp selector) + (and (> (regexp-opt-depth selector) 0) + (or (and (stringp action) + (string-match "%[0-9]" action)) + (consp action))) + nil))) + (defun org-default-apps () "Return the default applications for this operating system." (cond @@ -9269,8 +9722,7 @@ be opened in Emacs." nil (if (string-match "\\W" (car x)) x - (cons (concat "\\." (car x) "\\(::.*\\)?\\'") - (cdr x))))) + (cons (concat "\\." (car x) "\\'") (cdr x))))) list)) (if add-auto-mode (mapcar (lambda (x) (cons (car x) 'emacs)) auto-mode-alist)))) @@ -9321,12 +9773,64 @@ on the system \"/user@host:\"." (defvar org-agenda-new-buffers nil "Buffers created to visit agenda files.") +(defvar org-refile-cache nil + "Cache for refile targets.") + + +(defvar org-refile-markers nil + "All the markers used for caching refile locations.") + +(defun org-refile-marker (pos) + "Get a new refile marker, but only if caching is in use." + (if (not org-refile-use-cache) + pos + (let ((m (make-marker))) + (move-marker m pos) + (push m org-refile-markers) + m))) + +(defun org-refile-cache-clear () + "Clear the refile cache and disable all the markers." + (mapc (lambda (m) (move-marker m nil)) org-refile-markers) + (setq org-refile-markers nil) + (setq org-refile-cache nil) + (message "Refile cache has been cleared")) + +(defun org-refile-cache-check-set (set) + "Check if all the markers in the cache still have live buffers." + (let (marker) + (catch 'exit + (while (and set (setq marker (nth 3 (pop set)))) + ;; if org-refile-use-outline-path is 'file, marker may be nil + (when (and marker (null (marker-buffer marker))) + (message "not found") (sit-for 3) + (throw 'exit nil))) + t))) + +(defun org-refile-cache-put (set &rest identifiers) + "Push the refile targets SET into the cache, under IDENTIFIERS." + (let* ((key (sha1 (prin1-to-string identifiers))) + (entry (assoc key org-refile-cache))) + (if entry + (setcdr entry set) + (push (cons key set) org-refile-cache)))) + +(defun org-refile-cache-get (&rest identifiers) + "Retrieve the cached value for refile targets given by IDENTIFIERS." + (cond + ((not org-refile-cache) nil) + ((not org-refile-use-cache) (org-refile-cache-clear) nil) + (t + (let ((set (cdr (assoc (sha1 (prin1-to-string identifiers)) + org-refile-cache)))) + (and set (org-refile-cache-check-set set) set))))) + (defun org-get-refile-targets (&optional default-buffer) "Produce a table with refile targets." (let ((case-fold-search nil) ;; otherwise org confuses "TODO" as a kw and "Todo" as a word (entries (or org-refile-targets '((nil . (:level . 1))))) - targets txt re files f desc descre fast-path-p level pos0) + targets tgs txt re files f desc descre fast-path-p level pos0) (message "Getting targets...") (with-current-buffer (or default-buffer (current-buffer)) (while (setq entry (pop entries)) @@ -9365,46 +9869,64 @@ on the system \"/user@host:\"." (while (setq f (pop files)) (with-current-buffer (if (bufferp f) f (org-get-agenda-file-buffer f)) - (if (bufferp f) (setq f (buffer-file-name (buffer-base-buffer f)))) - (setq f (and f (expand-file-name f))) - (if (eq org-refile-use-outline-path 'file) - (push (list (file-name-nondirectory f) f nil nil) targets)) - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - (while (re-search-forward descre nil t) - (goto-char (setq pos0 (point-at-bol))) - (catch 'next - (when org-refile-target-verify-function - (save-match-data - (or (funcall org-refile-target-verify-function) - (throw 'next t)))) - (when (looking-at org-complex-heading-regexp) - (setq level (org-reduced-level (- (match-end 1) (match-beginning 1))) - txt (org-link-display-format (match-string 4)) - re (concat "^" (regexp-quote - (buffer-substring (match-beginning 1) - (match-end 4))))) - (if (match-end 5) (setq re (concat re "[ \t]+" - (regexp-quote - (match-string 5))))) - (setq re (concat re "[ \t]*$")) - (when org-refile-use-outline-path - (setq txt (mapconcat 'org-protect-slash - (append - (if (eq org-refile-use-outline-path 'file) - (list (file-name-nondirectory - (buffer-file-name (buffer-base-buffer)))) - (if (eq org-refile-use-outline-path 'full-file-path) - (list (buffer-file-name (buffer-base-buffer))))) - (org-get-outline-path fast-path-p level txt) - (list txt)) - "/"))) - (push (list txt f re (point)) targets))) - (when (= (point) pos0) - ;; verification function has not moved point - (goto-char (point-at-eol)))))))))) + (or + (setq tgs (org-refile-cache-get (buffer-file-name) descre)) + (progn + (if (bufferp f) (setq f (buffer-file-name + (buffer-base-buffer f)))) + (setq f (and f (expand-file-name f))) + (if (eq org-refile-use-outline-path 'file) + (push (list (file-name-nondirectory f) f nil nil) tgs)) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (while (re-search-forward descre nil t) + (goto-char (setq pos0 (point-at-bol))) + (catch 'next + (when org-refile-target-verify-function + (save-match-data + (or (funcall org-refile-target-verify-function) + (throw 'next t)))) + (when (looking-at org-complex-heading-regexp) + (setq level (org-reduced-level + (- (match-end 1) (match-beginning 1))) + txt (org-link-display-format (match-string 4)) + re (concat "^" (regexp-quote + (buffer-substring + (match-beginning 1) + (match-end 4))))) + (if (match-end 5) (setq re (concat + re "[ \t]+" + (regexp-quote + (match-string 5))))) + (setq re (concat re "[ \t]*$")) + (when org-refile-use-outline-path + (setq txt (mapconcat + 'org-protect-slash + (append + (if (eq org-refile-use-outline-path + 'file) + (list (file-name-nondirectory + (buffer-file-name + (buffer-base-buffer)))) + (if (eq org-refile-use-outline-path + 'full-file-path) + (list (buffer-file-name + (buffer-base-buffer))))) + (org-get-outline-path fast-path-p + level txt) + (list txt)) + "/"))) + (push (list txt f re (org-refile-marker (point))) + tgs))) + (when (= (point) pos0) + ;; verification function has not moved point + (goto-char (point-at-eol)))))))) + (when org-refile-use-cache + (org-refile-cache-put tgs (buffer-file-name) descre)) + (setq targets (append tgs targets)) + )))) (message "Getting targets...done") (nreverse targets))) @@ -9417,13 +9939,14 @@ on the system \"/user@host:\"." (defun org-get-outline-path (&optional fastp level heading) "Return the outline path to the current entry, as a list. -The parameters FASTP, LEVEL, and HEADING are for use be a scanner + +The parameters FASTP, LEVEL, and HEADING are for use by a scanner routine which makes outline path derivations for an entire file, -avoiding backtracing." +avoiding backtracing. Refile target collection makes use of that." (if fastp (progn (if (> level 19) - (error "Outline path failure, more than 19 levels.")) + (error "Outline path failure, more than 19 levels")) (loop for i from level upto 19 do (aset org-olpa i nil)) (prog1 @@ -9439,7 +9962,7 @@ avoiding backtracing." rtn))))) (defun org-format-outline-path (path &optional width prefix) - "Format the outlie path PATH for display. + "Format the outline path PATH for display. Width is the maximum number of characters that is available. Prefix is a prefix to be included in the returned string, such as the file name." @@ -9501,6 +10024,7 @@ such as the file name." Note that this is still *before* the stuff will be removed from the *old* location.") +(defvar org-capture-last-stored-marker) (defun org-refile (&optional goto default-buffer rfloc) "Move the entry at point to another heading. The list of target headings is compiled using the information in @@ -9512,119 +10036,130 @@ Depending on `org-reverse-note-order', the new subitem will either be the first or the last subitem. If there is an active region, all entries in that region will be moved. -However, the region must fulfil the requirement that the first heading +However, the region must fulfill the requirement that the first heading is the first one sets the top-level of the moved text - at most siblings below it are allowed. With prefix arg GOTO, the command will only visit the target location, not actually move anything. -With a double prefix `C-u C-u', go to the location where the last refiling +With a double prefix arg \\[universal-argument] \\[universal-argument], \ +go to the location where the last refiling operation has put the subtree. With a prefix argument of `2', refile to the running clock. RFLOC can be a refile location obtained in a different way. -See also `org-refile-use-outline-path' and `org-completion-use-ido'" - (interactive "P") - (let* ((cbuf (current-buffer)) - (regionp (org-region-active-p)) - (region-start (and regionp (region-beginning))) - (region-end (and regionp (region-end))) - (region-length (and regionp (- region-end region-start))) - (filename (buffer-file-name (buffer-base-buffer cbuf))) - pos it nbuf file re level reversed) - (setq last-command nil) - (when regionp - (goto-char region-start) - (or (bolp) (goto-char (point-at-bol))) - (setq region-start (point)) - (unless (org-kill-is-subtree-p - (buffer-substring region-start region-end)) - (error "The region is not a (sequence of) subtree(s)"))) - (if (equal goto '(16)) - (org-refile-goto-last-stored) - (when (or - (and (equal goto 2) - org-clock-hd-marker (marker-buffer org-clock-hd-marker) - (prog1 - (setq it (list (or org-clock-heading "running clock") - (buffer-file-name - (marker-buffer org-clock-hd-marker)) - "" - (marker-position org-clock-hd-marker))) - (setq goto nil))) - (setq it (or rfloc - (save-excursion - (org-refile-get-location - (if goto "Goto: " "Refile to: ") default-buffer - org-refile-allow-creating-parent-nodes))))) - (setq file (nth 1 it) - re (nth 2 it) - pos (nth 3 it)) - (if (and (not goto) - pos - (equal (buffer-file-name) file) - (if regionp - (and (>= pos region-start) - (<= pos region-end)) - (and (>= pos (point)) - (< pos (save-excursion - (org-end-of-subtree t t)))))) - (error "Cannot refile to position inside the tree or region")) +See also `org-refile-use-outline-path' and `org-completion-use-ido'. - (setq nbuf (or (find-buffer-visiting file) - (find-file-noselect file))) - (if goto - (progn - (switch-to-buffer nbuf) - (goto-char pos) - (org-show-context 'org-goto)) - (if regionp +If you are using target caching (see `org-refile-use-cache'), +You have to clear the target cache in order to find new targets. +This can be done with a 0 prefix: `C-0 C-c C-w'" + (interactive "P") + (if (member goto '(0 (64))) + (org-refile-cache-clear) + (let* ((cbuf (current-buffer)) + (regionp (org-region-active-p)) + (region-start (and regionp (region-beginning))) + (region-end (and regionp (region-end))) + (region-length (and regionp (- region-end region-start))) + (filename (buffer-file-name (buffer-base-buffer cbuf))) + pos it nbuf file re level reversed) + (setq last-command nil) + (when regionp + (goto-char region-start) + (or (bolp) (goto-char (point-at-bol))) + (setq region-start (point)) + (unless (org-kill-is-subtree-p + (buffer-substring region-start region-end)) + (error "The region is not a (sequence of) subtree(s)"))) + (if (equal goto '(16)) + (org-refile-goto-last-stored) + (when (or + (and (equal goto 2) + org-clock-hd-marker (marker-buffer org-clock-hd-marker) + (prog1 + (setq it (list (or org-clock-heading "running clock") + (buffer-file-name + (marker-buffer org-clock-hd-marker)) + "" + (marker-position org-clock-hd-marker))) + (setq goto nil))) + (setq it (or rfloc + (save-excursion + (org-refile-get-location + (if goto "Goto: " "Refile to: ") default-buffer + org-refile-allow-creating-parent-nodes))))) + (setq file (nth 1 it) + re (nth 2 it) + pos (nth 3 it)) + (if (and (not goto) + pos + (equal (buffer-file-name) file) + (if regionp + (and (>= pos region-start) + (<= pos region-end)) + (and (>= pos (point)) + (< pos (save-excursion + (org-end-of-subtree t t)))))) + (error "Cannot refile to position inside the tree or region")) + + (setq nbuf (or (find-buffer-visiting file) + (find-file-noselect file))) + (if goto (progn - (org-kill-new (buffer-substring region-start region-end)) - (org-save-markers-in-region region-start region-end)) - (org-copy-subtree 1 nil t)) - (with-current-buffer (setq nbuf (or (find-buffer-visiting file) - (find-file-noselect file))) - (setq reversed (org-notes-order-reversed-p)) - (save-excursion - (save-restriction - (widen) - (if pos - (progn - (goto-char pos) - (looking-at outline-regexp) - (setq level (org-get-valid-level (funcall outline-level) 1)) - (goto-char - (if reversed - (or (outline-next-heading) (point-max)) - (or (save-excursion (org-get-next-sibling)) - (org-end-of-subtree t t) - (point-max))))) - (setq level 1) - (if (not reversed) - (goto-char (point-max)) - (goto-char (point-min)) - (or (outline-next-heading) (goto-char (point-max))))) - (if (not (bolp)) (newline)) - (org-paste-subtree level) - (when org-log-refile - (org-add-log-setup 'refile nil nil 'findpos - org-log-refile) - (unless (eq org-log-refile 'note) - (save-excursion (org-add-log-note)))) - (and org-auto-align-tags (org-set-tags nil t)) - (bookmark-set "org-refile-last-stored") - (if (fboundp 'deactivate-mark) (deactivate-mark)) - (run-hooks 'org-after-refile-insert-hook)))) - (if regionp - (delete-region (point) (+ (point) region-length)) - (org-cut-subtree)) - (when (featurep 'org-inlinetask) - (org-inlinetask-remove-END-maybe)) - (setq org-markers-to-move nil) - (message "Refiled to \"%s\"" (car it)))))) - (org-reveal)) + (switch-to-buffer nbuf) + (goto-char pos) + (org-show-context 'org-goto)) + (if regionp + (progn + (org-kill-new (buffer-substring region-start region-end)) + (org-save-markers-in-region region-start region-end)) + (org-copy-subtree 1 nil t)) + (with-current-buffer (setq nbuf (or (find-buffer-visiting file) + (find-file-noselect file))) + (setq reversed (org-notes-order-reversed-p)) + (save-excursion + (save-restriction + (widen) + (if pos + (progn + (goto-char pos) + (looking-at outline-regexp) + (setq level (org-get-valid-level (funcall outline-level) 1)) + (goto-char + (if reversed + (or (outline-next-heading) (point-max)) + (or (save-excursion (org-get-next-sibling)) + (org-end-of-subtree t t) + (point-max))))) + (setq level 1) + (if (not reversed) + (goto-char (point-max)) + (goto-char (point-min)) + (or (outline-next-heading) (goto-char (point-max))))) + (if (not (bolp)) (newline)) + (org-paste-subtree level) + (when org-log-refile + (org-add-log-setup 'refile nil nil 'findpos + org-log-refile) + (unless (eq org-log-refile 'note) + (save-excursion (org-add-log-note)))) + (and org-auto-align-tags (org-set-tags nil t)) + (bookmark-set "org-refile-last-stored") + ;; If we are refiling for capture, make sure that the + ;; last-capture pointers point here + (when (org-bound-and-true-p org-refile-for-capture) + (bookmark-set "org-capture-last-stored-marker") + (move-marker org-capture-last-stored-marker (point))) + (if (fboundp 'deactivate-mark) (deactivate-mark)) + (run-hooks 'org-after-refile-insert-hook)))) + (if regionp + (delete-region (point) (+ (point) region-length)) + (org-cut-subtree)) + (when (featurep 'org-inlinetask) + (org-inlinetask-remove-END-maybe)) + (setq org-markers-to-move nil) + (message "Refiled to \"%s\" in file %s" (car it) file))))))) (defun org-refile-goto-last-stored () "Go to the location where the last refile was stored." @@ -9837,7 +10372,7 @@ blocks in the buffer." (org-update-dblock))) (defun org-update-dblock () - "Update the dynamic block at point + "Update the dynamic block at point. This means to empty the block, parse for parameters and then call the correct writing function." (save-window-excursion @@ -9932,12 +10467,12 @@ This function can be used in a hook." ) "Structure completion elements. This is a list of abbreviation keys and values. The value gets inserted -it you type @samp{.} followed by the key and then the completion key, +if you type `<' followed by the key and then press the completion key, usually `M-TAB'. %file will be replaced by a file name after prompting for the file using completion. There are two templates for each key, the first uses the original Org syntax, the second uses Emacs Muse-like syntax tags. These Muse-like tags become -the default when the /org-mtags.el/ module has been loaded. See also the +the default when the /org-mtags.el/ module has been loaded. See also the variable `org-mtags-prefer-muse-templates'. This is an experimental feature, it is undecided if it is going to stay in." :group 'org-completion @@ -10157,15 +10692,13 @@ this is nil.") (defvar org-todo-setup-filter-hook nil "Hook for functions that pre-filter todo specs. - -Each function takes a todo spec and returns either `nil' or the spec +Each function takes a todo spec and returns either nil or the spec transformed into canonical form." ) (defvar org-todo-get-default-hook nil "Hook for functions that get a default item for todo. - Each function takes arguments (NEW-MARK OLD-MARK) and returns either -`nil' or a string to be used for the todo mark." ) +nil or a string to be used for the todo mark." ) (defvar org-agenda-headline-snapshot-before-repeat) @@ -10182,10 +10715,12 @@ So for this example: when the item starts with TODO, it is changed to DONE. When it starts with DONE, the DONE is removed. And when neither TODO nor DONE are present, add TODO at the beginning of the heading. -With C-u prefix arg, use completion to determine the new state. +With \\[universal-argument] prefix arg, use completion to determine the new \ +state. With numeric prefix arg, switch to that state. -With a double C-u prefix, switch to the next set of TODO keywords (nextset). -With a triple C-u prefix, circumvent any state blocking. +With a double \\[universal-argument] prefix, switch to the next set of TODO \ +keywords (nextset). +With a triple \\[universal-argument] prefix, circumvent any state blocking. For calling through lisp, arg is also interpreted in the following way: 'none -> empty state @@ -10213,7 +10748,7 @@ For calling through lisp, arg is also interpreted in the following way: (looking-at " *")) (let* ((match-data (match-data)) (startpos (point-at-bol)) - (logging (save-match-data (org-entry-get nil "LOGGING" t))) + (logging (save-match-data (org-entry-get nil "LOGGING" t t))) (org-log-done org-log-done) (org-log-repeat org-log-repeat) (org-todo-log-states org-todo-log-states) @@ -10429,7 +10964,7 @@ changes. Such blocking occurs when: (let* ((pos (point)) (parent-pos (and (org-up-heading-safe) (point)))) (if (not parent-pos) (throw 'dont-block t)) ; no parent - (when (and (org-entry-get (point) "ORDERED") + (when (and (org-not-nil (org-entry-get (point) "ORDERED")) (forward-line 1) (re-search-forward org-not-done-heading-regexp pos t)) (throw 'dont-block nil)) ; block, there is an older sibling not done. @@ -10441,7 +10976,7 @@ changes. Such blocking occurs when: (setq pos (point)) (setq parent-pos (and (org-up-heading-safe) (point))) (if (not parent-pos) (throw 'dont-block t)) ; no parent - (when (and (org-entry-get (point) "ORDERED") + (when (and (org-not-nil (org-entry-get (point) "ORDERED")) (forward-line 1) (re-search-forward org-not-done-heading-regexp pos t)) (throw 'dont-block nil)))))))) ; block, older sibling not done. @@ -10835,12 +11370,17 @@ This function is run automatically after each state change to a DONE state." (org-log-done nil) (org-todo-log-states nil) (nshiftmax 10) (nshift 0) - re type n what ts time) + re type n what ts time to-state) (when repeat (if (eq org-log-repeat t) (setq org-log-repeat 'state)) - (org-todo (if (eq interpret 'type) last-state head)) - (org-entry-put nil "LAST_REPEAT" (format-time-string - (org-time-stamp-format t t))) + (setq to-state (or (org-entry-get nil "REPEAT_TO_STATE") + org-todo-repeat-to-state)) + (unless (and to-state (member to-state org-todo-keywords-1)) + (setq to-state (if (eq interpret 'type) last-state head))) + (org-todo to-state) + (when (or org-log-repeat (org-entry-get nil "CLOCK")) + (org-entry-put nil "LAST_REPEAT" (format-time-string + (org-time-stamp-format t t)))) (when org-log-repeat (if (or (memq 'org-add-log-note (default-value 'post-command-hook)) (memq 'org-add-log-note post-command-hook)) @@ -11004,7 +11544,7 @@ returns nil." (apply 'encode-time (org-parse-time-string time))))) (defun org-get-deadline-time (pom &optional inherit) - "Get the deadine as a time tuple, of a format suitable for + "Get the deadline as a time tuple, of a format suitable for calling org-deadline with, or if there is no scheduling, returns nil." (let ((time (org-entry-get pom "DEADLINE" inherit))) @@ -11122,7 +11662,7 @@ be removed." (end-of-line 1)) (goto-char (point-min)) (widen) - (if (and (looking-at "[ \t]+\n") + (if (and (looking-at "[ \t]*\n") (equal (char-before) ?\n)) (delete-region (1- (point)) (point-at-eol))) ts)))))) @@ -11272,6 +11812,9 @@ EXTRA is additional text that will be inserted into the notes buffer." (cons "%t" (format-time-string (org-time-stamp-format 'long 'inactive) (current-time))) + (cons "%T" (format-time-string + (org-time-stamp-format 'long nil) + (current-time))) (cons "%s" (if org-log-note-state (concat "\"" org-log-note-state "\"") "")) @@ -11326,7 +11869,8 @@ POS may also be a marker." This command can create sparse trees. You first need to select the type of match used to create the tree: -t Show entries with a specific TODO keyword. +t Show all TODO entries. +T Show entries with a specific TODO keyword. m Show entries selected by a tags/property match. p Enter a property name and its value (both with completion on existing names/values) and show entries with that property. @@ -11336,7 +11880,7 @@ b Show deadlines and scheduled items before a date. a Show deadlines and scheduled items after a date." (interactive "P") (let (ans kwd value) - (message "Sparse tree: [/]regexp [t]odo-kwd [m]atch [p]roperty [d]eadlines [b]efore-date [a]fter-date") + (message "Sparse tree: [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty [d]eadlines\n [b]efore-date [a]fter-date") (setq ans (read-char-exclusive)) (cond ((equal ans ?d) @@ -11346,6 +11890,8 @@ a Show deadlines and scheduled items after a date." ((equal ans ?a) (call-interactively 'org-check-after-date)) ((equal ans ?t) + (org-show-todo-tree nil)) + ((equal ans ?T) (org-show-todo-tree '(4))) ((member ans '(?T ?m)) (call-interactively 'org-match-sparse-tree)) @@ -11417,7 +11963,7 @@ that the match should indeed be shown." cnt)) (defun org-show-context (&optional key) - "Make sure point and context and visible. + "Make sure point and context are visible. How much context is shown depends upon the variables `org-show-hierarchy-above', `org-show-following-heading'. and `org-show-siblings'." @@ -11460,7 +12006,8 @@ not t for the search context. With optional argument SIBLINGS, on each level of the hierarchy all siblings are shown. This repairs the tree structure to what it would look like when opened with hierarchical calls to `org-cycle'. -With double optional argument `C-u C-u', go to the parent and show the +With double optional argument \\[universal-argument] \\[universal-argument], \ +go to the parent and show the entire tree." (interactive "P") (run-hooks 'org-reveal-start-hook) @@ -11476,8 +12023,8 @@ entire tree." (defun org-highlight-new-match (beg end) "Highlight from BEG to END and mark the highlight is an occur headline." - (let ((ov (org-make-overlay beg end))) - (org-overlay-put ov 'face 'secondary-selection) + (let ((ov (make-overlay beg end))) + (overlay-put ov 'face 'secondary-selection) (push ov org-occur-highlights))) (defun org-remove-occur-highlights (&optional beg end noremove) @@ -11486,7 +12033,7 @@ BEG and END are ignored. If NOREMOVE is nil, remove this function from the `before-change-functions' in the current buffer." (interactive) (unless org-inhibit-highlight-removal - (mapc 'org-delete-overlay org-occur-highlights) + (mapc 'delete-overlay org-occur-highlights) (setq org-occur-highlights nil) (setq org-occur-parameters nil) (unless noremove @@ -11989,7 +12536,7 @@ epoch to the beginning of today (00:00)." (delq nil list)) (defvar org-add-colon-after-tag-completion nil) ;; dynamically scoped param -(defvar org-tags-overlay (org-make-overlay 1 1)) +(defvar org-tags-overlay (make-overlay 1 1)) (org-detach-overlay org-tags-overlay) (defun org-get-local-tags-at (&optional pos) @@ -12142,6 +12689,16 @@ If DATA is nil or the empty string, any tags will be removed." (if (looking-at ".*?\\([ \t]+\\)$") (delete-region (match-beginning 1) (match-end 1)))))) +(defun org-align-all-tags () + "Align the tags i all headings." + (interactive) + (save-excursion + (or (ignore-errors (org-back-to-heading t)) + (outline-next-heading)) + (if (org-on-heading-p) + (org-set-tags t) + (message "No headings")))) + (defun org-set-tags (&optional arg just-align) "Set the tags for the current headline. With prefix ARG, realign all tags in headings in the current buffer." @@ -12355,7 +12912,7 @@ Returns the new tags string, or nil to not change the current settings." (if (> (current-column) org-tags-column) " " (make-string (- org-tags-column (current-column)) ?\ )))))) - (org-move-overlay org-tags-overlay ov-start ov-end) + (move-overlay org-tags-overlay ov-start ov-end) (save-window-excursion (if expert (set-buffer (get-buffer-create " *Org tags*")) @@ -12663,7 +13220,7 @@ but in some other way.") "LOCATION" "LOGGING" "COLUMNS" "VISIBILITY" "TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE" "EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" - "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" + "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE" "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS") "Some properties that are used by Org-mode for various purposes. Being in this list makes sure that they are offered for completion.") @@ -12753,12 +13310,11 @@ allowed value." (save-excursion (beginning-of-line 1) (when (looking-at (org-re "^[ \t]*\\(:\\([[:alpha:]][[:alnum:]_-]*\\):\\)[ \t]*\\(.*\\)")) - (let ((match (match-data)) ;; Keep match-data for use by calling - (p (point)) ;; procedures. - (range (unless (org-before-first-heading-p) - (org-get-property-block)))) - (prog1 (and range (<= (car range) p) (< p (cdr range))) - (set-match-data match)))))) + (save-match-data ;; Used by calling procedures + (let ((p (point)) + (range (unless (org-before-first-heading-p) + (org-get-property-block)))) + (and range (<= (car range) p) (< p (cdr range)))))))) (defun org-get-property-block (&optional beg end force) "Return the (beg . end) range of the body of the property drawer. @@ -12806,7 +13362,7 @@ things up because then unnecessary parsing is avoided." (let ((clockstr (substring org-clock-string 0 -1)) (excluded '("TODO" "TAGS" "ALLTAGS" "PRIORITY" "BLOCKED")) (case-fold-search nil) - beg end range props sum-props key value string clocksum) + beg end range props sum-props key key1 value string clocksum) (save-excursion (when (condition-case nil (and (org-mode-p) (org-back-to-heading t)) @@ -12837,23 +13393,35 @@ things up because then unnecessary parsing is avoided." (when (or (not specific) (string= specific "BLOCKED")) (push (cons "BLOCKED" (if (org-entry-blocked-p) "t" "")) props)) (when (or (not specific) - (member specific org-all-time-keywords) - (member specific '("TIMESTAMP" "TIMESTAMP_IA"))) + (member specific + '("SCHEDULED" "DEADLINE" "CLOCK" "CLOSED" + "TIMESTAMP" "TIMESTAMP_IA"))) (while (re-search-forward org-maybe-keyword-time-regexp end t) - (setq key (if (match-end 1) (substring (org-match-string-no-properties 1) 0 -1)) + (setq key (if (match-end 1) + (substring (org-match-string-no-properties 1) + 0 -1)) string (if (equal key clockstr) (org-no-properties (org-trim - (buffer-substring - (match-beginning 3) (goto-char (point-at-eol))))) - (substring (org-match-string-no-properties 3) 1 -1))) - (unless key - (if (= (char-after (match-beginning 3)) ?\[) - (setq key "TIMESTAMP_IA") - (setq key "TIMESTAMP"))) - (when (or (equal key clockstr) (not (assoc key props))) + (buffer-substring + (match-beginning 3) (goto-char + (point-at-eol))))) + (substring (org-match-string-no-properties 3) + 1 -1))) + ;; Get the correct property name from the key. This is + ;; necessary if the user has configured time keywords. + (setq key1 (concat key ":")) + (cond + ((not key) + (setq key + (if (= (char-after (match-beginning 3)) ?\[) + "TIMESTAMP_IA" "TIMESTAMP"))) + ((equal key1 org-scheduled-string) (setq key "SCHEDULED")) + ((equal key1 org-deadline-string) (setq key "DEADLINE")) + ((equal key1 org-closed-string) (setq key "CLOSED")) + ((equal key1 org-clock-string) (setq key "CLOCK"))) + (when (or (equal key "CLOCK") (not (assoc key props))) (push (cons key string) props)))) - ) (when (memq which '(all standard)) @@ -12880,19 +13448,23 @@ things up because then unnecessary parsing is avoided." (push (cons "CATEGORY" value) props)) (append sum-props (nreverse props))))))) -(defun org-entry-get (pom property &optional inherit) +(defun org-entry-get (pom property &optional inherit literal-nil) "Get value of PROPERTY for entry at point-or-marker POM. If INHERIT is non-nil and the entry does not have the property, then also check higher levels of the hierarchy. If INHERIT is the symbol `selective', use inheritance only if the setting in `org-use-property-inheritance' selects PROPERTY for inheritance. If the property is present but empty, the return value is the empty string. -If the property is not present at all, nil is returned." +If the property is not present at all, nil is returned. + +If LITERAL-NIL is set, return the string value \"nil\" as a string, +do not interpret it as the list atom nil. This is used for inheritance +when a \"nil\" value can supersede a non-nil value higher up the hierarchy." (org-with-point-at pom (if (and inherit (if (eq inherit 'selective) (org-property-inherit-p property) t)) - (org-entry-get-with-inheritance property) + (org-entry-get-with-inheritance property literal-nil) (if (member property org-special-properties) ;; We need a special property. Use `org-entry-properties' to ;; retrieve it, but specify the wanted property @@ -12905,7 +13477,9 @@ If the property is not present at all, nil is returned." (cdr range) t)) ;; Found the property, return it. (if (match-end 1) - (org-match-string-no-properties 1) + (if literal-nil + (org-match-string-no-properties 1) + (org-not-nil (org-match-string-no-properties 1))) ""))))))) (defun org-property-or-variable-value (var &optional inherit) @@ -13000,8 +13574,12 @@ no match, the marker will point nowhere. Note that also `org-entry-get' calls this function, if the INHERIT flag is set.") -(defun org-entry-get-with-inheritance (property) - "Get entry property, and search higher levels if not present." +(defun org-entry-get-with-inheritance (property &optional literal-nil) + "Get entry property, and search higher levels if not present. +The search will stop at the first ancestor which has the property defined. +If the value found is \"nil\", return nil to show that the property +should be considered as undefined (this is the meaning of nil here). +However, if LITERAL-NIL is set, return the string value \"nil\" instead." (move-marker org-entry-property-inherited-from nil) (let (tmp) (save-excursion @@ -13009,15 +13587,16 @@ is set.") (widen) (catch 'ex (while t - (when (setq tmp (org-entry-get nil property)) + (when (setq tmp (org-entry-get nil property nil 'literal-nil)) (org-back-to-heading t) (move-marker org-entry-property-inherited-from (point)) (throw 'ex tmp)) (or (org-up-heading-safe) (throw 'ex nil))))) - (or tmp - (cdr (assoc property org-file-properties)) - (cdr (assoc property org-global-properties)) - (cdr (assoc property org-global-properties-fixed)))))) + (setq tmp (or tmp + (cdr (assoc property org-file-properties)) + (cdr (assoc property org-global-properties)) + (cdr (assoc property org-global-properties-fixed)))) + (if literal-nil tmp (org-not-nil tmp))))) (defvar org-property-changed-functions nil "Hook called when the value of a property has changed. @@ -13216,7 +13795,8 @@ in the current file." "In the current entry, delete PROPERTY." (interactive (let* ((completion-ignore-case t) - (prop (org-icompleting-read "Property: " (org-entry-properties nil 'standard)))) + (prop (org-icompleting-read "Property: " + (org-entry-properties nil 'standard)))) (list prop))) (message "Property %s %s" property (if (org-entry-delete nil property) @@ -13330,6 +13910,51 @@ completion." (skip-chars-forward " \t") (run-hook-with-args 'org-property-changed-functions key nval))) +(defun org-find-olp (path &optional this-buffer) + "Return a marker pointing to the entry at outline path OLP. +If anything goes wrong, throw an error. +You can wrap this call to catch the error like this: + + (condition-case msg + (org-mobile-locate-entry (match-string 4)) + (error (nth 1 msg))) + +The return value will then be either a string with the error message, +or a marker if everything is OK. + +If THIS-BUFFER is set, the outline path does not contain a file, +only headings." + (let* ((file (if this-buffer buffer-file-name (pop path))) + (buffer (if this-buffer (current-buffer) (find-file-noselect file))) + (level 1) + (lmin 1) + (lmax 1) + limit re end found pos heading cnt) + (unless buffer (error "File not found :%s" file)) + (with-current-buffer buffer + (save-excursion + (save-restriction + (widen) + (setq limit (point-max)) + (goto-char (point-min)) + (while (setq heading (pop path)) + (setq re (format org-complex-heading-regexp-format + (regexp-quote heading))) + (setq cnt 0 pos (point)) + (while (re-search-forward re end t) + (setq level (- (match-end 1) (match-beginning 1))) + (if (and (>= level lmin) (<= level lmax)) + (setq found (match-beginning 0) cnt (1+ cnt)))) + (when (= cnt 0) (error "Heading not found on level %d: %s" + lmax heading)) + (when (> cnt 1) (error "Heading not unique on level %d: %s" + lmax heading)) + (goto-char found) + (setq lmin (1+ level) lmax (+ lmin (if org-odd-levels-only 1 0))) + (setq end (save-excursion (org-end-of-subtree t t)))) + (when (org-on-heading-p) + (move-marker (make-marker) (point)))))))) + (defun org-find-entry-with-id (ident) "Locate the entry that contains the ID property with exact value IDENT. IDENT can be a string, a symbol or a number, this function will search for @@ -13436,8 +14061,8 @@ So these are more for recording a certain time/date." (interactive "P") (org-time-stamp arg 'inactive)) -(defvar org-date-ovl (org-make-overlay 1 1)) -(org-overlay-put org-date-ovl 'face 'org-warning) +(defvar org-date-ovl (make-overlay 1 1)) +(overlay-put org-date-ovl 'face 'org-warning) (org-detach-overlay org-date-ovl) (defvar org-ans1) ; dynamically scoped parameter @@ -13458,10 +14083,15 @@ The prompt will suggest to enter an ISO date, but you can also enter anything which will at least partially be understood by `parse-time-string'. Unrecognized parts of the date will default to the current day, month, year, hour and minute. If this command is called to replace a timestamp at point, -of to enter the second timestamp of a range, the default time is taken from the -existing stamp. For example, +of to enter the second timestamp of a range, the default time is taken +from the existing stamp. Furthermore, the command prefers the future, +so if you are giving a date where the year is not given, and the day-month +combination is already past in the current year, it will assume you +mean next year. For details, see the manual. A few examples: + 3-2-5 --> 2003-02-05 feb 15 --> currentyear-02-15 + 2/15 --> currentyear-02-15 sep 12 9 --> 2009-09-12 12:45 --> today 12:45 22 sept 0:34 --> currentyear-09-22 0:34 @@ -13514,11 +14144,10 @@ user." (setq def (apply 'encode-time defdecode) defdecode (decode-time def))))) (calendar-frame-setup nil) + (calendar-setup nil) (calendar-move-hook nil) (calendar-view-diary-initially-flag nil) - (view-diary-entries-initially nil) (calendar-view-holidays-initially-flag nil) - (view-calendar-holidays-initially nil) (timestr (format-time-string (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") def)) (prompt (concat (if prompt (concat prompt " ") "") @@ -13539,10 +14168,8 @@ user." (map (copy-keymap calendar-mode-map)) (minibuffer-local-map (copy-keymap minibuffer-local-map))) (org-defkey map (kbd "RET") 'org-calendar-select) - (org-defkey map (if (featurep 'xemacs) [button1] [mouse-1]) - 'org-calendar-select-mouse) - (org-defkey map (if (featurep 'xemacs) [button2] [mouse-2]) - 'org-calendar-select-mouse) + (org-defkey map [mouse-1] 'org-calendar-select-mouse) + (org-defkey map [mouse-2] 'org-calendar-select-mouse) (org-defkey minibuffer-local-map [(meta shift left)] (lambda () (interactive) (org-eval-in-calendar '(calendar-backward-month 1)))) @@ -13585,6 +14212,14 @@ user." (org-defkey minibuffer-local-map "<" (lambda () (interactive) (org-eval-in-calendar '(scroll-calendar-right 1)))) + (org-defkey minibuffer-local-map "\C-v" + (lambda () (interactive) + (org-eval-in-calendar + '(calendar-scroll-left-three-months 1)))) + (org-defkey minibuffer-local-map "\M-v" + (lambda () (interactive) + (org-eval-in-calendar + '(calendar-scroll-right-three-months 1)))) (run-hooks 'org-read-date-minibuffer-setup-hook) (unwind-protect (progn @@ -13599,7 +14234,7 @@ user." (remove-hook 'post-command-hook 'org-read-date-display) (use-local-map old-map) (when org-read-date-overlay - (org-delete-overlay org-read-date-overlay) + (delete-overlay org-read-date-overlay) (setq org-read-date-overlay nil))))))) (t ; Naked prompt only @@ -13607,7 +14242,7 @@ user." (setq ans (read-string prompt default-input 'org-read-date-history timestr)) (when org-read-date-overlay - (org-delete-overlay org-read-date-overlay) + (delete-overlay org-read-date-overlay) (setq org-read-date-overlay nil))))) (setq final (org-read-date-analyze ans def defdecode)) @@ -13629,7 +14264,7 @@ user." "Display the current date prompt interpretation in the minibuffer." (when org-read-date-display-live (when org-read-date-overlay - (org-delete-overlay org-read-date-overlay)) + (delete-overlay org-read-date-overlay)) (let ((p (point))) (end-of-line 1) (while (not (equal (buffer-substring @@ -13657,11 +14292,11 @@ user." (when org-read-date-analyze-futurep (setq txt (concat txt " (=>F)"))) (setq org-read-date-overlay - (org-make-overlay (1- (point-at-eol)) (point-at-eol))) + (make-overlay (1- (point-at-eol)) (point-at-eol))) (org-overlay-display org-read-date-overlay txt 'secondary-selection)))) (defun org-read-date-analyze (ans def defdecode) - "Analyse the combined answer of the date prompt." + "Analyze the combined answer of the date prompt." ;; FIXME: cleanup and comment (let ((nowdecode (decode-time (current-time))) delta deltan deltaw deltadef year month day @@ -13703,7 +14338,7 @@ user." t nil ans))) ;; Help matching american dates, like 5/30 or 5/30/7 (when (string-match - "^ *\\([0-3]?[0-9]\\)/\\([0-1]?[0-9]\\)\\(/\\([0-9]+\\)\\)?\\([^/0-9]\\|$\\)" ans) + "^ *\\(0?[1-9]\\|1[012]\\)/\\(0?[1-9]\\|[12][0-9]\\|3[01]\\)\\(/\\([0-9]+\\)\\)?\\([^/0-9]\\|$\\)" ans) (setq year (if (match-end 4) (string-to-number (match-string 4 ans)) (progn (setq kill-year t) @@ -13893,7 +14528,7 @@ Also, store the cursor date in variable org-ans2." (let* ((date (calendar-cursor-to-date)) (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date)))) (setq org-ans2 (format-time-string "%Y-%m-%d" time)))) - (org-move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer)) + (move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer)) (select-window sw) (org-select-frame-set-input-focus sf))) @@ -14187,7 +14822,7 @@ days in order to avoid rounding problems." (defun org-time-string-to-absolute (s &optional daynr prefer show-all) "Convert a time stamp to an absolute day number. -If there is a specifyer for a cyclic time stamp, get the closest date to +If there is a specifier for a cyclic time stamp, get the closest date to DAYNR. PREFER and SHOW-ALL are passed through to `org-closest-date'. the variable date is bound by the calendar when this is called." @@ -14300,7 +14935,7 @@ When SHOW-ALL is nil, only return the current occurrence of a time stamp." (if (string-match "\\(\\+[0-9]+\\)\\([dwmy]\\)" change) (setq dn (string-to-number (match-string 1 change)) dw (cdr (assoc (match-string 2 change) a1))) - (error "Invalid change specifyer: %s" change)) + (error "Invalid change specifier: %s" change)) (if (eq dw 'week) (setq dw 'day dn (* 7 dn))) (cond ((eq dw 'day) @@ -14346,7 +14981,7 @@ When SHOW-ALL is nil, only return the current occurrence of a time stamp." (t (if (= cday n1) n1 n2))))))) (defun org-date-to-gregorian (date) - "Turn any specification of DATE into a gregorian date for the calendar." + "Turn any specification of DATE into a Gregorian date for the calendar." (cond ((integerp date) (calendar-gregorian-from-absolute date)) ((and (listp date) (= (length date) 3)) date) ((stringp date) @@ -14378,7 +15013,7 @@ If the cursor is on the year, change the year. If it is on the month or the day, change that. With prefix ARG, change by that many units." (interactive "p") - (org-timestamp-change (prefix-numeric-value arg))) + (org-timestamp-change (prefix-numeric-value arg) nil 'updown)) (defun org-timestamp-down (&optional arg) "Decrease the date item at the cursor by one. @@ -14386,7 +15021,7 @@ If the cursor is on the year, change the year. If it is on the month or the day, change that. With prefix ARG, change by that many units." (interactive "p") - (org-timestamp-change (- (prefix-numeric-value arg)))) + (org-timestamp-change (- (prefix-numeric-value arg)) nil 'updown)) (defun org-timestamp-up-day (&optional arg) "Increase the date in the time stamp by one day. @@ -14395,7 +15030,7 @@ With prefix ARG, change that many days." (if (and (not (org-at-timestamp-p t)) (org-on-heading-p)) (org-todo 'up) - (org-timestamp-change (prefix-numeric-value arg) 'day))) + (org-timestamp-change (prefix-numeric-value arg) 'day 'updown))) (defun org-timestamp-down-day (&optional arg) "Decrease the date in the time stamp by one day. @@ -14404,7 +15039,7 @@ With prefix ARG, change that many days." (if (and (not (org-at-timestamp-p t)) (org-on-heading-p)) (org-todo 'down) - (org-timestamp-change (- (prefix-numeric-value arg)) 'day))) + (org-timestamp-change (- (prefix-numeric-value arg)) 'day) 'updown)) (defun org-at-timestamp-p (&optional inactive-ok) "Determine if the cursor is in or at a timestamp." @@ -14449,7 +15084,7 @@ With prefix ARG, change that many days." (message "Timestamp is now %sactive" (if (equal (char-after beg) ?<) "" "in"))))) -(defun org-timestamp-change (n &optional what) +(defun org-timestamp-change (n &optional what updown) "Change the date in the time stamp at point. The date will be changed by N times WHAT. WHAT can be `day', `month', `year', `minute', `second'. If WHAT is not given, the cursor position @@ -14480,8 +15115,10 @@ in the timestamp determines what will be changed." (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts) (setq with-hm t)) (setq time0 (org-parse-time-string ts)) - (when (and (eq org-ts-what 'minute) - (eq current-prefix-arg nil)) + (when (and updown + (eq org-ts-what 'minute) + (not current-prefix-arg)) + ;; This looks like s-up and s-down. Change by one rounding step. (setq n (* dm (cond ((> n 0) 1) ((< n 0) -1) (t 0)))) (when (not (= 0 (setq rem (% (nth 1 time0) dm)))) (setcar (cdr time0) (+ (nth 1 time0) @@ -14578,9 +15215,7 @@ A prefix ARG can be used to force the current date." (let ((tsr org-ts-regexp) diff (calendar-move-hook nil) (calendar-view-holidays-initially-flag nil) - (view-calendar-holidays-initially nil) - (calendar-view-diary-initially-flag nil) - (view-diary-entries-initially nil)) + (calendar-view-diary-initially-flag nil)) (if (or (org-at-timestamp-p) (save-excursion (beginning-of-line 1) @@ -14670,21 +15305,31 @@ changes from another. I believe the procedure must be like this: ;;;; Agenda files ;;;###autoload -(defun org-iswitchb (&optional arg) - "Use `org-icompleting-read' to prompt for an Org buffer to switch to. +(defun org-switchb (&optional arg) + "Switch between Org buffers. With a prefix argument, restrict available to files. -With two prefix arguments, restrict available buffers to agenda files." +With two prefix arguments, restrict available buffers to agenda files. + +Defaults to `iswitchb' for buffer name completion. +Set `org-completion-use-ido' to make it use ido instead." (interactive "P") (let ((blist (cond ((equal arg '(4)) (org-buffer-list 'files)) ((equal arg '(16)) (org-buffer-list 'agenda)) - (t (org-buffer-list))))) + (t (org-buffer-list)))) + (org-completion-use-iswitchb org-completion-use-iswitchb) + (org-completion-use-ido org-completion-use-ido)) + (unless (or org-completion-use-ido org-completion-use-iswitchb) + (setq org-completion-use-iswitchb t)) (switch-to-buffer (org-icompleting-read "Org buffer: " - (mapcar 'list (mapcar 'buffer-name blist)) - nil t)))) + (mapcar 'list (mapcar 'buffer-name blist)) + nil t)))) +;;; Define some older names previously used for this functionality ;;;###autoload -(defalias 'org-ido-switchb 'org-iswitchb) +(defalias 'org-ido-switchb 'org-switchb) +;;;###autoload +(defalias 'org-iswitchb 'org-switchb) (defun org-buffer-list (&optional predicate exclude-tmp) "Return a list of Org buffers. @@ -14755,6 +15400,13 @@ used by the agenda files. If ARCHIVE is `ifmode', do this only if (setq files (org-add-archive-files files))) files)) +(defun org-agenda-file-p (&optional file) + "Return non-nil, if FILE is an agenda file. +If FILE is omitted, use the file associated with the current +buffer." + (member (or file (buffer-file-name)) + (org-agenda-files t))) + (defun org-edit-agenda-file-list () "Edit the list of agenda files. Depending on setup, this either uses customize to edit the variable @@ -15068,10 +15720,6 @@ looks only before point, not after." (org-in-regexp "\\\\[a-zA-Z]+\\*?\\(\\(\\[[^][\n{}]*\\]\\)\\|\\({[^{}\n]*}\\)\\)*"))) -(defun test () - (interactive) - (message "%s" (org-inside-latex-macro-p))) - (defun org-try-cdlatex-tab () "Check if it makes sense to execute `cdlatex-tab', and do it if yes. It makes sense to do so if `org-cdlatex-mode' is active and if the cursor is @@ -15113,7 +15761,7 @@ Revert to the normal definition outside of these fragments." (defun org-remove-latex-fragment-image-overlays () "Remove all overlays with LaTeX fragment images in current buffer." - (mapc 'org-delete-overlay org-latex-fragment-image-overlays) + (mapc 'delete-overlay org-latex-fragment-image-overlays) (setq org-latex-fragment-image-overlays nil)) (defun org-preview-latex-fragment (&optional subtree) @@ -15122,7 +15770,8 @@ If the cursor is in a LaTeX fragment, create the image and overlay it over the source code. If there is no fragment at point, display all fragments in the current text, from one headline to the next. With prefix SUBTREE, display all fragments in the current subtree. With a -double prefix `C-u C-u', or when the cursor is before the first headline, +double prefix arg \\[universal-argument] \\[universal-argument], or when \ +the cursor is before the first headline, display all fragments in the buffer. The images can be removed again with \\[org-ctrl-c-ctrl-c]." (interactive "P") @@ -15168,7 +15817,8 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]." ("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil)) "Regular expressions for matching embedded LaTeX.") -(defun org-format-latex (prefix &optional dir overlays msg at forbuffer) +(defun org-format-latex (prefix &optional dir overlays msg at + forbuffer protect-only) "Replace LaTeX fragments with links to an image, and produce images. Some of the options can be changed using the variable `org-format-latex-options'." @@ -15198,60 +15848,63 @@ Some of the options can be changed using the variable (not (eq (get-char-property (match-beginning n) 'org-overlay-type) 'org-latex-overlay)))) - (setq txt (match-string n) - beg (match-beginning n) end (match-end n) - cnt (1+ cnt)) - (let (print-length print-level) ; make sure full list is printed - (setq hash (sha1 (prin1-to-string - (list org-format-latex-header - org-format-latex-header-extra - org-export-latex-default-packages-alist - org-export-latex-packages-alist - org-format-latex-options - forbuffer txt))) - linkfile (format "%s_%s.png" prefix hash) - movefile (format "%s_%s.png" absprefix hash))) - (setq link (concat block "[[file:" linkfile "]]" block)) - (if msg (message msg cnt)) - (goto-char beg) - (unless checkdir ; make sure the directory exists - (setq checkdir t) - (or (file-directory-p todir) (make-directory todir))) - - (unless executables-checked - (org-check-external-command - "latex" "needed to convert LaTeX fragments to images") - (org-check-external-command - "dvipng" "needed to convert LaTeX fragments to images") - (setq executables-checked t)) - - (unless (file-exists-p movefile) - (org-create-formula-image - txt movefile opt forbuffer)) - (if overlays - (progn - (mapc (lambda (o) - (if (eq (org-overlay-get o 'org-overlay-type) - 'org-latex-overlay) - (org-delete-overlay o))) - (org-overlays-in beg end)) - (setq ov (org-make-overlay beg end)) - (org-overlay-put ov 'org-overlay-type 'org-latex-overlay) - (if (featurep 'xemacs) - (progn - (org-overlay-put ov 'invisible t) - (org-overlay-put - ov 'end-glyph - (make-glyph (vector 'png :file movefile)))) - (org-overlay-put - ov 'display - (list 'image :type 'png :file movefile :ascent 'center))) - (push ov org-latex-fragment-image-overlays) - (goto-char end)) - (delete-region beg end) - (insert (org-add-props link - (list 'org-latex-src - (replace-regexp-in-string "\"" "" txt))))))))))) + (if protect-only + (add-text-properties (match-beginning n) (match-end n) + '(org-protected t)) + (setq txt (match-string n) + beg (match-beginning n) end (match-end n) + cnt (1+ cnt)) + (let (print-length print-level) ; make sure full list is printed + (setq hash (sha1 (prin1-to-string + (list org-format-latex-header + org-format-latex-header-extra + org-export-latex-default-packages-alist + org-export-latex-packages-alist + org-format-latex-options + forbuffer txt))) + linkfile (format "%s_%s.png" prefix hash) + movefile (format "%s_%s.png" absprefix hash))) + (setq link (concat block "[[file:" linkfile "]]" block)) + (if msg (message msg cnt)) + (goto-char beg) + (unless checkdir ; make sure the directory exists + (setq checkdir t) + (or (file-directory-p todir) (make-directory todir))) + + (unless executables-checked + (org-check-external-command + "latex" "needed to convert LaTeX fragments to images") + (org-check-external-command + "dvipng" "needed to convert LaTeX fragments to images") + (setq executables-checked t)) + + (unless (file-exists-p movefile) + (org-create-formula-image + txt movefile opt forbuffer)) + (if overlays + (progn + (mapc (lambda (o) + (if (eq (overlay-get o 'org-overlay-type) + 'org-latex-overlay) + (delete-overlay o))) + (overlays-in beg end)) + (setq ov (make-overlay beg end)) + (overlay-put ov 'org-overlay-type 'org-latex-overlay) + (if (featurep 'xemacs) + (progn + (overlay-put ov 'invisible t) + (overlay-put + ov 'end-glyph + (make-glyph (vector 'png :file movefile)))) + (overlay-put + ov 'display + (list 'image :type 'png :file movefile :ascent 'center))) + (push ov org-latex-fragment-image-overlays) + (goto-char end)) + (delete-region beg end) + (insert (org-add-props link + (list 'org-latex-src + (replace-regexp-in-string "\"" "" txt)))))))))))) ;; This function borrows from Ganesh Swami's latex2png.el (defun org-create-formula-image (string tofile options buffer) @@ -15280,7 +15933,7 @@ Some of the options can be changed using the variable (insert (org-splice-latex-header org-format-latex-header org-export-latex-default-packages-alist - org-export-latex-packages-alist + org-export-latex-packages-alist t org-format-latex-header-extra)) (insert "\n\\begin{document}\n" string "\n\\end{document}\n") (require 'org-latex) @@ -15314,13 +15967,13 @@ Some of the options can be changed using the variable (delete-file (concat texfilebase e))) pngfile)))) -(defun org-splice-latex-header (tpl def-pkg pkg &optional extra) +(defun org-splice-latex-header (tpl def-pkg pkg snippets-p &optional extra) "Fill a LaTeX header template TPL. In the template, the following place holders will be recognized: [DEFAULT-PACKAGES] \\usepackage statements for DEF-PKG [NO-DEFAULT-PACKAGES] do not include DEF-PKG - [PACKAGES] \\usepackage statements for PKG + [PACKAGES] \\usepackage statements for PKG [NO-PACKAGES] do not include PKG [EXTRA] the string EXTRA [NO-EXTRA] do not include EXTRA @@ -15329,19 +15982,22 @@ For backward compatibility, if both the positive and the negative place holder is missing, the positive one (without the \"NO-\") will be assumed to be present at the end of the template. DEF-PKG and PKG are assumed to be alists of options/packagename lists. -EXTRA is a string." +EXTRA is a string. +SNIPPETS-P indicates if this is run to create snippet images for HTML." (let (rpl (end "")) (if (string-match "^[ \t]*\\[\\(NO-\\)?DEFAULT-PACKAGES\\][ \t]*\n?" tpl) (setq rpl (if (or (match-end 1) (not def-pkg)) - "" (org-latex-packages-to-string def-pkg t)) + "" (org-latex-packages-to-string def-pkg snippets-p t)) tpl (replace-match rpl t t tpl)) - (if def-pkg (setq end (org-latex-packages-to-string def-pkg)))) - + (if def-pkg (setq end (org-latex-packages-to-string def-pkg snippets-p)))) + (if (string-match "\\[\\(NO-\\)?PACKAGES\\][ \t]*\n?" tpl) (setq rpl (if (or (match-end 1) (not pkg)) - "" (org-latex-packages-to-string pkg t)) + "" (org-latex-packages-to-string pkg snippets-p t)) tpl (replace-match rpl t t tpl)) - (if pkg (setq end (concat end "\n" (org-latex-packages-to-string pkg))))) + (if pkg (setq end + (concat end "\n" + (org-latex-packages-to-string pkg snippets-p))))) (if (string-match "\\[\\(NO-\\)?EXTRA\\][ \t]*\n?" tpl) (setq rpl (if (or (match-end 1) (not extra)) @@ -15354,11 +16010,13 @@ EXTRA is a string." (concat tpl "\n" end) tpl))) -(defun org-latex-packages-to-string (pkg &optional newline) +(defun org-latex-packages-to-string (pkg &optional snippets-p newline) "Turn an alist of packages into a string with the \\usepackage macros." (setq pkg (mapconcat (lambda(p) (cond ((stringp p) p) + ((and snippets-p (>= (length p) 3) (not (nth 2 p))) + (format "%% Package %s omitted" (cadr p))) ((equal "" (car p)) (format "\\usepackage{%s}" (cadr p))) (t @@ -15378,6 +16036,80 @@ EXTRA is a string." "Return string to be used as color value for an RGB component." (format "%g" (/ value 65535.0))) +;; Image display + + +(defvar org-inline-image-overlays nil) +(make-variable-buffer-local 'org-inline-image-overlays) + +(defun org-toggle-inline-images (&optional include-linked) + "Toggle the display of inline images. +INCLUDE-LINKED is passed to `org-display-inline-images'." + (interactive "P") + (if org-inline-image-overlays + (progn + (org-remove-inline-images) + (message "Inline image display turned off")) + (org-display-inline-images include-linked) + (if org-inline-image-overlays + (message "%d images displayed inline" + (length org-inline-image-overlays)) + (message "No images to display inline")))) + +(defun org-display-inline-images (&optional include-linked refresh beg end) + "Display inline images. +Normally only links without a description part are inlined, because this +is how it will work for export. When INCLUDE-LINKED is set, also links +with a description part will be inlined. This can be nice for a quick +look at those images, but it does not reflect what exported files will look +like. +When REFRESH is set, refresh existing images between BEG and END. +This will create new image displays only if necessary. +BEG and END default to the buffer boundaries." + (interactive "P") + (unless refresh + (org-remove-inline-images) + (clear-image-cache)) + (save-excursion + (save-restriction + (widen) + (setq beg (or beg (point-min)) end (or end (point-max))) + (goto-char (point-min)) + (let ((re (concat "\\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([-+~.:/\\_0-9a-zA-Z ]+" + (substring (org-image-file-name-regexp) 0 -2) + "\\)\\]" (if include-linked "" "\\]"))) + old file ov img) + (while (re-search-forward re end t) + (setq old (get-char-property-and-overlay (match-beginning 1) + 'org-image-overlay)) + (setq file (expand-file-name + (concat (or (match-string 3) "") (match-string 4)))) + (when (file-exists-p file) + (if (and (car-safe old) refresh) + (image-refresh (overlay-get (cdr old) 'display)) + (setq img (create-image file)) + (when img + (setq ov (make-overlay (match-beginning 0) (match-end 0))) + (overlay-put ov 'display img) + (overlay-put ov 'face 'default) + (overlay-put ov 'org-image-overlay t) + (overlay-put ov 'modification-hooks + (list 'org-display-inline-modification-hook)) + (push ov org-inline-image-overlays))))))))) + +(defun org-display-inline-modification-hook (ov after beg end &optional len) + "Remove inline-display overlay if a corresponding region is modified." + (let ((inhibit-modification-hooks t)) + (when (and ov after) + (delete ov org-inline-image-overlays) + (delete-overlay ov)))) + +(defun org-remove-inline-images () + "Remove inline display of images." + (interactive) + (mapc 'delete-overlay org-inline-image-overlays) + (setq org-inline-image-overlays nil)) + ;;;; Key bindings ;; Make `C-c C-x' a prefix key @@ -15419,6 +16151,12 @@ EXTRA is a string." (org-defkey org-mode-map [(control shift right)] 'org-shiftcontrolright) (org-defkey org-mode-map [(control shift left)] 'org-shiftcontrolleft) +;; Babel keys +(define-key org-mode-map org-babel-key-prefix org-babel-map) +(mapc (lambda (pair) + (define-key org-babel-map (car pair) (cdr pair))) + org-babel-key-bindings) + ;;; Extra keys for tty access. ;; We only set them when really needed because otherwise the ;; menus don't show the simple keys @@ -15476,7 +16214,6 @@ EXTRA is a string." (org-defkey org-mode-map "\C-c\C-s" 'org-schedule) (org-defkey org-mode-map "\C-c\C-d" 'org-deadline) (org-defkey org-mode-map "\C-c;" 'org-toggle-comment) -(org-defkey org-mode-map "\C-c\C-v" 'org-show-todo-tree) (org-defkey org-mode-map "\C-c\C-w" 'org-refile) (org-defkey org-mode-map "\C-c/" 'org-sparse-tree) ; Minor-mode reserved (org-defkey org-mode-map "\C-c\\" 'org-match-sparse-tree) ; Minor-mode res. @@ -15547,6 +16284,8 @@ EXTRA is a string." (org-defkey org-mode-map "\C-c\C-x\C-r" 'org-clock-report) (org-defkey org-mode-map "\C-c\C-x\C-u" 'org-dblock-update) (org-defkey org-mode-map "\C-c\C-x\C-l" 'org-preview-latex-fragment) +(org-defkey org-mode-map "\C-c\C-x\C-v" 'org-toggle-inline-images) +(org-defkey org-mode-map "\C-c\C-x\\" 'org-toggle-pretty-entities) (org-defkey org-mode-map "\C-c\C-x\C-b" 'org-toggle-checkbox) (org-defkey org-mode-map "\C-c\C-xp" 'org-set-property) (org-defkey org-mode-map "\C-c\C-xe" 'org-set-effort) @@ -15639,7 +16378,7 @@ EXTRA is a string." "Show the available speed commands." (interactive) (if (not org-use-speed-commands) - (error "Speed commands are not activated, customize `org-use-speed-commands'.") + (error "Speed commands are not activated, customize `org-use-speed-commands'") (with-output-to-temp-buffer "*Help*" (princ "User-defined Speed commands\n===========================\n") (mapc 'org-print-speed-command org-speed-commands-user) @@ -15832,8 +16571,9 @@ See `org-ctrl-c-ctrl-c-hook' for more information. This hook runs as the first action when TAB is pressed, even before `org-cycle' messes around with the `outline-regexp' to cater for inline tasks and plain list item folding. -If any function in this hook returns t, not other actions like table -field motion visibility cycling will be done.") +If any function in this hook returns t, any other actions that +would have been caused by TAB (such as table field motion or visibility +cycling) will not occur.") (defvar org-tab-after-check-for-table-hook nil "Hook for functions to attach themselves to TAB. @@ -15884,6 +16624,34 @@ See `org-ctrl-c-ctrl-c-hook' for more information.") (defvar org-metareturn-hook nil "Hook for functions attaching themselves to `M-RET'. See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftup-hook nil + "Hook for functions attaching themselves to `S-up'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftup-final-hook nil + "Hook for functions attaching themselves to `S-up'. +This one runs after all other options except shift-select have been excluded. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftdown-hook nil + "Hook for functions attaching themselves to `S-down'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftdown-final-hook nil + "Hook for functions attaching themselves to `S-down'. +This one runs after all other options except shift-select have been excluded. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftleft-hook nil + "Hook for functions attaching themselves to `S-left'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftleft-final-hook nil + "Hook for functions attaching themselves to `S-left'. +This one runs after all other options except shift-select have been excluded. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftright-hook nil + "Hook for functions attaching themselves to `S-right'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftright-final-hook nil + "Hook for functions attaching themselves to `S-right'. +This one runs after all other options except shift-select have been excluded. +See `org-ctrl-c-ctrl-c-hook' for more information.") (defun org-modifier-cursor-error () "Throw an error, a modified cursor command was applied in wrong context." @@ -15924,7 +16692,7 @@ See the individual commands for more information." ((run-hook-with-args-until-success 'org-shiftmetaleft-hook)) ((org-at-table-p) (call-interactively 'org-table-delete-column)) ((org-on-heading-p) (call-interactively 'org-promote-subtree)) - ((org-at-item-p) (call-interactively 'org-outdent-item)) + ((org-at-item-p) (call-interactively 'org-outdent-item-tree)) (t (org-modifier-cursor-error)))) (defun org-shiftmetaright () @@ -15937,7 +16705,7 @@ See the individual commands for more information." ((run-hook-with-args-until-success 'org-shiftmetaright-hook)) ((org-at-table-p) (call-interactively 'org-table-insert-column)) ((org-on-heading-p) (call-interactively 'org-demote-subtree)) - ((org-at-item-p) (call-interactively 'org-indent-item)) + ((org-at-item-p) (call-interactively 'org-indent-item-tree)) (t (org-modifier-cursor-error)))) (defun org-shiftmetaup (&optional arg) @@ -15966,6 +16734,10 @@ commands for more information." ((org-at-item-p) (call-interactively 'org-move-item-down)) (t (org-modifier-cursor-error)))) +(defsubst org-hidden-tree-error () + (error + "Hidden subtree, open with TAB or use subtree command M-S-<left>/<right>")) + (defun org-metaleft (&optional arg) "Promote heading or move table column to left. Calls `org-do-promote' or `org-table-move-column', depending on context. @@ -15980,12 +16752,14 @@ See the individual commands for more information." (save-excursion (goto-char (region-beginning)) (org-on-heading-p)))) + (when (org-check-for-hidden 'headlines) (org-hidden-tree-error)) (call-interactively 'org-do-promote)) ((or (org-at-item-p) (and (org-region-active-p) (save-excursion (goto-char (region-beginning)) (org-at-item-p)))) + (when (org-check-for-hidden 'items) (org-hidden-tree-error)) (call-interactively 'org-outdent-item)) (t (call-interactively 'backward-word)))) @@ -16003,15 +16777,44 @@ See the individual commands for more information." (save-excursion (goto-char (region-beginning)) (org-on-heading-p)))) + (when (org-check-for-hidden 'headlines) (org-hidden-tree-error)) (call-interactively 'org-do-demote)) ((or (org-at-item-p) (and (org-region-active-p) (save-excursion (goto-char (region-beginning)) (org-at-item-p)))) + (when (org-check-for-hidden 'items) (org-hidden-tree-error)) (call-interactively 'org-indent-item)) (t (call-interactively 'forward-word)))) +(defun org-check-for-hidden (what) + "Check if there are hidden headlines/items in the current visual line. +WHAT can be either `headlines' or `items'. If the current line is +an outline or item heading and it has a folded subtree below it, +this function returns t, nil otherwise." + (let ((re (cond + ((eq what 'headlines) (concat "^" org-outline-regexp)) + ((eq what 'items) (concat "^" (org-item-re t))) + (t (error "This should not happen")))) + beg end) + (save-excursion + (catch 'exit + (unless (org-region-active-p) + (setq beg (point-at-bol)) + (beginning-of-line 2) + (while (and (not (eobp)) ;; this is like `next-line' + (get-char-property (1- (point)) 'invisible)) + (beginning-of-line 2)) + (setq end (point)) + (goto-char beg) + (goto-char (point-at-eol)) + (setq end (max end (point))) + (while (re-search-forward re end t) + (if (get-char-property (match-beginning 0) 'invisible) + (throw 'exit t)))) + nil)))) + (defun org-metaup (&optional arg) "Move subtree up or move table row up. Calls `org-move-subtree-up' or `org-table-move-row' or @@ -16044,6 +16847,7 @@ Calls `org-timestamp-up' or `org-priority-up', or `org-previous-item', depending on context. See the individual commands for more information." (interactive "P") (cond + ((run-hook-with-args-until-success 'org-shiftup-hook)) ((and org-support-shift-select (org-region-active-p)) (org-call-for-shift-select 'previous-line)) ((org-at-timestamp-p t) @@ -16056,6 +16860,7 @@ depending on context. See the individual commands for more information." ((and (not org-support-shift-select) (org-at-item-p)) (call-interactively 'org-previous-item)) ((org-clocktable-try-shift 'up arg)) + ((run-hook-with-args-until-success 'org-shiftup-final-hook)) (org-support-shift-select (org-call-for-shift-select 'previous-line)) (t (org-shiftselect-error)))) @@ -16066,6 +16871,7 @@ Calls `org-timestamp-down' or `org-priority-down', or `org-next-item' depending on context. See the individual commands for more information." (interactive "P") (cond + ((run-hook-with-args-until-success 'org-shiftdown-hook)) ((and org-support-shift-select (org-region-active-p)) (org-call-for-shift-select 'next-line)) ((org-at-timestamp-p t) @@ -16078,6 +16884,7 @@ depending on context. See the individual commands for more information." ((and (not org-support-shift-select) (org-at-item-p)) (call-interactively 'org-next-item)) ((org-clocktable-try-shift 'down arg)) + ((run-hook-with-args-until-success 'org-shiftdown-final-hook)) (org-support-shift-select (org-call-for-shift-select 'next-line)) (t (org-shiftselect-error)))) @@ -16093,6 +16900,7 @@ Depending on context, this does one of the following: - on a clocktable definition line, move time block into the future" (interactive "P") (cond + ((run-hook-with-args-until-success 'org-shiftright-hook)) ((and org-support-shift-select (org-region-active-p)) (org-call-for-shift-select 'forward-char)) ((org-at-timestamp-p t) (call-interactively 'org-timestamp-up-day)) @@ -16112,6 +16920,7 @@ Depending on context, this does one of the following: (org-at-property-p)) (call-interactively 'org-property-next-allowed-value)) ((org-clocktable-try-shift 'right arg)) + ((run-hook-with-args-until-success 'org-shiftright-final-hook)) (org-support-shift-select (org-call-for-shift-select 'forward-char)) (t (org-shiftselect-error)))) @@ -16127,6 +16936,7 @@ Depending on context, this does one of the following: - on a clocktable definition line, move time block into the past" (interactive "P") (cond + ((run-hook-with-args-until-success 'org-shiftleft-hook)) ((and org-support-shift-select (org-region-active-p)) (org-call-for-shift-select 'backward-char)) ((org-at-timestamp-p t) (call-interactively 'org-timestamp-down-day)) @@ -16146,6 +16956,7 @@ Depending on context, this does one of the following: (org-at-property-p)) (call-interactively 'org-property-previous-allowed-value)) ((org-clocktable-try-shift 'left arg)) + ((run-hook-with-args-until-success 'org-shiftleft-final-hook)) (org-support-shift-select (org-call-for-shift-select 'backward-char)) (t (org-shiftselect-error)))) @@ -16208,24 +17019,33 @@ See the individual commands for more information." (org-table-paste-rectangle) (org-paste-subtree arg))) -(defun org-edit-special () +(defun org-edit-special (&optional arg) "Call a special editor for the stuff at point. When at a table, call the formula editor with `org-table-edit-formulas'. When at the first line of an src example, call `org-edit-src-code'. When in an #+include line, visit the include file. Otherwise call `ffap' to visit the file at point." (interactive) - (cond - ((org-at-table.el-p) - (org-edit-src-code)) - ((org-at-table-p) - (call-interactively 'org-table-edit-formulas)) + ;; possibly prep session before editing source + (when arg + (let* ((info (org-babel-get-src-block-info)) + (lang (nth 0 info)) + (params (nth 2 info)) + (session (cdr (assoc :session params)))) + (when (and info session) ;; we are in a source-code block with a session + (funcall + (intern (concat "org-babel-prep-session:" lang)) session params)))) + (cond ;; proceed with `org-edit-special' ((save-excursion (beginning-of-line 1) (looking-at "\\(?:#\\+\\(?:setupfile\\|include\\):?[ \t]+\"?\\|[ \t]*<include\\>.*?file=\"\\)\\([^\"\n>]+\\)")) (find-file (org-trim (match-string 1)))) ((org-edit-src-code)) ((org-edit-fixed-width-region)) + ((org-at-table.el-p) + (org-edit-src-code)) + ((org-at-table-p) + (call-interactively 'org-table-edit-formulas)) (t (call-interactively 'ffap)))) @@ -16269,7 +17089,13 @@ This command does many different things, depending on context: - If the cursor is on a numbered item in a plain list, renumber the ordered list. -- If the cursor is on a checkbox, toggle it." +- If the cursor is on a checkbox, toggle it. + +- If the cursor is on a code block, evaluate it. The variable + `org-confirm-babel-evaluate' can be used to control prompting + before code block evaluation, by default every code block + evaluation requires confirmation. Code block evaluation can be + inhibited by setting `org-babel-no-eval-on-ctrl-c-ctrl-c'." (interactive "P") (let ((org-enable-table-editor t)) (cond @@ -16304,11 +17130,13 @@ This command does many different things, depending on context: (org-footnote-at-definition-p)) (call-interactively 'org-footnote-action)) ((org-at-item-checkbox-p) - (call-interactively 'org-toggle-checkbox)) + (call-interactively 'org-toggle-checkbox) + (org-list-send-list 'maybe)) ((org-at-item-p) (if arg (call-interactively 'org-toggle-checkbox) - (call-interactively 'org-maybe-renumber-ordered-list))) + (call-interactively 'org-maybe-renumber-ordered-list)) + (org-list-send-list 'maybe)) ((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re)) ;; Dynamic block (beginning-of-line 1) @@ -16343,7 +17171,9 @@ Also updates the keyword regular expressions." "If this is a Note buffer, abort storing the note. Else call `show-branches'." (interactive) (if (not org-finish-function) - (call-interactively 'show-branches) + (progn + (hide-subtree) + (call-interactively 'show-branches)) (let ((org-note-abort t)) (funcall org-finish-function)))) @@ -16638,7 +17468,7 @@ See the individual commands for more information." ["Previous link" org-previous-link t] "--" ["Descriptive Links" - (progn (org-add-to-invisibility-spec '(org-link)) (org-restart-font-lock)) + (progn (add-to-invisibility-spec '(org-link)) (org-restart-font-lock)) :style radio :selected (member '(org-link) buffer-invisibility-spec)] ["Literal Links" @@ -16655,8 +17485,8 @@ See the individual commands for more information." ["Complete Keyword" org-complete (assq :todo-keyword (org-context))] ["Next keyword set" org-shiftcontrolright (and (> (length org-todo-sets) 1) (org-on-heading-p))] ["Previous keyword set" org-shiftcontrolright (and (> (length org-todo-sets) 1) (org-on-heading-p))]) - ["Show TODO Tree" org-show-todo-tree t] - ["Global TODO list" org-todo-list t] + ["Show TODO Tree" org-show-todo-tree :active t :keys "C-c / t"] + ["Global TODO list" org-todo-list :active t :keys "C-c a t"] "--" ["Enforce dependencies" (customize-variable 'org-enforce-todo-dependencies) :selected org-enforce-todo-dependencies :style toggle :active t] @@ -16752,7 +17582,7 @@ See the individual commands for more information." :style toggle :selected (and (boundp 'org-export-with-LaTeX-fragments) org-export-with-LaTeX-fragments)] "--" - ["Template for BEAMER" org-beamer-settings-template t]) + ["Template for BEAMER" org-insert-beamer-options-template t]) "--" ("MobileOrg" ["Push Files and Views" org-mobile-push t] @@ -16885,8 +17715,18 @@ With prefix arg UNCOMPILED, load the uncompiled versions." (dir-org-contrib (ignore-errors (file-name-directory (org-find-library-name "org-contribdir")))) + (babel-files + (mapcar (lambda (el) (concat "ob" (when el (format "-%s" el)) ".el")) + (append (list nil "comint" "eval" "exp" "keys" + "lob" "ref" "table" "tangle") + (delq nil + (mapcar + (lambda (lang) + (when (cdr lang) (symbol-name (car lang)))) + org-babel-load-languages))))) (files (append (directory-files dir-org t file-re) + babel-files (and dir-org-contrib (directory-files dir-org-contrib t file-re)))) (remove-re (concat (if (featurep 'xemacs) @@ -16953,9 +17793,7 @@ With prefix arg UNCOMPILED, load the uncompiled versions." "Display the given MESSAGE as a warning." (if (fboundp 'display-warning) (display-warning 'org message - (if (featurep 'xemacs) - 'warning - :warning)) + (if (featurep 'xemacs) 'warning :warning)) (let ((buf (get-buffer-create "*Org warnings*"))) (with-current-buffer buf (goto-char (point-max)) @@ -16969,6 +17807,13 @@ With prefix arg UNCOMPILED, load the uncompiled versions." "Is point in a line starting with `#'?" (equal (char-after (point-at-bol)) ?#)) +(defun org-in-indented-comment-line () + "Is point in a line starting with `#' after some white space?" + (save-excursion + (save-match-data + (goto-char (point-at-bol)) + (looking-at "[ \t]*#")))) + (defun org-in-verbatim-emphasis () (save-match-data (and (org-in-regexp org-emph-re 2) (member (match-string 3) '("=" "~"))))) @@ -17276,11 +18121,11 @@ and :keyword." (mapcar (lambda (x) (if (memq x org-latex-fragment-image-overlays) x)) - (org-overlays-at (point)))))) + (overlays-at (point)))))) (push (list :latex-fragment - (org-overlay-start o) (org-overlay-end o)) clist) + (overlay-start o) (overlay-end o)) clist) (push (list :latex-preview - (org-overlay-start o) (org-overlay-end o)) clist)) + (overlay-start o) (overlay-end o)) clist)) ((org-inside-LaTeX-fragment-p) ;; FIXME: positions wrong. (push (list :latex-fragment (point) (point)) clist))) @@ -17319,7 +18164,7 @@ really on, so that the block visually is on the match." nil)))) (defun org-in-regexps-block-p (start-re end-re) - "Returns t if the current point is between matches of START-RE and END-RE. + "Return t if the current point is between matches of START-RE and END-RE. This will also return to if point is on one of the two matches." (interactive) (let ((p (point))) @@ -17396,6 +18241,33 @@ for the search purpose." (setq list (delete (pop elts) list))) list) +(defun org-count (cl-item cl-seq) + "Count the number of occurrences of ITEM in SEQ. +Taken from `count' in cl-seq.el with all keyword arguments removed." + (let ((cl-end (length cl-seq)) (cl-start 0) (cl-count 0) cl-x) + (when (consp cl-seq) (setq cl-seq (nthcdr cl-start cl-seq))) + (while (< cl-start cl-end) + (setq cl-x (if (consp cl-seq) (pop cl-seq) (aref cl-seq cl-start))) + (if (equal cl-item cl-x) (setq cl-count (1+ cl-count))) + (setq cl-start (1+ cl-start))) + cl-count)) + +(defun org-remove-if (predicate seq) + "Remove everything from SEQ that fulfills PREDICATE." + (let (res e) + (while seq + (setq e (pop seq)) + (if (not (funcall predicate e)) (push e res))) + (nreverse res))) + +(defun org-remove-if-not (predicate seq) + "Remove everything from SEQ that does not fulfill PREDICATE." + (let (res e) + (while seq + (setq e (pop seq)) + (if (funcall predicate e) (push e res))) + (nreverse res))) + (defun org-back-over-empty-lines () "Move backwards over whitespace, to the beginning of the first empty line. Returns the number of empty lines passed." @@ -17411,7 +18283,7 @@ Returns the number of empty lines passed." (defun org-point-in-group (point group &optional context) "Check if POINT is in match-group GROUP. If CONTEXT is non-nil, return a list with CONTEXT and the boundaries of the -match. If the match group does ot exist or point is not inside it, +match. If the match group does not exist or point is not inside it, return nil." (and (match-beginning group) (>= point (match-beginning group)) @@ -17422,7 +18294,8 @@ return nil." (defun org-switch-to-buffer-other-window (&rest args) "Switch to buffer in a second window on the current frame. -In particular, do not allow pop-up frames." +In particular, do not allow pop-up frames. +Returns the newly created buffer." (let (pop-up-frames special-display-buffer-names special-display-regexps special-display-function) (apply 'switch-to-buffer-other-window args))) @@ -17473,17 +18346,27 @@ TABLE is an association list with keys like \"%a\" and string values. The sequences in STRING may contain normal field width and padding information, for example \"%-5s\". Replacements happen in the sequence given by TABLE, so values can contain further %-escapes if they are define later in TABLE." - (let ((case-fold-search nil) - e re rpl) - (while (setq e (pop table)) + (let ((tbl (copy-alist table)) + (case-fold-search nil) + (pchg 0) + e re rpl) + (while (setq e (pop tbl)) (setq re (concat "%-?[0-9.]*" (substring (car e) 1))) + (when (and (cdr e) (string-match re (cdr e))) + (let ((sref (substring (cdr e) (match-beginning 0) (match-end 0))) + (safe "SREF")) + (add-text-properties 0 3 (list 'sref sref) safe) + (setcdr e (replace-match safe t t (cdr e))))) (while (string-match re string) - (setq rpl (format (concat (substring (match-string 0 string) 0 -1) "s") - (cdr e))) - (setq string (replace-match rpl t t string)))) + (setq rpl (format (concat (substring (match-string 0 string) 0 -1) "s") + (cdr e))) + (setq string (replace-match rpl t t string)))) + (while (setq pchg (next-property-change pchg string)) + (let ((sref (get-text-property pchg 'sref string))) + (when (and sref (string-match "SREF" string pchg)) + (setq string (replace-match sref t t string))))) string)) - (defun org-sublist (list start end) "Return a section of LIST, from START to END. Counting starts at 1." @@ -17678,7 +18561,7 @@ the functionality can be provided as a fall-back.") (org-set-local 'fill-paragraph-function 'org-fill-paragraph) ;; Adaptive filling: To get full control, first make sure that ;; `adaptive-fill-regexp' never matches. Then install our own matcher. - (unless (local-variable-p 'adaptive-fill-regexp) + (unless (local-variable-p 'adaptive-fill-regexp (current-buffer)) (org-set-local 'org-adaptive-fill-regexp-backup adaptive-fill-regexp)) (org-set-local 'adaptive-fill-regexp "\000") @@ -17829,8 +18712,8 @@ beyond the end of the headline." (if (bobp) nil (backward-char 1) - (if (org-invisible-p) - (while (and (not (bobp)) (org-invisible-p)) + (if (org-truely-invisible-p) + (while (and (not (bobp)) (org-truely-invisible-p)) (backward-char 1) (beginning-of-line 1)) (forward-char 1)))) @@ -17926,6 +18809,11 @@ depending on context." ((or (not org-special-ctrl-k) (bolp) (not (org-on-heading-p))) + (if (and (get-char-property (min (point-max) (point-at-eol)) 'invisible) + org-ctrl-k-protect-subtree) + (if (or (eq org-ctrl-k-protect-subtree 'error) + (not (y-or-n-p "Kill hidden subtree along with headline? "))) + (error "C-k aborted - would kill hidden subtree"))) (call-interactively 'kill-line)) ((looking-at (org-re ".*?\\S-\\([ \t]+\\(:[[:alnum:]_@:]+:\\)\\)[ \t]*$")) (kill-region (point) (match-beginning 1)) @@ -17953,7 +18841,8 @@ org-yank-adjusted-subtrees *visible* surrounding headings. Any prefix to this command will cause `yank' to be called directly with -no special treatment. In particular, a simple `C-u' prefix will just +no special treatment. In particular, a simple \\[universal-argument] prefix \ +will just plainly yank the text as it is. \[1] The test checks if the first non-white line is a heading @@ -18043,6 +18932,17 @@ interactive command with similar behavior." (outline-invisible-p) (get-char-property (point) 'invisible))) +(defun org-truely-invisible-p () + "Check if point is at a character currently not visible. +This version does not only check the character property, but also +`visible-mode'." + ;; Early versions of noutline don't have `outline-invisible-p'. + (if (org-bound-and-true-p visible-mode) + nil + (if (fboundp 'outline-invisible-p) + (outline-invisible-p) + (get-char-property (point) 'invisible)))) + (defun org-invisible-p2 () "Check if point is at a character currently not visible." (save-excursion @@ -18059,6 +18959,13 @@ interactive command with similar behavior." (error (error "Before first headline at position %d in buffer %s" (point) (current-buffer))))) +(defun org-beginning-of-defun () + "Go to the beginning of the subtree, i.e. back to the heading." + (org-back-to-heading)) +(defun org-end-of-defun () + "Go to the end of the subtree." + (org-end-of-subtree nil t)) + (defun org-before-first-heading-p () "Before first heading?" (save-excursion @@ -18403,11 +19310,11 @@ if no description is present" ;; Speedbar support -(defvar org-speedbar-restriction-lock-overlay (org-make-overlay 1 1) +(defvar org-speedbar-restriction-lock-overlay (make-overlay 1 1) "Overlay marking the agenda restriction line in speedbar.") -(org-overlay-put org-speedbar-restriction-lock-overlay +(overlay-put org-speedbar-restriction-lock-overlay 'face 'org-agenda-restriction-lock) -(org-overlay-put org-speedbar-restriction-lock-overlay +(overlay-put org-speedbar-restriction-lock-overlay 'help-echo "Agendas are currently limited to this item.") (org-detach-overlay org-speedbar-restriction-lock-overlay) @@ -18440,8 +19347,8 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]." (error "Cannot restrict to non-Org-mode file")) (org-agenda-set-restriction-lock 'file))) (t (error "Don't know how to restrict Org-mode's agenda"))) - (org-move-overlay org-speedbar-restriction-lock-overlay - (point-at-bol) (point-at-eol)) + (move-overlay org-speedbar-restriction-lock-overlay + (point-at-bol) (point-at-eol)) (setq current-prefix-arg nil) (org-agenda-maybe-redo))) @@ -18455,7 +19362,6 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]." (add-hook 'speedbar-visiting-tag-hook (lambda () (and (org-mode-p) (org-show-context 'org-goto)))))) - ;;; Fixes and Hacks for problems with other packages ;; Make flyspell not check words in links, to not mess up our keymap diff --git a/lisp/play/zone.el b/lisp/play/zone.el index 367c301de44..4fa5a8c3920 100644 --- a/lisp/play/zone.el +++ b/lisp/play/zone.el @@ -1,7 +1,7 @@ ;;; zone.el --- idle display hacks -;; Copyright (C) 2000, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +;; 2009, 2010 Free Software Foundation, Inc. ;; Author: Victor Zandy <zandy@cs.wisc.edu> ;; Maintainer: Thien-Thi Nguyen <ttn@gnu.org> @@ -40,10 +40,6 @@ ;;; Code: -(require 'timer) -(require 'tabify) -(eval-when-compile (require 'cl)) - (defvar zone-timer nil "The timer we use to decide when to zone out, or nil if none.") @@ -210,19 +206,20 @@ If the element is a function or a list of a function and a number, (insert s))) (defun zone-shift-left () - (let (s) + (let ((inhibit-point-motion-hooks t) + s) (while (not (eobp)) (unless (eolp) (setq s (buffer-substring (point) (1+ (point)))) (delete-char 1) (end-of-line) (insert s)) - (forward-char 1)))) + (ignore-errors (forward-char 1))))) (defun zone-shift-right () (goto-char (point-max)) - (end-of-line) - (let (s) + (let ((inhibit-point-motion-hooks t) + s) (while (not (bobp)) (unless (bolp) (setq s (buffer-substring (1- (point)) (point))) @@ -348,15 +345,8 @@ If the element is a function or a list of a function and a number, (let ((np (+ 2 (random 5))) (pm (point-max))) (while (< np pm) - (goto-char np) - (let ((prec (preceding-char)) - (props (text-properties-at (1- (point))))) - (insert (if (zerop (random 2)) - (upcase prec) - (downcase prec))) - (set-text-properties (1- (point)) (point) props)) - (backward-char 2) - (delete-char 1) + (funcall (if (zerop (random 2)) 'upcase-region + 'downcase-region) (1- np) np) (setq np (+ np (1+ (random 5)))))) (goto-char (point-min)) (sit-for 0 2))) @@ -365,13 +355,14 @@ If the element is a function or a list of a function and a number, ;;;; rotating (defun zone-line-specs () - (let (ret) + (let ((ok t) + ret) (save-excursion (goto-char (window-start)) - (while (< (point) (window-end)) + (while (and ok (< (point) (window-end))) (when (looking-at "[\t ]*\\([^\n]+\\)") (setq ret (cons (cons (match-beginning 1) (match-end 1)) ret))) - (forward-line 1))) + (setq ok (zerop (forward-line 1))))) ret)) (defun zone-pgm-rotate (&optional random-style) @@ -404,6 +395,7 @@ If the element is a function or a list of a function and a number, (setq cut 1 paste 2) (setq cut 2 paste 1)) (goto-char (aref ent cut)) + (setq aamt (min aamt (- (point-max) (point)))) (setq txt (buffer-substring (point) (+ (point) aamt))) (delete-char aamt) (goto-char (aref ent paste)) @@ -447,19 +439,19 @@ If the element is a function or a list of a function and a number, (hmm (cond ((string-match "[a-z]" c-string) (upcase c-string)) ((string-match "[A-Z]" c-string) (downcase c-string)) - (t (propertize " " 'display `(space :width ,cw-ceil)))))) - (do ((i 0 (1+ i)) - (wait 0.5 (* wait 0.8))) - ((= i 20)) + (t (propertize " " 'display `(space :width ,cw-ceil))))) + (wait 0.5)) + (dotimes (i 20) (goto-char pos) (delete-char 1) (insert (if (= 0 (% i 2)) hmm c-string)) - (zone-park/sit-for wbeg wait)) + (zone-park/sit-for wbeg (setq wait (* wait 0.8)))) (delete-char -1) (insert c-string))) (defun zone-fill-out-screen (width height) (let ((start (window-start)) - (line (make-string width 32))) + (line (make-string width 32)) + (inhibit-point-motion-hooks t)) (goto-char start) ;; fill out rectangular ws block (while (progn (end-of-line) @@ -473,8 +465,7 @@ If the element is a function or a list of a function and a number, (let ((nl (- height (count-lines (point-min) (point))))) (when (> nl 0) (setq line (concat line "\n")) - (do ((i 0 (1+ i))) - ((= i nl)) + (dotimes (i nl) (insert line)))) (goto-char start) (recenter 0) @@ -487,8 +478,10 @@ If the element is a function or a list of a function and a number, (wait 0.15) newpos fall-p) (while (when (save-excursion - (forward-line 1) - (and (= col (current-column)) + (and (zerop (forward-line 1)) + (progn + (forward-char col) + (= col (current-column))) (setq newpos (point)) (string= spaces (buffer-substring-no-properties newpos (+ newpos cw-ceil))) @@ -587,11 +580,12 @@ If the element is a function or a list of a function and a number, (defun zone-pgm-stress () (goto-char (point-min)) - (let (lines) - (while (< (point) (point-max)) + (let ((ok t) + lines) + (while (and ok (< (point) (point-max))) (let ((p (point))) - (forward-line 1) - (setq lines (cons (buffer-substring p (point)) lines)))) + (setq ok (zerop (forward-line 1)) + lines (cons (buffer-substring p (point)) lines)))) (sit-for 5) (zone-hiding-modeline (let ((msg "Zoning... (zone-pgm-stress)")) @@ -671,7 +665,8 @@ If nil, `zone-pgm-random-life' chooses a value from 0-3 (inclusive).") (setq c (point)) (move-to-column 9) (setq col (cons (buffer-substring (point) c) col)) - (end-of-line 0) +; (let ((inhibit-point-motion-hooks t)) + (end-of-line 0);) (forward-char -10)) (let ((life-patterns (vector (if (and col (search-forward "@" max t)) diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 7eb0016ff43..e5e108106f1 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -1082,7 +1082,7 @@ been put there by c-put-char-property. POINT remains unchanged." (setq place (next-single-property-change place property nil to))) (< place to)) (setq end-place (next-single-property-change place property nil to)) - (put-text-property place end-place property nil) + (remove-text-properties place end-place (cons property nil)) ;; Do we have to do anything with stickiness here? (setq place end-place)))) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 1ee3c295fe1..9bbf82a0449 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -4985,7 +4985,8 @@ comment at the start of cc-engine.el for more info." ;; POS (default point) is at a < character. If it is both marked ;; with open/close paren syntax-table property, and has a matching > ;; (also marked) which is after LIM, remove the property both from - ;; the current > and its partner. + ;; the current > and its partner. Return t when this happens, nil + ;; when it doesn't. (save-excursion (if pos (goto-char pos) @@ -4998,13 +4999,15 @@ comment at the start of cc-engine.el for more info." (equal (c-get-char-property (1- (point)) 'syntax-table) c->-as-paren-syntax)) ; should always be true. (c-unmark-<->-as-paren (1- (point))) - (c-unmark-<->-as-paren pos))))) + (c-unmark-<->-as-paren pos)) + t))) (defun c-clear->-pair-props-if-match-before (lim &optional pos) ;; POS (default point) is at a > character. If it is both marked ;; with open/close paren syntax-table property, and has a matching < ;; (also marked) which is before LIM, remove the property both from - ;; the current < and its partner. + ;; the current < and its partner. Return t when this happens, nil + ;; when it doesn't. (save-excursion (if pos (goto-char pos) @@ -5017,7 +5020,8 @@ comment at the start of cc-engine.el for more info." (equal (c-get-char-property (point) 'syntax-table) c-<-as-paren-syntax)) ; should always be true. (c-unmark-<->-as-paren (point)) - (c-unmark-<->-as-paren pos))))) + (c-unmark-<->-as-paren pos)) + t))) (defun c-before-change-check-<>-operators (beg end) ;; Unmark certain pairs of "< .... >" which are currently marked as @@ -5040,25 +5044,39 @@ comment at the start of cc-engine.el for more info." ;; 2010-01-29. (save-excursion (let ((beg-lit-limits (progn (goto-char beg) (c-literal-limits))) - (end-lit-limits (progn (goto-char end) (c-literal-limits)))) + (end-lit-limits (progn (goto-char end) (c-literal-limits))) + new-beg new-end need-new-beg need-new-end) ;; Locate the barrier before the changed region (goto-char (if beg-lit-limits (car beg-lit-limits) beg)) (c-syntactic-skip-backward "^;{}" (max (- beg 2048) (point-min))) + (setq new-beg (point)) ;; Remove the syntax-table properties from each pertinent <...> pair. ;; Firsly, the ones with the < before beg and > after beg. (while (c-search-forward-char-property 'category 'c-<-as-paren-syntax beg) - (c-clear-<-pair-props-if-match-after beg (1- (point)))) + (if (c-clear-<-pair-props-if-match-after beg (1- (point))) + (setq need-new-beg t))) ;; Locate the barrier after END. (goto-char (if end-lit-limits (cdr end-lit-limits) end)) (c-syntactic-re-search-forward "[;{}]" (min (+ end 2048) (point-max)) 'end) + (setq new-end (point)) ;; Remove syntax-table properties from the remaining pertinent <...> ;; pairs, those with a > after end and < before end. (while (c-search-backward-char-property 'category 'c->-as-paren-syntax end) - (c-clear->-pair-props-if-match-before end))))) + (if (c-clear->-pair-props-if-match-before end) + (setq need-new-end t))) + + ;; Extend the fontification region, if needed. + (when need-new-beg + (goto-char new-beg) + (c-forward-syntactic-ws) + (and (< (point) c-new-BEG) (setq c-new-BEG (point)))) + + (when need-new-end + (and (> new-end c-new-END) (setq c-new-END new-end)))))) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index ed17e6f34e6..070d044c199 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -640,6 +640,8 @@ compatible with old code; callers should always specify it." ;; Starting a mode is a sort of "change". So call the change functions... (save-restriction (widen) + (setq c-new-BEG (point-min)) + (setq c-new-END (point-max)) (save-excursion (if c-get-state-before-change-functions (mapc (lambda (fn) @@ -660,6 +662,17 @@ compatible with old code; callers should always specify it." (and (cdr rfn) (setq require-final-newline mode-require-final-newline))))) +(defun c-count-cfss (lv-alist) + ;; LV-ALIST is an alist like `file-local-variables-alist'. Count how many + ;; elements with the key `c-file-style' there are in it. + (let ((elt-ptr lv-alist) elt (cownt 0)) + (while elt-ptr + (setq elt (car elt-ptr) + elt-ptr (cdr elt-ptr)) + (when (eq (car elt) 'c-file-style) + (setq cownt (1+ cownt)))) + cownt)) + (defun c-before-hack-hook () "Set the CC Mode style and \"offsets\" when in the buffer's local variables. They are set only when, respectively, the pseudo variables @@ -667,11 +680,24 @@ They are set only when, respectively, the pseudo variables This function is called from the hook `before-hack-local-variables-hook'." (when c-buffer-is-cc-mode - (let ((stile (cdr (assq 'c-file-style file-local-variables-alist))) + (let ((mode-cons (assq 'mode file-local-variables-alist)) + (stile (cdr (assq 'c-file-style file-local-variables-alist))) (offsets (cdr (assq 'c-file-offsets file-local-variables-alist)))) + (when mode-cons + (hack-one-local-variable (car mode-cons) (cdr mode-cons)) + (setq file-local-variables-alist + (delq mode-cons file-local-variables-alist))) (when stile (or (stringp stile) (error "c-file-style is not a string")) - (c-set-style stile)) + (if (boundp 'dir-local-variables-alist) + ;; Determine whether `c-file-style' was set in the file's local + ;; variables or in a .dir-locals.el (a directory setting). + (let ((cfs-in-file-and-dir-count + (c-count-cfss file-local-variables-alist)) + (cfs-in-dir-count (c-count-cfss dir-local-variables-alist))) + (c-set-style stile + (= cfs-in-file-and-dir-count cfs-in-dir-count))) + (c-set-style stile))) (when offsets (mapc (lambda (langentry) @@ -886,17 +912,19 @@ Note that the style variables are always made local to the buffer." ;; inside a string, comment, or macro. (goto-char c-old-BOM) ; already set to old start of macro or begg. (setq c-new-BEG - (if (setq limits (c-state-literal-at (point))) - (cdr limits) ; go forward out of any string or comment. - (point))) + (min c-new-BEG + (if (setq limits (c-state-literal-at (point))) + (cdr limits) ; go forward out of any string or comment. + (point)))) (goto-char endd) (if (setq limits (c-state-literal-at (point))) (goto-char (car limits))) ; go backward out of any string or comment. (if (c-beginning-of-macro) (c-end-of-macro)) - (setq c-new-END (max (+ (- c-old-EOM old-len) (- endd begg)) - (point))) + (setq c-new-END (max c-new-END + (+ (- c-old-EOM old-len) (- endd begg)) + (point))) ;; Clear all old relevant properties. (c-clear-char-property-with-value c-new-BEG c-new-END 'syntax-table '(1)) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 7000b4bbc8a..76bd02615e3 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -196,6 +196,10 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) "^\"\\([^,\" \n\t]+\\)\", line \\([0-9]+\\)\ \\(?:[(. pos]+\\([0-9]+\\))?\\)?[:.,; (-]\\( warning:\\|[-0-9 ]*(W)\\)?" 1 2 3 (4)) + (cucumber + "\\(?:^cucumber\\(?: -p [^[:space:]]+\\)?\\|#\\)\ +\\(?: \\)\\([^\(].*\\):\\([1-9][0-9]*\\)" 1 2) + (edg-1 "^\\([^ \n]+\\)(\\([0-9]+\\)): \\(?:error\\|warnin\\(g\\)\\|remar\\(k\\)\\)" 1 2 nil (3 . 4)) @@ -325,6 +329,13 @@ during global destruction\\.$\\)" 1 2) "\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)" 2 3 nil nil) + (ruby + "^[\t ]*\\(?:from \\)?\ +\\([^\(\n][^[:space:]\n]*\\):\\([1-9][0-9]*\\)\\(:in `.*'\\)?.*$" 1 2) + + (ruby-Test::Unit + "[\t ]*\\[\\([^\(].*\\):\\([1-9][0-9]*\\)\\(\\]\\)?:$" 1 2) + (rxp "^\\(?:Error\\|Warnin\\(g\\)\\):.*\n.* line \\([0-9]+\\) char\ \\([0-9]+\\) of file://\\(.+\\)" @@ -2083,7 +2094,7 @@ and overlay is highlighted between MK and END-MK." pre-existing (let ((display-buffer-reuse-frames t) (pop-up-windows t)) - ;; Pop up a window. + ;; Pop up a window. (display-buffer (marker-buffer msg))))) (highlight-regexp (with-current-buffer (marker-buffer msg) ;; also do this while we change buffer diff --git a/lisp/progmodes/delphi.el b/lisp/progmodes/delphi.el index 1e5f1f506b3..2558456bc07 100644 --- a/lisp/progmodes/delphi.el +++ b/lisp/progmodes/delphi.el @@ -628,7 +628,9 @@ routine.") (defun delphi-token-at (p) ;; Returns the token from parsing text at point p. (when (and (<= (point-min) p) (<= p (point-max))) - (cond ((delphi-literal-token-at p)) + (cond ((delphi-char-token-at p ?\n 'newline)) + + ((delphi-literal-token-at p)) ((delphi-space-token-at p)) @@ -638,7 +640,6 @@ routine.") ((delphi-char-token-at p ?\) 'close-group)) ((delphi-char-token-at p ?\[ 'open-group)) ((delphi-char-token-at p ?\] 'close-group)) - ((delphi-char-token-at p ?\n 'newline)) ((delphi-char-token-at p ?\; 'semicolon)) ((delphi-char-token-at p ?. 'dot)) ((delphi-char-token-at p ?, 'comma)) @@ -888,7 +889,24 @@ non-delphi buffer. Set to nil in a delphi buffer. To override, just do: (setq token (delphi-block-start token))) ;; Regular block start found. - ((delphi-is token-kind delphi-block-statements) (throw 'done token)) + ((delphi-is token-kind delphi-block-statements) + (throw 'done + ;; As a special case, when a "case" block appears + ;; within a record declaration (to denote a variant + ;; part), the record declaration should be considered + ;; the enclosing block. + (if (eq 'case token-kind) + (let ((enclosing-token + (delphi-block-start token + 'stop-on-class))) + (if + (eq 'record + (delphi-token-kind enclosing-token)) + (if stop-on-class + enclosing-token + (delphi-previous-token enclosing-token)) + token)) + token))) ;; A class/record start also begins a block. ((delphi-composite-type-start token last-token) @@ -1058,6 +1076,7 @@ non-delphi buffer. Set to nil in a delphi buffer. To override, just do: (token-kind nil) (from-kind (delphi-token-kind from-token)) (last-colon nil) + (last-of nil) (last-token nil)) (catch 'done (while token @@ -1101,9 +1120,17 @@ non-delphi buffer. Set to nil in a delphi buffer. To override, just do: ;; Ignore whitespace. ((delphi-is token-kind delphi-whitespace)) - ;; Remember any ':' we encounter, since that affects how we indent to - ;; a case statement. - ((eq 'colon token-kind) (setq last-colon token)) + ;; Remember any "of" we encounter, since that affects how we + ;; indent to a case statement within a record declaration + ;; (i.e. a variant part). + ((eq 'of token-kind) + (setq last-of token)) + + ;; Remember any ':' we encounter (until we reach an "of"), + ;; since that affects how we indent to case statements in + ;; general. + ((eq 'colon token-kind) + (unless last-of (setq last-colon token))) ;; A case statement delimits a previous statement. We indent labels ;; specially. diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index 402893c5946..1d042c99451 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -1602,7 +1602,7 @@ Capitalize system variables - action only `(lambda () (interactive) (self-insert-command 1) - ,@(if (listp cmd) cmd (list cmd)))))) + ,(if (listp cmd) cmd (list cmd)))))) ;; Set action and key bindings. ;; See description of the function `idlwave-action-and-binding'. diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 6bd8fbc2442..60ed14afbac 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -474,8 +474,7 @@ for preventing Firefox from stealing the keyboard focus." (defcustom js-js-tmpdir "~/.emacs.d/js/js" "Temporary directory used by `js-mode' to communicate with Mozilla. -This directory must be readable and writable by both Mozilla and -Emacs." +This directory must be readable and writable by both Mozilla and Emacs." :type 'directory :group 'js) @@ -499,11 +498,11 @@ getting timeout messages." (define-key keymap [(meta ?.)] #'js-find-symbol) (easy-menu-define nil keymap "Javascript Menu" '("Javascript" - ["Select new Mozilla context…" js-set-js-context + ["Select New Mozilla Context..." js-set-js-context (fboundp #'inferior-moz-process)] - ["Evaluate expression in Mozilla context…" js-eval + ["Evaluate Expression in Mozilla Context..." js-eval (fboundp #'inferior-moz-process)] - ["Send current function to Mozilla…" js-eval-defun + ["Send Current Function to Mozilla..." js-eval-defun (fboundp #'inferior-moz-process)])) keymap) "Keymap for `js-mode'.") diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 4e0f326e2d4..2b09e346331 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -93,7 +93,7 @@ (defvar python-font-lock-keywords `(,(rx symbol-start - ;; From v 2.5 reference, keywords. + ;; From v 2.7 reference, keywords. ;; def and class dealt with separately below (or "and" "as" "assert" "break" "continue" "del" "elif" "else" "except" "exec" "finally" "for" "from" "global" "if" @@ -102,7 +102,7 @@ ;; Not real keywords, but close enough to be fontified as such "self" "True" "False") symbol-end) - (,(rx symbol-start "None" symbol-end) ; see Keywords in 2.5 manual + (,(rx symbol-start "None" symbol-end) ; see Keywords in 2.7 manual . font-lock-constant-face) ;; Definitions (,(rx symbol-start (group "class") (1+ space) (group (1+ (or word ?_)))) @@ -117,7 +117,7 @@ (0+ "." (1+ (or word ?_))))) (1 font-lock-type-face)) ;; Built-ins. (The next three blocks are from - ;; `__builtin__.__dict__.keys()' in Python 2.5.1.) These patterns + ;; `__builtin__.__dict__.keys()' in Python 2.7) These patterns ;; are debateable, but they at least help to spot possible ;; shadowing of builtins. (,(rx symbol-start (or @@ -135,7 +135,9 @@ "SystemExit" "TabError" "TypeError" "UnboundLocalError" "UnicodeDecodeError" "UnicodeEncodeError" "UnicodeError" "UnicodeTranslateError" "UnicodeWarning" "UserWarning" - "ValueError" "Warning" "ZeroDivisionError") symbol-end) + "ValueError" "Warning" "ZeroDivisionError" + ;; Python 2.7 + "BufferError" "BytesWarning" "WindowsError") symbol-end) . font-lock-type-face) (,(rx (or line-start (not (any ". \t"))) (* (any " \t")) symbol-start (group (or @@ -152,12 +154,16 @@ "range" "raw_input" "reduce" "reload" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type" "unichr" "unicode" "vars" - "xrange" "zip")) symbol-end) + "xrange" "zip" + ;; Python 2.7. + "bin" "bytearray" "bytes" "format" "memoryview" "next" "print" + )) symbol-end) (1 font-lock-builtin-face)) (,(rx symbol-start (or ;; other built-ins "True" "False" "None" "Ellipsis" - "_" "__debug__" "__doc__" "__import__" "__name__") symbol-end) + "_" "__debug__" "__doc__" "__import__" "__name__" "__package__") + symbol-end) . font-lock-builtin-face))) (defconst python-font-lock-syntactic-keywords diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 59d85e60eef..a75c5b01bb8 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -166,7 +166,6 @@ This should only be called after matching against `ruby-here-doc-end-re'." (define-key map (kbd "M-C-n") 'ruby-end-of-block) (define-key map (kbd "M-C-h") 'ruby-mark-defun) (define-key map (kbd "M-C-q") 'ruby-indent-exp) - (define-key map (kbd "TAB") 'ruby-indent-line) (define-key map (kbd "C-M-h") 'backward-kill-word) (define-key map (kbd "C-j") 'reindent-then-newline-and-indent) (define-key map (kbd "C-m") 'newline) @@ -1390,6 +1389,8 @@ The variable `ruby-indent-level' controls the amount of indentation. (setq major-mode 'ruby-mode) (ruby-mode-variables) + (set (make-local-variable 'indent-line-function) + 'ruby-indent-line) (set (make-local-variable 'imenu-create-index-function) 'ruby-imenu-create-index) (set (make-local-variable 'add-log-current-defun-function) diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 19e60da7ea2..afadcb973d0 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -5,7 +5,7 @@ ;; Author: Alex Schroeder <alex@gnu.org> ;; Maintainer: Michael Mauger <mmaug@yahoo.com> -;; Version: 2.1 +;; Version: 2.4 ;; Keywords: comm languages processes ;; URL: http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/progmodes/sql.el ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?SqlMode @@ -152,11 +152,7 @@ ;; (defcustom my-sql-xyz-login-params '(user password server database) ;; "Login parameters to needed to connect to XyzDB." -;; :type '(repeat (choice -;; (const user) -;; (const password) -;; (const server) -;; (const database))) +;; :type 'sql-login-params ;; :group 'SQL) ;; ;; (sql-set-product-feature 'xyz @@ -170,7 +166,7 @@ ;; (sql-set-product-feature 'xyz ;; :sqli-options 'my-sql-xyz-options)) -;; (defun my-sql-connect-xyz (product options) +;; (defun my-sql-comint-xyz (product options) ;; "Connect ti XyzDB in a comint buffer." ;; ;; ;; Do something with `sql-user', `sql-password', @@ -184,10 +180,10 @@ ;; (setq params (append (list "-P" sql-password) params))) ;; (if (not (string= "" sql-user)) ;; (setq params (append (list "-U" sql-user) params))) -;; (sql-connect product params))) +;; (sql-comint product params))) ;; ;; (sql-set-product-feature 'xyz -;; :sqli-connect-func 'my-sql-connect-xyz) +;; :sqli-comint-func 'my-sql-comint-xyz) ;; 6) Define a convienence function to invoke the SQL interpreter. @@ -236,7 +232,7 @@ (require 'regexp-opt)) (require 'custom) (eval-when-compile ;; needed in Emacs 19, 20 - (setq max-specpdl-size 2000)) + (setq max-specpdl-size (max max-specpdl-size 2000))) (defvar font-lock-keyword-face) (defvar font-lock-set-defaults) @@ -255,8 +251,8 @@ (defcustom sql-user "" "Default username." :type 'string - :group 'SQL) -(put 'sql-user 'safe-local-variable 'stringp) + :group 'SQL + :safe 'stringp) (defcustom sql-password "" "Default password. @@ -264,32 +260,68 @@ Storing your password in a textfile such as ~/.emacs could be dangerous. Customizing your password will store it in your ~/.emacs file." :type 'string - :group 'SQL) -(put 'sql-password 'risky-local-variable t) + :group 'SQL + :risky t) (defcustom sql-database "" "Default database." :type 'string - :group 'SQL) -(put 'sql-database 'safe-local-variable 'stringp) + :group 'SQL + :safe 'stringp) (defcustom sql-server "" "Default server or host." :type 'string - :group 'SQL) -(put 'sql-server 'safe-local-variable 'stringp) + :group 'SQL + :safe 'stringp) (defcustom sql-port nil "Default server or host." + :version "24.1" :type 'number - :group 'SQL) -(put 'sql-port 'safe-local-variable 'numberp) + :group 'SQL + :safe 'numberp) + +;; Login parameter type + +(define-widget 'sql-login-params 'lazy + "Widget definition of the login parameters list" + :tag "Login Parameters" + :type '(repeat (choice + (const user) + (const password) + (choice :tag "server" + (const server) + (list :tag "file" + (const :format "" server) + (const :format "" :file) + regexp) + (list :tag "completion" + (const :format "" server) + (const :format "" :completion) + (restricted-sexp + :match-alternatives (listp symbolp)))) + (choice :tag "database" + (const database) + (list :tag "file" + (const :format "" database) + (const :format "" :file) + regexp) + (list :tag "completion" + (const :format "" database) + (const :format "" :completion) + (restricted-sexp + :match-alternatives (listp symbolp)))) + (const port)))) ;; SQL Product support (defvar sql-interactive-product nil "Product under `sql-interactive-mode'.") +(defvar sql-connection nil + "Connection name if interactive session started by `sql-connect'.") + (defvar sql-product-alist '((ansi :name "ANSI" @@ -301,7 +333,7 @@ Customizing your password will store it in your ~/.emacs file." :sqli-program sql-db2-program :sqli-options sql-db2-options :sqli-login sql-db2-login-params - :sqli-connect-func sql-connect-db2 + :sqli-comint-func sql-comint-db2 :prompt-regexp "^db2 => " :prompt-length 7 :input-filter sql-escape-newlines-filter) @@ -312,7 +344,7 @@ Customizing your password will store it in your ~/.emacs file." :sqli-program sql-informix-program :sqli-options sql-informix-options :sqli-login sql-informix-login-params - :sqli-connect-func sql-connect-informix + :sqli-comint-func sql-comint-informix :prompt-regexp "^> " :prompt-length 2 :syntax-alist ((?{ . "<") (?} . ">"))) @@ -323,7 +355,7 @@ Customizing your password will store it in your ~/.emacs file." :sqli-program sql-ingres-program :sqli-options sql-ingres-options :sqli-login sql-ingres-login-params - :sqli-connect-func sql-connect-ingres + :sqli-comint-func sql-comint-ingres :prompt-regexp "^\* " :prompt-length 2) @@ -333,7 +365,7 @@ Customizing your password will store it in your ~/.emacs file." :sqli-program sql-interbase-program :sqli-options sql-interbase-options :sqli-login sql-interbase-login-params - :sqli-connect-func sql-connect-interbase + :sqli-comint-func sql-comint-interbase :prompt-regexp "^SQL> " :prompt-length 5) @@ -343,7 +375,7 @@ Customizing your password will store it in your ~/.emacs file." :sqli-program sql-linter-program :sqli-options sql-linter-options :sqli-login sql-linter-login-params - :sqli-connect-func sql-connect-linter + :sqli-comint-func sql-comint-linter :prompt-regexp "^SQL>" :prompt-length 4) @@ -353,7 +385,7 @@ Customizing your password will store it in your ~/.emacs file." :sqli-program sql-ms-program :sqli-options sql-ms-options :sqli-login sql-ms-login-params - :sqli-connect-func sql-connect-ms + :sqli-comint-func sql-comint-ms :prompt-regexp "^[0-9]*>" :prompt-length 5 :syntax-alist ((?@ . "w")) @@ -366,7 +398,7 @@ Customizing your password will store it in your ~/.emacs file." :sqli-program sql-mysql-program :sqli-options sql-mysql-options :sqli-login sql-mysql-login-params - :sqli-connect-func sql-connect-mysql + :sqli-comint-func sql-comint-mysql :prompt-regexp "^mysql> " :prompt-length 6 :input-filter sql-remove-tabs-filter) @@ -377,7 +409,7 @@ Customizing your password will store it in your ~/.emacs file." :sqli-program sql-oracle-program :sqli-options sql-oracle-options :sqli-login sql-oracle-login-params - :sqli-connect-func sql-connect-oracle + :sqli-comint-func sql-comint-oracle :prompt-regexp "^SQL> " :prompt-length 5 :syntax-alist ((?$ . "w") (?# . "w")) @@ -391,7 +423,7 @@ Customizing your password will store it in your ~/.emacs file." :sqli-program sql-postgres-program :sqli-options sql-postgres-options :sqli-login sql-postgres-login-params - :sqli-connect-func sql-connect-postgres + :sqli-comint-func sql-comint-postgres :prompt-regexp "^.*[#>] *" :prompt-length 5 :input-filter sql-remove-tabs-filter @@ -403,7 +435,7 @@ Customizing your password will store it in your ~/.emacs file." :sqli-program sql-solid-program :sqli-options sql-solid-options :sqli-login sql-solid-login-params - :sqli-connect-func sql-connect-solid + :sqli-comint-func sql-comint-solid :prompt-regexp "^" :prompt-length 0) @@ -414,7 +446,7 @@ Customizing your password will store it in your ~/.emacs file." :sqli-program sql-sqlite-program :sqli-options sql-sqlite-options :sqli-login sql-sqlite-login-params - :sqli-connect-func sql-connect-sqlite + :sqli-comint-func sql-comint-sqlite :prompt-regexp "^sqlite> " :prompt-length 8) @@ -424,7 +456,7 @@ Customizing your password will store it in your ~/.emacs file." :sqli-program sql-sybase-program :sqli-options sql-sybase-options :sqli-login sql-sybase-login-params - :sqli-connect-func sql-connect-sybase + :sqli-comint-func sql-comint-sybase :prompt-regexp "^SQL> " :prompt-length 5 :syntax-alist ((?@ . "w")) @@ -463,7 +495,7 @@ may be any one of the following: database and server) needed to connect to the database. - :sqli-connect-func name of a function which accepts no + :sqli-comint-func name of a function which accepts no parameters that will use the values of `sql-user', `sql-password', `sql-database' and `sql-server' to open a @@ -507,6 +539,55 @@ settings.") (defvar sql-indirect-features '(:font-lock :sqli-program :sqli-options :sqli-login)) +;;;###autoload +(defcustom sql-connection-alist nil + "An alist of connection parameters for interacting with a SQL + product. + +Each element of the alist is as follows: + + \(CONNECTION \(SQL-VARIABLE VALUE) ...) + +Where CONNECTION is a symbol identifying the connection, SQL-VARIABLE +is the symbol name of a SQL mode variable, and VALUE is the value to +be assigned to the variable. + +The most common SQL-VARIABLE settings associated with a connection +are: + + `sql-product' + `sql-user' + `sql-password' + `sql-port' + `sql-server' + `sql-database' + +If a SQL-VARIABLE is part of the connection, it will not be +prompted for during login." + + :type `(alist :key-type (string :tag "Connection") + :value-type + (set + (group (const :tag "Product" sql-product) + (choice + ,@(mapcar (lambda (prod-info) + `(const :tag + ,(or (plist-get (cdr prod-info) :name) + (capitalize (symbol-name (car prod-info)))) + (quote ,(car prod-info)))) + sql-product-alist))) + (group (const :tag "Username" sql-user) string) + (group (const :tag "Password" sql-password) string) + (group (const :tag "Server" sql-server) string) + (group (const :tag "Database" sql-database) string) + (group (const :tag "Port" sql-port) integer) + (repeat :inline t + (list :tab "Other" + (symbol :tag " Variable Symbol") + (sexp :tag "Value Expression"))))) + :version "24.1" + :group 'SQL) + ;;;###autoload (defcustom sql-product 'ansi "Select the SQL database product used so that buffers can be @@ -518,11 +599,8 @@ highlighted properly when you open them." (capitalize (symbol-name (car prod-info)))) ,(car prod-info))) sql-product-alist)) - :group 'SQL) -(put 'sql-product 'safe-local-variable 'symbolp) - -(defvar sql-interactive-product nil - "Product under `sql-interactive-mode'.") + :group 'SQL + :safe 'symbolp) ;; misc customization of sql.el behaviour @@ -677,11 +755,7 @@ You will find the file in your Orant\\bin directory." (defcustom sql-oracle-login-params '(user password database) "List of login parameters needed to connect to Oracle." - :type '(repeat (choice - (const user) - (const password) - (const server) - (const database))) + :type 'sql-login-params :version "24.1" :group 'SQL) @@ -702,7 +776,7 @@ to be safe: ;; Customization for SQLite -(defcustom sql-sqlite-program "sqlite" +(defcustom sql-sqlite-program "sqlite3" "Command to start SQLite. Starts `sql-interactive-mode' after doing some setup." @@ -715,13 +789,9 @@ Starts `sql-interactive-mode' after doing some setup." :version "20.8" :group 'SQL) -(defcustom sql-sqlite-login-params '(database) +(defcustom sql-sqlite-login-params '((database :file ".*\\.db")) "List of login parameters needed to connect to SQLite." - :type '(repeat (choice - (const user) - (const password) - (const server) - (const database))) + :type 'sql-login-params :version "24.1" :group 'SQL) @@ -744,12 +814,7 @@ on Windows: \"-C\" \"-t\" \"-f\" \"-n\"." (defcustom sql-mysql-login-params '(user password database server) "List of login parameters needed to connect to MySql." - :type '(repeat (choice - (const user) - (const password) - (const server) - (const database) - (const port))) + :type 'sql-login-params :version "24.1" :group 'SQL) @@ -764,11 +829,7 @@ Starts `sql-interactive-mode' after doing some setup." (defcustom sql-solid-login-params '(user password server) "List of login parameters needed to connect to Solid." - :type '(repeat (choice - (const user) - (const password) - (const server) - (const database))) + :type 'sql-login-params :version "24.1" :group 'SQL) @@ -790,11 +851,7 @@ Some versions of isql might require the -n option in order to work." (defcustom sql-sybase-login-params '(server user password database) "List of login parameters needed to connect to Sybase." - :type '(repeat (choice - (const user) - (const password) - (const server) - (const database))) + :type 'sql-login-params :version "24.1" :group 'SQL) @@ -809,11 +866,7 @@ Starts `sql-interactive-mode' after doing some setup." (defcustom sql-informix-login-params '(database) "List of login parameters needed to connect to Informix." - :type '(repeat (choice - (const user) - (const password) - (const server) - (const database))) + :type 'sql-login-params :version "24.1" :group 'SQL) @@ -828,11 +881,7 @@ Starts `sql-interactive-mode' after doing some setup." (defcustom sql-ingres-login-params '(database) "List of login parameters needed to connect to Ingres." - :type '(repeat (choice - (const user) - (const password) - (const server) - (const database))) + :type 'sql-login-params :version "24.1" :group 'SQL) @@ -854,11 +903,7 @@ Starts `sql-interactive-mode' after doing some setup." (defcustom sql-ms-login-params '(user password server database) "List of login parameters needed to connect to Microsoft." - :type '(repeat (choice - (const user) - (const password) - (const server) - (const database))) + :type 'sql-login-params :version "24.1" :group 'SQL) @@ -885,11 +930,7 @@ add your name with a \"-U\" prefix (such as \"-Umark\") to the list." (defcustom sql-postgres-login-params '(user database server) "List of login parameters needed to connect to Postgres." - :type '(repeat (choice - (const user) - (const password) - (const server) - (const database))) + :type 'sql-login-params :version "24.1" :group 'SQL) @@ -910,11 +951,7 @@ Starts `sql-interactive-mode' after doing some setup." (defcustom sql-interbase-login-params '(user password database) "List of login parameters needed to connect to Interbase." - :type '(repeat (choice - (const user) - (const password) - (const server) - (const database))) + :type 'sql-login-params :version "24.1" :group 'SQL) @@ -935,11 +972,7 @@ Starts `sql-interactive-mode' after doing some setup." (defcustom sql-db2-login-params nil "List of login parameters needed to connect to DB2." - :type '(repeat (choice - (const user) - (const password) - (const server) - (const database))) + :type 'sql-login-params :version "24.1" :group 'SQL) @@ -960,11 +993,7 @@ Starts `sql-interactive-mode' after doing some setup." (defcustom sql-linter-login-params '(user password database server) "Login parameters to needed to connect to Linter." - :type '(repeat (choice - (const user) - (const password) - (const server) - (const database))) + :type 'sql-login-params :version "24.1" :group 'SQL) @@ -1056,8 +1085,17 @@ Based on `comint-mode-map'.") (get-buffer-process sql-buffer))] ["Send String" sql-send-string (and (buffer-live-p sql-buffer) (get-buffer-process sql-buffer))] - ["--" nil nil] - ["Start SQLi session" sql-product-interactive (sql-get-product-feature sql-product :sqli-connect-func)] + "--" + ["Start SQLi session" sql-product-interactive + :visible (not sql-connection-alist) + :enable (sql-get-product-feature sql-product :sqli-comint-func)] + ("Start..." + :visible sql-connection-alist + :filter sql-connection-menu-filter + "--" + ["New SQLi Session" sql-product-interactive (sql-get-product-feature sql-product :sqli-comint-func)]) + ["--" + :visible sql-connection-alist] ["Show SQLi buffer" sql-show-sqli-buffer t] ["Set SQLi buffer" sql-set-sqli-buffer t] ["Pop to SQLi buffer after send" @@ -1085,7 +1123,8 @@ Based on `comint-mode-map'.") sql-interactive-mode-menu sql-interactive-mode-map "Menu for `sql-interactive-mode'." '("SQL" - ["Rename Buffer" sql-rename-buffer t])) + ["Rename Buffer" sql-rename-buffer t] + ["Save Connection" sql-save-connection (not sql-connection)])) ;; Abbreviations -- if you want more of them, define them in your ;; ~/.emacs file. Abbrevs have to be enabled in your ~/.emacs, too. @@ -1969,7 +2008,7 @@ configuration." ;; Each product is represented by a radio ;; button with it's display name. `[,display - (lambda () (interactive) (sql-set-product ',product)) + (sql-set-product ',product) :style radio :selected (eq sql-product ',product)] ;; Maintain the product list in @@ -2016,13 +2055,17 @@ argument must be a plist keyword accepted by (setcdr p (plist-put (cdr p) feature newvalue))) (message "`%s' is not a known product; use `sql-add-product' to add it first." product)))) -(defun sql-get-product-feature (product feature &optional fallback) +(defun sql-get-product-feature (product feature &optional fallback not-indirect) "Lookup FEATURE associated with a SQL PRODUCT. If the FEATURE is nil for PRODUCT, and FALLBACK is specified, then the FEATURE associated with the FALLBACK product is returned. +If the FEATURE is in the list `sql-indirect-features', and the +NOT-INDIRECT parameter is not set, then the value of the symbol +stored in the connect alist is returned. + See `sql-product-alist' for a list of products and supported features." (let* ((p (assoc product sql-product-alist)) (v (plist-get (cdr p) feature))) @@ -2036,10 +2079,12 @@ See `sql-product-alist' for a list of products and supported features." (if (and (member feature sql-indirect-features) + (not not-indirect) (symbolp v)) (symbol-value v) v)) - (message "`%s' is not a known product; use `sql-add-product' to add it first." product)))) + (message "`%s' is not a known product; use `sql-add-product' to add it first." product) + nil))) (defun sql-product-font-lock (keywords-only imenu) "Configure font-lock and imenu with product-specific settings. @@ -2126,6 +2171,19 @@ adds a fontification pattern to fontify identifiers ending in (append old-val keywords) (append keywords old-val)))))) +(defun sql-for-each-login (login-params body) + "Iterates through login parameters and returns a list of results." + + (delq nil + (mapcar + (lambda (param) + (let ((token (or (and (listp param) (car param)) param)) + (type (or (and (listp param) (nth 1 param)) nil)) + (arg (or (and (listp param) (nth 2 param)) nil))) + + (funcall body token type arg))) + login-params))) + ;;; Functions to switch highlighting @@ -2287,6 +2345,38 @@ appended to the SQLi buffer without disturbing your SQL buffer." "Read a password using PROMPT. Optional DEFAULT is password to start with." (read-passwd prompt nil default)) +(defun sql-get-login-ext (prompt last-value history-var type arg) + "Prompt user with extended login parameters. + +If TYPE is nil, then the user is simply prompted for a string +value. + +If TYPE is `:file', then the user is prompted for a file +name that must match the regexp pattern specified in the ARG +argument. + +If TYPE is `:completion', then the user is prompted for a string +specified by ARG. (ARG is used as the PREDICATE argument to +`completing-read'.)" + (cond + ((eq type nil) + (read-from-minibuffer prompt last-value nil nil history-var)) + + ((eq type :file) + (let ((use-dialog-box nil)) + (expand-file-name + (read-file-name prompt + (file-name-directory last-value) nil t + (file-name-nondirectory last-value) + (if arg + `(lambda (f) + (string-match (concat "\\<" ,arg "\\>") + (file-name-nondirectory f))) + nil))))) + + ((eq type :completion) + (completing-read prompt arg nil t last-value history-var)))) + (defun sql-get-login (&rest what) "Get username, password and database from the user. @@ -2304,32 +2394,48 @@ symbol `password', for the server if it contains the symbol `database'. The members of WHAT are processed in the order in which they are provided. +The tokens for `database' and `server' may also be lists to +control or limit the values that can be supplied. These can be +of the form: + + \(database :file \".+\\\\.EXT\") + \(database :completion FUNCTION) + +The `server' token supports the same forms. + In order to ask the user for username, password and database, call the function like this: (sql-get-login 'user 'password 'database)." (interactive) - (while what - (cond - ((eq (car what) 'user) ; user - (setq sql-user - (read-from-minibuffer "User: " sql-user nil nil - 'sql-user-history))) - ((eq (car what) 'password) ; password - (setq sql-password - (sql-read-passwd "Password: " sql-password))) + (mapcar + (lambda (w) + (let ((token (or (and (listp w) (car w)) w)) + (type (or (and (listp w) (nth 1 w)) nil)) + (arg (or (and (listp w) (nth 2 w)) nil))) - ((eq (car what) 'server) ; server - (setq sql-server - (read-from-minibuffer "Server: " sql-server nil nil - 'sql-server-history))) - ((eq (car what) 'port) ; port - (setq sql-port - (read-from-minibuffer "Port: " sql-port nil nil - 'sql-port-history))) - ((eq (car what) 'database) ; database - (setq sql-database - (read-from-minibuffer "Database: " sql-database nil nil - 'sql-database-history)))) - (setq what (cdr what)))) + (cond + ((eq token 'user) ; user + (setq sql-user + (read-from-minibuffer "User: " sql-user nil nil + 'sql-user-history))) + + ((eq token 'password) ; password + (setq sql-password + (sql-read-passwd "Password: " sql-password))) + + ((eq token 'server) ; server + (setq sql-server + (sql-get-login-ext "Server: " sql-server + 'sql-server-history type arg))) + + ((eq token 'database) ; database + (setq sql-database + (sql-get-login-ext "Database: " sql-database + 'sql-database-history type arg))) + + ((eq token 'port) ; port + (setq sql-port + (read-number "Port: " sql-port)))))) + what)) (defun sql-find-sqli-buffer () "Returns the current default SQLi buffer or nil. @@ -2419,17 +2525,62 @@ variable `sql-buffer'. See `sql-help' on how to create such a buffer." "Return a string that can be used to rename a SQLi buffer. This is used to set `sql-alternate-buffer-name' within -`sql-interactive-mode'." - (concat (if (string= "" sql-user) - (if (string= "" (user-login-name)) - () - (concat (user-login-name) "/")) - (concat sql-user "/")) - (if (string= "" sql-database) - (if (string= "" sql-server) - (system-name) - sql-server) - sql-database))) +`sql-interactive-mode'. + +If the session was started with `sql-connect' then the alternate +name would be the name of the connection. + +Otherwise, it uses the parameters identified by the :sqlilogin +parameter. + +If all else fails, the alternate name would be the user and +server/database name." + + (let ((name "")) + + ;; Build a name using the :sqli-login setting + (setq name + (apply 'concat + (apply 'append nil + (sql-for-each-login + (sql-get-product-feature sql-product :sqli-login) + (lambda (token type arg) + (cond + ((eq token 'user) (list "/" sql-user)) + ((eq token 'port) (list ":" sql-port)) + ((eq token 'server) + (list "." (if (eq type :file) + (file-name-nondirectory sql-server) + sql-server))) + ((eq token 'database) + (list "@" (if (eq type :file) + (file-name-nondirectory sql-database) + sql-database))) + + ((eq token 'password) nil) + (t nil))))))) + + + ;; If there's a connection, use it and the name thus far + (if sql-connection + (format "<%s>%s" sql-connection (or name "")) + + ;; If there is no name, try to create something meaningful + (if (string= "" (or name "")) + (concat + (if (string= "" sql-user) + (if (string= "" (user-login-name)) + () + (concat (user-login-name) "/")) + (concat sql-user "/")) + (if (string= "" sql-database) + (if (string= "" sql-server) + (system-name) + sql-server) + sql-database)) + + ;; We've got a name, go with it (without the first punctuation char) + (substring name 1))))) (defun sql-rename-buffer () "Rename a SQLi buffer." @@ -2788,6 +2939,8 @@ you entered, right above the output it created. (setq abbrev-all-caps 1) ;; Exiting the process will call sql-stop. (set-process-sentinel (get-buffer-process sql-buffer) 'sql-stop) + ;; Save the connection name + (make-local-variable 'sql-connection) ;; Create a usefull name for renaming this buffer later. (make-local-variable 'sql-alternate-buffer-name) (setq sql-alternate-buffer-name (sql-make-alternate-buffer-name)) @@ -2831,6 +2984,133 @@ Sentinels will always get the two parameters PROCESS and EVENT." +;;; Connection handling + +;;;###autoload +(defun sql-connect (connection) + "Connect to an interactive session using CONNECTION settings. + +See `sql-connection-alist' to see how to define connections and +their settings. + +The user will not be prompted for any login parameters if a value +is specified in the connection settings." + + ;; Prompt for the connection from those defined in the alist + (interactive + (if sql-connection-alist + (list + (let ((completion-ignore-case t)) + (completing-read "Connection: " + (mapcar (lambda (c) (car c)) + sql-connection-alist) + nil t nil nil '(())))) + nil)) + + ;; Are there connections defined + (if sql-connection-alist + ;; Was one selected + (when connection + ;; Get connection settings + (let ((connect-set (assoc connection sql-connection-alist))) + ;; Settings are defined + (if connect-set + ;; Set the desired parameters + (eval `(let* + (,@(cdr connect-set) + ;; :sqli-login params variable + (param-var (sql-get-product-feature sql-product + :sqli-login nil t)) + ;; :sqli-login params value + (login-params (sql-get-product-feature sql-product + :sqli-login)) + ;; which params are in the connection + (set-params (mapcar + (lambda (v) + (cond + ((eq (car v) 'sql-user) 'user) + ((eq (car v) 'sql-password) 'password) + ((eq (car v) 'sql-server) 'server) + ((eq (car v) 'sql-database) 'database) + ((eq (car v) 'sql-port) 'port) + (t (car v)))) + (cdr connect-set))) + ;; the remaining params (w/o the connection params) + (rem-params (sql-for-each-login + login-params + (lambda (token type arg) + (unless (member token set-params) + (if (or type arg) + (list token type arg) + token))))) + ;; Remember the connection + (sql-connection connection)) + + ;; Set the remaining parameters and start the + ;; interactive session + (eval `(let ((,param-var ',rem-params)) + (sql-product-interactive sql-product))))) + (message "SQL Connection <%s> does not exist" connection) + nil))) + (message "No SQL Connections defined") + nil)) + +(defun sql-save-connection (name) + "Captures the connection information of the current SQLi session. + +The information is appended to `sql-connection-alist' and +optionally is saved to the user's init file." + + (interactive "sNew connection name: ") + + (if sql-connection + (message "This session was started by a connection; it's already been saved.") + + (let ((login (sql-get-product-feature sql-product :sqli-login)) + (alist sql-connection-alist) + connect) + + ;; Remove the existing connection if the user says so + (when (and (assoc name alist) + (yes-or-no-p (format "Replace connection definition <%s>? " name))) + (setq alist (assq-delete-all name alist))) + + ;; Add the new connection if it doesn't exist + (if (assoc name alist) + (message "Connection <%s> already exists" name) + (setq connect + (append (list name) + (sql-for-each-login + `(product ,@login) + (lambda (token type arg) + (cond + ((eq token 'product) `(sql-product ',sql-product)) + ((eq token 'user) `(sql-user ,sql-user)) + ((eq token 'database) `(sql-database ,sql-database)) + ((eq token 'server) `(sql-server ,sql-server)) + ((eq token 'port) `(sql-port ,sql-port))))))) + + (setq alist (append alist (list connect))) + + ;; confirm whether we want to save the connections + (if (yes-or-no-p "Save the connections for future sessions? ") + (customize-save-variable 'sql-connection-alist alist) + (customize-set-variable 'sql-connection-alist alist)))))) + +(defun sql-connection-menu-filter (tail) + "Generates menu entries for using each connection." + (append + (mapcar + (lambda (conn) + (vector + (format "Connection <%s>" (car conn)) + (list 'sql-connect (car conn)) + t)) + sql-connection-alist) + tail)) + + + ;;; Entry functions for different SQL interpreters. ;;;###autoload @@ -2851,66 +3131,67 @@ If buffer exists and a process is running, just switch to buffer `*SQL*'. sql-product-alist) nil 'require-match (or (and sql-product (symbol-name sql-product)) "ansi")))) - ((symbolp product) product) ; Product specified + ((and product ; Product specified + (symbolp product)) product) (t sql-product))) ; Default to sql-product - (when (sql-get-product-feature product :sqli-connect-func) - (if (and sql-buffer - (buffer-live-p sql-buffer) - (comint-check-proc sql-buffer)) - (pop-to-buffer sql-buffer) + (if product + (when (sql-get-product-feature product :sqli-comint-func) + (if (and sql-buffer + (buffer-live-p sql-buffer) + (comint-check-proc sql-buffer)) + (pop-to-buffer sql-buffer) - ;; Is the current buffer in sql-mode and - ;; there is a buffer local setting of sql-buffer - (let* ((start-buffer - (and (derived-mode-p 'sql-mode) - (current-buffer))) - (start-sql-buffer - (and start-buffer - (let (found) - (dolist (var (buffer-local-variables)) - (and (consp var) - (eq (car var) 'sql-buffer) - (buffer-live-p (cdr var)) - (get-buffer-process (cdr var)) - (setq found (cdr var)))) - found))) - new-sqli-buffer) + ;; Is the current buffer in sql-mode and + ;; there is a buffer local setting of sql-buffer + (let* ((start-buffer + (and (derived-mode-p 'sql-mode) + (current-buffer))) + (start-sql-buffer + (and start-buffer + (let (found) + (dolist (var (buffer-local-variables)) + (and (consp var) + (eq (car var) 'sql-buffer) + (buffer-live-p (cdr var)) + (get-buffer-process (cdr var)) + (setq found (cdr var)))) + found))) + new-sqli-buffer) - ;; Get credentials. - (apply 'sql-get-login (sql-get-product-feature product :sqli-login)) + ;; Get credentials. + (apply 'sql-get-login (sql-get-product-feature product :sqli-login)) - ;; Connect to database. - (message "Login...") - (funcall (sql-get-product-feature product :sqli-connect-func) - product - (sql-get-product-feature product :sqli-options)) + ;; Connect to database. + (message "Login...") + (funcall (sql-get-product-feature product :sqli-comint-func) + product + (sql-get-product-feature product :sqli-options)) - ;; Set SQLi mode. - (setq sql-interactive-product product - new-sqli-buffer (current-buffer) - sql-buffer new-sqli-buffer) - (sql-interactive-mode) + ;; Set SQLi mode. + (setq sql-interactive-product product + new-sqli-buffer (current-buffer) + sql-buffer new-sqli-buffer) + (sql-interactive-mode) - ;; Set `sql-buffer' in the start buffer - (when (and start-buffer (not start-sql-buffer)) - (with-current-buffer start-buffer - (setq sql-buffer new-sqli-buffer))) + ;; Set `sql-buffer' in the start buffer + (when (and start-buffer (not start-sql-buffer)) + (with-current-buffer start-buffer + (setq sql-buffer new-sqli-buffer))) - ;; All done. - (message "Login...done") - (pop-to-buffer sql-buffer))))) + ;; All done. + (message "Login...done") + (pop-to-buffer sql-buffer)))) + (message "No default SQL product defined. Set `sql-product'."))) -(defun sql-connect (product params) - "Set up a comint buffer to connect to the SQL processor. +(defun sql-comint (product params) + "Set up a comint buffer to run the SQL processor. PRODUCT is the SQL product. PARAMS is a list of strings which are passed as command line arguments." (let ((program (sql-get-product-feature product :sqli-program))) (set-buffer - (if params - (apply 'make-comint "SQL" program nil params) - (make-comint "SQL" program nil))))) + (apply 'make-comint "SQL" program nil params)))) ;;;###autoload (defun sql-oracle () @@ -2939,7 +3220,7 @@ The default comes from `process-coding-system-alist' and (interactive) (sql-product-interactive 'oracle)) -(defun sql-connect-oracle (product options) +(defun sql-comint-oracle (product options) "Create comint buffer and connect to Oracle." ;; Produce user/password@database construct. Password without user ;; is meaningless; database without user/password is meaningless, @@ -2955,7 +3236,7 @@ The default comes from `process-coding-system-alist' and (if parameter (setq parameter (nconc (list parameter) options)) (setq parameter options)) - (sql-connect product parameter))) + (sql-comint product parameter))) @@ -2986,7 +3267,7 @@ The default comes from `process-coding-system-alist' and (interactive) (sql-product-interactive 'sybase)) -(defun sql-connect-sybase (product options) +(defun sql-comint-sybase (product options) "Create comint buffer and connect to Sybase." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. @@ -2999,7 +3280,7 @@ The default comes from `process-coding-system-alist' and (setq params (append (list "-P" sql-password) params))) (if (not (string= "" sql-user)) (setq params (append (list "-U" sql-user) params))) - (sql-connect product params))) + (sql-comint product params))) @@ -3028,7 +3309,7 @@ The default comes from `process-coding-system-alist' and (interactive) (sql-product-interactive 'informix)) -(defun sql-connect-informix (product options) +(defun sql-comint-informix (product options) "Create comint buffer and connect to Informix." ;; username and password are ignored. (let ((db (if (string= "" sql-database) @@ -3036,7 +3317,7 @@ The default comes from `process-coding-system-alist' and (if (string= "" sql-server) sql-database (concat sql-database "@" sql-server))))) - (sql-connect product (append `(,db "-") options)))) + (sql-comint product (append `(,db "-") options)))) @@ -3069,15 +3350,16 @@ The default comes from `process-coding-system-alist' and (interactive) (sql-product-interactive 'sqlite)) -(defun sql-connect-sqlite (product options) +(defun sql-comint-sqlite (product options) "Create comint buffer and connect to SQLite." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. (let ((params)) (if (not (string= "" sql-database)) - (setq params (append (list sql-database) params))) + (setq params (append (list (expand-file-name sql-database)) + params))) (setq params (append options params)) - (sql-connect product params))) + (sql-comint product params))) @@ -3110,7 +3392,7 @@ The default comes from `process-coding-system-alist' and (interactive) (sql-product-interactive 'mysql)) -(defun sql-connect-mysql (product options) +(defun sql-comint-mysql (product options) "Create comint buffer and connect to MySQL." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. @@ -3126,7 +3408,7 @@ The default comes from `process-coding-system-alist' and (if (not (string= "" sql-user)) (setq params (append (list (concat "--user=" sql-user)) params))) (setq params (append options params)) - (sql-connect product params))) + (sql-comint product params))) @@ -3156,7 +3438,7 @@ The default comes from `process-coding-system-alist' and (interactive) (sql-product-interactive 'solid)) -(defun sql-connect-solid (product options) +(defun sql-comint-solid (product options) "Create comint buffer and connect to Solid." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. @@ -3167,7 +3449,7 @@ The default comes from `process-coding-system-alist' and (setq params (append (list sql-user sql-password) params))) (if (not (string= "" sql-server)) (setq params (append (list sql-server) params))) - (sql-connect product params))) + (sql-comint product params))) @@ -3196,10 +3478,10 @@ The default comes from `process-coding-system-alist' and (interactive) (sql-product-interactive 'ingres)) -(defun sql-connect-ingres (product options) +(defun sql-comint-ingres (product options) "Create comint buffer and connect to Ingres." ;; username and password are ignored. - (sql-connect product + (sql-comint product (append (if (string= "" sql-database) nil (list sql-database)) @@ -3234,7 +3516,7 @@ The default comes from `process-coding-system-alist' and (interactive) (sql-product-interactive 'ms)) -(defun sql-connect-ms (product options) +(defun sql-comint-ms (product options) "Create comint buffer and connect to Microsoft SQL Server." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. @@ -3254,7 +3536,7 @@ The default comes from `process-coding-system-alist' and ;; If -P is passed to ISQL as the last argument without a ;; password, it's considered null. (setq params (append params (list "-P"))))) - (sql-connect product params))) + (sql-comint product params))) @@ -3290,7 +3572,7 @@ Try to set `comint-output-filter-functions' like this: (interactive) (sql-product-interactive 'postgres)) -(defun sql-connect-postgres (product options) +(defun sql-comint-postgres (product options) "Create comint buffer and connect to Postgres." ;; username and password are ignored. Mark Stosberg suggest to add ;; the database at the end. Jason Beegan suggest using --pset and @@ -3304,7 +3586,7 @@ Try to set `comint-output-filter-functions' like this: (setq params (append (list "-h" sql-server) params))) (if (not (string= "" sql-user)) (setq params (append (list "-U" sql-user) params))) - (sql-connect product params))) + (sql-comint product params))) @@ -3334,7 +3616,7 @@ The default comes from `process-coding-system-alist' and (interactive) (sql-product-interactive 'interbase)) -(defun sql-connect-interbase (product options) +(defun sql-comint-interbase (product options) "Create comint buffer and connect to Interbase." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. @@ -3345,7 +3627,7 @@ The default comes from `process-coding-system-alist' and (setq params (append (list "-p" sql-password) params))) (if (not (string= "" sql-database)) (setq params (cons sql-database params))) ; add to the front! - (sql-connect product params))) + (sql-comint product params))) @@ -3379,11 +3661,11 @@ The default comes from `process-coding-system-alist' and (interactive) (sql-product-interactive 'db2)) -(defun sql-connect-db2 (product options) +(defun sql-comint-db2 (product options) "Create comint buffer and connect to DB2." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. - (sql-connect product options) + (sql-comint product options) ) ;; ;; Properly escape newlines when DB2 is interactive. ;; (setq comint-input-sender 'sql-escape-newlines-and-send)) @@ -3415,7 +3697,7 @@ input. See `sql-interactive-mode'. (interactive) (sql-product-interactive 'linter)) -(defun sql-connect-linter (product options) +(defun sql-comint-linter (product options) "Create comint buffer and connect to Linter." ;; Put all parameters to the program (if defined) in a list and call ;; make-comint. @@ -3430,7 +3712,7 @@ input. See `sql-interactive-mode'. (if (string= "" sql-database) (setenv "LINTER_MBX" nil) (setenv "LINTER_MBX" sql-database)) - (sql-connect product params) + (sql-comint product params) (setenv "LINTER_MBX" old-mbx))) diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el index e3895efac8a..1c809bbd7e0 100644 --- a/lisp/ruler-mode.el +++ b/lisp/ruler-mode.el @@ -549,22 +549,37 @@ This variable is expected to be made buffer-local by modes.") "`header-line-format' used in ruler mode. Call `ruler-mode-ruler-function' to compute the ruler value.") +;;;###autoload +(defvar ruler-mode nil + "Non-nil if Ruler mode is enabled. +Use the command `ruler-mode' to change this variable.") +(make-variable-buffer-local 'ruler-mode) + +(defun ruler--save-header-line-format () + "Install the header line format for Ruler mode. +Unless Ruler mode is already enabled, save the old header line +format first." + (when (and (not ruler-mode) + (local-variable-p 'header-line-format) + (not (local-variable-p 'ruler-mode-header-line-format-old))) + (set (make-local-variable 'ruler-mode-header-line-format-old) + header-line-format)) + (setq header-line-format ruler-mode-header-line-format)) + ;;;###autoload (define-minor-mode ruler-mode - "Display a ruler in the header line if ARG > 0." + "Toggle Ruler mode. +In Ruler mode, Emacs displays a ruler in the header line." nil nil ruler-mode-map :group 'ruler-mode + :variable (ruler-mode + . (lambda (enable) + (when enable + (ruler--save-header-line-format)) + (setq ruler-mode enable))) (if ruler-mode - (progn - ;; When `ruler-mode' is on save previous header line format - ;; and install the ruler header line format. - (when (and (local-variable-p 'header-line-format) - (not (local-variable-p 'ruler-mode-header-line-format-old))) - (set (make-local-variable 'ruler-mode-header-line-format-old) - header-line-format)) - (setq header-line-format ruler-mode-header-line-format) - (add-hook 'post-command-hook 'force-mode-line-update nil t)) + (add-hook 'post-command-hook 'force-mode-line-update nil t) ;; When `ruler-mode' is off restore previous header line format if ;; the current one is the ruler header line format. (when (eq header-line-format ruler-mode-header-line-format) diff --git a/lisp/simple.el b/lisp/simple.el index 08ed329a9b8..43cb31b226b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -844,6 +844,78 @@ Don't use this command in Lisp programs! (overlay-recenter (point)) (recenter -3)))) +(defcustom delete-active-region t + "Whether single-char deletion commands delete an active region. +This has an effect only if Transient Mark mode is enabled, and +affects `delete-forward-char' and `delete-backward-char', though +not `delete-char'. + +If the value is the symbol `kill', the active region is killed +instead of deleted." + :type '(choice (const :tag "Delete active region" t) + (const :tag "Kill active region" kill) + (const :tag "Do ordinary deletion" nil)) + :group 'editing + :version "24.1") + +(defun delete-backward-char (n &optional killflag) + "Delete the previous N characters (following if N is negative). +If Transient Mark mode is enabled, the mark is active, and N is 1, +delete the text in the region and deactivate the mark instead. +To disable this, set `delete-active-region' to nil. + +Optional second arg KILLFLAG, if non-nil, means to kill (save in +kill ring) instead of delete. Interactively, N is the prefix +arg, and KILLFLAG is set if N is explicitly specified. + +In Overwrite mode, single character backward deletion may replace +tabs with spaces so as to back over columns, unless point is at +the end of the line." + (interactive "p\nP") + (unless (integerp n) + (signal 'wrong-type-argument (list 'integerp n))) + (cond ((and (use-region-p) + delete-active-region + (= n 1)) + ;; If a region is active, kill or delete it. + (if (eq delete-active-region 'kill) + (kill-region (region-beginning) (region-end)) + (delete-region (region-beginning) (region-end)))) + ;; In Overwrite mode, maybe untabify while deleting + ((null (or (null overwrite-mode) + (<= n 0) + (memq (char-before) '(?\t ?\n)) + (eobp) + (eq (char-after) ?\n))) + (let* ((ocol (current-column)) + (val (delete-char (- n) killflag))) + (save-excursion + (insert-char ?\s (- ocol (current-column)) nil)))) + ;; Otherwise, do simple deletion. + (t (delete-char (- n) killflag)))) + +(defun delete-forward-char (n &optional killflag) + "Delete the previous N characters (following if N is negative). +If Transient Mark mode is enabled, the mark is active, and N is 1, +delete the text in the region and deactivate the mark instead. +To disable this, set `delete-active-region' to nil. + +Optional second arg KILLFLAG non-nil means to kill (save in kill +ring) instead of delete. Interactively, N is the prefix arg, and +KILLFLAG is set if N was explicitly specified." + (interactive "p\nP") + (unless (integerp n) + (signal 'wrong-type-argument (list 'integerp n))) + (cond ((and (use-region-p) + delete-active-region + (= n 1)) + ;; If a region is active, kill or delete it. + (if (eq delete-active-region 'kill) + (kill-region (region-beginning) (region-end)) + (delete-region (region-beginning) (region-end)))) + ;; Otherwise, do simple deletion. + (t (delete-char n killflag)))) + (defun mark-whole-buffer () "Put point at beginning and mark at end of buffer. You probably should not use this function in Lisp programs; @@ -3594,11 +3666,11 @@ a mistake; see the documentation of `set-mark'." (marker-position (mark-marker)) (signal 'mark-inactive nil))) -(defcustom select-active-regions nil +(defcustom select-active-regions t "If non-nil, an active region automatically becomes the window selection." :type 'boolean :group 'killing - :version "23.1") + :version "24.1") (declare-function x-selection-owner-p "xselect.c" (&optional selection)) @@ -3635,9 +3707,13 @@ This function also runs `deactivate-mark-hook'." (setq mark-active t) (unless transient-mark-mode (setq transient-mark-mode 'lambda)) - (when (and select-active-regions - (display-selections-p)) - (x-set-selection 'PRIMARY (current-buffer))))) + (select-active-region))) + +(defsubst select-active-region () + "Set the PRIMARY X selection if `select-active-regions' is non-nil." + (and select-active-regions + (display-selections-p) + (x-set-selection 'PRIMARY (current-buffer)))) (defun set-mark (pos) "Set this buffer's mark to POS. Don't use this function! @@ -3660,9 +3736,7 @@ store it in a Lisp variable. Example: (progn (setq mark-active t) (run-hooks 'activate-mark-hook) - (when (and select-active-regions - (display-selections-p)) - (x-set-selection 'PRIMARY (current-buffer))) + (select-active-region) (set-marker (mark-marker) pos (current-buffer))) ;; Normally we never clear mark-active except in Transient Mark mode. ;; But when we actually clear out the mark value too, we must @@ -3688,10 +3762,9 @@ point otherwise." This is used by commands that act specially on the region under Transient Mark mode. -The return value is t provided Transient Mark mode is enabled and -the mark is active; and, when `use-empty-active-region' is -non-nil, provided the region is empty. Otherwise, the return -value is nil. +The return value is t if Transient Mark mode is enabled and the +mark is active; furthermore, if `use-empty-active-region' is nil, +the region must not be empty. Otherwise, the return value is nil. For some commands, it may be appropriate to ignore the value of `use-empty-active-region'; in that case, use `region-active-p'." @@ -3747,6 +3820,7 @@ Display `Mark set' unless the optional second arg NOMSG is non-nil." (push-mark nil nomsg t) (setq mark-active t) (run-hooks 'activate-mark-hook) + (select-active-region) (unless nomsg (message "Mark activated"))))) @@ -3934,9 +4008,12 @@ Otherwise, if the region has been activated temporarily, deactivate it, and restore the variable `transient-mark-mode' to its earlier value." (cond ((and shift-select-mode this-command-keys-shift-translated) - (unless (and mark-active - (eq (car-safe transient-mark-mode) 'only)) - (setq transient-mark-mode + (if (and mark-active + (eq (car-safe transient-mark-mode) 'only)) + ;; Another program may have grabbed the selection; make + ;; sure we get it back now. + (select-active-region) + (setq transient-mark-mode (cons 'only (unless (eq transient-mark-mode 'lambda) transient-mark-mode))) @@ -5698,7 +5775,7 @@ Each action has the form (FUNCTION . ARGS)." The default mail mode is now Message mode. You have the following Mail mode variable%s customized: \n %s\n\nTo use Mail mode, set `mail-user-agent' to sendmail-user-agent. -To disable this warning, set `compose-mail-check-user-agent' to nil." +To disable this warning, set `compose-mail-user-agent-warnings' to nil." (if (> (length warn-vars) 1) "s" "") (mapconcat 'symbol-name warn-vars " ")))))) @@ -6450,6 +6527,7 @@ call `normal-erase-is-backspace-mode' (which see) instead." (if (if (eq normal-erase-is-backspace 'maybe) (and (not noninteractive) (or (memq system-type '(ms-dos windows-nt)) + (memq window-system '(ns)) (and (memq window-system '(x)) (fboundp 'x-backspace-delete-keys-p) (x-backspace-delete-keys-p)) diff --git a/lisp/startup.el b/lisp/startup.el index 71857076d4f..76e11491c0c 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -878,10 +878,33 @@ opening the first frame (e.g. open a connection to an X server).") (run-hooks 'before-init-hook) - ;; Under X Window, this creates the X frame and deletes the terminal frame. + ;; Under X, this creates the X frame and deletes the terminal frame. (unless (daemonp) + ;; Enable or disable the tool-bar and menu-bar. + ;; While we're at it, set `no-blinking-cursor' too. + (cond + ((or noninteractive emacs-basic-display) + (setq menu-bar-mode nil + tool-bar-mode nil + no-blinking-cursor t)) + ;; Check X resources if available. + ((memq initial-window-system '(x w32 ns)) + (let ((no-vals '("no" "off" "false" "0"))) + (if (member (x-get-resource "menuBar" "MenuBar") no-vals) + (setq menu-bar-mode nil)) + (if (member (x-get-resource "toolBar" "ToolBar") no-vals) + (setq tool-bar-mode nil)) + (if (member (x-get-resource "cursorBlink" "CursorBlink") + no-vals) + (setq no-blinking-cursor t))))) (frame-initialize)) + (when (fboundp 'x-create-frame) + ;; Set up the tool-bar (even in tty frames, since Emacs might open a + ;; graphical frame later). + (unless noninteractive + (tool-bar-setup))) + ;; Turn off blinking cursor if so specified in X resources. This is here ;; only because all other settings of no-blinking-cursor are here. (unless (or noninteractive @@ -891,25 +914,6 @@ opening the first frame (e.g. open a connection to an X server).") '("off" "false"))))) (setq no-blinking-cursor t)) - ;; If frame was created with a menu bar, set menu-bar-mode on. - (unless (or noninteractive - emacs-basic-display - (and (memq initial-window-system '(x w32)) - (<= (frame-parameter nil 'menu-bar-lines) 0))) - (menu-bar-mode 1)) - - (unless (or noninteractive (not (fboundp 'tool-bar-mode))) - ;; Set up the tool-bar. Do this even in tty frames, so that there - ;; is a tool-bar if Emacs later opens a graphical frame. - (if (or emacs-basic-display - (and (numberp (frame-parameter nil 'tool-bar-lines)) - (<= (frame-parameter nil 'tool-bar-lines) 0))) - ;; On a graphical display with the toolbar disabled via X - ;; resources, set up the toolbar without enabling it. - (tool-bar-setup) - ;; Otherwise, enable tool-bar-mode. - (tool-bar-mode 1))) - ;; Re-evaluate predefined variables whose initial value depends on ;; the runtime context. (mapc 'custom-reevaluate-setting diff --git a/lisp/subr.el b/lisp/subr.el index 61a226c20ff..c490bb89d02 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1880,12 +1880,11 @@ any other non-digit terminates the character code and is then used as input.")) ;; Note: `read-char' does it using the `ascii-character' property. ;; We should try and use read-key instead. (let ((translation (lookup-key local-function-key-map (vector char)))) - (if (arrayp translation) - (setq translated (aref translation 0)))) - (setq translated - (if (integerp char) - (char-resolve-modifiers char) - char)) + (setq translated (if (arrayp translation) + (aref translation 0) + char))) + (if (integerp translated) + (setq translated (char-resolve-modifiers translated))) (cond ((null translated)) ((not (integerp translated)) (setq unread-command-events (list char) diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el index a53d0346d94..f73b3d7e67e 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el @@ -186,14 +186,11 @@ The properties returned may include `top', `left', `height', and `width'." ;;;; Keyboard mapping. -;; These tell read-char how to convert these special chars to ASCII. -(put 'S-tab 'ascii-character (logior 16 ?\t)) - (defvar ns-alternatives-map (let ((map (make-sparse-keymap))) ;; Map certain keypad keys into ASCII characters ;; that people usually expect. - (define-key map [S-tab] [25]) + (define-key map [S-tab] [backtab]) (define-key map [M-backspace] [?\M-\d]) (define-key map [M-delete] [?\M-\d]) (define-key map [M-tab] [?\M-\t]) @@ -208,6 +205,7 @@ The properties returned may include `top', `left', `height', and `width'." (define-key global-map [?\s-,] 'customize) (define-key global-map [?\s-'] 'next-multiframe-window) (define-key global-map [?\s-`] 'other-frame) +(define-key global-map [?\s-~] 'ns-prev-frame) (define-key global-map [?\s--] 'center-line) (define-key global-map [?\s-:] 'ispell) (define-key global-map [?\s-\;] 'ispell-next) diff --git a/lisp/term/vt100.el b/lisp/term/vt100.el index 017c976ed51..24561fe835f 100644 --- a/lisp/term/vt100.el +++ b/lisp/term/vt100.el @@ -45,7 +45,7 @@ "Toggle 132/80 column mode for vt100s. With positive argument, switch to 132-column mode. With negative argument, switch to 80-column mode." - :global t :initial-value (= (frame-width) 132) + :global t :init-value (= (frame-width) 132) (send-string-to-terminal (if vt100-wide-mode "\e[?3h" "\e[?3l")) (set-frame-width terminal-frame (if vt100-wide-mode 132 80))) diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 3208ece9c09..213f7f5230b 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -1219,20 +1219,18 @@ This is the actual text stored in the X cut buffer.") "Max number of characters to put in the cut buffer. It is said that overlarge strings are slow to put into the cut buffer.") -(defcustom x-select-enable-clipboard nil +(defcustom x-select-enable-clipboard t "Non-nil means cutting and pasting uses the clipboard. -This is in addition to, but in preference to, the primary selection. - -On MS-Windows, this is non-nil by default, since Windows does not -support other types of selections. \(The primary selection that is -set by Emacs is not accessible to other programs on Windows.\)" +This is in addition to, but in preference to, the primary selection." :type 'boolean - :group 'killing) + :group 'killing + :version "24.1") -(defcustom x-select-enable-primary t +(defcustom x-select-enable-primary nil "Non-nil means cutting and pasting uses the primary selection." :type 'boolean - :group 'killing) + :group 'killing + :version "24.1") (defun x-select-text (text &optional push) "Select TEXT, a string, according to the window system. @@ -1560,12 +1558,12 @@ The value nil is the same as this list: ;; Enable CLIPBOARD copy/paste through menu bar commands. (menu-bar-enable-clipboard) - ;; Override Paste so it looks at CLIPBOARD first. - (define-key menu-bar-edit-menu [paste] - (append '(menu-item "Paste" x-clipboard-yank - :enable (not buffer-read-only) - :help "Paste (yank) text most recently cut/copied") - nil)) + ;; ;; Override Paste so it looks at CLIPBOARD first. + ;; (define-key menu-bar-edit-menu [paste] + ;; (append '(menu-item "Paste" x-clipboard-yank + ;; :enable (not buffer-read-only) + ;; :help "Paste (yank) text most recently cut/copied") + ;; nil)) (setq x-initialized t)) diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index e5727f41e93..e8a92b101ef 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -1817,7 +1817,9 @@ misspelled words backwards." (throw 'exit t))))))) (save-excursion (goto-char pos) - (ispell-word)) + (ispell-word) + (setq flyspell-word-cache-word nil) ;; Force flyspell-word re-check + (flyspell-word)) (error "No word to correct before point")))) ;;*---------------------------------------------------------------------*/ diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 4d0cc842351..ad591eb0e7f 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -357,21 +357,21 @@ Must be greater than 1." :group 'ispell) (defcustom ispell-alternate-dictionary - (cond ((file-exists-p "/usr/dict/web2") "/usr/dict/web2") - ((file-exists-p "/usr/share/dict/web2") "/usr/share/dict/web2") - ((file-exists-p "/usr/dict/words") "/usr/dict/words") - ((file-exists-p "/usr/lib/dict/words") "/usr/lib/dict/words") - ((file-exists-p "/usr/share/dict/words") "/usr/share/dict/words") - ((file-exists-p "/usr/share/lib/dict/words") + (cond ((file-readable-p "/usr/dict/web2") "/usr/dict/web2") + ((file-readable-p "/usr/share/dict/web2") "/usr/share/dict/web2") + ((file-readable-p "/usr/dict/words") "/usr/dict/words") + ((file-readable-p "/usr/lib/dict/words") "/usr/lib/dict/words") + ((file-readable-p "/usr/share/dict/words") "/usr/share/dict/words") + ((file-readable-p "/usr/share/lib/dict/words") "/usr/share/lib/dict/words") - ((file-exists-p "/sys/dict") "/sys/dict") - (t "/usr/dict/words")) - "*Alternate dictionary for spelling help." + ((file-readable-p "/sys/dict") "/sys/dict")) + "*Alternate plain word-list dictionary for spelling help." :type '(choice file (const :tag "None" nil)) :group 'ispell) -(defcustom ispell-complete-word-dict ispell-alternate-dictionary - "*Dictionary used for word completion." +(defcustom ispell-complete-word-dict nil + "*Plain word-list dictionary used for word completion if +different from `ispell-alternate-dictionary'." :type '(choice file (const :tag "None" nil)) :group 'ispell) @@ -2049,10 +2049,11 @@ Global `ispell-quit' set to start location to continue spell session." (erase-buffer) (setq count ?0 skipped 0 - mode-line-format + mode-line-format ;; setup the *Choices* buffer with valid data. (concat "-- %b -- word: " new-word - " -- dict: " - ispell-alternate-dictionary) + " -- word-list: " + (or ispell-complete-word-dict + ispell-alternate-dictionary)) miss (lookup-words new-word) choices miss line ispell-choices-win-default-height) @@ -2267,11 +2268,20 @@ Otherwise the variable `ispell-grep-command' contains the command used to search for the words (usually egrep). Optional second argument contains the dictionary to use; the default is -`ispell-alternate-dictionary'." +`ispell-alternate-dictionary', overriden by `ispell-complete-word-dict' +if defined." ;; We don't use the filter for this function, rather the result is written ;; into a buffer. Hence there is no need to save the filter values. (if (null lookup-dict) - (setq lookup-dict ispell-alternate-dictionary)) + (setq lookup-dict (or ispell-complete-word-dict + ispell-alternate-dictionary))) + + (if lookup-dict + (unless (file-readable-p lookup-dict) + (error "lookup-words error: Unreadable or missing plain word-list %s." + lookup-dict)) + (error (concat "lookup-words error: No plain word-list found at system default " + "locations. Customize `ispell-alternate-dictionary' to set yours."))) (let* ((process-connection-type ispell-use-ptys-p) (wild-p (string-match "\\*" word)) @@ -2622,7 +2632,7 @@ Keeps argument list for future ispell invocations for no async support." ;; Restart check for personal dictionary is done in ;; `ispell-internal-change-dictionary', called from `ispell-buffer-local-dict' (or (or ispell-local-pdict ispell-personal-dictionary) - (equal ispell-process-directory default-directory))) + (equal ispell-process-directory (expand-file-name default-directory)))) (setq ispell-filter nil ispell-filter-continue nil) ;; may need to restart to select new personal dictionary. (ispell-kill-ispell t) @@ -2638,13 +2648,13 @@ Keeps argument list for future ispell invocations for no async support." (if (window-minibuffer-p) (if (fboundp 'minibuffer-selected-window) ;; Assign ispell process to parent buffer - (setq ispell-process-directory default-directory + (setq ispell-process-directory (expand-file-name default-directory) ispell-process-buffer-name (window-buffer (minibuffer-selected-window))) ;; Force `ispell-process-directory' to $HOME and use a dummy name (setq ispell-process-directory (expand-file-name "~/") ispell-process-buffer-name " * Minibuffer-has-spellcheck-enabled")) ;; Not in a minibuffer - (setq ispell-process-directory default-directory + (setq ispell-process-directory (expand-file-name default-directory) ispell-process-buffer-name (buffer-name))) (if ispell-async-processp (set-process-filter ispell-process 'ispell-filter)) @@ -3342,7 +3352,8 @@ Standard ispell choices are then available." (lookup-words (concat (and interior-frag "*") word (if (or interior-frag (null ispell-look-p)) "*")) - ispell-complete-word-dict))) + (or ispell-complete-word-dict + ispell-alternate-dictionary)))) (cond ((eq possibilities t) (message "No word to complete")) ((null possibilities) diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el index b735b446b81..577287c60bc 100644 --- a/lisp/textmodes/texinfmt.el +++ b/lisp/textmodes/texinfmt.el @@ -1,8 +1,8 @@ ;;; texinfmt.el --- format Texinfo files into Info files -;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, -;; 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, -;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +;; 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, +;; 2008, 2009, 2010 Free Software Foundation, Inc. ;; Maintainer: Robert J. Chassell <bug-texinfo@gnu.org> ;; Keywords: maint, tex, docs @@ -224,7 +224,7 @@ converted to Info is stored in a temporary buffer." (save-restriction (widen) (goto-char (point-min)) - (let ((search-end (save-excursion (forward-line 100) (point)))) + (let ((search-end (line-beginning-position 101))) (if (or ;; Either copy header text. (and @@ -285,7 +285,7 @@ converted to Info is stored in a temporary buffer." (let ((filename (concat input-directory (texinfo-parse-line-arg)))) (re-search-backward "^@include") - (delete-region (point) (save-excursion (forward-line 1) (point))) + (delete-region (point) (line-beginning-position 2)) (message "Reading included file: %s" filename) (save-excursion (save-restriction @@ -323,8 +323,7 @@ converted to Info is stored in a temporary buffer." ;; Insert Info region title text. (goto-char (point-min)) - (if (search-forward - "@setfilename" (save-excursion (forward-line 100) (point)) t) + (if (search-forward "@setfilename" (line-beginning-position 101) t) (progn (setq texinfo-command-end (point)) (beginning-of-line) @@ -772,13 +771,13 @@ commands." ((eq type '@raisesections) (setq level (1+ level)) (delete-region - (point) (save-excursion (forward-line 1) (point)))) + (point) (line-beginning-position 2))) ;; 2. Decrement level ((eq type '@lowersections) (setq level (1- level)) (delete-region - (point) (save-excursion (forward-line 1) (point)))) + (point) (line-beginning-position 2))) ;; Now handle structuring commands ((cond @@ -1505,9 +1504,7 @@ The node is constructed automatically." (progn (goto-char node-name-beginning) ; skip over node command (skip-chars-forward " \t") ; and over spaces (point)) - (if (search-forward - "," - (save-excursion (end-of-line) (point)) t) ; bound search + (if (search-forward "," (line-end-position) t) ; bound search (1- (point)) (end-of-line) (point)))))) (texinfo-discard-command) ; remove or insert whitespace, as needed @@ -1692,7 +1689,7 @@ Used by @refill indenting command to avoid indenting within lists, etc.") (put 'itemize 'texinfo-item 'texinfo-itemize-item) (defun texinfo-itemize-item () ;; (texinfo-discard-line) ; Did not handle text on same line as @item. - (delete-region (1+ (point)) (save-excursion (beginning-of-line) (point))) + (delete-region (1+ (point)) (line-beginning-position)) (if (looking-at "[ \t]*[^ \t\n]+") ;; Text on same line as @item command. (insert "\b " (nth 1 (car texinfo-stack)) " \n") @@ -2132,10 +2129,10 @@ This command is executed when texinfmt sees @item inside @multitable." (narrow-to-region start end) ;; Remove whitespace before and after entry. (skip-chars-forward " ") - (delete-region (point) (save-excursion (beginning-of-line) (point))) + (delete-region (point) (line-beginning-position)) (goto-char (point-max)) (skip-chars-backward " ") - (delete-region (point) (save-excursion (end-of-line) (point))) + (delete-region (point) (line-end-position)) ;; Temporarily set texinfo-stack to nil so texinfo-format-scan ;; does not see an unterminated @multitable. (let (texinfo-stack) ; nil @@ -2409,16 +2406,14 @@ Use only the FILENAME arg; for Info, ignore the other arguments to @image." (let ((start (1- (point))) args) (skip-chars-forward " ") - (save-excursion (end-of-line) (setq texinfo-command-end (point))) + (setq texinfo-command-end (line-end-position)) (if (not (looking-at "\\([^=]+\\)=\\(.*\\)")) (error "Invalid alias command") (push (cons (match-string-no-properties 1) (match-string-no-properties 2)) texinfo-alias-list) - (texinfo-discard-command)) - ) - ) + (texinfo-discard-command)))) ;;; @var, @code and the like @@ -2455,7 +2450,7 @@ Use only the FILENAME arg; for Info, ignore the other arguments to @image." "Insert ` ... ' around arg unless inside a table; in that case, no quotes." ;; `looking-at-backward' not available in v. 18.57, 20.2 (if (not (search-backward "" ; searched-for character is a control-H - (save-excursion (beginning-of-line) (point)) + (line-beginning-position) t)) (insert "`" (texinfo-parse-arg-discard) "'") (insert (texinfo-parse-arg-discard))) @@ -2840,8 +2835,7 @@ Default is to leave paragraph indentation as is." (defun texinfo-noindent () (save-excursion (forward-paragraph 1) - (if (search-backward "@refill" - (save-excursion (forward-line -1) (point)) t) + (if (search-backward "@refill" (line-beginning-position 0) t) () ; leave @noindent command so @refill command knows not to indent ;; else (texinfo-discard-line)))) diff --git a/lisp/time.el b/lisp/time.el index c11f399ae71..e09ceaec18a 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -490,15 +490,10 @@ This runs the normal hook `display-time-hook' after each update." 'display-time-event-handler))) -(defun display-time-world-mode () +(define-derived-mode display-time-world-mode nil "World clock" "Major mode for buffer that displays times in various time zones. See `display-time-world'." - (interactive) - (kill-all-local-variables) - (setq - major-mode 'display-time-world-mode - mode-name "World clock") - (use-local-map display-time-world-mode-map)) + (setq show-trailing-whitespace nil)) (defun display-time-world-display (alist) "Replace current buffer text with times in various zones, based on ALIST." @@ -506,24 +501,22 @@ See `display-time-world'." (buffer-undo-list t)) (erase-buffer) (let ((max-width 0) - (result ())) + (result ()) + fmt) (unwind-protect (dolist (zone alist) (let* ((label (cadr zone)) (width (string-width label))) (set-time-zone-rule (car zone)) - (setq result - (append result - (list - label width - (format-time-string display-time-world-time-format)))) + (push (cons label + (format-time-string display-time-world-time-format)) + result) (when (> width max-width) (setq max-width width)))) (set-time-zone-rule nil)) - (while result - (insert (pop result) - (make-string (1+ (- max-width (pop result))) ?\s) - (pop result) "\n"))) + (setq fmt (concat "%-" (int-to-string max-width) "s %s\n")) + (dolist (timedata (nreverse result)) + (insert (format fmt (car timedata) (cdr timedata))))) (delete-char -1))) ;;;###autoload diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el index a05d05daeb9..4b83b07754d 100644 --- a/lisp/tool-bar.el +++ b/lisp/tool-bar.el @@ -48,21 +48,23 @@ With numeric ARG, display the tool bar if and only if ARG is positive. See `tool-bar-add-item' and `tool-bar-add-item-from-menu' for conveniently adding tool bar items." - :init-value nil + :init-value t :global t :group 'mouse :group 'frames - (if tool-bar-mode - (progn - ;; Make one tool-bar-line for any - including non-graphical - - ;; terminal, see Bug#1754. If this causes problems, we should - ;; handle the problem in `modify-frame-parameters' or do not - ;; call `modify-all-frames-parameters' when toggling the tool - ;; bar off either. - (modify-all-frames-parameters (list (cons 'tool-bar-lines 1))) - (if (= 1 (length (default-value 'tool-bar-map))) ; not yet setup - (tool-bar-setup))) - (modify-all-frames-parameters (list (cons 'tool-bar-lines 0))))) + (let ((val (if tool-bar-mode 1 0))) + (dolist (frame (frame-list)) + (set-frame-parameter frame 'tool-bar-lines val)) + ;; If the user has given `default-frame-alist' a `tool-bar-lines' + ;; parameter, replace it. + (if (assq 'tool-bar-lines default-frame-alist) + (setq default-frame-alist + (cons (cons 'tool-bar-lines val) + (assq-delete-all 'tool-bar-lines + default-frame-alist))))) + (and tool-bar-mode + (= 1 (length (default-value 'tool-bar-map))) ; not yet setup + (tool-bar-setup))) ;;;###autoload ;; Used in the Show/Hide menu, to have the toggle reflect the current frame. @@ -74,17 +76,6 @@ See `tool-bar-mode' for more information." (tool-bar-mode (if (> (frame-parameter nil 'tool-bar-lines) 0) 0 1)) (tool-bar-mode arg))) -;;;###autoload -;; We want to pretend the toolbar by standard is on, as this will make -;; customize consider disabling the toolbar a customization, and save -;; that. We could do this for real by setting :init-value above, but -;; that would turn on the toolbar in MS Windows where it is currently -;; useless, and it would overwrite disabling the tool bar from X -;; resources. If anyone want to implement this in a cleaner way, -;; please do so. -;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-21. -(put 'tool-bar-mode 'standard-value '(t)) - (defvar tool-bar-map (make-sparse-keymap) "Keymap for the tool bar. Define this locally to override the global tool bar.") diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 374333150c8..b377f631704 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,15 @@ +2010-07-01 Mark A. Hershberger <mah@everybody.org> + + * url-http.el (url-http-create-request): Add a CRLF on the end so + that POSTs with content to https urls work. See + <https://bugs.launchpad.net/mediawiki-el/+bug/540759> + +2010-06-22 Mark A. Hershberger <mah@everybody.org> + + * url-parse.el (url-user-for-url, url-password-for-url): + Convenience functions that get usernames and passwords for urls + from auth-source functions. + 2010-06-12 Štěpán Němec <stepnem@gmail.com> (tiny change) * url-vars.el (url-privacy-level): Fix doc typo. (Bug#6406) @@ -208,7 +220,7 @@ 2008-03-09 Magnus Henoch <mange@freemail.hu> * url-http.el (url-http-chunked-encoding-after-change-function): - Remove superfluous CRLF at end of file. (bug #42) + Remove superfluous CRLF at end of file. (Bug #42) 2008-03-02 Andreas Schwab <schwab@suse.de> @@ -794,7 +806,7 @@ (url-http-parse-headers): Use it. (url-http-handle-authentication): Use subst-char-in-string. -2005-11-16 Juergen Hoetzel <emacs@hoetzel.info> (tiny change) +2005-11-16 Jürgen Hötzel <emacs@hoetzel.info> (tiny change) * url-handlers.el (url-insert-file-contents): Use the charset info provided by the HTTP server, if any. diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 9f988beaf0a..24daba4f779 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -339,7 +339,7 @@ request.") ;; End request "\r\n" ;; Any data - url-http-data)) + url-http-data "\r\n")) "")) (url-http-debug "Request is: \n%s" request) request)) diff --git a/lisp/url/url-parse.el b/lisp/url/url-parse.el index e68e0791558..20432dcf7e5 100644 --- a/lisp/url/url-parse.el +++ b/lisp/url/url-parse.el @@ -25,6 +25,7 @@ ;;; Code: (require 'url-vars) +(require 'auth-source) (eval-when-compile (require 'cl)) (autoload 'url-scheme-get-property "url-methods") @@ -174,6 +175,25 @@ TYPE USER PASSWORD HOST PORTSPEC FILENAME TARGET ATTRIBUTES FULLNESS." (url-parse-make-urlobj prot user pass host port file refs attr full))))))) +(defmacro url-bit-for-url (method lookfor url) + `(let* ((urlobj (url-generic-parse-url url)) + (bit (funcall ,method urlobj)) + (methods (list 'url-recreate-url + 'url-host))) + (while (and (not bit) (> (length methods) 0)) + (setq bit + (auth-source-user-or-password + ,lookfor (funcall (pop methods) urlobj) (url-type urlobj)))) + bit)) + +(defun url-user-for-url (url) + "Attempt to use .authinfo to find a user for this URL." + (url-bit-for-url 'url-user "login" url)) + +(defun url-password-for-url (url) + "Attempt to use .authinfo to find a password for this URL." + (url-bit-for-url 'url-password "password" url)) + (provide 'url-parse) ;; arch-tag: f338325f-71ab-4bee-93cc-78fb9a03d403 diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index adc5a2a0455..0ef9d06c3b2 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -97,6 +97,9 @@ when editing big diffs)." :options '(diff-delete-empty-files diff-make-unified) :group 'diff-mode) +(defvar diff-vc-backend nil + "The VC backend that created the current Diff buffer, if any.") + (defvar diff-outline-regexp "\\([*+][*+][*+] [^0-9]\\|@@ ...\\|\\*\\*\\* [0-9].\\|--- [0-9]..\\)") diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el index d0951bdd404..c95fe54d04a 100644 --- a/lisp/vc/vc-annotate.el +++ b/lisp/vc/vc-annotate.el @@ -315,7 +315,7 @@ use; you may override this using the second optional arg MODE." vc-annotate-display-mode)))) ;;;###autoload -(defun vc-annotate (file rev &optional display-mode buf move-point-to) +(defun vc-annotate (file rev &optional display-mode buf move-point-to vc-bk) "Display the edit history of the current FILE using colors. This command creates a buffer that shows, for each line of the current @@ -336,6 +336,8 @@ age, and everything that is older than that is shown in blue. If MOVE-POINT-TO is given, move the point to that line. +If VC-BK is given used that VC backend. + Customization variables: `vc-annotate-menu-elements' customizes the menu elements of the @@ -376,7 +378,7 @@ mode-specific menu. `vc-annotate-color-map' and ;; In case it had to be uniquified. (setq temp-buffer-name (buffer-name)))) (with-output-to-temp-buffer temp-buffer-name - (let ((backend (vc-backend file)) + (let ((backend (or vc-bk (vc-backend file))) (coding-system-for-read buffer-file-coding-system)) (vc-call-backend backend 'annotate-command file (get-buffer temp-buffer-name) rev) @@ -462,7 +464,7 @@ Return a cons (REV . FILENAME)." (if (not rev-at-line) (message "Cannot extract revision number from the current line") (switch-to-buffer-other-window - (vc-find-revision (cdr rev-at-line) (car rev-at-line))))))) + (vc-find-revision (cdr rev-at-line) (car rev-at-line) vc-annotate-backend)))))) (defun vc-annotate-revision-previous-to-line () "Visit the annotation of the revision before the revision at line." @@ -527,7 +529,7 @@ the file in question, search for the log entry required and move point ." (message "Cannot extract revision number from the current line") (setq prev-rev (vc-call-backend vc-annotate-backend 'previous-revision - fname rev)) + (if filediff fname nil) rev)) (if (not prev-rev) (message "Cannot diff from any revision prior to %s" rev) (save-window-excursion @@ -597,7 +599,8 @@ describes a revision number, so warp to that revision." ;; place the point in the line. (min oldline (progn (goto-char (point-max)) (forward-line -1) - (line-number-at-pos)))))))) + (line-number-at-pos))) + vc-annotate-backend))))) (defun vc-annotate-compcar (threshold a-list) "Test successive cons cells of A-LIST against THRESHOLD. diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 161013fbae0..9cacef2f71b 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -412,22 +412,24 @@ If NOINSERT, ignore elements on ENTRIES which are not in the ewoc." (setq entry (car entries)) (setq node (ewoc-next vc-ewoc node))) (t - (ewoc-enter-before vc-ewoc node - (apply 'vc-dir-create-fileinfo entry)) + (unless noinsert + (ewoc-enter-before vc-ewoc node + (apply 'vc-dir-create-fileinfo entry))) (setq entries (cdr entries)) (setq entry (car entries)))))) (t - ;; We might need to insert a directory node if the - ;; previous node was in a different directory. - (let* ((rd (file-relative-name entrydir)) - (prev-node (ewoc-prev vc-ewoc node)) - (prev-dir (vc-dir-node-directory prev-node))) - (unless (string-equal entrydir prev-dir) - (ewoc-enter-before - vc-ewoc node (vc-dir-create-fileinfo rd nil nil nil entrydir)))) - ;; Now insert the node itself. - (ewoc-enter-before vc-ewoc node - (apply 'vc-dir-create-fileinfo entry)) + (unless noinsert + ;; We might need to insert a directory node if the + ;; previous node was in a different directory. + (let* ((rd (file-relative-name entrydir)) + (prev-node (ewoc-prev vc-ewoc node)) + (prev-dir (vc-dir-node-directory prev-node))) + (unless (string-equal entrydir prev-dir) + (ewoc-enter-before + vc-ewoc node (vc-dir-create-fileinfo rd nil nil nil entrydir)))) + ;; Now insert the node itself. + (ewoc-enter-before vc-ewoc node + (apply 'vc-dir-create-fileinfo entry))) (setq entries (cdr entries) entry (car entries)))))) ;; We're past the last node, all remaining entries go to the end. (unless (or node noinsert) @@ -902,10 +904,12 @@ If it is a file, return the corresponding cons for the file itself." (vc-dir-resync-directory-files file) (ewoc-set-hf vc-ewoc (vc-dir-headers vc-dir-backend default-directory) "")) - (let ((state (vc-dir-recompute-file-state file ddir))) + (let* ((complete-state (vc-dir-recompute-file-state file ddir)) + (state (cadr complete-state))) (vc-dir-update - (list state) - status-buf (eq (cadr state) 'up-to-date)))))))))) + (list complete-state) + status-buf (or (not state) + (eq state 'up-to-date))))))))))) ;; Remove out-of-date entries from vc-dir-buffers. (dolist (b drop) (setq vc-dir-buffers (delq b vc-dir-buffers))))) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 6129b21c324..cccccbdfd02 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -563,13 +563,18 @@ or an empty string if none." (let* (process-file-side-effects (coding-system-for-read 'binary) (coding-system-for-write 'binary) - (fullname (substring - (vc-git--run-command-string - file "ls-files" "-z" "--full-name" "--") - 0 -1))) + (fullname + (let ((fn (vc-git--run-command-string + file "ls-files" "-z" "--full-name" "--"))) + ;; ls-files does not return anything when looking for a + ;; revision of a file that has been renamed or removed. + (if (string= fn "") + (file-relative-name file (vc-git-root default-directory)) + (substring fn 0 -1))))) (vc-git-command buffer 0 - (concat (if rev rev "HEAD") ":" fullname) "cat-file" "blob"))) + nil + "cat-file" "blob" (concat (if rev rev "HEAD") ":" fullname)))) (defun vc-git-checkout (file &optional editable rev) (vc-git-command nil 0 file "checkout" (or rev "HEAD"))) @@ -723,7 +728,7 @@ or BRANCH^ (where \"^\" can be repeated)." (defun vc-git-annotate-command (file buf &optional rev) (let ((name (file-relative-name file))) - (vc-git-command buf 'async name "blame" "--date=iso" "-C" "-C" rev))) + (vc-git-command buf 'async nil "blame" "--date=iso" "-C" "-C" rev "--" name))) (declare-function vc-annotate-convert-time "vc-annotate" (time)) @@ -740,8 +745,12 @@ or BRANCH^ (where \"^\" can be repeated)." (when (looking-at "\\([0-9a-f^][0-9a-f]+\\) \\(\\([^(]+\\) \\)?") (let ((revision (match-string-no-properties 1))) (if (match-beginning 2) - (cons revision (expand-file-name (match-string-no-properties 3) - (vc-git-root default-directory))) + (let ((fname (match-string-no-properties 3))) + ;; Remove trailing whitespace from the file name. + (when (string-match " +\\'" fname) + (setq fname (substring fname 0 (match-beginning 0)))) + (cons revision + (expand-file-name fname (vc-git-root default-directory)))) revision))))) ;;; TAG SYSTEM @@ -765,11 +774,10 @@ or BRANCH^ (where \"^\" can be repeated)." (defun vc-git-previous-revision (file rev) "Git-specific version of `vc-previous-revision'." (if file - (let* ((default-directory (file-name-directory (expand-file-name file))) - (file (file-name-nondirectory file)) + (let* ((fname (file-relative-name file)) (prev-rev (with-temp-buffer (and - (vc-git--out-ok "rev-list" "-2" rev "--" file) + (vc-git--out-ok "rev-list" "-2" rev "--" fname) (goto-char (point-max)) (bolp) (zerop (forward-line -1)) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 0d6584fb343..20e56bbd42f 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -913,6 +913,16 @@ Within directories, only files already under version control are noticed." (nreverse flattened))) (defvar vc-dir-backend) +(defvar log-view-vc-backend) +(defvar diff-vc-backend) + +(defun vc-deduce-backend () + (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend) + ((derived-mode-p 'log-view-mode) log-view-vc-backend) + ((derived-mode-p 'diff-mode) diff-vc-backend) + ((derived-mode-p 'dired-mode) + (vc-responsible-backend default-directory)) + (vc-mode (vc-backend buffer-file-name)))) (declare-function vc-dir-current-file "vc-dir" ()) (declare-function vc-dir-deduce-fileset "vc-dir" (&optional state-model-only-files)) @@ -1427,6 +1437,16 @@ Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'." ;; (vc-call-backend ',(vc-backend f) ;; 'diff (list ',f) ',rev1 ',rev2)))))) +(defvar vc-coding-system-inherit-eol t + "When non-nil, inherit the EOL format for reading Diff output from the file. + +Used in `vc-coding-system-for-diff' to determine the EOL format to use +for reading Diff output for a file. If non-nil, the EOL format is +inherited from the file itself. +Set this variable to nil if your Diff tool might use a different +EOL. Then Emacs will auto-detect the EOL format in Diff output, which +gives better results.") ;; Cf. bug#4451. + (defun vc-coding-system-for-diff (file) "Return the coding system for reading diff output for FILE." (or coding-system-for-read @@ -1434,7 +1454,12 @@ Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'." ;; use the buffer's coding system (let ((buf (find-buffer-visiting file))) (when buf (with-current-buffer buf - buffer-file-coding-system))) + (if vc-coding-system-inherit-eol + buffer-file-coding-system + ;; Don't inherit the EOL part of the coding-system, + ;; because some Diff tools may choose to use + ;; a different one. bug#4451. + (coding-system-base buffer-file-coding-system))))) ;; otherwise, try to find one based on the file name (car (find-operation-coding-system 'insert-file-contents file)) ;; and a final fallback @@ -1547,6 +1572,10 @@ returns t if the buffer had changes, nil otherwise." (message "%s" (cdr messages)) nil) (diff-mode) + (set (make-local-variable 'diff-vc-backend) (car vc-fileset)) + (set (make-local-variable 'revert-buffer-function) + `(lambda (ignore-auto noconfirm) + (vc-diff-internal ,async ',vc-fileset ,rev1 ,rev2 ,verbose))) ;; Make the *vc-diff* buffer read only, the diff-mode key ;; bindings are nicer for read only buffers. pcl-cvs does the ;; same thing. @@ -1653,10 +1682,7 @@ saving the buffer." ;; that's not what we want here, we want the diff for the VC root dir. (call-interactively 'vc-version-diff) (when buffer-file-name (vc-buffer-sync not-urgent)) - (let ((backend - (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend) - ((derived-mode-p 'dired-mode) (vc-responsible-backend default-directory)) - (vc-mode (vc-backend buffer-file-name)))) + (let ((backend (vc-deduce-backend)) rootdir working-revision) (unless backend (error "Buffer is not version controlled")) @@ -1689,8 +1715,9 @@ If `F.~REV~' already exists, use it instead of checking it out again." rev))) (switch-to-buffer-other-window (vc-find-revision file revision)))) -(defun vc-find-revision (file revision) - "Read REVISION of FILE into a buffer and return the buffer." +(defun vc-find-revision (file revision &optional backend) + "Read REVISION of FILE into a buffer and return the buffer. +Use BACKEND as the VC backend if specified." (let ((automatic-backup (vc-version-backup-file-name file revision)) (filebuf (or (get-file-buffer file) (current-buffer))) (filename (vc-version-backup-file-name file revision 'manual))) @@ -1708,7 +1735,9 @@ If `F.~REV~' already exists, use it instead of checking it out again." ;; Change buffer to get local value of ;; vc-checkout-switches. (with-current-buffer filebuf - (vc-call find-revision file revision outbuf)))) + (if backend + (vc-call-backend backend 'find-revision file revision outbuf) + (vc-call find-revision file revision outbuf))))) (setq failed nil)) (when (and failed (file-exists-p filename)) (delete-file filename)))) @@ -1953,7 +1982,6 @@ If it contains `directory' then if the fileset contains a directory show a short If it contains `file' then show short logs for files. Not all VC backends support short logs!") -(defvar log-view-vc-backend) (defvar log-view-vc-fileset) (defun vc-print-log-setup-buttons (working-revision is-start-revision limit pl-return) @@ -2102,10 +2130,7 @@ When called interactively with a prefix argument, prompt for LIMIT." (list lim))) (t (list (when (> vc-log-show-limit 0) vc-log-show-limit))))) - (let ((backend - (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend) - ((derived-mode-p 'dired-mode) (vc-responsible-backend default-directory)) - (vc-mode (vc-backend buffer-file-name)))) + (let ((backend (vc-deduce-backend)) rootdir working-revision) (unless backend (error "Buffer is not version controlled")) @@ -2117,10 +2142,7 @@ When called interactively with a prefix argument, prompt for LIMIT." (defun vc-log-incoming (&optional remote-location) "Show a log of changes that will be received with a pull operation from REMOTE-LOCATION." (interactive "sRemote location (empty for default): ") - (let ((backend - (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend) - ((derived-mode-p 'dired-mode) (vc-responsible-backend default-directory)) - (vc-mode (vc-backend buffer-file-name)))) + (let ((backend (vc-deduce-backend)) rootdir working-revision) (unless backend (error "Buffer is not version controlled")) @@ -2130,10 +2152,7 @@ When called interactively with a prefix argument, prompt for LIMIT." (defun vc-log-outgoing (&optional remote-location) "Show a log of changes that will be sent with a push operation to REMOTE-LOCATION." (interactive "sRemote location (empty for default): ") - (let ((backend - (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend) - ((derived-mode-p 'dired-mode) (vc-responsible-backend default-directory)) - (vc-mode (vc-backend buffer-file-name)))) + (let ((backend (vc-deduce-backend)) rootdir working-revision) (unless backend (error "Buffer is not version controlled")) diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el index 0b97b184d22..78fe793b174 100644 --- a/lisp/w32-fns.el +++ b/lisp/w32-fns.el @@ -254,7 +254,7 @@ You should set this to t when using a non-system shell.\n\n")))) ;; (expand-file-name ".." exec-directory))))) (defun w32-convert-standard-filename (filename) - "Convert a standard file's name to something suitable for the MS-Windows. + "Convert a standard file's name to something suitable for MS-Windows. This means to guarantee valid names and perhaps to canonicalize certain patterns. diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 5e67c07957e..dfeb6371f5e 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -1156,14 +1156,17 @@ the field." (if field (narrow-to-region (line-beginning-position) (line-end-position))))) +;; This used to say: +;; "When not inside a field, move to the previous button or field." +;; but AFAICS, it has always just thrown an error. (defun widget-complete () "Complete content of editable field from point. -When not inside a field, move to the previous button or field." +When not inside a field, signal an error." (interactive) (let ((field (widget-field-find (point)))) - (when field - (widget-apply field :complete)) - (error "Not in an editable field"))) + (if field + (widget-apply field :complete) + (error "Not in an editable field")))) ;;; Setting up the buffer. diff --git a/lisp/woman.el b/lisp/woman.el index 3efe15d5f7d..291ebcee740 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -4521,7 +4521,8 @@ logging the message." nil) ; for woman-file-readable-p etc. ;;; Bookmark Woman support. -(declare-function bookmark-make-record-default "bookmark" (&optional pos-only)) +(declare-function bookmark-make-record-default + "bookmark" (&optional no-file no-context posn)) (declare-function bookmark-prop-get "bookmark" (bookmark prop)) (declare-function bookmark-default-handler "bookmark" (bmk)) (declare-function bookmark-get-bookmark-record "bookmark" (bmk)) @@ -4532,7 +4533,7 @@ logging the message." (defun woman-bookmark-make-record () "Make a bookmark entry for a Woman buffer." `(,(Man-default-bookmark-title) - ,@(bookmark-make-record-default 'point-only) + ,@(bookmark-make-record-default 'no-file) (location . ,(concat "woman " woman-last-file-name)) ;; Use the same form as man's bookmarks, as much as possible. (man-args . ,woman-last-file-name) diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el index 328eb569c6f..6d38fd043fe 100644 --- a/lisp/x-dnd.el +++ b/lisp/x-dnd.el @@ -1,9 +1,9 @@ -;;; x-dnd.el --- drag and drop support for X. +;;; x-dnd.el --- drag and drop support for X -*- coding: utf-8 -*- ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 ;; Free Software Foundation, Inc. -;; Author: Jan Dj,Ad(Brv <jan.h.d@swipnet.se> +;; Author: Jan Djärv <jan.h.d@swipnet.se> ;; Maintainer: FSF ;; Keywords: window, drag, drop diff --git a/lisp/xml.el b/lisp/xml.el index 20b595fd2d7..8e8981ac439 100644 --- a/lisp/xml.el +++ b/lisp/xml.el @@ -321,18 +321,20 @@ If PARSE-NS is non-nil, then QNAMES are expanded." (progn (forward-char -1) (setq result (xml-parse-tag parse-dtd parse-ns)) - (if (and xml result (not xml-sub-parser)) - ;; translation of rule [1] of XML specifications - (error "XML: (Not Well-Formed) Only one root tag allowed") - (cond - ((null result)) - ((and (listp (car result)) - parse-dtd) - (setq dtd (car result)) - (if (cdr result) ; possible leading comment - (add-to-list 'xml (cdr result)))) - (t - (add-to-list 'xml result))))) + (cond + ((null result) + ;; Not looking at an xml start tag. + (forward-char 1)) + ((and xml (not xml-sub-parser)) + ;; Translation of rule [1] of XML specifications + (error "XML: (Not Well-Formed) Only one root tag allowed")) + ((and (listp (car result)) + parse-dtd) + (setq dtd (car result)) + (if (cdr result) ; possible leading comment + (add-to-list 'xml (cdr result)))) + (t + (add-to-list 'xml result)))) (goto-char (point-max)))) (if parse-dtd (cons dtd (nreverse xml)) diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 2d38c6e827c..f802103fbd7 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -122,8 +122,8 @@ ;; read xterm sequences above ascii 127 (#x7f) (defun xterm-mouse-event-read () (let ((c (read-char))) - (if (< c 0) - (+ c #x8000000 128) + (if (> c #x3FFF80) + (+ 128 (- c #x3FFF80)) c))) (defun xterm-mouse-truncate-wrap (f) diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 207b94f190a..d591b93e50b 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,3 +1,118 @@ +2010-07-12 Andreas Schwab <schwab@linux-m68k.org> + + * Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS): Set from + substitution. + (ALL_CFLAGS): Add ${C_WARNINGS_SWITCH} and ${PROFILING_CFLAGS}. + +2010-07-08 Jan Djärv <jan.h.d@swipnet.se> + + * xlwmenu.c (size_menu_item): Change from K&R to prototype. + Change label_width and height to int. + (draw_arrow, draw_shadow_rectangle, draw_shadow_rhombus) + (draw_separator, display_menu, fit_to_screen, motion_event_is_in_menu) + (map_event_to_widget_value): Reformat. + (display_menu_item): Change from K&R to prototype. + + * lwlib.c (allocate_widget_info, lw_register_widget): Change from K&R + to prototype. + (lw_internal_update_other_instances, merge_widget_value): Reformat. + + * lwlib-int.h (widget_creation_function): Fix prototype. + + * lwlib-Xm.c (x_print_complete_resource_name) + (make_destroyed_instance, free_destroyed_instance, first_child) + (lw_motif_widget_p, resource_motif_string, destroy_all_children) + (xm_arm_callback, xm_update_label, xm_update_list) + (xm_update_pushbutton, xm_update_cascadebutton) + (xm_update_toggle, xm_update_radiobox, make_menu_in_widget) + (update_one_menu_entry, xm_update_menu, xm_update_text) + (xm_update_text_field, xm_update_one_widget) + (xm_update_one_value, activate_button, dialog_key_cb) + (make_dialog, mark_dead_instance_destroyed) + (find_matching_instance, recenter_widget, recycle_instance) + (xm_create_dialog, make_menubar, remove_grabs, make_popup_menu) + (make_main, xm_destroy_instance, xm_popup_menu) + (set_min_dialog_size, xm_pop_instance, do_call) + (xm_internal_update_other_instances, xm_generic_callback) + (xm_nosel_callback, xm_pull_down_callback, xm_pop_down_callback) + (xm_set_keyboard_focus, xm_set_main_areas, xm_manage_resizing): Change + from K&R to prototype. + + * lwlib-Xlw.c (x_print_complete_resource_name): Change from K&R to + prototype. + (xlw_update_one_value): Reformat. + + * lwlib-Xaw.c (xaw_generic_callback, command_reset) + (xaw_update_one_value): Reformat. + (xaw_update_one_widget): Reformat and remove dead code. + (xaw_scrollbar_scroll, xaw_scrollbar_jump, xaw_create_scrollbar) + (xaw_update_scrollbar): Remove (not used). + (make_dialog): Change from K&R to prototype. Remove dead code. + (xaw_creation_table): Remove scrollbar entry. + +2010-07-08 Dan Nicolaescu <dann@ics.uci.edu> + + * lwlib.c (allocate_widget_instance, get_widget_info) + (get_widget_instance, find_instance, set_one_value) + (update_one_widget_instance, update_all_widget_values) + (lw_modify_all_widgets, lw_get_widget, lw_make_widget) + (lw_create_widget, lw_pop_all_widgets, lw_show_busy) + (lw_refigure_widget, lw_allow_resizing): Remove alternative K&R + declarations. + * lwlib-Xlw.c (xlw_update_one_widget): + (xlw_pop_instance): Likewise. + * lwlib-Xaw.c (xaw_update_one_widget, xaw_pop_instance): + Likewise. + * lwlib-Xm.c (P_): Remove. + +2010-07-07 Andreas Schwab <schwab@linux-m68k.org> + + * lwlib.c (lwlib_memset, lwlib_bcopy): Remove. + (malloc_widget_value, free_widget_info, allocate_widget_instance) + (lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by + memset, memcpy, memcmp. + * lwlib-utils.c (XtApplyToWidgets): Likewise. + * xlwmenu.c (XlwMenuInitialize): Likewise. + * lwlib.h (lwlib_bcopy): Remove declaration. + +2010-07-05 Jan Djärv <jan.h.d@swipnet.se> + + * xlwmenu.c (XlwMenuSetValues, XlwMenuInitialize): Correct prototype. + (display_menu_item): Remove unused variable gi. + (make_windows_if_needed): Remove unused variable screen. + (XlwMenuRedisplay): Remove unused variable i. + + * lwlib-Xaw.c: Include <ctype.h> for isdigit. + (fill_xft_data, set_text): Remove unused variable screen. + (draw_text): Cast bp to FcChar8*. + (find_xft_data): Return 0 if inst or xft_data is not set. + (wm_delete_window): Correct prototype. Initialize widget to 0 + and return if widget is still 0 after loop. + +2010-07-04 Dan Nicolaescu <dann@ics.uci.edu> + + * lwlib-Xaw.c: Convert function definitions to standard C. + * lwlib-Xlw.c: + * lwlib-utils.c: + * lwlib.c: + * lwlib.h: + * xlwmenu.c: Likewise. + +2010-07-02 Jan Djärv <jan.h.d@swipnet.se> + + * lwlib-Xm.c: Remove __P and P_ from .c and .m files. + * lwlib-Xm.c: + * lwlib.c: + * xlwmenu.c: Likewise. + + Remove P_ and __P macros. + * lwlib-Xaw.h: Remove P_ and __P macros. + * lwlib-Xlw.h: + * lwlib-Xm.h: + * lwlib-int.h: + * lwlib-utils.h: + * lwlib.h: Likewise. + 2010-05-15 Glenn Morris <rgm@gnu.org> * Makefile.in (mostlyclean): Remove references to non-existent files. diff --git a/lwlib/Makefile.in b/lwlib/Makefile.in index eac09174451..13c3f5691f1 100644 --- a/lwlib/Makefile.in +++ b/lwlib/Makefile.in @@ -29,6 +29,8 @@ C_SWITCH_X_SITE=@C_SWITCH_X_SITE@ C_SWITCH_X_SYSTEM=@C_SWITCH_X_SYSTEM@ C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ +C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ +PROFILING_CFLAGS = @PROFILING_CFLAGS@ CC=@CC@ CFLAGS=@CFLAGS@ @@ -50,7 +52,8 @@ OBJS = lwlib.o $(TOOLKIT_OBJS) lwlib-utils.o # ../src is needed to find config.h. ALL_CFLAGS= $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ - $(C_SWITCH_X_SYSTEM) $(C_SWITCH_MACHINE) $(CFLAGS) \ + $(C_SWITCH_X_SYSTEM) $(C_SWITCH_MACHINE) \ + ${C_WARNINGS_SWITCH} ${PROFILING_CFLAGS} $(CFLAGS) \ -DHAVE_CONFIG_H -Demacs -I. -I../src -I${srcdir} -I${srcdir}/../src .c.o: diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c index eaaf2b46d4e..2e08dd12bd0 100644 --- a/lwlib/lwlib-Xaw.c +++ b/lwlib/lwlib-Xaw.c @@ -26,6 +26,7 @@ Boston, MA 02110-1301, USA. */ #include <stdio.h> #include <setjmp.h> +#include <ctype.h> #include "../src/lisp.h" @@ -70,81 +71,18 @@ struct widget_xft_data #endif -static void xaw_generic_callback (/*Widget, XtPointer, XtPointer*/); +static void xaw_generic_callback (Widget widget, + XtPointer closure, + XtPointer call_data); Boolean -lw_xaw_widget_p (widget) - Widget widget; +lw_xaw_widget_p (Widget widget) { return (XtIsSubclass (widget, scrollbarWidgetClass) || XtIsSubclass (widget, dialogWidgetClass)); } -#if 0 -static void -xaw_update_scrollbar (instance, widget, val) - widget_instance *instance; - Widget widget; - widget_value *val; -{ - if (val->scrollbar_data) - { - scrollbar_values *data = val->scrollbar_data; - Dimension height, width; - Dimension pos_x, pos_y; - int widget_shown, widget_topOfThumb; - float new_shown, new_topOfThumb; - - XtVaGetValues (widget, - XtNheight, &height, - XtNwidth, &width, - XtNx, &pos_x, - XtNy, &pos_y, - XtNtopOfThumb, &widget_topOfThumb, - XtNshown, &widget_shown, - NULL); - - /* - * First size and position the scrollbar widget. - * We need to position it to second-guess the Paned widget's notion - * of what should happen when the WMShell gets resized. - */ - if (height != data->scrollbar_height || pos_y != data->scrollbar_pos) - { - XtConfigureWidget (widget, pos_x, data->scrollbar_pos, - width, data->scrollbar_height, 0); - - XtVaSetValues (widget, - XtNlength, data->scrollbar_height, - XtNthickness, width, - NULL); - } - - /* - * Now the size the scrollbar's slider. - */ - new_shown = (float) data->slider_size / - (float) (data->maximum - data->minimum); - - new_topOfThumb = (float) (data->slider_position - data->minimum) / - (float) (data->maximum - data->minimum); - - if (new_shown > 1.0) - new_shown = 1.0; - if (new_shown < 0) - new_shown = 0; - - if (new_topOfThumb > 1.0) - new_topOfThumb = 1.0; - if (new_topOfThumb < 0) - new_topOfThumb = 0; - - if (new_shown != widget_shown || new_topOfThumb != widget_topOfThumb) - XawScrollbarSetThumb (widget, new_topOfThumb, new_shown); - } -} -#endif #ifdef HAVE_XFT static void @@ -152,7 +90,6 @@ fill_xft_data (struct widget_xft_data *data, Widget widget, XftFont *font) { Pixel bg, fg; XColor colors[2]; - int screen = XScreenNumberOfScreen (XtScreen (widget)); data->widget = widget; data->xft_font = font; @@ -253,7 +190,9 @@ draw_text (struct widget_xft_data *data, char *lbl, int inverse) char *cp = strchr (bp, '\n'); XftDrawStringUtf8 (data->xft_draw, inverse ? &data->xft_bg : &data->xft_fg, - data->xft_font, x, y, bp, cp ? cp - bp : strlen (bp)); + data->xft_font, x, y, + (FcChar8 *) bp, + cp ? cp - bp : strlen (bp)); bp = cp ? cp + 1 : NULL; /* 1.2 gives reasonable line spacing. */ y += data->xft_font->height * 1.2; @@ -265,7 +204,6 @@ draw_text (struct widget_xft_data *data, char *lbl, int inverse) static void set_text (struct widget_xft_data *data, Widget toplevel, char *lbl, int margin) { - int screen = XScreenNumberOfScreen (XtScreen (data->widget)); int width, height; width = get_text_width_and_height (data->widget, lbl, data->xft_font, @@ -294,7 +232,7 @@ find_xft_data (Widget widget) inst = lw_get_widget_instance (parent); parent = XtParent (parent); } - if (!inst || !inst->xft_data || !inst->xft_data[0].xft_font) return; + if (!inst || !inst->xft_data || !inst->xft_data[0].xft_font) return 0; for (nr = 0; data == NULL && nr < inst->nr_xft_data; ++nr) { @@ -325,9 +263,9 @@ command_press (Widget widget, static void command_reset (Widget widget, - XEvent* event, - String *params, - Cardinal *num_params) + XEvent* event, + String *params, + Cardinal *num_params) { struct widget_xft_data *data = find_xft_data (widget); if (data) @@ -348,23 +286,11 @@ command_reset (Widget widget, #endif void -#ifdef PROTOTYPES -xaw_update_one_widget (widget_instance *instance, Widget widget, - widget_value *val, Boolean deep_p) -#else -xaw_update_one_widget (instance, widget, val, deep_p) - widget_instance *instance; - Widget widget; - widget_value *val; - Boolean deep_p; -#endif +xaw_update_one_widget (widget_instance *instance, + Widget widget, + widget_value *val, + Boolean deep_p) { -#if 0 - if (XtIsSubclass (widget, scrollbarWidgetClass)) - { - xaw_update_scrollbar (instance, widget, val); - } -#endif if (XtIsSubclass (widget, dialogWidgetClass)) { @@ -427,10 +353,9 @@ xaw_update_one_widget (instance, widget, val, deep_p) } void -xaw_update_one_value (instance, widget, val) - widget_instance *instance; - Widget widget; - widget_value *val; +xaw_update_one_value (widget_instance *instance, + Widget widget, + widget_value *val) { /* This function is not used by the scrollbars and those are the only Athena widget implemented at the moment so do nothing. */ @@ -438,8 +363,7 @@ xaw_update_one_value (instance, widget, val) } void -xaw_destroy_instance (instance) - widget_instance *instance; +xaw_destroy_instance (widget_instance *instance) { #ifdef HAVE_XFT if (instance->xft_data) @@ -471,22 +395,14 @@ xaw_destroy_instance (instance) } void -xaw_popup_menu (widget, event) - Widget widget; - XEvent *event; +xaw_popup_menu (Widget widget, XEvent *event) { /* An Athena menubar has not been implemented. */ return; } void -#ifdef PROTOTYPES xaw_pop_instance (widget_instance *instance, Boolean up) -#else -xaw_pop_instance (instance, up) - widget_instance *instance; - Boolean up; -#endif { Widget widget = instance->widget; @@ -557,7 +473,10 @@ static char overrideTrans[] = /* Dialogs pop down on any key press */ static char dialogOverride[] = "<KeyPress>Escape: lwlib_delete_dialog()"; -static void wm_delete_window(); +static void wm_delete_window (Widget w, + XEvent *event, + String *params, + Cardinal *num_params); static XtActionsRec xaw_actions [] = { {"lwlib_delete_dialog", wm_delete_window} }; @@ -576,19 +495,17 @@ char buttonTrans[] = #endif static Widget -make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, - radio_box, list, left_buttons, right_buttons, instance) - char* name; - Widget parent; - Boolean pop_up_p; - char* shell_title; - char* icon_name; - Boolean text_input_slot; - Boolean radio_box; - Boolean list; - int left_buttons; - int right_buttons; - widget_instance *instance; +make_dialog (char* name, + Widget parent, + Boolean pop_up_p, + char* shell_title, + char* icon_name, + Boolean text_input_slot, + Boolean radio_box, + Boolean list, + int left_buttons, + int right_buttons, + widget_instance *instance) { Arg av [20]; int ac = 0; @@ -748,8 +665,7 @@ make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, } Widget -xaw_create_dialog (instance) - widget_instance* instance; +xaw_create_dialog (widget_instance *instance) { char *name = instance->info->type; Widget parent = instance->parent; @@ -813,10 +729,7 @@ xaw_create_dialog (instance) static void -xaw_generic_callback (widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +xaw_generic_callback (Widget widget, XtPointer closure, XtPointer call_data) { widget_instance *instance = (widget_instance *) closure; Widget instance_widget; @@ -836,10 +749,6 @@ xaw_generic_callback (widget, closure, call_data) id = instance->info->id; -#if 0 - user_data = NULL; - XtVaGetValues (widget, XtNuserData, &user_data, NULL); -#else /* Damn! Athena doesn't give us a way to hang our own data on the buttons, so we have to go find it... I guess this assumes that all instances of a button have the same call data. */ @@ -855,23 +764,22 @@ xaw_generic_callback (widget, closure, call_data) if (! val) abort (); user_data = val->call_data; } -#endif if (instance->info->selection_cb) instance->info->selection_cb (widget, id, user_data); } static void -wm_delete_window (w, closure, call_data) - Widget w; - XtPointer closure; - XtPointer call_data; +wm_delete_window (Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { LWLIB_ID id; Cardinal nkids; int i; Widget *kids = 0; - Widget widget, shell; + Widget widget = 0, shell; if (XtIsSubclass (w, dialogWidgetClass)) shell = XtParent (w); @@ -890,6 +798,8 @@ wm_delete_window (w, closure, call_data) if (XtIsSubclass (widget, dialogWidgetClass)) break; } + if (! widget) return; + id = lw_get_widget_id (widget); if (! id) abort (); @@ -904,111 +814,9 @@ wm_delete_window (w, closure, call_data) } -/* Scrollbars */ - -#if 0 -static void -xaw_scrollbar_scroll (widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; -{ - widget_instance *instance = (widget_instance *) closure; - LWLIB_ID id; - scroll_event event_data; - - if (!instance || widget->core.being_destroyed) - return; - - id = instance->info->id; - event_data.slider_value = 0; - event_data.time = 0; - - if ((int) call_data > 0) - event_data.action = SCROLLBAR_PAGE_DOWN; - else - event_data.action = SCROLLBAR_PAGE_UP; - - if (instance->info->pre_activate_cb) - instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data); -} -#endif - -#if 0 -static void -xaw_scrollbar_jump (widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; -{ - widget_instance *instance = (widget_instance *) closure; - LWLIB_ID id; - scroll_event event_data; - scrollbar_values *val = - (scrollbar_values *) instance->info->val->scrollbar_data; - float percent; - - if (!instance || widget->core.being_destroyed) - return; - - id = instance->info->id; - - percent = * (float *) call_data; - event_data.slider_value = - (int) (percent * (float) (val->maximum - val->minimum)) + val->minimum; - - event_data.time = 0; - event_data.action = SCROLLBAR_DRAG; - - if (instance->info->pre_activate_cb) - instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data); -} -#endif static Widget -xaw_create_scrollbar (instance) - widget_instance *instance; -{ -#if 0 - Arg av[20]; - int ac = 0; - Dimension width; - Widget scrollbar; - - XtVaGetValues (instance->parent, XtNwidth, &width, NULL); - - XtSetArg (av[ac], XtNshowGrip, 0); ac++; - XtSetArg (av[ac], XtNresizeToPreferred, 1); ac++; - XtSetArg (av[ac], XtNallowResize, True); ac++; - XtSetArg (av[ac], XtNskipAdjust, True); ac++; - XtSetArg (av[ac], XtNwidth, width); ac++; - XtSetArg (av[ac], XtNmappedWhenManaged, True); ac++; - - scrollbar = - XtCreateWidget (instance->info->name, scrollbarWidgetClass, - instance->parent, av, ac); - - /* We have to force the border width to be 0 otherwise the - geometry manager likes to start looping for awhile... */ - XtVaSetValues (scrollbar, XtNborderWidth, 0, NULL); - - XtRemoveAllCallbacks (scrollbar, "jumpProc"); - XtRemoveAllCallbacks (scrollbar, "scrollProc"); - - XtAddCallback (scrollbar, "jumpProc", xaw_scrollbar_jump, - (XtPointer) instance); - XtAddCallback (scrollbar, "scrollProc", xaw_scrollbar_scroll, - (XtPointer) instance); - - return scrollbar; -#else - return NULL; -#endif -} - -static Widget -xaw_create_main (instance) - widget_instance *instance; +xaw_create_main (widget_instance *instance) { Arg al[1]; int ac; @@ -1023,7 +831,6 @@ xaw_create_main (instance) widget_creation_entry xaw_creation_table [] = { - {"scrollbar", xaw_create_scrollbar}, {"main", xaw_create_main}, {NULL, NULL} }; diff --git a/lwlib/lwlib-Xaw.h b/lwlib/lwlib-Xaw.h index 41b8013ee64..e359b95359c 100644 --- a/lwlib/lwlib-Xaw.h +++ b/lwlib/lwlib-Xaw.h @@ -6,25 +6,25 @@ extern widget_creation_entry xaw_creation_table []; Widget -xaw_create_dialog __P ((widget_instance*)); +xaw_create_dialog (widget_instance*); Boolean -lw_xaw_widget_p __P ((Widget)); +lw_xaw_widget_p (Widget); void -xaw_update_one_widget __P ((widget_instance *, Widget, widget_value *, Boolean)); +xaw_update_one_widget (widget_instance *, Widget, widget_value *, Boolean); void -xaw_update_one_value __P ((widget_instance *, Widget, widget_value *)); +xaw_update_one_value (widget_instance *, Widget, widget_value *); void -xaw_destroy_instance __P ((widget_instance *)); +xaw_destroy_instance (widget_instance *); void -xaw_popup_menu __P ((Widget, XEvent *)); +xaw_popup_menu (Widget, XEvent *); void -xaw_pop_instance __P ((widget_instance *, Boolean)); +xaw_pop_instance (widget_instance *, Boolean); #endif /* LWLIB_XAW_H */ diff --git a/lwlib/lwlib-Xlw.c b/lwlib/lwlib-Xlw.c index 115997d3612..9a0ff10b11f 100644 --- a/lwlib/lwlib-Xlw.c +++ b/lwlib/lwlib-Xlw.c @@ -43,8 +43,7 @@ Boston, MA 02110-1301, USA. */ This is sometimes handy to have available. */ void -x_print_complete_resource_name (widget) - Widget widget; +x_print_complete_resource_name (Widget widget) { int i; String names[100]; @@ -72,10 +71,7 @@ x_print_complete_resource_name (widget) if there isn't any highlighted menu item. */ static void -highlight_hook (w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +highlight_hook (Widget w, XtPointer client_data, XtPointer call_data) { widget_instance *instance = (widget_instance *) client_data; @@ -85,29 +81,20 @@ highlight_hook (w, client_data, call_data) } static void -enter_hook (w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +enter_hook (Widget w, XtPointer client_data, XtPointer call_data) { highlight_hook (w, client_data, call_data); } static void -leave_hook (w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +leave_hook (Widget w, XtPointer client_data, XtPointer call_data) { highlight_hook (w, client_data, NULL); } static void -pre_hook (w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +pre_hook (Widget w, XtPointer client_data, XtPointer call_data) { widget_instance* instance = (widget_instance*)client_data; widget_value* val; @@ -122,10 +109,7 @@ pre_hook (w, client_data, call_data) } static void -pick_hook (w, client_data, call_data) - Widget w; - XtPointer client_data; - XtPointer call_data; +pick_hook (Widget w, XtPointer client_data, XtPointer call_data) { widget_instance* instance = (widget_instance*)client_data; widget_value* contents_val = (widget_value*)call_data; @@ -150,8 +134,7 @@ pick_hook (w, client_data, call_data) /* creation functions */ static Widget -xlw_create_menubar (instance) - widget_instance* instance; +xlw_create_menubar (widget_instance *instance) { Widget widget; Arg al[5]; @@ -178,8 +161,7 @@ xlw_create_menubar (instance) } static Widget -xlw_create_popup_menu (instance) - widget_instance* instance; +xlw_create_popup_menu (widget_instance *instance) { Widget popup_shell = XtCreatePopupShell (instance->info->name, overrideShellWidgetClass, @@ -214,8 +196,7 @@ xlw_creation_table [] = }; Boolean -lw_lucid_widget_p (widget) - Widget widget; +lw_lucid_widget_p (Widget widget) { WidgetClass the_class = XtClass (widget); @@ -228,16 +209,8 @@ lw_lucid_widget_p (widget) } void -#ifdef PROTOTYPES xlw_update_one_widget (widget_instance* instance, Widget widget, widget_value* val, Boolean deep_p) -#else -xlw_update_one_widget (instance, widget, val, deep_p) - widget_instance* instance; - Widget widget; - widget_value* val; - Boolean deep_p; -#endif { Arg al[1]; @@ -249,29 +222,20 @@ xlw_update_one_widget (instance, widget, val, deep_p) } void -xlw_update_one_value (instance, widget, val) - widget_instance* instance; - Widget widget; - widget_value* val; +xlw_update_one_value (widget_instance *instance, + Widget widget, + widget_value *val) { return; } void -#ifdef PROTOTYPES xlw_pop_instance (widget_instance* instance, Boolean up) -#else -xlw_pop_instance (instance, up) - widget_instance* instance; - Boolean up; -#endif { } void -xlw_popup_menu (widget, event) - Widget widget; - XEvent *event; +xlw_popup_menu (Widget widget, XEvent *event) { XlwMenuWidget mw; @@ -304,8 +268,7 @@ xlw_popup_menu (widget, event) /* Destruction of instances */ void -xlw_destroy_instance (instance) - widget_instance* instance; +xlw_destroy_instance (widget_instance *instance) { if (instance->widget) XtDestroyWidget (instance->widget); diff --git a/lwlib/lwlib-Xlw.h b/lwlib/lwlib-Xlw.h index 36f8244101b..cb2125ee17f 100644 --- a/lwlib/lwlib-Xlw.h +++ b/lwlib/lwlib-Xlw.h @@ -7,24 +7,24 @@ extern widget_creation_entry xlw_creation_table []; extern widget_creation_function xlw_create_dialog; Boolean -lw_lucid_widget_p __P ((Widget widget)); +lw_lucid_widget_p (Widget widget); void -xlw_update_one_widget __P ((widget_instance* instance, Widget widget, - widget_value* val, Boolean deep_p)); +xlw_update_one_widget (widget_instance* instance, Widget widget, + widget_value* val, Boolean deep_p); void -xlw_update_one_value __P ((widget_instance* instance, Widget widget, - widget_value* val)); +xlw_update_one_value (widget_instance* instance, Widget widget, + widget_value* val); void -xlw_destroy_instance __P ((widget_instance* instance)); +xlw_destroy_instance (widget_instance* instance); void -xlw_pop_instance __P ((widget_instance* instance, Boolean up)); +xlw_pop_instance (widget_instance* instance, Boolean up); void -xlw_popup_menu __P ((Widget widget, XEvent * event)); +xlw_popup_menu (Widget widget, XEvent * event); #endif /* LWLIB_XLW_H */ diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c index ed203e26bf4..1116a6a5440 100644 --- a/lwlib/lwlib-Xm.c +++ b/lwlib/lwlib-Xm.c @@ -65,13 +65,6 @@ Boston, MA 02110-1301, USA. */ #include <Xm/DialogS.h> #include <Xm/Form.h> -#undef P_ -#if defined __STDC__ || defined PROTOTYPES -#define P_(X) X -#else -#define P_(X) () -#endif - enum do_call_type { pre_activate, selection, no_selection, post_activate }; @@ -86,63 +79,63 @@ typedef struct _destroyed_instance struct _destroyed_instance* next; } destroyed_instance; -static destroyed_instance *make_destroyed_instance P_ ((char *, char *, - Widget, Widget, - Boolean)); -static void free_destroyed_instance P_ ((destroyed_instance*)); -Widget first_child P_ ((Widget)); -Boolean lw_motif_widget_p P_ ((Widget)); -static XmString resource_motif_string P_ ((Widget, char *)); -static void destroy_all_children P_ ((Widget, int)); -static void xm_update_label P_ ((widget_instance *, Widget, widget_value *)); -static void xm_update_list P_ ((widget_instance *, Widget, widget_value *)); -static void xm_update_pushbutton P_ ((widget_instance *, Widget, - widget_value *)); -static void xm_update_cascadebutton P_ ((widget_instance *, Widget, - widget_value *)); -static void xm_update_toggle P_ ((widget_instance *, Widget, widget_value *)); -static void xm_update_radiobox P_ ((widget_instance *, Widget, widget_value *)); -static void make_menu_in_widget P_ ((widget_instance *, Widget, - widget_value *, int)); -static void update_one_menu_entry P_ ((widget_instance *, Widget, - widget_value *, Boolean)); -static void xm_update_menu P_ ((widget_instance *, Widget, widget_value *, - Boolean)); -static void xm_update_text P_ ((widget_instance *, Widget, widget_value *)); -static void xm_update_text_field P_ ((widget_instance *, Widget, - widget_value *)); -void xm_update_one_value P_ ((widget_instance *, Widget, widget_value *)); -static void activate_button P_ ((Widget, XtPointer, XtPointer)); -static Widget make_dialog P_ ((char *, Widget, Boolean, char *, char *, - Boolean, Boolean, Boolean, int, int)); -static destroyed_instance* find_matching_instance P_ ((widget_instance*)); -static void mark_dead_instance_destroyed P_ ((Widget, XtPointer, XtPointer)); -static void recenter_widget P_ ((Widget)); -static Widget recycle_instance P_ ((destroyed_instance*)); -Widget xm_create_dialog P_ ((widget_instance*)); -static Widget make_menubar P_ ((widget_instance*)); -static void remove_grabs P_ ((Widget, XtPointer, XtPointer)); -static Widget make_popup_menu P_ ((widget_instance*)); -static Widget make_main P_ ((widget_instance*)); -void xm_destroy_instance P_ ((widget_instance*)); -void xm_popup_menu P_ ((Widget, XEvent *)); -static void set_min_dialog_size P_ ((Widget)); -static void do_call P_ ((Widget, XtPointer, enum do_call_type)); -static void xm_generic_callback P_ ((Widget, XtPointer, XtPointer)); -static void xm_nosel_callback P_ ((Widget, XtPointer, XtPointer)); -static void xm_pull_down_callback P_ ((Widget, XtPointer, XtPointer)); -static void xm_pop_down_callback P_ ((Widget, XtPointer, XtPointer)); -void xm_set_keyboard_focus P_ ((Widget, Widget)); -void xm_set_main_areas P_ ((Widget, Widget, Widget)); -static void xm_internal_update_other_instances P_ ((Widget, XtPointer, - XtPointer)); -static void xm_arm_callback P_ ((Widget, XtPointer, XtPointer)); +static destroyed_instance *make_destroyed_instance (char *, char *, + Widget, Widget, + Boolean); +static void free_destroyed_instance (destroyed_instance*); +Widget first_child (Widget); +Boolean lw_motif_widget_p (Widget); +static XmString resource_motif_string (Widget, char *); +static void destroy_all_children (Widget, int); +static void xm_update_label (widget_instance *, Widget, widget_value *); +static void xm_update_list (widget_instance *, Widget, widget_value *); +static void xm_update_pushbutton (widget_instance *, Widget, + widget_value *); +static void xm_update_cascadebutton (widget_instance *, Widget, + widget_value *); +static void xm_update_toggle (widget_instance *, Widget, widget_value *); +static void xm_update_radiobox (widget_instance *, Widget, widget_value *); +static void make_menu_in_widget (widget_instance *, Widget, + widget_value *, int); +static void update_one_menu_entry (widget_instance *, Widget, + widget_value *, Boolean); +static void xm_update_menu (widget_instance *, Widget, widget_value *, + Boolean); +static void xm_update_text (widget_instance *, Widget, widget_value *); +static void xm_update_text_field (widget_instance *, Widget, + widget_value *); +void xm_update_one_value (widget_instance *, Widget, widget_value *); +static void activate_button (Widget, XtPointer, XtPointer); +static Widget make_dialog (char *, Widget, Boolean, char *, char *, + Boolean, Boolean, Boolean, int, int); +static destroyed_instance* find_matching_instance (widget_instance*); +static void mark_dead_instance_destroyed (Widget, XtPointer, XtPointer); +static void recenter_widget (Widget); +static Widget recycle_instance (destroyed_instance*); +Widget xm_create_dialog (widget_instance*); +static Widget make_menubar (widget_instance*); +static void remove_grabs (Widget, XtPointer, XtPointer); +static Widget make_popup_menu (widget_instance*); +static Widget make_main (widget_instance*); +void xm_destroy_instance (widget_instance*); +void xm_popup_menu (Widget, XEvent *); +static void set_min_dialog_size (Widget); +static void do_call (Widget, XtPointer, enum do_call_type); +static void xm_generic_callback (Widget, XtPointer, XtPointer); +static void xm_nosel_callback (Widget, XtPointer, XtPointer); +static void xm_pull_down_callback (Widget, XtPointer, XtPointer); +static void xm_pop_down_callback (Widget, XtPointer, XtPointer); +void xm_set_keyboard_focus (Widget, Widget); +void xm_set_main_areas (Widget, Widget, Widget); +static void xm_internal_update_other_instances (Widget, XtPointer, + XtPointer); +static void xm_arm_callback (Widget, XtPointer, XtPointer); #if 0 -void xm_update_one_widget P_ ((widget_instance *, Widget, widget_value *, - Boolean)); -void xm_pop_instance P_ ((widget_instance*, Boolean)); -void xm_manage_resizing P_ ((Widget, Boolean)); +void xm_update_one_widget (widget_instance *, Widget, widget_value *, + Boolean); +void xm_pop_instance (widget_instance*, Boolean); +void xm_manage_resizing (Widget, Boolean); #endif @@ -152,8 +145,7 @@ void xm_manage_resizing P_ ((Widget, Boolean)); This is sometimes handy to have available. */ void -x_print_complete_resource_name (widget) - Widget widget; +x_print_complete_resource_name (Widget widget) { int i; String names[100]; @@ -175,12 +167,11 @@ x_print_complete_resource_name (widget) static destroyed_instance *all_destroyed_instances = NULL; static destroyed_instance* -make_destroyed_instance (name, type, widget, parent, pop_up_p) - char* name; - char* type; - Widget widget; - Widget parent; - Boolean pop_up_p; +make_destroyed_instance (char* name, + char* type, + Widget widget, + Widget parent, + Boolean pop_up_p) { destroyed_instance* instance = (destroyed_instance*)malloc (sizeof (destroyed_instance)); @@ -194,8 +185,7 @@ make_destroyed_instance (name, type, widget, parent, pop_up_p) } static void -free_destroyed_instance (instance) - destroyed_instance* instance; +free_destroyed_instance (destroyed_instance* instance) { free (instance->name); free (instance->type); @@ -204,15 +194,13 @@ free_destroyed_instance (instance) /* motif utility functions */ Widget -first_child (widget) - Widget widget; +first_child (Widget widget) { return ((CompositeWidget)widget)->composite.children [0]; } Boolean -lw_motif_widget_p (widget) - Widget widget; +lw_motif_widget_p (Widget widget) { return XtClass (widget) == xmDialogShellWidgetClass @@ -220,9 +208,8 @@ lw_motif_widget_p (widget) } static XmString -resource_motif_string (widget, name) - Widget widget; - char* name; +resource_motif_string (Widget widget, + char* name) { XtResource resource; XmString result = 0; @@ -244,9 +231,8 @@ resource_motif_string (widget, name) starting with number FIRST_CHILD_TO_DESTROY. */ static void -destroy_all_children (widget, first_child_to_destroy) - Widget widget; - int first_child_to_destroy; +destroy_all_children (Widget widget, + int first_child_to_destroy) { Widget* children; unsigned int number; @@ -292,9 +278,7 @@ destroy_all_children (widget, first_child_to_destroy) is called. */ static void -xm_arm_callback (w, client_data, call_data) - Widget w; - XtPointer client_data, call_data; +xm_arm_callback (Widget w, XtPointer client_data, XtPointer call_data) { XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct *) call_data; widget_value *wv = (widget_value *) client_data; @@ -346,10 +330,9 @@ xm_arm_callback (w, client_data, call_data) not null, and contains the label string to display. */ static void -xm_update_label (instance, widget, val) - widget_instance* instance; - Widget widget; - widget_value* val; +xm_update_label (widget_instance* instance, + Widget widget, + widget_value* val) { XmString res_string = 0; XmString built_string = 0; @@ -397,10 +380,9 @@ xm_update_label (instance, widget, val) /* update of list */ static void -xm_update_list (instance, widget, val) - widget_instance* instance; - Widget widget; - widget_value* val; +xm_update_list (widget_instance* instance, + Widget widget, + widget_value* val) { widget_value* cur; int i; @@ -421,10 +403,9 @@ xm_update_list (instance, widget, val) /* update of buttons */ static void -xm_update_pushbutton (instance, widget, val) - widget_instance* instance; - Widget widget; - widget_value* val; +xm_update_pushbutton (widget_instance* instance, + Widget widget, + widget_value* val) { XtVaSetValues (widget, XmNalignment, XmALIGNMENT_CENTER, NULL); XtRemoveAllCallbacks (widget, XmNactivateCallback); @@ -432,10 +413,9 @@ xm_update_pushbutton (instance, widget, val) } static void -xm_update_cascadebutton (instance, widget, val) - widget_instance* instance; - Widget widget; - widget_value* val; +xm_update_cascadebutton (widget_instance* instance, + Widget widget, + widget_value* val) { /* Should also rebuild the menu by calling ...update_menu... */ XtRemoveAllCallbacks (widget, XmNcascadingCallback); @@ -445,10 +425,9 @@ xm_update_cascadebutton (instance, widget, val) /* update toggle and radiobox */ static void -xm_update_toggle (instance, widget, val) - widget_instance* instance; - Widget widget; - widget_value* val; +xm_update_toggle (widget_instance* instance, + Widget widget, + widget_value* val) { XtRemoveAllCallbacks (widget, XmNvalueChangedCallback); XtAddCallback (widget, XmNvalueChangedCallback, @@ -458,10 +437,9 @@ xm_update_toggle (instance, widget, val) } static void -xm_update_radiobox (instance, widget, val) - widget_instance* instance; - Widget widget; - widget_value* val; +xm_update_radiobox (widget_instance* instance, + Widget widget, + widget_value* val) { Widget toggle; @@ -505,11 +483,10 @@ xm_update_radiobox (instance, widget, val) /* KEEP_FIRST_CHILDREN gives the number of initial children to keep. */ static void -make_menu_in_widget (instance, widget, val, keep_first_children) - widget_instance* instance; - Widget widget; - widget_value* val; - int keep_first_children; +make_menu_in_widget (widget_instance* instance, + Widget widget, + widget_value* val, + int keep_first_children) { Widget* children = 0; int num_children; @@ -662,11 +639,10 @@ make_menu_in_widget (instance, widget, val, keep_first_children) } static void -update_one_menu_entry (instance, widget, val, deep_p) - widget_instance* instance; - Widget widget; - widget_value* val; - Boolean deep_p; +update_one_menu_entry (widget_instance* instance, + Widget widget, + widget_value* val, + Boolean deep_p) { Arg al [256]; int ac; @@ -764,11 +740,10 @@ update_one_menu_entry (instance, widget, val, deep_p) } static void -xm_update_menu (instance, widget, val, deep_p) - widget_instance* instance; - Widget widget; - widget_value* val; - Boolean deep_p; +xm_update_menu (widget_instance* instance, + Widget widget, + widget_value* val, + Boolean deep_p) { Widget* children; unsigned int num_children; @@ -839,10 +814,9 @@ xm_update_menu (instance, widget, val, deep_p) /* update text widgets */ static void -xm_update_text (instance, widget, val) - widget_instance* instance; - Widget widget; - widget_value* val; +xm_update_text (widget_instance* instance, + Widget widget, + widget_value* val) { XmTextSetString (widget, val->value ? val->value : ""); XtRemoveAllCallbacks (widget, XmNactivateCallback); @@ -853,10 +827,9 @@ xm_update_text (instance, widget, val) } static void -xm_update_text_field (instance, widget, val) - widget_instance* instance; - Widget widget; - widget_value* val; +xm_update_text_field (widget_instance* instance, + Widget widget, + widget_value* val) { XmTextFieldSetString (widget, val->value ? val->value : ""); XtRemoveAllCallbacks (widget, XmNactivateCallback); @@ -870,11 +843,10 @@ xm_update_text_field (instance, widget, val) /* update a motif widget */ void -xm_update_one_widget (instance, widget, val, deep_p) - widget_instance* instance; - Widget widget; - widget_value* val; - Boolean deep_p; +xm_update_one_widget (widget_instance* instance, + Widget widget, + widget_value* val, + Boolean deep_p) { WidgetClass class; @@ -935,10 +907,9 @@ xm_update_one_widget (instance, widget, val, deep_p) /* getting the value back */ void -xm_update_one_value (instance, widget, val) - widget_instance* instance; - Widget widget; - widget_value* val; +xm_update_one_value (widget_instance* instance, + Widget widget, + widget_value* val) { WidgetClass class = XtClass (widget); widget_value *old_wv; @@ -1031,10 +1002,9 @@ xm_update_one_value (instance, widget, val) I could not find a way to do that with accelerators. */ static void -activate_button (widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +activate_button (Widget widget, + XtPointer closure, + XtPointer call_data) { Widget button = (Widget)closure; XtCallCallbacks (button, XmNactivateCallback, NULL); @@ -1044,11 +1014,10 @@ activate_button (widget, closure, call_data) /* Called for key press in dialogs. Used to pop down dialog on ESC. */ static void -dialog_key_cb (widget, closure, event, continue_to_dispatch) - Widget widget; - XtPointer closure; - XEvent *event; - Boolean *continue_to_dispatch; +dialog_key_cb (Widget widget, + XtPointer closure, + XEvent *event, + Boolean *continue_to_dispatch) { KeySym sym = 0; Modifiers modif_ret; @@ -1071,18 +1040,16 @@ dialog_key_cb (widget, closure, event, continue_to_dispatch) /* dialogs */ static Widget -make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, - radio_box, list, left_buttons, right_buttons) - char* name; - Widget parent; - Boolean pop_up_p; - char* shell_title; - char* icon_name; - Boolean text_input_slot; - Boolean radio_box; - Boolean list; - int left_buttons; - int right_buttons; +make_dialog (char* name, + Widget parent, + Boolean pop_up_p, + char* shell_title, + char* icon_name, + Boolean text_input_slot, + Boolean radio_box, + Boolean list, + int left_buttons, + int right_buttons) { Widget result; Widget form; @@ -1335,8 +1302,7 @@ make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, } static destroyed_instance* -find_matching_instance (instance) - widget_instance* instance; +find_matching_instance (widget_instance* instance) { destroyed_instance* cur; destroyed_instance* prev; @@ -1373,18 +1339,16 @@ find_matching_instance (instance) } static void -mark_dead_instance_destroyed (widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +mark_dead_instance_destroyed (Widget widget, + XtPointer closure, + XtPointer call_data) { destroyed_instance* instance = (destroyed_instance*)closure; instance->widget = NULL; } static void -recenter_widget (widget) - Widget widget; +recenter_widget (Widget widget) { Widget parent = XtParent (widget); Screen* screen = XtScreen (widget); @@ -1420,8 +1384,7 @@ recenter_widget (widget) } static Widget -recycle_instance (instance) - destroyed_instance* instance; +recycle_instance (destroyed_instance* instance) { Widget widget = instance->widget; @@ -1457,8 +1420,7 @@ recycle_instance (instance) } Widget -xm_create_dialog (instance) - widget_instance* instance; +xm_create_dialog (widget_instance* instance) { char* name = instance->info->type; Widget parent = instance->parent; @@ -1538,8 +1500,7 @@ xm_create_dialog (instance) because we have not yet managed to make it work right in Motif. */ static Widget -make_menubar (instance) - widget_instance* instance; +make_menubar (widget_instance* instance) { Arg al[3]; int ac; @@ -1550,18 +1511,16 @@ make_menubar (instance) } static void -remove_grabs (shell, closure, call_data) - Widget shell; - XtPointer closure; - XtPointer call_data; +remove_grabs (Widget shell, + XtPointer closure, + XtPointer call_data) { Widget menu = (Widget) closure; XmRemoveFromPostFromList (menu, XtParent (XtParent (menu))); } static Widget -make_popup_menu (instance) - widget_instance* instance; +make_popup_menu (widget_instance* instance) { Widget parent = instance->parent; Window parent_window = parent->core.window; @@ -1577,8 +1536,7 @@ make_popup_menu (instance) } static Widget -make_main (instance) - widget_instance* instance; +make_main (widget_instance* instance) { Widget parent = instance->parent; Widget result; @@ -1717,8 +1675,7 @@ xm_creation_table [] = /* Destruction of instances */ void -xm_destroy_instance (instance) - widget_instance* instance; +xm_destroy_instance ( widget_instance* instance) { Widget widget = instance->widget; /* recycle the dialog boxes */ @@ -1752,9 +1709,7 @@ xm_destroy_instance (instance) /* popup utility */ void -xm_popup_menu (widget, event) - Widget widget; - XEvent *event; +xm_popup_menu (Widget widget, XEvent *event) { XButtonPressedEvent dummy; @@ -1802,8 +1757,7 @@ xm_popup_menu (widget, event) } static void -set_min_dialog_size (w) - Widget w; +set_min_dialog_size (Widget w) { short width; short height; @@ -1812,9 +1766,7 @@ set_min_dialog_size (w) } void -xm_pop_instance (instance, up) - widget_instance* instance; - Boolean up; +xm_pop_instance (widget_instance* instance, Boolean up) { Widget widget = instance->widget; @@ -1843,10 +1795,9 @@ xm_pop_instance (instance, up) /* motif callback */ static void -do_call (widget, closure, type) - Widget widget; - XtPointer closure; - enum do_call_type type; +do_call (Widget widget, + XtPointer closure, + enum do_call_type type) { Arg al [256]; int ac; @@ -1903,10 +1854,9 @@ do_call (widget, closure, type) if the widget was ``destroyed'' by caching it in the all_destroyed_instances list */ static void -xm_internal_update_other_instances (widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +xm_internal_update_other_instances (Widget widget, + XtPointer closure, + XtPointer call_data) { Widget parent; for (parent = widget; parent; parent = XtParent (parent)) @@ -1918,20 +1868,18 @@ xm_internal_update_other_instances (widget, closure, call_data) } static void -xm_generic_callback (widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +xm_generic_callback (Widget widget, + XtPointer closure, + XtPointer call_data) { lw_internal_update_other_instances (widget, closure, call_data); do_call (widget, closure, selection); } static void -xm_nosel_callback (widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +xm_nosel_callback (Widget widget, + XtPointer closure, + XtPointer call_data) { /* This callback is only called when a dialog box is dismissed with the wm's destroy button (WM_DELETE_WINDOW.) We want the dialog @@ -1946,10 +1894,9 @@ xm_nosel_callback (widget, closure, call_data) } static void -xm_pull_down_callback (widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +xm_pull_down_callback (Widget widget, + XtPointer closure, + XtPointer call_data) { Widget parent = XtParent (widget); @@ -1970,10 +1917,9 @@ xm_pull_down_callback (widget, closure, call_data) menu, whether or not its submenu is visible. */ static void -xm_pop_down_callback (widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +xm_pop_down_callback (Widget widget, + XtPointer closure, + XtPointer call_data) { widget_instance *instance = (widget_instance *) closure; @@ -1985,9 +1931,7 @@ xm_pop_down_callback (widget, closure, call_data) /* set the keyboard focus */ void -xm_set_keyboard_focus (parent, w) - Widget parent; - Widget w; +xm_set_keyboard_focus (Widget parent, Widget w) { XmProcessTraversal (w, 0); XtSetKeyboardFocus (parent, w); @@ -1995,10 +1939,9 @@ xm_set_keyboard_focus (parent, w) /* Motif hack to set the main window areas. */ void -xm_set_main_areas (parent, menubar, work_area) - Widget parent; - Widget menubar; - Widget work_area; +xm_set_main_areas (Widget parent, + Widget menubar, + Widget work_area) { XmMainWindowSetAreas (parent, menubar, /* menubar (maybe 0) */ @@ -2010,9 +1953,7 @@ xm_set_main_areas (parent, menubar, work_area) /* Motif hack to control resizing on the menubar. */ void -xm_manage_resizing (w, flag) - Widget w; - Boolean flag; +xm_manage_resizing (Widget w, Boolean flag) { XtVaSetValues (w, XtNallowShellResize, flag, NULL); } diff --git a/lwlib/lwlib-Xm.h b/lwlib/lwlib-Xm.h index 3a827036f36..a68fd4ee458 100644 --- a/lwlib/lwlib-Xm.h +++ b/lwlib/lwlib-Xm.h @@ -26,36 +26,36 @@ Boston, MA 02110-1301, USA. */ extern widget_creation_entry xm_creation_table []; Widget -xm_create_dialog __P ((widget_instance* instance)); +xm_create_dialog (widget_instance* instance); Boolean -lw_motif_widget_p __P ((Widget widget)); +lw_motif_widget_p (Widget widget); void -xm_update_one_widget __P ((widget_instance* instance, Widget widget, - widget_value* val, Boolean deep_p)); +xm_update_one_widget (widget_instance* instance, Widget widget, + widget_value* val, Boolean deep_p); void -xm_update_one_value __P ((widget_instance* instance, Widget widget, - widget_value* val)); +xm_update_one_value (widget_instance* instance, Widget widget, + widget_value* val); void -xm_destroy_instance __P ((widget_instance* instance)); +xm_destroy_instance (widget_instance* instance); void -xm_set_keyboard_focus __P ((Widget parent, Widget w)); +xm_set_keyboard_focus (Widget parent, Widget w); void -xm_popup_menu __P ((Widget widget, XEvent *event)); +xm_popup_menu (Widget widget, XEvent *event); void -xm_pop_instance __P ((widget_instance* instance, Boolean up)); +xm_pop_instance (widget_instance* instance, Boolean up); void -xm_set_main_areas __P ((Widget parent, Widget menubar, Widget work_area)); +xm_set_main_areas (Widget parent, Widget menubar, Widget work_area); void -xm_manage_resizing __P ((Widget w, Boolean flag)); +xm_manage_resizing (Widget w, Boolean flag); #endif /* LWLIB_XM_H */ diff --git a/lwlib/lwlib-int.h b/lwlib/lwlib-int.h index ba48d191752..e84d7fb9956 100644 --- a/lwlib/lwlib-int.h +++ b/lwlib/lwlib-int.h @@ -26,7 +26,7 @@ Boston, MA 02110-1301, USA. */ #include "lwlib.h" -extern char *safe_strdup __P ((const char *)); +extern char *safe_strdup (const char *); struct widget_xft_data; @@ -58,8 +58,7 @@ typedef struct _widget_info struct _widget_info* next; } widget_info; -typedef Widget -(*widget_creation_function) (); +typedef Widget (*widget_creation_function) (widget_instance *instance); typedef struct _widget_creation_entry { @@ -70,14 +69,14 @@ typedef struct _widget_creation_entry /* update all other instances of a widget. Can be used in a callback when a widget has been used by the user */ void -lw_internal_update_other_instances __P ((Widget, XtPointer, XtPointer)); +lw_internal_update_other_instances (Widget, XtPointer, XtPointer); /* get the widget_value for a widget in a given instance */ widget_value* -lw_get_widget_value_for_widget __P ((widget_instance *, Widget)); +lw_get_widget_value_for_widget (widget_instance *, Widget); -widget_info *lw_get_widget_info __P ((LWLIB_ID)); -widget_instance * lw_get_widget_instance __P ((Widget)); +widget_info *lw_get_widget_info (LWLIB_ID); +widget_instance * lw_get_widget_instance (Widget); #endif /* LWLIB_INTERNAL_H */ diff --git a/lwlib/lwlib-utils.c b/lwlib/lwlib-utils.c index 9dce513cb82..ea765cf5bd1 100644 --- a/lwlib/lwlib-utils.c +++ b/lwlib/lwlib-utils.c @@ -42,8 +42,7 @@ Boston, MA 02110-1301, USA. */ /* Redisplay the contents of the widget, without first clearing it. */ void -XtNoClearRefreshWidget (widget) - Widget widget; +XtNoClearRefreshWidget (Widget widget) { XEvent event; @@ -67,10 +66,7 @@ XtNoClearRefreshWidget (widget) * Apply a function to all the subwidgets of a given widget recursively. */ void -XtApplyToWidgets (w, proc, arg) - Widget w; - XtApplyToWidgetsProc proc; - XtPointer arg; +XtApplyToWidgets (Widget w, XtApplyToWidgetsProc proc, XtPointer arg) { if (XtIsComposite (w)) { @@ -81,8 +77,8 @@ XtApplyToWidgets (w, proc, arg) int nkids = cw->composite.num_children; Widget *kids = (Widget *) malloc (sizeof (Widget) * nkids); int i; - lwlib_bcopy ((char *) cw->composite.children, (char *) kids, - sizeof (Widget) * nkids); + memcpy ((char *) kids, (char *) cw->composite.children, + sizeof (Widget) * nkids); for (i = 0; i < nkids; i++) /* This prevent us from using gadgets, why is it here? */ /* if (XtIsWidget (kids [i])) */ @@ -101,10 +97,7 @@ XtApplyToWidgets (w, proc, arg) * Stop as soon as the function returns non NULL and returns this as a value. */ void * -XtApplyUntilToWidgets (w, proc, arg) - Widget w; - XtApplyUntilToWidgetsProc proc; - XtPointer arg; +XtApplyUntilToWidgets (Widget w, XtApplyUntilToWidgetsProc proc, XtPointer arg) { void* result; if (XtIsComposite (w)) @@ -130,9 +123,7 @@ XtApplyUntilToWidgets (w, proc, arg) * Returns a copy of the list of all children of a composite widget */ Widget * -XtCompositeChildren (widget, number) - Widget widget; - unsigned int* number; +XtCompositeChildren (Widget widget, unsigned int *number) { CompositeWidget cw = (CompositeWidget)widget; Widget* result; @@ -153,15 +144,13 @@ XtCompositeChildren (widget, number) } Boolean -XtWidgetBeingDestroyedP (widget) - Widget widget; +XtWidgetBeingDestroyedP (Widget widget) { return widget->core.being_destroyed; } void -XtSafelyDestroyWidget (widget) - Widget widget; +XtSafelyDestroyWidget (Widget widget) { #if 0 diff --git a/lwlib/lwlib-utils.h b/lwlib/lwlib-utils.h index 934b0b48f4a..d4dbda8467d 100644 --- a/lwlib/lwlib-utils.h +++ b/lwlib/lwlib-utils.h @@ -1,21 +1,21 @@ #ifndef _LWLIB_UTILS_H_ #define _LWLIB_UTILS_H_ -void XtNoClearRefreshWidget __P ((Widget)); +void XtNoClearRefreshWidget (Widget); -typedef void (*XtApplyToWidgetsProc) __P ((Widget, XtPointer)); -typedef void* (*XtApplyUntilToWidgetsProc) __P ((Widget, XtPointer)); +typedef void (*XtApplyToWidgetsProc) (Widget, XtPointer); +typedef void* (*XtApplyUntilToWidgetsProc) (Widget, XtPointer); -void XtApplyToWidgets __P ((Widget, XtApplyToWidgetsProc, XtPointer)); -void *XtApplyUntilToWidgets __P ((Widget, XtApplyUntilToWidgetsProc, XtPointer)); +void XtApplyToWidgets (Widget, XtApplyToWidgetsProc, XtPointer); +void *XtApplyUntilToWidgets (Widget, XtApplyUntilToWidgetsProc, XtPointer); -Widget *XtCompositeChildren __P ((Widget, unsigned int *)); +Widget *XtCompositeChildren (Widget, unsigned int *); /* returns True is the widget is being destroyed, False otherwise */ Boolean -XtWidgetBeingDestroyedP __P ((Widget widget)); +XtWidgetBeingDestroyedP (Widget widget); -void XtSafelyDestroyWidget __P ((Widget)); +void XtSafelyDestroyWidget (Widget); #endif /* _LWLIB_UTILS_H_ */ diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c index 5a64e4da984..2b72f54bb19 100644 --- a/lwlib/lwlib.c +++ b/lwlib/lwlib.c @@ -71,67 +71,42 @@ char *lwlib_toolkit_type = "motif"; char *lwlib_toolkit_type = "lucid"; #endif -static widget_value *merge_widget_value P_ ((widget_value *, - widget_value *, - int, int *)); -static void instantiate_widget_instance P_ ((widget_instance *)); -static int my_strcasecmp P_ ((char *, char *)); -static void safe_free_str P_ ((char *)); -static void free_widget_value_tree P_ ((widget_value *)); -static widget_value *copy_widget_value_tree P_ ((widget_value *, - change_type)); -static widget_info *allocate_widget_info P_ ((char *, char *, LWLIB_ID, - widget_value *, - lw_callback, lw_callback, - lw_callback, lw_callback)); -static void free_widget_info P_ ((widget_info *)); -static void mark_widget_destroyed P_ ((Widget, XtPointer, XtPointer)); -static widget_instance *allocate_widget_instance P_ ((widget_info *, - Widget, Boolean)); -static void free_widget_instance P_ ((widget_instance *)); -static widget_info *get_widget_info P_ ((LWLIB_ID, Boolean)); -static widget_instance *get_widget_instance P_ ((Widget, Boolean)); -static widget_instance *find_instance P_ ((LWLIB_ID, Widget, Boolean)); -static Boolean safe_strcmp P_ ((char *, char *)); -static Widget name_to_widget P_ ((widget_instance *, char *)); -static void set_one_value P_ ((widget_instance *, widget_value *, Boolean)); -static void update_one_widget_instance P_ ((widget_instance *, Boolean)); -static void update_all_widget_values P_ ((widget_info *, Boolean)); -static void initialize_widget_instance P_ ((widget_instance *)); -static widget_creation_function find_in_table P_ ((char *, widget_creation_entry *)); -static Boolean dialog_spec_p P_ ((char *)); -static void destroy_one_instance P_ ((widget_instance *)); -static void lw_pop_all_widgets P_ ((LWLIB_ID, Boolean)); -static Boolean get_one_value P_ ((widget_instance *, widget_value *)); -static void show_one_widget_busy P_ ((Widget, Boolean)); - -void -lwlib_memset (address, value, length) - char *address; - int value; - size_t length; -{ - int i; - - for (i = 0; i < length; i++) - address[i] = value; -} - -void -lwlib_bcopy (from, to, length) - char *from; - char *to; - int length; -{ - int i; - - for (i = 0; i < length; i++) - to[i] = from[i]; -} +static widget_value *merge_widget_value (widget_value *, + widget_value *, + int, int *); +static void instantiate_widget_instance (widget_instance *); +static int my_strcasecmp (char *, char *); +static void safe_free_str (char *); +static void free_widget_value_tree (widget_value *); +static widget_value *copy_widget_value_tree (widget_value *, + change_type); +static widget_info *allocate_widget_info (char *, char *, LWLIB_ID, + widget_value *, + lw_callback, lw_callback, + lw_callback, lw_callback); +static void free_widget_info (widget_info *); +static void mark_widget_destroyed (Widget, XtPointer, XtPointer); +static widget_instance *allocate_widget_instance (widget_info *, + Widget, Boolean); +static void free_widget_instance (widget_instance *); +static widget_info *get_widget_info (LWLIB_ID, Boolean); +static widget_instance *get_widget_instance (Widget, Boolean); +static widget_instance *find_instance (LWLIB_ID, Widget, Boolean); +static Boolean safe_strcmp (char *, char *); +static Widget name_to_widget (widget_instance *, char *); +static void set_one_value (widget_instance *, widget_value *, Boolean); +static void update_one_widget_instance (widget_instance *, Boolean); +static void update_all_widget_values (widget_info *, Boolean); +static void initialize_widget_instance (widget_instance *); +static widget_creation_function find_in_table (char *, widget_creation_entry *); +static Boolean dialog_spec_p (char *); +static void destroy_one_instance (widget_instance *); +static void lw_pop_all_widgets (LWLIB_ID, Boolean); +static Boolean get_one_value (widget_instance *, widget_value *); +static void show_one_widget_busy (Widget, Boolean); /* utility functions for widget_instance and widget_info */ char * -safe_strdup (s) - const char *s; +safe_strdup (const char *s) { char *result; if (! s) return 0; @@ -145,8 +120,7 @@ safe_strdup (s) /* Like strcmp but ignore differences in case. */ static int -my_strcasecmp (s1, s2) - char *s1, *s2; +my_strcasecmp (char *s1, char *s2) { while (1) { @@ -164,8 +138,7 @@ my_strcasecmp (s1, s2) } static void -safe_free_str (s) - char *s; +safe_free_str (char *s) { free (s); } @@ -174,7 +147,7 @@ static widget_value *widget_value_free_list = 0; static int malloc_cpt = 0; widget_value * -malloc_widget_value () +malloc_widget_value (void) { widget_value *wv; if (widget_value_free_list) @@ -188,7 +161,7 @@ malloc_widget_value () wv = (widget_value *) malloc (sizeof (widget_value)); malloc_cpt++; } - lwlib_memset ((void*) wv, 0, sizeof (widget_value)); + memset ((void*) wv, 0, sizeof (widget_value)); return wv; } @@ -196,8 +169,7 @@ malloc_widget_value () by malloc_widget_value(), and no substructures. */ void -free_widget_value (wv) - widget_value *wv; +free_widget_value (widget_value *wv) { if (wv->free_list) abort (); @@ -217,8 +189,7 @@ free_widget_value (wv) } static void -free_widget_value_tree (wv) - widget_value *wv; +free_widget_value_tree (widget_value *wv) { if (!wv) return; @@ -249,9 +220,7 @@ free_widget_value_tree (wv) } static widget_value * -copy_widget_value_tree (val, change) - widget_value* val; - change_type change; +copy_widget_value_tree (widget_value *val, change_type change) { widget_value* copy; @@ -280,16 +249,14 @@ copy_widget_value_tree (val, change) } static widget_info * -allocate_widget_info (type, name, id, val, pre_activate_cb, - selection_cb, post_activate_cb, highlight_cb) - char* type; - char* name; - LWLIB_ID id; - widget_value* val; - lw_callback pre_activate_cb; - lw_callback selection_cb; - lw_callback post_activate_cb; - lw_callback highlight_cb; +allocate_widget_info (char* type, + char* name, + LWLIB_ID id, + widget_value* val, + lw_callback pre_activate_cb, + lw_callback selection_cb, + lw_callback post_activate_cb, + lw_callback highlight_cb) { widget_info* info = (widget_info*)malloc (sizeof (widget_info)); info->type = safe_strdup (type); @@ -310,21 +277,17 @@ allocate_widget_info (type, name, id, val, pre_activate_cb, } static void -free_widget_info (info) - widget_info* info; +free_widget_info (widget_info *info) { safe_free_str (info->type); safe_free_str (info->name); free_widget_value_tree (info->val); - lwlib_memset ((void*)info, 0xDEADBEEF, sizeof (widget_info)); + memset ((void*)info, 0xDEADBEEF, sizeof (widget_info)); free (info); } static void -mark_widget_destroyed (widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +mark_widget_destroyed (Widget widget, XtPointer closure, XtPointer call_data) { widget_instance* instance = (widget_instance*)closure; @@ -333,22 +296,12 @@ mark_widget_destroyed (widget, closure, call_data) instance->widget = NULL; } -/* The messy #ifdef PROTOTYPES here and elsewhere are prompted by a - flood of warnings about argument promotion from proprietary ISO C - compilers. (etags still only makes one entry for each function.) */ static widget_instance * -#ifdef PROTOTYPES allocate_widget_instance (widget_info* info, Widget parent, Boolean pop_up_p) -#else -allocate_widget_instance (info, parent, pop_up_p) - widget_info* info; - Widget parent; - Boolean pop_up_p; -#endif { widget_instance* instance = (widget_instance*)malloc (sizeof (widget_instance)); - bzero (instance, sizeof *instance); + memset (instance, 0, sizeof *instance); instance->parent = parent; instance->pop_up_p = pop_up_p; instance->info = info; @@ -363,21 +316,14 @@ allocate_widget_instance (info, parent, pop_up_p) } static void -free_widget_instance (instance) - widget_instance* instance; +free_widget_instance (widget_instance *instance) { - lwlib_memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance)); + memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance)); free (instance); } static widget_info * -#ifdef PROTOTYPES get_widget_info (LWLIB_ID id, Boolean remove_p) -#else -get_widget_info (id, remove_p) - LWLIB_ID id; - Boolean remove_p; -#endif { widget_info* info; widget_info* prev; @@ -401,20 +347,13 @@ get_widget_info (id, remove_p) /* Internal function used by the library dependent implementation to get the widget_value for a given widget in an instance */ widget_info * -lw_get_widget_info (id) - LWLIB_ID id; +lw_get_widget_info (LWLIB_ID id) { return get_widget_info (id, 0); } static widget_instance * -#ifdef PROTOTYPES get_widget_instance (Widget widget, Boolean remove_p) -#else -get_widget_instance (widget, remove_p) - Widget widget; - Boolean remove_p; -#endif { widget_info* info; widget_instance* instance; @@ -441,21 +380,13 @@ get_widget_instance (widget, remove_p) WIDGET, or null if WIDGET is not a lwlib widget. */ widget_instance * -lw_get_widget_instance (widget) - Widget widget; +lw_get_widget_instance (Widget widget) { return get_widget_instance (widget, False); } static widget_instance* -#ifdef PROTOTYPES find_instance (LWLIB_ID id, Widget parent, Boolean pop_up_p) -#else -find_instance (id, parent, pop_up_p) - LWLIB_ID id; - Widget parent; - Boolean pop_up_p; -#endif { widget_info* info = get_widget_info (id, False); widget_instance* instance; @@ -471,9 +402,7 @@ find_instance (id, parent, pop_up_p) /* utility function for widget_value */ static Boolean -safe_strcmp (s1, s2) - char* s1; - char* s2; +safe_strcmp (char *s1, char *s2) { if (!!s1 ^ !!s2) return True; return (s1 && s2) ? strcmp (s1, s2) : s1 ? False : !!s2; @@ -500,11 +429,10 @@ safe_strcmp (s1, s2) static widget_value * -merge_widget_value (val1, val2, level, change_p) - widget_value* val1; - widget_value* val2; - int level; - int *change_p; +merge_widget_value (widget_value *val1, + widget_value *val2, + int level, + int *change_p) { change_type change, this_one_change; widget_value* merged_next; @@ -658,9 +586,7 @@ merge_widget_value (val1, val2, level, change_p) /* modifying the widgets */ static Widget -name_to_widget (instance, name) - widget_instance* instance; - char* name; +name_to_widget (widget_instance *instance, char *name) { Widget widget = NULL; @@ -684,14 +610,7 @@ name_to_widget (instance, name) } static void -#ifdef PROTOTYPES set_one_value (widget_instance* instance, widget_value* val, Boolean deep_p) -#else -set_one_value (instance, val, deep_p) - widget_instance* instance; - widget_value* val; - Boolean deep_p; -#endif { Widget widget = name_to_widget (instance, val->name); @@ -713,13 +632,7 @@ set_one_value (instance, val, deep_p) } static void -#ifdef PROTOTYPES update_one_widget_instance (widget_instance* instance, Boolean deep_p) -#else -update_one_widget_instance (instance, deep_p) - widget_instance* instance; - Boolean deep_p; -#endif { widget_value *val; @@ -733,13 +646,7 @@ update_one_widget_instance (instance, deep_p) } static void -#ifdef PROTOTYPES update_all_widget_values (widget_info* info, Boolean deep_p) -#else -update_all_widget_values (info, deep_p) - widget_info* info; - Boolean deep_p; -#endif { widget_instance* instance; widget_value* val; @@ -752,14 +659,7 @@ update_all_widget_values (info, deep_p) } int -#ifdef PROTOTYPES lw_modify_all_widgets (LWLIB_ID id, widget_value* val, Boolean deep_p) -#else -lw_modify_all_widgets (id, val, deep_p) - LWLIB_ID id; - widget_value* val; - Boolean deep_p; -#endif { widget_info* info = get_widget_info (id, False); widget_value* new_val; @@ -814,8 +714,7 @@ lw_modify_all_widgets (id, val, deep_p) /* creating the widgets */ static void -initialize_widget_instance (instance) - widget_instance* instance; +initialize_widget_instance (widget_instance *instance) { widget_value* val; @@ -830,9 +729,7 @@ initialize_widget_instance (instance) static widget_creation_function -find_in_table (type, table) - char* type; - widget_creation_entry* table; +find_in_table (char *type, widget_creation_entry *table) { widget_creation_entry* cur; for (cur = table; cur->type; cur++) @@ -842,8 +739,7 @@ find_in_table (type, table) } static Boolean -dialog_spec_p (name) - char* name; +dialog_spec_p (char *name) { /* return True if name matches [EILPQeilpq][1-9][Bb] or [EILPQeilpq][1-9][Bb][Rr][1-9] */ @@ -876,8 +772,7 @@ dialog_spec_p (name) } static void -instantiate_widget_instance (instance) - widget_instance* instance; +instantiate_widget_instance (widget_instance *instance) { widget_creation_function function = NULL; @@ -928,16 +823,14 @@ instantiate_widget_instance (instance) } void -lw_register_widget (type, name, id, val, pre_activate_cb, - selection_cb, post_activate_cb, highlight_cb) - char* type; - char* name; - LWLIB_ID id; - widget_value* val; - lw_callback pre_activate_cb; - lw_callback selection_cb; - lw_callback post_activate_cb; - lw_callback highlight_cb; +lw_register_widget (char* type, + char* name, + LWLIB_ID id, + widget_value* val, + lw_callback pre_activate_cb, + lw_callback selection_cb, + lw_callback post_activate_cb, + lw_callback highlight_cb) { if (!get_widget_info (id, False)) allocate_widget_info (type, name, id, val, pre_activate_cb, selection_cb, @@ -945,14 +838,7 @@ lw_register_widget (type, name, id, val, pre_activate_cb, } Widget -#ifdef PROTOTYPES lw_get_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p) -#else -lw_get_widget (id, parent, pop_up_p) - LWLIB_ID id; - Widget parent; - Boolean pop_up_p; -#endif { widget_instance* instance; @@ -961,14 +847,7 @@ lw_get_widget (id, parent, pop_up_p) } Widget -#ifdef PROTOTYPES lw_make_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p) -#else -lw_make_widget (id, parent, pop_up_p) - LWLIB_ID id; - Widget parent; - Boolean pop_up_p; -#endif { widget_instance* instance; widget_info* info; @@ -988,25 +867,10 @@ lw_make_widget (id, parent, pop_up_p) } Widget -#ifdef PROTOTYPES lw_create_widget (char* type, char* name, LWLIB_ID id, widget_value* val, Widget parent, Boolean pop_up_p, lw_callback pre_activate_cb, lw_callback selection_cb, lw_callback post_activate_cb, lw_callback highlight_cb) -#else -lw_create_widget (type, name, id, val, parent, pop_up_p, pre_activate_cb, - selection_cb, post_activate_cb, highlight_cb) - char* type; - char* name; - LWLIB_ID id; - widget_value* val; - Widget parent; - Boolean pop_up_p; - lw_callback pre_activate_cb; - lw_callback selection_cb; - lw_callback post_activate_cb; - lw_callback highlight_cb; -#endif { lw_register_widget (type, name, id, val, pre_activate_cb, selection_cb, post_activate_cb, highlight_cb); @@ -1016,8 +880,7 @@ lw_create_widget (type, name, id, val, parent, pop_up_p, pre_activate_cb, /* destroying the widgets */ static void -destroy_one_instance (instance) - widget_instance* instance; +destroy_one_instance (widget_instance *instance) { /* Remove the destroy callback on the widget; that callback will try to dereference the instance object (to set its widget slot to 0, since the @@ -1059,8 +922,7 @@ destroy_one_instance (instance) } void -lw_destroy_widget (w) - Widget w; +lw_destroy_widget (Widget w) { widget_instance* instance = get_widget_instance (w, True); @@ -1076,8 +938,7 @@ lw_destroy_widget (w) } void -lw_destroy_all_widgets (id) - LWLIB_ID id; +lw_destroy_all_widgets (LWLIB_ID id) { widget_info* info = get_widget_info (id, True); widget_instance* instance; @@ -1096,14 +957,14 @@ lw_destroy_all_widgets (id) } void -lw_destroy_everything () +lw_destroy_everything (void) { while (all_widget_info) lw_destroy_all_widgets (all_widget_info->id); } void -lw_destroy_all_pop_ups () +lw_destroy_all_pop_ups (void) { widget_info* info; widget_info* next; @@ -1123,7 +984,7 @@ extern Widget first_child (/* Widget */); /* garbage */ #endif Widget -lw_raise_all_pop_up_widgets () +lw_raise_all_pop_up_widgets (void) { widget_info* info; widget_instance* instance; @@ -1156,13 +1017,7 @@ lw_raise_all_pop_up_widgets () } static void -#ifdef PROTOTYPES lw_pop_all_widgets (LWLIB_ID id, Boolean up) -#else -lw_pop_all_widgets (id, up) - LWLIB_ID id; - Boolean up; -#endif { widget_info* info = get_widget_info (id, False); widget_instance* instance; @@ -1197,23 +1052,19 @@ lw_pop_all_widgets (id, up) } void -lw_pop_up_all_widgets (id) - LWLIB_ID id; +lw_pop_up_all_widgets (LWLIB_ID id) { lw_pop_all_widgets (id, True); } void -lw_pop_down_all_widgets (id) - LWLIB_ID id; +lw_pop_down_all_widgets (LWLIB_ID id) { lw_pop_all_widgets (id, False); } void -lw_popup_menu (widget, event) - Widget widget; - XEvent *event; +lw_popup_menu (Widget widget, XEvent *event) { #if defined (USE_LUCID) if (lw_lucid_widget_p (widget)) @@ -1231,9 +1082,7 @@ lw_popup_menu (widget, event) /* get the values back */ static Boolean -get_one_value (instance, val) - widget_instance* instance; - widget_value* val; +get_one_value (widget_instance *instance, widget_value *val) { Widget widget = name_to_widget (instance, val->name); @@ -1258,9 +1107,7 @@ get_one_value (instance, val) } Boolean -lw_get_some_values (id, val_out) - LWLIB_ID id; - widget_value* val_out; +lw_get_some_values (LWLIB_ID id, widget_value *val_out) { widget_info* info = get_widget_info (id, False); widget_instance* instance; @@ -1282,8 +1129,7 @@ lw_get_some_values (id, val_out) } widget_value* -lw_get_all_values (id) - LWLIB_ID id; +lw_get_all_values (LWLIB_ID id) { widget_info* info = get_widget_info (id, False); widget_value* val = info->val; @@ -1296,9 +1142,7 @@ lw_get_all_values (id) /* internal function used by the library dependent implementation to get the widget_value for a given widget in an instance */ widget_value* -lw_get_widget_value_for_widget (instance, w) - widget_instance* instance; - Widget w; +lw_get_widget_value_for_widget (widget_instance *instance, Widget w) { char* name = XtName (w); widget_value* cur; @@ -1317,10 +1161,9 @@ static Boolean lwlib_updating; modified to update other instances of the widgets. Closure should be the widget_instance. */ void -lw_internal_update_other_instances (widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +lw_internal_update_other_instances (Widget widget, + XtPointer closure, + XtPointer call_data) { widget_instance* instance = (widget_instance*)closure; char* name = XtName (widget); @@ -1357,8 +1200,7 @@ lw_internal_update_other_instances (widget, closure, call_data) /* get the id */ LWLIB_ID -lw_get_widget_id (w) - Widget w; +lw_get_widget_id (Widget w) { widget_instance* instance = get_widget_instance (w, False); @@ -1367,9 +1209,7 @@ lw_get_widget_id (w) /* set the keyboard focus */ void -lw_set_keyboard_focus (parent, w) - Widget parent; - Widget w; +lw_set_keyboard_focus (Widget parent, Widget w) { #if defined (USE_MOTIF) xm_set_keyboard_focus (parent, w); @@ -1380,13 +1220,7 @@ lw_set_keyboard_focus (parent, w) /* Show busy */ static void -#ifdef PROTOTYPES show_one_widget_busy (Widget w, Boolean flag) -#else -show_one_widget_busy (w, flag) - Widget w; - Boolean flag; -#endif { Pixel foreground = 0; Pixel background = 1; @@ -1405,13 +1239,7 @@ show_one_widget_busy (w, flag) } void -#ifdef PROTOTYPES lw_show_busy (Widget w, Boolean busy) -#else -lw_show_busy (w, busy) - Widget w; - Boolean busy; -#endif { widget_instance* instance = get_widget_instance (w, False); widget_info* info; @@ -1433,13 +1261,7 @@ lw_show_busy (w, busy) /* This hack exists because Lucid/Athena need to execute the strange function below to support geometry management. */ void -#ifdef PROTOTYPES lw_refigure_widget (Widget w, Boolean doit) -#else -lw_refigure_widget (w, doit) - Widget w; - Boolean doit; -#endif { #if defined (USE_XAW) XawPanedSetRefigureMode (w, doit); @@ -1455,9 +1277,7 @@ lw_refigure_widget (w, doit) /* Toolkit independent way of determining if an event window is in the menubar. */ Boolean -lw_window_is_in_menubar (win, menubar_widget) - Window win; - Widget menubar_widget; +lw_window_is_in_menubar (Window win, Widget menubar_widget) { return menubar_widget #if defined (USE_LUCID) @@ -1473,10 +1293,7 @@ lw_window_is_in_menubar (win, menubar_widget) /* Motif hack to set the main window areas. */ void -lw_set_main_areas (parent, menubar, work_area) - Widget parent; - Widget menubar; - Widget work_area; +lw_set_main_areas (Widget parent, Widget menubar, Widget work_area) { #if defined (USE_MOTIF) xm_set_main_areas (parent, menubar, work_area); @@ -1486,13 +1303,7 @@ lw_set_main_areas (parent, menubar, work_area) /* Manage resizing for Motif. This disables resizing when the menubar is about to be modified. */ void -#ifdef PROTOTYPES lw_allow_resizing (Widget w, Boolean flag) -#else -lw_allow_resizing (w, flag) - Widget w; - Boolean flag; -#endif { #if defined (USE_MOTIF) xm_manage_resizing (w, flag); @@ -1506,15 +1317,12 @@ lw_allow_resizing (w, flag) to similar ones that are supported. */ int -lw_separator_p (label, type, motif_p) - char *label; - enum menu_separator *type; - int motif_p; +lw_separator_p (char *label, enum menu_separator *type, int motif_p) { int separator_p = 0; if (strlen (label) >= 3 - && bcmp (label, "--:", 3) == 0) + && memcmp (label, "--:", 3) == 0) { static struct separator_table { @@ -1557,7 +1365,7 @@ lw_separator_p (label, type, motif_p) } } else if (strlen (label) > 3 - && bcmp (label, "--", 2) == 0 + && memcmp (label, "--", 2) == 0 && label[2] != '-') { /* Alternative, more Emacs-style names. */ diff --git a/lwlib/lwlib.h b/lwlib/lwlib.h index 8b724fc56a5..1ee075257f1 100644 --- a/lwlib/lwlib.h +++ b/lwlib/lwlib.h @@ -130,66 +130,64 @@ typedef struct _widget_value } widget_value; -typedef void (*lw_callback) __P ((Widget w, LWLIB_ID id, void* data)); +typedef void (*lw_callback) (Widget w, LWLIB_ID id, void* data); -void lw_register_widget __P ((char* type, char* name, LWLIB_ID id, - widget_value* val, lw_callback pre_activate_cb, - lw_callback selection_cb, - lw_callback post_activate_cb, - lw_callback highlight_cb)); -Widget lw_get_widget __P ((LWLIB_ID id, Widget parent, Boolean pop_up_p)); -Widget lw_make_widget __P ((LWLIB_ID id, Widget parent, Boolean pop_up_p)); -Widget lw_create_widget __P ((char* type, char* name, LWLIB_ID id, - widget_value* val, Widget parent, Boolean pop_up_p, - lw_callback pre_activate_cb, - lw_callback selection_cb, - lw_callback post_activate_cb, - lw_callback highlight_cb)); -LWLIB_ID lw_get_widget_id __P ((Widget w)); -int lw_modify_all_widgets __P ((LWLIB_ID id, widget_value* val, Boolean deep_p)); -void lw_destroy_widget __P ((Widget w)); -void lw_destroy_all_widgets __P ((LWLIB_ID id)); -void lw_destroy_everything __P ((void)); -void lw_destroy_all_pop_ups __P ((void)); -Widget lw_raise_all_pop_up_widgets __P ((void)); -widget_value* lw_get_all_values __P ((LWLIB_ID id)); -Boolean lw_get_some_values __P ((LWLIB_ID id, widget_value* val)); -void lw_pop_up_all_widgets __P ((LWLIB_ID id)); -void lw_pop_down_all_widgets __P ((LWLIB_ID id)); -widget_value *malloc_widget_value (); -void free_widget_value __P ((widget_value *)); -void lw_popup_menu __P ((Widget, XEvent *)); +void lw_register_widget (char* type, char* name, LWLIB_ID id, + widget_value* val, lw_callback pre_activate_cb, + lw_callback selection_cb, + lw_callback post_activate_cb, + lw_callback highlight_cb); +Widget lw_get_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p); +Widget lw_make_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p); +Widget lw_create_widget (char* type, char* name, LWLIB_ID id, + widget_value* val, Widget parent, Boolean pop_up_p, + lw_callback pre_activate_cb, + lw_callback selection_cb, + lw_callback post_activate_cb, + lw_callback highlight_cb); +LWLIB_ID lw_get_widget_id (Widget w); +int lw_modify_all_widgets (LWLIB_ID id, widget_value* val, Boolean deep_p); +void lw_destroy_widget (Widget w); +void lw_destroy_all_widgets (LWLIB_ID id); +void lw_destroy_everything (void); +void lw_destroy_all_pop_ups (void); +Widget lw_raise_all_pop_up_widgets (void); +widget_value* lw_get_all_values (LWLIB_ID id); +Boolean lw_get_some_values (LWLIB_ID id, widget_value* val); +void lw_pop_up_all_widgets (LWLIB_ID id); +void lw_pop_down_all_widgets (LWLIB_ID id); +widget_value *malloc_widget_value (void); +void free_widget_value (widget_value *); +void lw_popup_menu (Widget, XEvent *); /* Toolkit independent way of focusing on a Widget at the Xt level. */ -void lw_set_keyboard_focus __P ((Widget parent, Widget w)); +void lw_set_keyboard_focus (Widget parent, Widget w); /* Silly Energize hack to invert the "sheet" button */ -void lw_show_busy __P ((Widget w, Boolean busy)); +void lw_show_busy (Widget w, Boolean busy); /* Silly hack to assist with Lucid/Athena geometry management. */ -void lw_refigure_widget __P ((Widget w, Boolean doit)); +void lw_refigure_widget (Widget w, Boolean doit); /* Toolkit independent way of determining if an event occurred on a menubar. */ -Boolean lw_window_is_in_menubar __P ((Window win, Widget menubar_widget)); +Boolean lw_window_is_in_menubar (Window win, Widget menubar_widget); /* Manage resizing: TRUE permits resizing widget w; FALSE disallows it. */ -void lw_allow_resizing __P ((Widget w, Boolean flag)); +void lw_allow_resizing (Widget w, Boolean flag); /* Set up the main window. */ -void lw_set_main_areas __P ((Widget parent, - Widget menubar, - Widget work_area)); +void lw_set_main_areas (Widget parent, + Widget menubar, + Widget work_area); /* Value is non-zero if LABEL is a menu separator. If it is, *TYPE is set to an appropriate enumerator of type enum menu_separator. MOTIF_P non-zero means map separator types not supported by Motif to similar ones that are supported. */ -int lw_separator_p __P ((char *label, enum menu_separator *type, - int motif_p)); - -void lwlib_bcopy __P ((char*, char*, int)); +int lw_separator_p (char *label, enum menu_separator *type, + int motif_p); #endif /* LWLIB_H */ diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c index 1bb0d50b6d7..143c4c51d58 100644 --- a/lwlib/xlwmenu.c +++ b/lwlib/xlwmenu.c @@ -185,24 +185,25 @@ xlwMenuResources[] = }; #undef offset -static Boolean XlwMenuSetValues(); -static void XlwMenuRealize(); -static void XlwMenuResize(); -static void XlwMenuInitialize(); -static void XlwMenuRedisplay(); -static void XlwMenuDestroy(); -static void XlwMenuClassInitialize(); -static void Start(); -static void Drag(); -static void Down(); -static void Up(); -static void Left(); -static void Right(); -static void Select(); -static void Key(); -static void Nothing(); -static int separator_height __P ((enum menu_separator)); -static void pop_up_menu __P ((XlwMenuWidget, XButtonPressedEvent *)); +static Boolean XlwMenuSetValues(Widget current, Widget request, Widget new, + ArgList args, Cardinal *num_args); +static void XlwMenuRealize(Widget, Mask *, XSetWindowAttributes *); +static void XlwMenuResize(Widget w); +static void XlwMenuInitialize(Widget, Widget, ArgList, Cardinal *); +static void XlwMenuRedisplay(Widget w, XEvent *ev, Region region); +static void XlwMenuDestroy(Widget w); +static void XlwMenuClassInitialize(void); +static void Start(Widget w, XEvent *ev, String *params, Cardinal *num_params); +static void Drag(Widget w, XEvent *ev, String *params, Cardinal *num_params); +static void Down(Widget w, XEvent *ev, String *params, Cardinal *num_params); +static void Up(Widget w, XEvent *ev, String *params, Cardinal *num_params); +static void Left(Widget w, XEvent *ev, String *params, Cardinal *num_params); +static void Right(Widget w, XEvent *ev, String *params, Cardinal *num_params); +static void Select(Widget w, XEvent *ev, String *params, Cardinal *num_params); +static void Key(Widget w, XEvent *ev, String *params, Cardinal *num_params); +static void Nothing(Widget w, XEvent *ev, String *params, Cardinal *num_params); +static int separator_height (enum menu_separator); +static void pop_up_menu (XlwMenuWidget, XButtonPressedEvent *); static XtActionsRec @@ -278,9 +279,7 @@ static int next_release_must_exit; /* Ungrab pointer and keyboard */ static void -ungrab_all (w, ungrabtime) - Widget w; - Time ungrabtime; +ungrab_all (Widget w, Time ungrabtime) { XtUngrabPointer (w, ungrabtime); if (GRAB_KEYBOARD) XtUngrabKeyboard (w, ungrabtime); @@ -289,8 +288,7 @@ ungrab_all (w, ungrabtime) /* Like abort, but remove grabs from widget W before. */ static void -abort_gracefully (w) - Widget w; +abort_gracefully (Widget w) { if (XtIsShell (XtParent (w))) XtRemoveGrab (w); @@ -299,9 +297,7 @@ abort_gracefully (w) } static void -push_new_stack (mw, val) - XlwMenuWidget mw; - widget_value* val; +push_new_stack (XlwMenuWidget mw, widget_value *val) { if (!mw->menu.new_stack) { @@ -321,8 +317,7 @@ push_new_stack (mw, val) } static void -pop_new_stack_if_no_contents (mw) - XlwMenuWidget mw; +pop_new_stack_if_no_contents (XlwMenuWidget mw) { if (mw->menu.new_depth > 1) { @@ -332,9 +327,7 @@ pop_new_stack_if_no_contents (mw) } static void -make_old_stack_space (mw, n) - XlwMenuWidget mw; - int n; +make_old_stack_space (XlwMenuWidget mw, int n) { if (!mw->menu.old_stack) { @@ -354,9 +347,7 @@ make_old_stack_space (mw, n) /* Size code */ static int -string_width (mw, s) - XlwMenuWidget mw; - char *s; +string_width (XlwMenuWidget mw, char *s) { XCharStruct xcs; int drop; @@ -415,8 +406,7 @@ string_width (mw, s) #endif static int -arrow_width (mw) - XlwMenuWidget mw; +arrow_width (XlwMenuWidget mw) { return (MENU_FONT_ASCENT (mw) * 3/4) | 1; } @@ -424,8 +414,7 @@ arrow_width (mw) /* Return the width of toggle buttons of widget MW. */ static int -toggle_button_width (mw) - XlwMenuWidget mw; +toggle_button_width (XlwMenuWidget mw) { return (MENU_FONT_HEIGHT (mw) * 2 / 3) | 1; } @@ -434,8 +423,7 @@ toggle_button_width (mw) /* Return the width of radio buttons of widget MW. */ static int -radio_button_width (mw) - XlwMenuWidget mw; +radio_button_width (XlwMenuWidget mw) { return toggle_button_width (mw) * 1.41; } @@ -449,9 +437,7 @@ nameResource[] = }; static char* -resource_widget_value (mw, val) - XlwMenuWidget mw; - widget_value *val; +resource_widget_value (XlwMenuWidget mw, widget_value *val) { if (!val->toolkit_data) { @@ -487,15 +473,13 @@ resource_widget_value (mw, val) /* Returns the sizes of an item */ static void -size_menu_item (mw, val, horizontal_p, label_width, rest_width, button_width, - height) - XlwMenuWidget mw; - widget_value* val; - int horizontal_p; - int* label_width; - int* rest_width; - int* button_width; - int* height; +size_menu_item (XlwMenuWidget mw, + widget_value* val, + int horizontal_p, + int* label_width, + int* rest_width, + int* button_width, + int* height) { enum menu_separator separator; @@ -537,16 +521,14 @@ size_menu_item (mw, val, horizontal_p, label_width, rest_width, button_width, } static void -size_menu (mw, level) - XlwMenuWidget mw; - int level; +size_menu (XlwMenuWidget mw, int level) { - unsigned int label_width = 0; + int label_width = 0; int rest_width = 0; int button_width = 0; int max_rest_width = 0; int max_button_width = 0; - unsigned int height = 0; + int height = 0; int horizontal_p = mw->menu.horizontal && (level == 0); widget_value* val; window_state* ws; @@ -605,14 +587,13 @@ size_menu (mw, level) /* Display code */ static void -draw_arrow (mw, window, gc, x, y, width, down_p) - XlwMenuWidget mw; - Window window; - GC gc; - int x; - int y; - int width; - int down_p; +draw_arrow (XlwMenuWidget mw, + Window window, + GC gc, + int x, + int y, + int width, + int down_p) { Display *dpy = XtDisplay (mw); GC top_gc = mw->menu.shadow_top_gc; @@ -669,15 +650,14 @@ draw_arrow (mw, window, gc, x, y, width, down_p) static void -draw_shadow_rectangle (mw, window, x, y, width, height, erase_p, down_p) - XlwMenuWidget mw; - Window window; - int x; - int y; - int width; - int height; - int erase_p; - int down_p; +draw_shadow_rectangle (XlwMenuWidget mw, + Window window, + int x, + int y, + int width, + int height, + int erase_p, + int down_p) { Display *dpy = XtDisplay (mw); GC top_gc = !erase_p ? mw->menu.shadow_top_gc : mw->menu.background_gc; @@ -733,15 +713,14 @@ draw_shadow_rectangle (mw, window, x, y, width, height, erase_p, down_p) static void -draw_shadow_rhombus (mw, window, x, y, width, height, erase_p, down_p) - XlwMenuWidget mw; - Window window; - int x; - int y; - int width; - int height; - int erase_p; - int down_p; +draw_shadow_rhombus (XlwMenuWidget mw, + Window window, + int x, + int y, + int width, + int height, + int erase_p, + int down_p) { Display *dpy = XtDisplay (mw); GC top_gc = !erase_p ? mw->menu.shadow_top_gc : mw->menu.background_gc; @@ -801,10 +780,7 @@ draw_shadow_rhombus (mw, window, x, y, width, height, erase_p, down_p) toggle button is selected. */ static void -draw_toggle (mw, window, x, y, selected_p) - XlwMenuWidget mw; - Window window; - int x, y, selected_p; +draw_toggle (XlwMenuWidget mw, Window window, int x, int y, int selected_p) { int width, height; @@ -821,10 +797,7 @@ draw_toggle (mw, window, x, y, selected_p) toggle button is selected. */ static void -draw_radio (mw, window, x, y, selected_p) - XlwMenuWidget mw; - Window window; - int x, y, selected_p; +draw_radio (XlwMenuWidget mw, Window window, int x, int y, int selected_p) { int width, height; @@ -841,11 +814,12 @@ draw_radio (mw, window, x, y, selected_p) separator to draw. TYPE is the separator type. */ static void -draw_separator (mw, window, x, y, width, type) - XlwMenuWidget mw; - Window window; - int x, y, width; - enum menu_separator type; +draw_separator (XlwMenuWidget mw, + Window window, + int x, + int y, + int width, + enum menu_separator type) { Display *dpy = XtDisplay (mw); XGCValues xgcv; @@ -958,8 +932,7 @@ draw_separator (mw, window, x, y, width, type) /* Return the pixel height of menu separator SEPARATOR. */ static int -separator_height (separator) - enum menu_separator separator; +separator_height (enum menu_separator separator) { switch (separator) { @@ -996,15 +969,13 @@ separator_height (separator) the menu item was. */ static void -display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p, - just_compute_p) - XlwMenuWidget mw; - widget_value* val; - window_state* ws; - XPoint* where; - Boolean highlighted_p; - Boolean horizontal_p; - Boolean just_compute_p; +display_menu_item (XlwMenuWidget mw, + widget_value* val, + window_state* ws, + XPoint* where, + Boolean highlighted_p, + Boolean horizontal_p, + Boolean just_compute_p) { GC deco_gc; GC text_gc; @@ -1137,7 +1108,6 @@ display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p, #ifdef HAVE_XFT if (ws->xft_draw) { - XGlyphInfo gi; int draw_x = ws->width - ws->max_rest_width + mw->menu.arrow_spacing; int draw_y = y + v_spacing + shadow + font_ascent; @@ -1188,13 +1158,12 @@ display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p, } static void -display_menu (mw, level, just_compute_p, highlighted_pos, hit, hit_return) - XlwMenuWidget mw; - int level; - Boolean just_compute_p; - XPoint* highlighted_pos; - XPoint* hit; - widget_value** hit_return; +display_menu (XlwMenuWidget mw, + int level, + Boolean just_compute_p, + XPoint *highlighted_pos, + XPoint *hit, + widget_value **hit_return) { widget_value* val; widget_value* following_item; @@ -1285,10 +1254,7 @@ display_menu (mw, level, just_compute_p, highlighted_pos, hit, hit_return) /* Motion code */ static void -set_new_state (mw, val, level) - XlwMenuWidget mw; - widget_value* val; - int level; +set_new_state (XlwMenuWidget mw, widget_value *val, int level) { int i; @@ -1311,7 +1277,7 @@ expose_cb (Widget widget, for (i = 0; i < mw->menu.windows_length; ++i) if (mw->menu.windows [i].w == widget) break; if (i < mw->menu.windows_length && i < mw->menu.old_depth) - display_menu (mw, i, False, NULL, NULL, NULL, NULL, NULL); + display_menu (mw, i, False, NULL, NULL, NULL); } static void @@ -1332,16 +1298,11 @@ set_window_type (Widget w, XlwMenuWidget mw) static void -make_windows_if_needed (mw, n) - XlwMenuWidget mw; - int n; +make_windows_if_needed (XlwMenuWidget mw, int n) { int i; int start_at; window_state* windows; -#ifdef HAVE_XFT - int screen = XScreenNumberOfScreen (mw->core.screen); -#endif if (mw->menu.windows_length >= n) return; @@ -1396,9 +1357,7 @@ make_windows_if_needed (mw, n) /* Value is non-zero if WINDOW is part of menu bar widget W. */ int -xlwmenu_window_p (w, window) - Widget w; - Window window; +xlwmenu_window_p (Widget w, Window window) { XlwMenuWidget mw = (XlwMenuWidget) w; int i; @@ -1412,11 +1371,10 @@ xlwmenu_window_p (w, window) /* Make the window fit in the screen */ static void -fit_to_screen (mw, ws, previous_ws, horizontal_p) - XlwMenuWidget mw; - window_state* ws; - window_state* previous_ws; - Boolean horizontal_p; +fit_to_screen (XlwMenuWidget mw, + window_state *ws, + window_state *previous_ws, + Boolean horizontal_p) { unsigned int screen_width = WidthOfScreen (XtScreen (mw)); unsigned int screen_height = HeightOfScreen (XtScreen (mw)); @@ -1497,8 +1455,7 @@ create_pixmap_for_menu (window_state* ws, XlwMenuWidget mw) /* Updates old_stack from new_stack and redisplays. */ static void -remap_menubar (mw) - XlwMenuWidget mw; +remap_menubar (XlwMenuWidget mw) { int i; int last_same; @@ -1591,11 +1548,10 @@ remap_menubar (mw) } static Boolean -motion_event_is_in_menu (mw, ev, level, relative_pos) - XlwMenuWidget mw; - XMotionEvent* ev; - int level; - XPoint* relative_pos; +motion_event_is_in_menu (XlwMenuWidget mw, + XMotionEvent *ev, + int level, + XPoint *relative_pos) { window_state* ws = &mw->menu.windows [level]; int shadow = level == 0 ? 0 : mw->menu.shadow_thickness; @@ -1608,11 +1564,10 @@ motion_event_is_in_menu (mw, ev, level, relative_pos) } static Boolean -map_event_to_widget_value (mw, ev, val, level) - XlwMenuWidget mw; - XMotionEvent* ev; - widget_value** val; - int* level; +map_event_to_widget_value (XlwMenuWidget mw, + XMotionEvent *ev, + widget_value **val, + int *level) { int i; XPoint relative_pos; @@ -1651,8 +1606,7 @@ map_event_to_widget_value (mw, ev, val, level) /* Procedures */ static void -make_drawing_gcs (mw) - XlwMenuWidget mw; +make_drawing_gcs (XlwMenuWidget mw) { XGCValues xgcv; float scale; @@ -1722,8 +1676,7 @@ make_drawing_gcs (mw) } static void -release_drawing_gcs (mw) - XlwMenuWidget mw; +release_drawing_gcs (XlwMenuWidget mw) { XtReleaseGC ((Widget) mw, mw->menu.foreground_gc); XtReleaseGC ((Widget) mw, mw->menu.button_gc); @@ -1742,8 +1695,7 @@ release_drawing_gcs (mw) ? ((unsigned long) (x)) : ((unsigned long) (y))) static void -make_shadow_gcs (mw) - XlwMenuWidget mw; +make_shadow_gcs (XlwMenuWidget mw) { XGCValues xgcv; unsigned long pm = 0; @@ -1875,8 +1827,7 @@ make_shadow_gcs (mw) static void -release_shadow_gcs (mw) - XlwMenuWidget mw; +release_shadow_gcs (XlwMenuWidget mw) { Display *dpy = XtDisplay ((Widget) mw); Screen *screen = XtScreen ((Widget) mw); @@ -1897,8 +1848,7 @@ release_shadow_gcs (mw) #ifdef HAVE_XFT static int -openXftFont (mw) - XlwMenuWidget mw; +openXftFont (XlwMenuWidget mw) { char *fname = mw->menu.faceName; @@ -1934,14 +1884,10 @@ openXftFont (mw) #endif static void -XlwMenuInitialize (request, mw, args, num_args) - Widget request; - XlwMenuWidget mw; - ArgList args; - Cardinal *num_args; +XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args) { /* Get the GCs and the widget size */ - + XlwMenuWidget mw = (XlwMenuWidget) w; Window window = RootWindowOfScreen (DefaultScreenOfDisplay (XtDisplay (mw))); Display* display = XtDisplay (mw); @@ -1950,7 +1896,7 @@ XlwMenuInitialize (request, mw, args, num_args) /* _XtCreate is freeing the object that was passed to us, so make a copy that we will actually keep. */ - lwlib_bcopy (mw->menu.contents, tem, sizeof (widget_value)); + memcpy (tem, mw->menu.contents, sizeof (widget_value)); mw->menu.contents = tem; #endif @@ -2018,16 +1964,13 @@ XlwMenuInitialize (request, mw, args, num_args) } static void -XlwMenuClassInitialize () +XlwMenuClassInitialize (void) { xlwmenu_default_font = 0; } static void -XlwMenuRealize (w, valueMask, attributes) - Widget w; - Mask *valueMask; - XSetWindowAttributes *attributes; +XlwMenuRealize (Widget w, Mask *valueMask, XSetWindowAttributes *attributes) { XlwMenuWidget mw = (XlwMenuWidget)w; XSetWindowAttributes xswa; @@ -2089,13 +2032,9 @@ XlwMenuRealize (w, valueMask, attributes) receives expose events through Xt. So we repaint all the other panes when receiving an Expose event. */ static void -XlwMenuRedisplay (w, ev, region) - Widget w; - XEvent* ev; - Region region; +XlwMenuRedisplay (Widget w, XEvent *ev, Region region) { XlwMenuWidget mw = (XlwMenuWidget)w; - int i; /* If we have a depth beyond 1, it's because a submenu was displayed. If the submenu has been destroyed, set the depth back to 1. */ @@ -2113,15 +2052,13 @@ XlwMenuRedisplay (w, ev, region) over a menu item is unmapped. */ void -xlwmenu_redisplay (w) - Widget w; +xlwmenu_redisplay (Widget w) { XlwMenuRedisplay (w, NULL, None); } static void -XlwMenuDestroy (w) - Widget w; +XlwMenuDestroy (Widget w) { int i; XlwMenuWidget mw = (XlwMenuWidget) w; @@ -2200,10 +2137,8 @@ facename_changed (XlwMenuWidget newmw, #endif static Boolean -XlwMenuSetValues (current, request, new) - Widget current; - Widget request; - Widget new; +XlwMenuSetValues (Widget current, Widget request, Widget new, + ArgList args, Cardinal *num_args) { XlwMenuWidget oldmw = (XlwMenuWidget)current; XlwMenuWidget newmw = (XlwMenuWidget)new; @@ -2292,8 +2227,7 @@ XlwMenuSetValues (current, request, new) } static void -XlwMenuResize (w) - Widget w; +XlwMenuResize (Widget w) { XlwMenuWidget mw = (XlwMenuWidget)w; @@ -2315,9 +2249,7 @@ XlwMenuResize (w) /* Action procedures */ static void -handle_single_motion_event (mw, ev) - XlwMenuWidget mw; - XMotionEvent* ev; +handle_single_motion_event (XlwMenuWidget mw, XMotionEvent *ev) { widget_value* val; int level; @@ -2333,9 +2265,7 @@ handle_single_motion_event (mw, ev) } static void -handle_motion_event (mw, ev) - XlwMenuWidget mw; - XMotionEvent* ev; +handle_motion_event (XlwMenuWidget mw, XMotionEvent *ev) { int x = ev->x_root; int y = ev->y_root; @@ -2357,11 +2287,7 @@ handle_motion_event (mw, ev) } static void -Start (w, ev, params, num_params) - Widget w; - XEvent *ev; - String *params; - Cardinal *num_params; +Start (Widget w, XEvent *ev, String *params, Cardinal *num_params) { XlwMenuWidget mw = (XlwMenuWidget)w; @@ -2394,11 +2320,7 @@ Start (w, ev, params, num_params) } static void -Drag (w, ev, params, num_params) - Widget w; - XEvent *ev; - String *params; - Cardinal *num_params; +Drag (Widget w, XEvent *ev, String *params, Cardinal *num_params) { XlwMenuWidget mw = (XlwMenuWidget)w; if (mw->menu.popped_up) @@ -2408,19 +2330,12 @@ Drag (w, ev, params, num_params) /* Do nothing. This is how we handle presses and releases of modifier keys. */ static void -Nothing (w, ev, params, num_params) - Widget w; - XEvent *ev; - String *params; - Cardinal *num_params; +Nothing (Widget w, XEvent *ev, String *params, Cardinal *num_params) { } static widget_value * -find_first_selectable (mw, item, skip_titles) - XlwMenuWidget mw; - widget_value *item; - int skip_titles; +find_first_selectable (XlwMenuWidget mw, widget_value *item, int skip_titles) { widget_value *current = item; enum menu_separator separator; @@ -2436,10 +2351,7 @@ find_first_selectable (mw, item, skip_titles) } static widget_value * -find_next_selectable (mw, item, skip_titles) - XlwMenuWidget mw; - widget_value *item; - int skip_titles; +find_next_selectable (XlwMenuWidget mw, widget_value *item, int skip_titles) { widget_value *current = item; enum menu_separator separator; @@ -2473,10 +2385,7 @@ find_next_selectable (mw, item, skip_titles) } static widget_value * -find_prev_selectable (mw, item, skip_titles) - XlwMenuWidget mw; - widget_value *item; - int skip_titles; +find_prev_selectable (XlwMenuWidget mw, widget_value *item, int skip_titles) { widget_value *current = item; widget_value *prev = item; @@ -2493,11 +2402,7 @@ find_prev_selectable (mw, item, skip_titles) } static void -Down (w, ev, params, num_params) - Widget w; - XEvent *ev; - String *params; - Cardinal *num_params; +Down (Widget w, XEvent *ev, String *params, Cardinal *num_params) { XlwMenuWidget mw = (XlwMenuWidget) w; widget_value* selected_item = mw->menu.old_stack [mw->menu.old_depth - 1]; @@ -2522,11 +2427,7 @@ Down (w, ev, params, num_params) } static void -Up (w, ev, params, num_params) - Widget w; - XEvent *ev; - String *params; - Cardinal *num_params; +Up (Widget w, XEvent *ev, String *params, Cardinal *num_params) { XlwMenuWidget mw = (XlwMenuWidget) w; widget_value* selected_item = mw->menu.old_stack [mw->menu.old_depth - 1]; @@ -2562,11 +2463,7 @@ Up (w, ev, params, num_params) } void -Left (w, ev, params, num_params) - Widget w; - XEvent *ev; - String *params; - Cardinal *num_params; +Left (Widget w, XEvent *ev, String *params, Cardinal *num_params) { XlwMenuWidget mw = (XlwMenuWidget) w; widget_value* selected_item = mw->menu.old_stack [mw->menu.old_depth - 1]; @@ -2602,11 +2499,7 @@ Left (w, ev, params, num_params) } void -Right (w, ev, params, num_params) - Widget w; - XEvent *ev; - String *params; - Cardinal *num_params; +Right (Widget w, XEvent *ev, String *params, Cardinal *num_params) { XlwMenuWidget mw = (XlwMenuWidget) w; widget_value* selected_item = mw->menu.old_stack [mw->menu.old_depth - 1]; @@ -2642,11 +2535,7 @@ Right (w, ev, params, num_params) /* Handle key press and release events while menu is popped up. Our action is to get rid of the menu. */ static void -Key (w, ev, params, num_params) - Widget w; - XEvent *ev; - String *params; - Cardinal *num_params; +Key (Widget w, XEvent *ev, String *params, Cardinal *num_params) { XlwMenuWidget mw = (XlwMenuWidget)w; @@ -2672,11 +2561,7 @@ Key (w, ev, params, num_params) } static void -Select (w, ev, params, num_params) - Widget w; - XEvent *ev; - String *params; - Cardinal *num_params; +Select (Widget w, XEvent *ev, String *params, Cardinal *num_params) { XlwMenuWidget mw = (XlwMenuWidget)w; widget_value* selected_item = mw->menu.old_stack [mw->menu.old_depth - 1]; @@ -2715,9 +2600,7 @@ Select (w, ev, params, num_params) /* Special code to pop-up a menu */ static void -pop_up_menu (mw, event) - XlwMenuWidget mw; - XButtonPressedEvent* event; +pop_up_menu (XlwMenuWidget mw, XButtonPressedEvent *event) { int x = event->x_root; int y = event->y_root; diff --git a/msdos/ChangeLog b/msdos/ChangeLog index fe5831ab259..a7a72d233d5 100644 --- a/msdos/ChangeLog +++ b/msdos/ChangeLog @@ -1,3 +1,57 @@ +2010-07-12 Eli Zaretskii <eliz@gnu.org> + + * sed1v2.inp (C_WARNINGS_SWITCH, PROFILING_CFLAGS, PROFILING_LDFLAGS): + Edit to empty. + + * sed3v2.inp(C_WARNINGS_SWITCH, PROFILING_CFLAGS, PROFILING_LDFLAGS): + Edit to empty. + +2010-07-11 Eli Zaretskii <eliz@gnu.org> + + * sed2v2.inp (HAVE_STRCHR, HAVE_STRRCHR): Don't edit, already + defined on <sys/config.h>. + +2010-07-11 Andreas Schwab <schwab@linux-m68k.org> + + * sed2v2.inp (HAVE_INDEX, HAVE_RINDEX): Don't edit. + (HAVE_STRCHR, HAVE_STRRCHR): Edit to 1. + +2010-07-08 Eli Zaretskii <eliz@gnu.org> + + * sed1v2.inp (stamp-oldxmenu): Don't edit out in `temacs:' target, + which doesn't exist. + + * sed2v2.inp (HAVE_MEMCPY): Don't edit, defined on <sys/config.h>. + +2010-07-08 Dan Nicolaescu <dann@ics.uci.edu> + + * sed1v2.inp: Remove reference to prefix-args. + +2010-07-07 Andreas Schwab <schwab@linux-m68k.org> + + * sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1. + (HAVE_BZERO): Don't edit. + +2010-07-02 Eli Zaretskii <eliz@gnu.org> + + * sed1v2.inp (LIB_GCC): Edit to empty. + Return back to ../src after compiling each .el file. + +2010-06-30 Glenn Morris <rgm@gnu.org> + + * sed1v2.inp (CANNOT_DUMP): Update for configure name change. + +2010-06-26 Eli Zaretskii <eliz@gnu.org> + + * mainmake.v2 (version): Use emacs_version[] in src/emacs.c + instead of lisp/version.el (see 2010-05-15T21:11:37Z!raeburn@raeburn.org). + + * sed1v2.inp (MKDEPDIR): Edit to empty. + Delete lines in rules that invoke $(MKDEPDIR). + Fix editing rules that begin with "cd ../lisp". + Edit out sh if-then-else-fi constructs that test ${CANNOT_DUMP}. + Edit out "|| exit ;\" constructs in emacs${EXEEXT} rule. + 2010-06-03 Dan Nicolaescu <dann@ics.uci.edu> * sed1v2.inp (UNEXEC_OBJ): Use UNEXEC_OBJ instead of unexec. diff --git a/msdos/mainmake.v2 b/msdos/mainmake.v2 index 271db707e37..4bb13e367ed 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 '/(defconst emacs-version/s/^[^"]*\("[^"]*"\).*/\1/p' lisp/version.el} +version := ${shell sed -n -e '/^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/msdos/sed1v2.inp b/msdos/sed1v2.inp index 67d307a5532..95ef5305d4c 100644 --- a/msdos/sed1v2.inp +++ b/msdos/sed1v2.inp @@ -20,12 +20,6 @@ s/^#.*// s/^[ \f\t][ \f\t]*$// s/^ / / s/\.h\.in/.h-in/ -/^ LC_ALL=C \$(RUN_TEMACS)/i\ - stubedit temacs.exe minstack=1024k -/^ LC_ALL=C.*\$(RUN_TEMACS)/s/LC_ALL=C/set &;/ -/-batch -l loadup/a\ - stubify emacs\ - stubedit emacs.exe minstack=2048k /^MAKE *=/s/^/# / /^SHELL *=/s/^/# / /^srcdir *=/s/@[^@\n]*@/./ @@ -46,6 +40,9 @@ s/\.h\.in/.h-in/ /^C_SWITCH_SYSTEM *=/s/@C_SWITCH_SYSTEM@// /^C_SWITCH_X_SYSTEM *=/s/@C_SWITCH_X_SYSTEM@// /^C_SWITCH_X_SITE *=/s/@C_SWITCH_X_SITE@// +/^C_WARNINGS_SWITCH *=/s/@C_WARNINGS_SWITCH@// +/^PROFILING_CFLAGS *=/s/@PROFILING_CFLAGS@// +/^PROFILING_LDFLAGS *=/s/@PROFILING_LDFLAGS@// #/^LD_SWITCH_X_SITE *=/s/@LD_SWITCH_X_SITE@// /^LD_SWITCH_SYSTEM_TEMACS *=/s/@LD_SWITCH_SYSTEM_TEMACS@// /^LD_SWITCH_X_SITE_AUX *=/s/@LD_SWITCH_X_SITE_AUX@// @@ -53,7 +50,7 @@ s/\.h\.in/.h-in/ /^LD_SWITCH_SYSTEM *=/s/@LD_SWITCH_SYSTEM@// /^TEMACS_LDFLAGS2 *=/s/@TEMACS_LDFLAGS2@/$(LDFLAGS)/ /^LIBS_SYSTEM *=/s/@LIBS_SYSTEM@// -/^LIB_GCC *=/s/@LIB_GCC@/-Lgcc/ +/^LIB_GCC *=/s/@LIB_GCC@// /^LD *=/s/@LINKER@/$(CC)/ /^LIB_STANDARD *=/s/@LIB_STANDARD@// /^LIB_MATH *=/s/@LIB_MATH@/-lm/ @@ -122,9 +119,9 @@ s/\.h\.in/.h-in/ /^PRE_ALLOC_OBJ *=/s/@PRE_ALLOC_OBJ@/lastfile.o/ /^POST_ALLOC_OBJ *=/s/@POST_ALLOC_OBJ@/$(vmlimitobj)/ /^UNEXEC_OBJ *=/s/@UNEXEC_OBJ@/unexec.o/ -/^CANNOT_DUMP *=/s/@cannot_dump@/no/ +/^CANNOT_DUMP *=/s/@CANNOT_DUMP@/no/ /^DEPFLAGS *=/s/@DEPFLAGS@// -/^MKDEPDIR *=/s/@MKDEPDIR@/:/ +/^MKDEPDIR *=/s/@MKDEPDIR@// /^version *=/s/@[^@\n]*@// /^M_FILE *=/s!@[^@\n]*@!m/intel386.h! /^S_FILE *=/s!@[^@\n]*@!s/msdos.h! @@ -132,17 +129,27 @@ s/\.h\.in/.h-in/ /^.\${libsrc}make-docfile.*>/s!make-docfile!make-docfile -o ../etc/DOC! /^.\${libsrc}make-doc/s!>.*$!! /^[ ]*$/d -/^temacs:/s/prefix-args// -/^temacs:/s/stamp-oldxmenu// -/^RUN_TEMACS *=/s|`/bin/pwd`|.| -/^ mv \.\/\.gdbinit/d -/^ if test -f/c\ +/^ if test -f/,/^ fi$/c\ + command.com /c if exist .gdbinit rm -f _gdbinit +/^ if test "\${CANNOT_DUMP}" =/,/^ else /d +/^ fi/d +/^ LC_ALL=C \$(RUN_TEMACS)/i\ + stubedit temacs.exe minstack=1024k +/^ *LC_ALL=C.*\$(RUN_TEMACS)/s/LC_ALL=C/set &;/ +/-batch -l loadup/a\ + stubify emacs\ + stubedit emacs.exe minstack=2048k +s/ || exit 1\; \\$// +s/ || true\; \\$// +/^RUN_TEMACS *=/s|`/bin/pwd`|.| +/^ *@\$(MKDEPDIR) *$/d +/^ mv \.\/\.gdbinit/d +/^ if test -f/,/^ fi$/c\ command.com /c if exist .gdbinit rm -f _gdbinit -/^ else mv \.\/\.gdbinit/d /^ #/d /^ cd.*make-docfile/s!$!; cd ${dot}${dot}/src! /^ @: /d -/^ -\{0,1\}ln -/s/ln -f/cp -pf/ +/^ -\{0,1\} *ln -/s/ln -f/cp -pf/ /^[ ]touch /s/touch/djecho $@ >/ s/@YMF_PASS_LDFLAGS@/flags/ s/@deps_frag@// @@ -162,7 +169,8 @@ s/echo.*buildobj.lst/dj&/ stubedit b-emacs.exe minstack=3072k\ djecho bootlisp > bootlisp /^ -\{0,1\}rm -f/s/\\#/#/ -/^ @\{0,1\}cd ..\/lisp; /s|$|\; cd ../src| +/^ @\{0,1\}cd ..\/lisp;.*[^\]$/s|$|\; cd ../src| +/^ *THEFILE=/s|$|\; cd ../src| /^ echo.* buildobj.h/s|echo |djecho | # arch-tag: c7e3aacb-4162-460e-99f9-4252bca68d2c diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp index 0bec8733be7..7d5964089c4 100644 --- a/msdos/sed2v2.inp +++ b/msdos/sed2v2.inp @@ -38,6 +38,7 @@ /^#undef HAVE_CBRT *$/s/^.*$/#define HAVE_CBRT 1/ /^#undef HAVE_DIFFTIME *$/s/^.*$/#define HAVE_DIFFTIME 1/ /^#undef HAVE_FPATHCONF *$/s/^.*$/#define HAVE_FPATHCONF 1/ +/^#undef HAVE_MEMSET *$/s/^.*$/#define HAVE_MEMSET 1/ /^#undef HAVE_MEMCMP *$/s/^.*$/#define HAVE_MEMCMP 1/ /^#undef HAVE_MEMMOVE *$/s/^.*$/#define HAVE_MEMMOVE 1/ /^#undef HAVE_SETRLIMIT *$/s/^.*$/#define HAVE_SETRLIMIT 1/ @@ -45,9 +46,7 @@ /^#undef HAVE_TM_GMTOFF *$/s/^.*$/#define HAVE_TM_GMTOFF 1/ /^#undef HAVE_MBLEN *$/s/^.*$/#define HAVE_MBLEN 1/ /^#undef HAVE_STRUCT_TIMEZONE *$/s/^.*$/#define HAVE_STRUCT_TIMEZONE 1/ -/^#undef HAVE_INDEX *$/s/^.*$/#define HAVE_INDEX 1/ /^#undef HAVE_SIZE_T *$/s/^.*$/#define HAVE_SIZE_T 1/ -/^#undef HAVE_RINDEX *$/s/^.*$/#define HAVE_RINDEX 1/ /^#undef HAVE_MKSTEMP *$/s/^.*$/#define HAVE_MKSTEMP 1/ /^#undef HAVE_STRUCT_TM_TM_ZONE *$/s/^.*$/#define HAVE_STRUCT_TM_TM_ZONE 1/ /^#undef HAVE_SYNC *$/s/^.*$/#define HAVE_SYNC 1/ @@ -84,14 +83,6 @@ s/^#undef POINTER_TYPE *$/#define POINTER_TYPE void/ #else\ #undef HAVE_STDINT_H\ #endif -# GCC 3.x has a built-in bzero, which conflicts with the define at -# the end of config.in -/^#undef HAVE_BZERO/c\ -#if __GNUC__ >= 3\ -#define HAVE_BZERO 1\ -#else\ -#undef HAVE_BZERO\ -#endif # Comment out any remaining undef directives, because some of them # might be defined in sys/config.h we include at the top of config.h. diff --git a/msdos/sed3v2.inp b/msdos/sed3v2.inp index bc555cc0b08..9e2e3ebd23f 100644 --- a/msdos/sed3v2.inp +++ b/msdos/sed3v2.inp @@ -39,6 +39,9 @@ /^CFLAGS *=/s!=.*$!=-O2 -g! /^C_SWITCH_SYSTEM *=/s!=.*$!=-DMSDOS! /^C_SWITCH_MACHINE *=/s/@C_SWITCH_MACHINE@// +/^C_WARNINGS_SWITCH *=/s/@C_WARNINGS_SWITCH@// +/^PROFILING_CFLAGS *=/s/@PROFILING_CFLAGS@// +/^PROFILING_LDFLAGS *=/s/@PROFILING_LDFLAGS@// /^LOADLIBES *=/s!=.*$!=! /^ALLOCA *=/s!@ALLOCA@!! /^EXEEXT *=/s!@EXEEXT@!! diff --git a/nt/ChangeLog b/nt/ChangeLog index 5e5abf6b771..08f12203ec1 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,39 @@ +2010-07-21 Juanma Barranquero <lekktu@gmail.com> + + * INSTALL: Add note about backslashes in Windows paths. + Fix typos. Simplify references to Windows versions. + +2010-07-20 Juanma Barranquero <lekktu@gmail.com> + + * addpm.c (add_registry, main): + * cmdproxy.c (get_env_size): + * ddeclient.c (main): + * runemacs.c (set_user_model_id): + Convert definitions to standard C. + +2010-07-20 Juanma Barranquero <lekktu@gmail.com> + + * gmake.defs (CHECKING_CFLAGS) [ENABLECHECKS]: Add -fno-crossjumping. + +2010-07-18 Juanma Barranquero <lekktu@gmail.com> + + * configure.bat: New option --enable-checking. + * gmake.defs, nmake.defs (CHECKING_CFLAGS): New define. + (CFLAGS): Include it. + +2010-07-12 Dan Nicolaescu <dann@ics.uci.edu> + + * config.nt (volatile): Remove definition. + +2010-07-07 Andreas Schwab <schwab@linux-m68k.org> + + * config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs. + (HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs. + +2010-07-02 Juanma Barranquero <lekktu@gmail.com> + + * config.nt (__P): Remove. + 2010-06-06 Dan Nicolaescu <dann@ics.uci.edu> * config.nt: Remove code depending on BSTRING. diff --git a/nt/INSTALL b/nt/INSTALL index da36b4e3390..1f1f75395f7 100644 --- a/nt/INSTALL +++ b/nt/INSTALL @@ -1,5 +1,5 @@ - Building and Installing Emacs - on Windows NT/2K/XP and Windows 95/98/ME + Building and Installing Emacs on Windows + (from 95 to 7 and beyond) Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. @@ -158,7 +158,7 @@ emacs source with text!=binary. [2] fails when needs to invoke shell commands; okay invoking gcc etc. [3] requires LC_MESSAGES support to build; cannot build with early - versions of cygwin. + versions of Cygwin. [4] may fail on Windows 9X and Windows ME; if so, install Bash. [5] fails when building leim due to the use of cygwin style paths. May work if building emacs without leim. @@ -174,8 +174,8 @@ like this, we recommend the use of the supported compilers mentioned in the previous paragraph. - You will also need a copy of the Posix cp, rm and mv programs. These - and other useful Posix utilities can be obtained from one of several + You will also need a copy of the POSIX cp, rm and mv programs. These + and other useful POSIX utilities can be obtained from one of several projects: * http://gnuwin32.sourceforge.net/ ( GnuWin32 ) @@ -183,13 +183,12 @@ * http://www.cygwin.com/ ( Cygwin ) * http://unxutils.sourceforge.net/ ( UnxUtils ) - If you build Emacs on Windows 9X or ME, not on Windows 2K/XP or - Windows NT, we suggest to install the Cygwin port of Bash. That is - because the native Windows shell COMMAND.COM is too limited; the - Emacs build procedure tries very hard to support even such limited - shells, but as none of the Windows developers of Emacs work on - Windows 9x, we cannot guarantee that it works without a more - powerful shell. + If you build Emacs on 16-bit versions of Windows (9X or ME), we + suggest to install the Cygwin port of Bash. That is because the + native Windows shell COMMAND.COM is too limited; the Emacs build + procedure tries very hard to support even such limited shells, but + as none of the Windows developers of Emacs work on Windows 9X, we + cannot guarantee that it works without a more powerful shell. Additional instructions and help for building Emacs on Windows can be found at the Emacs Wiki: @@ -224,7 +223,7 @@ N.B. It is normal to see a few error messages output while configure is running, when gcc support is being tested. These cannot be - suppressed because of limitations in the Windows 9x command.com shell. + suppressed because of limitations in the Windows 9X command.com shell. You are encouraged to look at the file config.log which shows details for failed tests, after configure.bat finishes. Any unexplained failure @@ -249,6 +248,10 @@ wrong. (Usually, any such failures happen because some headers are missing due to bad packaging of the image support libraries.) + Note that any file path passed to the compiler or linker must use + forward slashes; using backslashes will cause compiler warnings or + errors about unrecognized escape sequences. + To use the external image support, the DLLs implementing the functionality must be found when Emacs first needs them, either on the PATH, or in the same directory as emacs.exe. Failure to find a @@ -430,10 +433,10 @@ The main problems that are likely to be encountered when building Emacs stem from using an old version of GCC, or old MinGW or W32 API - headers. Additionally, cygwin ports of GNU make may require the Emacs + headers. Additionally, Cygwin ports of GNU make may require the Emacs source tree to be mounted with text!=binary, because the makefiles generated by configure.bat necessarily use DOS line endings. Also, - cygwin ports of make must run in UNIX mode, either by specifying + Cygwin ports of make must run in UNIX mode, either by specifying --unix on the command line, or MAKE_MODE=UNIX in the environment. When configure runs, it attempts to detect when GCC itself, or the diff --git a/nt/addpm.c b/nt/addpm.c index 9bdfafc2a3e..20b289f6761 100644 --- a/nt/addpm.c +++ b/nt/addpm.c @@ -83,8 +83,7 @@ env_vars[] = }; BOOL -add_registry (path) - char *path; +add_registry (char *path) { HKEY hrootkey = NULL; int i; @@ -175,9 +174,7 @@ add_registry (path) } int -main (argc, argv) - int argc; - char *argv[]; +main (int argc, char *argv[]) { char start_folder[MAX_PATH + 1]; int shortcuts_created = 0; @@ -315,10 +312,10 @@ main (argc, argv) if (SUCCEEDED (IPersistFile_Save (lnk, unicode_path, TRUE))) shortcuts_created = 1; IPersistFile_Release (lnk); - + } } - } + } } if (com_available) diff --git a/nt/cmdproxy.c b/nt/cmdproxy.c index aae852bf4fa..4f167339b7f 100644 --- a/nt/cmdproxy.c +++ b/nt/cmdproxy.c @@ -407,7 +407,7 @@ spawn (char * progname, char * cmdline, char * dir, int * retcode) /* Return size of current environment block. */ int -get_env_size () +get_env_size (void) { char * start = GetEnvironmentStrings (); char * tmp = start; diff --git a/nt/config.nt b/nt/config.nt index e3bb4792b70..683070f1063 100644 --- a/nt/config.nt +++ b/nt/config.nt @@ -212,8 +212,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #undef HAVE_SYSINFO #undef HAVE_RANDOM #undef HAVE_LRAND48 -#undef HAVE_BCOPY -#undef HAVE_BCMP +#undef HAVE_MEMCPY +#undef HAVE_MEMMOVE +#undef HAVE_MEMSET +#undef HAVE_MEMCMP #undef HAVE_LOGB #undef HAVE_FREXP #undef HAVE_FMOD @@ -347,13 +349,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define my_strftime nstrftime /* for strftime.c */ -/* Non-ANSI C compilers usually don't have volatile. */ -#ifndef HAVE_VOLATILE -#ifndef __STDC__ -#define volatile -#endif -#endif - #ifndef WINDOWSNT /* Some of the files of Emacs which are intended for use with other programs assume that if you have a config.h file, you must declare @@ -393,14 +388,6 @@ extern char *getenv (); #define PROTOTYPES 1 #endif -#ifndef __P -#if defined PROTOTYPES -#define __P(args) args -#else -#define __P(args) () -#endif -#endif - #ifdef HAVE_STRING_H #include "string.h" #endif diff --git a/nt/configure.bat b/nt/configure.bat index 7317416442b..705d4e92717 100755 --- a/nt/configure.bat +++ b/nt/configure.bat @@ -80,6 +80,7 @@ rem Default settings. set prefix= set nodebug=N set noopt=N +set enablechecking=N set profile=N set nocygwin=N set COMPILER= @@ -100,6 +101,7 @@ if "%1" == "--with-gcc" goto withgcc if "%1" == "--with-msvc" goto withmsvc if "%1" == "--no-debug" goto nodebug if "%1" == "--no-opt" goto noopt +if "%1" == "--enable-checking" goto enablechecking if "%1" == "--profile" goto profile if "%1" == "--no-cygwin" goto nocygwin if "%1" == "--cflags" goto usercflags @@ -119,6 +121,7 @@ echo. --with-gcc use GCC to compile Emacs echo. --with-msvc use MSVC to compile Emacs echo. --no-debug exclude debug info from executables echo. --no-opt disable optimization +echo. --enable-checking enable checks and assertions echo. --profile enable profiling echo. --no-cygwin use -mno-cygwin option with GCC echo. --cflags FLAG pass FLAG to compiler @@ -157,6 +160,11 @@ set noopt=Y shift goto again rem ---------------------------------------------------------------------- +:enablechecking +set enablechecking=Y +shift +goto again +rem ---------------------------------------------------------------------- :profile set profile=Y shift @@ -529,6 +537,7 @@ if not "(%mf%)" == "()" echo MCPU_FLAG=%mf%>>config.settings if not "(%dbginfo%)" == "()" echo DEBUG_INFO=%dbginfo%>>config.settings if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings if (%noopt%) == (Y) echo NOOPT=1 >>config.settings +if (%enablechecking%) == (Y) echo ENABLECHECKS=1 >>config.settings if (%profile%) == (Y) echo PROFILE=1 >>config.settings if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix%>>config.settings @@ -660,6 +669,7 @@ set $foo$= set prefix= set nodebug= set noopt= +set enablechecking= set profile= set nocygwin= set COMPILER= diff --git a/nt/ddeclient.c b/nt/ddeclient.c index b8c6683c3a3..ef287f017ba 100644 --- a/nt/ddeclient.c +++ b/nt/ddeclient.c @@ -35,9 +35,7 @@ DdeCallback (UINT uType, UINT uFmt, HCONV hconv, CF_TEXT, XTYP_EXECUTE, 30000, NULL) int -main (argc, argv) - int argc; - char *argv[]; +main (int argc, char *argv[]) { DWORD idDde = 0; HCONV HConversation; diff --git a/nt/gmake.defs b/nt/gmake.defs index 7b2aba4151e..491e6512066 100644 --- a/nt/gmake.defs +++ b/nt/gmake.defs @@ -198,7 +198,14 @@ DEBUG_CFLAGS = -DEMACSDEBUG else DEBUG_CFLAGS = endif -CFLAGS = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(PROFILE_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS) + +ifdef ENABLECHECKS +CHECKING_CFLAGS = -DENABLE_CHECKING -DXASSERTS -fno-crossjumping +else +CHECKING_CFLAGS = +endif + +CFLAGS = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(PROFILE_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS) EMACS_EXTRA_C_FLAGS = -DUSE_CRT_DLL=1 ifdef PROFILE diff --git a/nt/nmake.defs b/nt/nmake.defs index c065ee60de1..412b0148bb5 100644 --- a/nt/nmake.defs +++ b/nt/nmake.defs @@ -136,8 +136,15 @@ DEBUG_CFLAGS = -DEMACSDEBUG !else DEBUG_CFLAGS = !endif + +!ifdef ENABLECHECKS +CHECKING_CFLAGS = -DENABLE_CHECKING -DXASSERTS +!else +CHECKING_CFLAGS = +!endif + CFLAGS = -I. $(ARCH_CFLAGS) \ - $(DEBUG_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS) + $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS) EMACS_EXTRA_C_FLAGS = SYS_LDFLAGS = -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj diff --git a/nt/runemacs.c b/nt/runemacs.c index 4a3d4a9536d..d28d677dca8 100644 --- a/nt/runemacs.c +++ b/nt/runemacs.c @@ -174,7 +174,8 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) return 1; } -void set_user_model_id () +void +set_user_model_id (void) { HMODULE shell; HRESULT (WINAPI * set_user_model) (wchar_t * id); diff --git a/oldXMenu/Activate.c b/oldXMenu/Activate.c index 2e1996e7287..55bfca510b9 100644 --- a/oldXMenu/Activate.c +++ b/oldXMenu/Activate.c @@ -103,32 +103,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* For debug, set this to 0 to not grab the keyboard on menu popup */ int x_menu_grab_keyboard = 1; -typedef void (*Wait_func)(); - static Wait_func wait_func; static void* wait_data; void -XMenuActivateSetWaitFunction (func, data) - Wait_func func; - void *data; +XMenuActivateSetWaitFunction (Wait_func func, void *data) { wait_func = func; wait_data = data; } int -XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data, - help_callback) - register Display *display; /* Display to put menu on. */ - register XMenu *menu; /* Menu to activate. */ - int *p_num; /* Pane number selected. */ - int *s_num; /* Selection number selected. */ - int x_pos; /* X coordinate of menu position. */ - int y_pos; /* Y coordinate of menu position. */ - unsigned int event_mask; /* Mouse button event mask. */ - char **data; /* Pointer to return data value. */ - void (* help_callback) (); /* Help callback. */ +XMenuActivate( + register Display *display, /* Display to put menu on. */ + register XMenu *menu, /* Menu to activate. */ + int *p_num, /* Pane number selected. */ + int *s_num, /* Selection number selected. */ + int x_pos, /* X coordinate of menu position. */ + int y_pos, /* Y coordinate of menu position. */ + unsigned int event_mask, /* Mouse button event mask. */ + char **data, /* Pointer to return data value. */ + void (* help_callback) (char *, int, int)) /* Help callback. */ { int status; /* X routine call status. */ int orig_x; /* Upper left menu origin X coord. */ diff --git a/oldXMenu/AddPane.c b/oldXMenu/AddPane.c index 54b55a150c9..6312aa2c70a 100644 --- a/oldXMenu/AddPane.c +++ b/oldXMenu/AddPane.c @@ -16,11 +16,11 @@ #include "XMenuInt.h" int -XMenuAddPane(display, menu, label, active) - Display *display; - register XMenu *menu; /* Menu object to be modified. */ - register char *label; /* Selection label. */ - int active; /* Make selection active? */ +XMenuAddPane(Display *display, register XMenu *menu, register char *label, int active) + + /* Menu object to be modified. */ + /* Selection label. */ + /* Make selection active? */ { register XMPane *pane; /* Newly created pane. */ register XMSelect *select; /* Initial selection for the new pane. */ diff --git a/oldXMenu/AddSel.c b/oldXMenu/AddSel.c index e38b3404b56..d2f2156b077 100644 --- a/oldXMenu/AddSel.c +++ b/oldXMenu/AddSel.c @@ -17,14 +17,14 @@ #include "XMenuInt.h" int -XMenuAddSelection(display, menu, p_num, data, label, active, help) - Display *display; - register XMenu *menu; /* Menu object to be modified. */ - register int p_num; /* Pane number to be modified. */ - char *data; /* Data value. */ - char *label; /* Selection label. */ - int active; /* Make selection active? */ - char *help; /* Help string */ +XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char *help) + + /* Menu object to be modified. */ + /* Pane number to be modified. */ + /* Data value. */ + /* Selection label. */ + /* Make selection active? */ + /* Help string */ { register XMPane *pane; /* Pane containing the new selection. */ register XMSelect *select; /* Newly created selection. */ diff --git a/oldXMenu/ChangeLog b/oldXMenu/ChangeLog index 7c2b2826375..cc6bcc92727 100644 --- a/oldXMenu/ChangeLog +++ b/oldXMenu/ChangeLog @@ -1,3 +1,48 @@ +2010-07-12 Dan Nicolaescu <dann@ics.uci.edu> + + * XMenu.h: Include <stdlib.h>. + +2010-07-12 Andreas Schwab <schwab@linux-m68k.org> + + * Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS): Set from + substitution. + (ALL_CFLAGS): Add ${C_WARNINGS_SWITCH} and ${PROFILING_CFLAGS}. + +2010-07-04 Dan Nicolaescu <dann@ics.uci.edu> + + * Activate.c: Convert function definitions to standard C. + * AddPane.c: + * AddSel.c: + * ChgPane.c: + * ChgSel.c: + * Create.c: + * DelPane.c: + * DelSel.c: + * Destroy.c: + * Error.c: + * EvHand.c: + * FindPane.c: + * FindSel.c: + * InsPane.c: + * InsSel.c: + * Internal.c: + * Locate.c: + * Post.c: + * Recomp.c: + * SetAEQ.c: + * SetFrz.c: + * SetPane.c: + * SetSel.c: + * X10.h: + * XCrAssoc.c: + * XDelAssoc.c: + * XDestAssoc.c: + * XLookAssoc.c: + * XMakeAssoc.c: + * XMenu.h: + * XMenuInt.h: + * insque.c: Likewise. + 2010-05-07 Chong Yidong <cyd@stupidchicken.com> * Version 23.2 released. diff --git a/oldXMenu/ChgPane.c b/oldXMenu/ChgPane.c index 06b2faa4451..9217c848641 100644 --- a/oldXMenu/ChgPane.c +++ b/oldXMenu/ChgPane.c @@ -17,10 +17,10 @@ #include "XMenuInt.h" int -XMenuChangePane(menu, p_num, label) - register XMenu *menu; /* Menu object to be modified. */ - register int p_num; /* Pane number to be modified. */ - char *label; /* Selection label. */ +XMenuChangePane(register XMenu *menu, register int p_num, char *label) + /* Menu object to be modified. */ + /* Pane number to be modified. */ + /* Selection label. */ { register XMPane *p_ptr; /* XMPane pointer. */ diff --git a/oldXMenu/ChgSel.c b/oldXMenu/ChgSel.c index 9a1230bd39b..b23bb6fd348 100644 --- a/oldXMenu/ChgSel.c +++ b/oldXMenu/ChgSel.c @@ -17,15 +17,15 @@ #include "XMenuInt.h" int -XMenuChangeSelection(display, menu, p_num, s_num, data, data_sw, label, label_sw) - Display *display; /* previously opened display. */ - register XMenu *menu; /* Menu object to be modified. */ - register int p_num; /* Pane number to be modified. */ - register int s_num; /* Selection number to modified. */ - char *data; /* Data value. */ - int data_sw; /* Change to new data value? */ - char *label; /* Selection label. */ - int label_sw; /* Change to new label? */ +XMenuChangeSelection(Display *display, register XMenu *menu, register int p_num, register int s_num, char *data, int data_sw, char *label, int label_sw) + /* previously opened display. */ + /* Menu object to be modified. */ + /* Pane number to be modified. */ + /* Selection number to modified. */ + /* Data value. */ + /* Change to new data value? */ + /* Selection label. */ + /* Change to new label? */ { register XMPane *p_ptr; /* XMPane pointer. */ register XMSelect *s_ptr; /* XMSelect pointer. */ diff --git a/oldXMenu/Create.c b/oldXMenu/Create.c index 628ab89a678..f96e077a466 100644 --- a/oldXMenu/Create.c +++ b/oldXMenu/Create.c @@ -91,19 +91,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #define TILE_BUF_SIZE 5 -int atoi(); -double atof(); -char *x_get_resource_string (); +int atoi(const char *); +double atof(const char *); +char *x_get_resource_string (char *attribute, char *class); static Status -XAllocDisplayColor(display, map, colorName, color, junk) - Display *display; - Colormap map; - char *colorName; - XColor *color; - XColor *junk; +XAllocDisplayColor(Display *display, Colormap map, char *colorName, XColor *color, XColor *junk) { return (colorName!=0 && XParseColor(display, map, colorName, color) && @@ -112,10 +107,10 @@ XAllocDisplayColor(display, map, colorName, color, junk) XMenu * -XMenuCreate(display, parent, def_env) - Display *display; /* ID of previously opened display */ - Window parent; /* Window ID of the menu's parent window. */ - register char *def_env; /* X Defaults program environment name. */ +XMenuCreate(Display *display, Window parent, register char *def_env) + /* ID of previously opened display */ + /* Window ID of the menu's parent window. */ + /* X Defaults program environment name. */ { register int i; /* Loop counter. */ register int j; /* Loop counter. */ diff --git a/oldXMenu/DelPane.c b/oldXMenu/DelPane.c index e7568cff56e..baa1b8def41 100644 --- a/oldXMenu/DelPane.c +++ b/oldXMenu/DelPane.c @@ -16,10 +16,10 @@ #include "XMenuInt.h" int -XMenuDeletePane(display, menu, p_num) - register Display *display; /* Previously opened display */ - register XMenu *menu; /* Menu object to be modified. */ - register int p_num; /* Pane number to be deleted. */ +XMenuDeletePane(register Display *display, register XMenu *menu, register int p_num) + /* Previously opened display */ + /* Menu object to be modified. */ + /* Pane number to be deleted. */ { register XMPane *p_ptr; /* Pointer to pane being deleted. */ register XMSelect *s_ptr; /* Pointer to selections being deleted. */ diff --git a/oldXMenu/DelSel.c b/oldXMenu/DelSel.c index e7b6ace3845..9b0e3d7cd37 100644 --- a/oldXMenu/DelSel.c +++ b/oldXMenu/DelSel.c @@ -16,11 +16,11 @@ #include "XMenuInt.h" int -XMenuDeleteSelection(display, menu, p_num, s_num) - register Display *display; /* Previously opened display. */ - register XMenu *menu; /* Menu object to be modified. */ - register int p_num; /* Pane number to be deleted. */ - register int s_num; /* Selection number to be deleted. */ +XMenuDeleteSelection(register Display *display, register XMenu *menu, register int p_num, register int s_num) + /* Previously opened display. */ + /* Menu object to be modified. */ + /* Pane number to be deleted. */ + /* Selection number to be deleted. */ { register XMPane *p_ptr; /* Pointer to pane being deleted. */ register XMSelect *s_ptr; /* Pointer to selections being deleted. */ diff --git a/oldXMenu/Destroy.c b/oldXMenu/Destroy.c index 117f04ed1c5..906d92fb8cf 100644 --- a/oldXMenu/Destroy.c +++ b/oldXMenu/Destroy.c @@ -15,9 +15,9 @@ #include "XMenuInt.h" -XMenuDestroy(display, menu) - Display *display; - register XMenu *menu; /* Menu object to destroy. */ +XMenuDestroy(Display *display, register XMenu *menu) + + /* Menu object to destroy. */ { register XMPane *p_ptr; /* Pointer to the current pane. */ register XMPane *p_next; /* Pointer to the next pane. */ diff --git a/oldXMenu/Error.c b/oldXMenu/Error.c index 6f43cbdbf9b..6454974fd5e 100644 --- a/oldXMenu/Error.c +++ b/oldXMenu/Error.c @@ -17,7 +17,7 @@ #include "XMenuInt.h" char * -XMenuError() +XMenuError(void) { static char message[128]; /* Error message buffer. */ diff --git a/oldXMenu/EvHand.c b/oldXMenu/EvHand.c index 41ba49bcbca..fa99b8363af 100644 --- a/oldXMenu/EvHand.c +++ b/oldXMenu/EvHand.c @@ -15,8 +15,7 @@ #include "XMenuInt.h" -XMenuEventHandler(handler) - int (*handler)(); +XMenuEventHandler(int (*handler) (XEvent*)) { /* * Set the global event handler variable. diff --git a/oldXMenu/FindPane.c b/oldXMenu/FindPane.c index fa71c6b39a1..0d0f8188013 100644 --- a/oldXMenu/FindPane.c +++ b/oldXMenu/FindPane.c @@ -17,9 +17,7 @@ #include "XMenuInt.h" int -XMenuFindPane(menu, label) - register XMenu *menu; - register char *label; +XMenuFindPane(register XMenu *menu, register char *label) { register XMPane *p_ptr; register int i = 0; diff --git a/oldXMenu/FindSel.c b/oldXMenu/FindSel.c index fcb66eb851c..202bbc1b28c 100644 --- a/oldXMenu/FindSel.c +++ b/oldXMenu/FindSel.c @@ -34,10 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "XMenuInt.h" int -XMenuFindSelection(menu, p_num, label) - register XMenu *menu; - int p_num; - register char *label; +XMenuFindSelection(register XMenu *menu, int p_num, register char *label) { register XMPane *p_ptr; register XMSelect *s_ptr; diff --git a/oldXMenu/InsPane.c b/oldXMenu/InsPane.c index 0aa43935ea2..19ee33cb423 100644 --- a/oldXMenu/InsPane.c +++ b/oldXMenu/InsPane.c @@ -18,11 +18,11 @@ #include "XMenuInt.h" int -XMenuInsertPane(menu, p_num, label, active) - register XMenu *menu; /* Menu object to be modified. */ - register int p_num; /* Pane number of new pane. */ - char *label; /* Selection label. */ - int active; /* Make selection active? */ +XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int active) + /* Menu object to be modified. */ + /* Pane number of new pane. */ + /* Selection label. */ + /* Make selection active? */ { register XMPane *p_ptr; /* XMPane pointer. */ register XMPane *pane; /* Newly created pane. */ diff --git a/oldXMenu/InsSel.c b/oldXMenu/InsSel.c index 08a0370868c..0f28cdbef0c 100644 --- a/oldXMenu/InsSel.c +++ b/oldXMenu/InsSel.c @@ -17,13 +17,13 @@ #include "XMenuInt.h" int -XMenuInsertSelection(menu, p_num, s_num, data, label, active) - register XMenu *menu; /* Menu object to be modified. */ - register int p_num; /* Pane number to be modified. */ - register int s_num; /* Selection number of new selection. */ - char *data; /* Data value. */ - char *label; /* Selection label. */ - int active; /* Make selection active? */ +XMenuInsertSelection(register XMenu *menu, register int p_num, register int s_num, char *data, char *label, int active) + /* Menu object to be modified. */ + /* Pane number to be modified. */ + /* Selection number of new selection. */ + /* Data value. */ + /* Selection label. */ + /* Make selection active? */ { register XMPane *p_ptr; /* XMPane pointer. */ register XMSelect *s_ptr; /* XMSelect pointer. */ diff --git a/oldXMenu/Internal.c b/oldXMenu/Internal.c index b00841b0cc3..cb87dd650c7 100644 --- a/oldXMenu/Internal.c +++ b/oldXMenu/Internal.c @@ -96,7 +96,7 @@ _XMErrorList[XME_CODE_COUNT] = { /* * _XMEventHandler - Internal event handler variable. */ -int (*_XMEventHandler)() = NULL; +int (*_XMEventHandler)(XEvent*) = NULL; @@ -104,7 +104,7 @@ int (*_XMEventHandler)() = NULL; * _XMWinQueInit - Internal routine to initialize the window * queue. */ -_XMWinQueInit() +_XMWinQueInit(void) { /* * If the queue is not initialized initialize it. @@ -138,10 +138,10 @@ _XMWinQueInit() * window queue. */ int -_XMWinQueAddPane(display, menu, p_ptr) - register Display *display; - register XMenu *menu; /* Menu being manipulated. */ - register XMPane *p_ptr; /* XMPane being queued. */ +_XMWinQueAddPane(register Display *display, register XMenu *menu, register XMPane *p_ptr) + + /* Menu being manipulated. */ + /* XMPane being queued. */ { /* * If the queue is currently full then flush it. @@ -172,10 +172,10 @@ _XMWinQueAddPane(display, menu, p_ptr) * the selection window queue. */ int -_XMWinQueAddSelection(display, menu, s_ptr) - register Display *display; - register XMenu *menu; /* Menu being manipulated. */ - register XMSelect *s_ptr; /* XMSelection being queued. */ +_XMWinQueAddSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr) + + /* Menu being manipulated. */ + /* XMSelection being queued. */ { /* * If this entry will overflow the queue then flush it. @@ -206,10 +206,10 @@ _XMWinQueAddSelection(display, menu, s_ptr) * selection window queues. */ int -_XMWinQueFlush(display, menu, pane, select) - register Display *display; - register XMenu *menu; /* Menu being manipulated. */ - register XMPane *pane; /* Current pane. */ +_XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane *pane, XMSelect *select) + + /* Menu being manipulated. */ + /* Current pane. */ { register int pq_index; /* Pane queue index. */ register int sq_index; /* Selection queue index. */ @@ -346,9 +346,9 @@ _XMWinQueFlush(display, menu, pane, select) * a pane pointer that points to the indexed pane. */ XMPane * -_XMGetPanePtr(menu, p_num) - register XMenu *menu; /* Menu to find the pane in. */ - register int p_num; /* Index number of pane to find. */ +_XMGetPanePtr(register XMenu *menu, register int p_num) + /* Menu to find the pane in. */ + /* Index number of pane to find. */ { register XMPane *p_ptr; /* Pane pointer to be returned. */ register int i; /* Loop counter. */ @@ -382,9 +382,9 @@ _XMGetPanePtr(menu, p_num) * indexed selection. */ XMSelect * -_XMGetSelectionPtr(p_ptr, s_num) - register XMPane *p_ptr; /* Pane to find the selection in. */ - register int s_num; /* Index number of the selection to find. */ +_XMGetSelectionPtr(register XMPane *p_ptr, register int s_num) + /* Pane to find the selection in. */ + /* Index number of the selection to find. */ { register XMSelect *s_ptr; /* Selection pointer to be returned. */ register int i; /* Loop counter. */ @@ -416,9 +416,9 @@ _XMGetSelectionPtr(p_ptr, s_num) * _XMRecomputeGlobals - Internal subroutine to recompute menu wide * global values. */ -_XMRecomputeGlobals(display, menu) - register Display *display; /*X11 display variable. */ - register XMenu *menu; /* Menu object to compute from. */ +_XMRecomputeGlobals(register Display *display, register XMenu *menu) + /*X11 display variable. */ + /* Menu object to compute from. */ { register XMPane *p_ptr; /* Pane pointer. */ register XMSelect *s_ptr; /* Selection pointer. */ @@ -531,11 +531,11 @@ _XMRecomputeGlobals(display, menu) * window dependencies. */ int -_XMRecomputePane(display, menu, p_ptr, p_num) - register Display *display; /* Standard X display variable. */ - register XMenu *menu; /* Menu object being recomputed. */ - register XMPane *p_ptr; /* Pane pointer. */ - register int p_num; /* Pane sequence number. */ +_XMRecomputePane(register Display *display, register XMenu *menu, register XMPane *p_ptr, register int p_num) + /* Standard X display variable. */ + /* Menu object being recomputed. */ + /* Pane pointer. */ + /* Pane sequence number. */ { register int window_x; /* Recomputed window X coordinate. */ register int window_y; /* Recomputed window Y coordinate. */ @@ -681,11 +681,11 @@ _XMRecomputePane(display, menu, p_ptr, p_num) * selection window dependencies. */ int -_XMRecomputeSelection(display, menu, s_ptr, s_num) - register Display *display; - register XMenu *menu; /* Menu object being recomputed. */ - register XMSelect *s_ptr; /* Selection pointer. */ - register int s_num; /* Selection sequence number. */ +_XMRecomputeSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr, register int s_num) + + /* Menu object being recomputed. */ + /* Selection pointer. */ + /* Selection sequence number. */ { register Bool config_s = False; /* Reconfigure selection window? */ XWindowChanges *changes; /* Values to change in configure. */ @@ -811,15 +811,15 @@ _XMRecomputeSelection(display, menu, s_ptr, s_num) * recomputed before calling this routine or * unpredictable results will follow. */ -_XMTransToOrigin(display, menu, p_ptr, s_ptr, x_pos, y_pos, orig_x, orig_y) - Display *display; /* Not used. Included for consistency. */ - register XMenu *menu; /* Menu being computed against. */ - register XMPane *p_ptr; /* Current pane pointer. */ - register XMSelect *s_ptr; /* Current selection pointer. */ - int x_pos; /* X coordinate of point to translate. */ - int y_pos; /* Y coordinate of point to translate. */ - int *orig_x; /* Return value X coord. of the menu origin. */ - int *orig_y; /* Return value Y coord. of the menu origin. */ +_XMTransToOrigin(Display *display, register XMenu *menu, register XMPane *p_ptr, register XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y) + /* Not used. Included for consistency. */ + /* Menu being computed against. */ + /* Current pane pointer. */ + /* Current selection pointer. */ + /* X coordinate of point to translate. */ + /* Y coordinate of point to translate. */ + /* Return value X coord. of the menu origin. */ + /* Return value Y coord. of the menu origin. */ { register int l_orig_x; /* Local X coordinate of the menu origin. */ register int l_orig_y; /* Local Y coordinate of the menu origin. */ @@ -871,10 +871,7 @@ _XMTransToOrigin(display, menu, p_ptr, s_ptr, x_pos, y_pos, orig_x, orig_y) * _XMRefreshPane - Internal subroutine to completely refresh * the contents of a pane. */ -_XMRefreshPane(display, menu, pane) - register Display *display; - register XMenu *menu; - register XMPane *pane; +_XMRefreshPane(register Display *display, register XMenu *menu, register XMPane *pane) { register XMSelect *s_list = pane->s_list; register XMSelect *s_ptr; @@ -941,10 +938,7 @@ _XMRefreshPane(display, menu, pane) * _XMRefreshSelection - Internal subroutine that refreshes * a single selection window. */ -_XMRefreshSelection(display, menu, select) - register Display *display; - register XMenu *menu; - register XMSelect *select; +_XMRefreshSelection(register Display *display, register XMenu *menu, register XMSelect *select) { register int width = select->window_w; register int height = select->window_h; diff --git a/oldXMenu/Locate.c b/oldXMenu/Locate.c index edd94369e6e..c79f70bd836 100644 --- a/oldXMenu/Locate.c +++ b/oldXMenu/Locate.c @@ -17,17 +17,17 @@ #include "XMenuInt.h" int -XMenuLocate(display, menu, p_num, s_num, x_pos, y_pos, ul_x, ul_y, width, height) - register Display *display; /* Previously opened display. */ - register XMenu *menu; /* Menu object being located. */ - int p_num; /* Active pane number. */ - int s_num; /* Active selection number. */ - int x_pos; /* X coordinate of mouse active position. */ - int y_pos; /* Y coordinate of mouse active position. */ - int *ul_x; /* Returned upper left menu X coordinate. */ - int *ul_y; /* Returned upper left menu Y coordinate. */ - int *width; /* Returned menu width. */ - int *height; /* Returned menu height. */ +XMenuLocate(register Display *display, register XMenu *menu, int p_num, int s_num, int x_pos, int y_pos, int *ul_x, int *ul_y, int *width, int *height) + /* Previously opened display. */ + /* Menu object being located. */ + /* Active pane number. */ + /* Active selection number. */ + /* X coordinate of mouse active position. */ + /* Y coordinate of mouse active position. */ + /* Returned upper left menu X coordinate. */ + /* Returned upper left menu Y coordinate. */ + /* Returned menu width. */ + /* Returned menu height. */ { register XMPane *p_ptr; /* XMPane pointer. */ register XMSelect *s_ptr; /* XMSelect pointer. */ diff --git a/oldXMenu/Makefile.in b/oldXMenu/Makefile.in index 5e2e2f6fb9d..8acfee07fd0 100644 --- a/oldXMenu/Makefile.in +++ b/oldXMenu/Makefile.in @@ -49,6 +49,8 @@ C_SWITCH_X_SITE=@C_SWITCH_X_SITE@ C_SWITCH_X_SYSTEM=@C_SWITCH_X_SYSTEM@ C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ +C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ +PROFILING_CFLAGS = @PROFILING_CFLAGS@ EXTRA=insque.o CC=@CC@ @@ -88,6 +90,7 @@ all:: libXMenu11.a ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ $(C_SWITCH_X_SITE) $(C_SWITCH_X_SYSTEM) \ + ${C_WARNINGS_SWITCH} ${PROFILING_CFLAGS} \ $(CPPFLAGS) $(CFLAGS) -DEMACS_BITMAP_FILES \ -I../src -I${srcdir} -I${srcdir}/../src diff --git a/oldXMenu/Post.c b/oldXMenu/Post.c index c51f23e7146..07e24a26272 100644 --- a/oldXMenu/Post.c +++ b/oldXMenu/Post.c @@ -39,14 +39,14 @@ #include "XMenuInt.h" char * -XMenuPost(display, menu, p_num, s_num, x_pos, y_pos, event_mask) - register Display *display; /* Previously opened display. */ - register XMenu *menu; /* Menu to post. */ - register int *p_num; /* Pane number selected. */ - register int *s_num; /* Selection number selected. */ - register int x_pos; /* X coordinate of menu position. */ - register int y_pos; /* Y coordinate of menu position. */ - int event_mask; /* Mouse button event mask. */ +XMenuPost(register Display *display, register XMenu *menu, register int *p_num, register int *s_num, register int x_pos, register int y_pos, int event_mask) + /* Previously opened display. */ + /* Menu to post. */ + /* Pane number selected. */ + /* Selection number selected. */ + /* X coordinate of menu position. */ + /* Y coordinate of menu position. */ + /* Mouse button event mask. */ { register int stat; /* Routine call return status. */ char *data; /* Return data. */ diff --git a/oldXMenu/Recomp.c b/oldXMenu/Recomp.c index 230db9e3a13..038ac3b0b6b 100644 --- a/oldXMenu/Recomp.c +++ b/oldXMenu/Recomp.c @@ -16,9 +16,9 @@ #include "XMenuInt.h" int -XMenuRecompute(display, menu) - Display *display; - register XMenu *menu; /* Menu object to be recomputed. */ +XMenuRecompute(Display *display, register XMenu *menu) + + /* Menu object to be recomputed. */ { register XMPane *p_ptr; /* Pane pointer. */ register XMSelect *s_ptr; /* Selection pointer. */ diff --git a/oldXMenu/SetAEQ.c b/oldXMenu/SetAEQ.c index 0e81ed55a49..7cdb867ff09 100644 --- a/oldXMenu/SetAEQ.c +++ b/oldXMenu/SetAEQ.c @@ -18,9 +18,9 @@ #include "XMenuInt.h" -XMenuSetAEQ(menu, aeq) - register XMenu *menu; /* Menu object to be modified. */ - register int aeq; /* AEQ mode? */ +XMenuSetAEQ(register XMenu *menu, register int aeq) + /* Menu object to be modified. */ + /* AEQ mode? */ { /* * Set the AEQ mode switch. diff --git a/oldXMenu/SetFrz.c b/oldXMenu/SetFrz.c index be9f76f7d80..43684db9011 100644 --- a/oldXMenu/SetFrz.c +++ b/oldXMenu/SetFrz.c @@ -17,9 +17,9 @@ #include "XMenuInt.h" -XMenuSetFreeze(menu, freeze) - register XMenu *menu; /* Menu object to be modified. */ - register int freeze; /* Freeze mode? */ +XMenuSetFreeze(register XMenu *menu, register int freeze) + /* Menu object to be modified. */ + /* Freeze mode? */ { /* * Set the freeze mode switch. diff --git a/oldXMenu/SetPane.c b/oldXMenu/SetPane.c index b9ecb7e8706..9f5a99a564e 100644 --- a/oldXMenu/SetPane.c +++ b/oldXMenu/SetPane.c @@ -16,10 +16,10 @@ #include "XMenuInt.h" int -XMenuSetPane(menu, p_num, active) - register XMenu *menu; /* Menu object to be modified. */ - register int p_num; /* Pane number to be modified. */ - register int active; /* Make selection active? */ +XMenuSetPane(register XMenu *menu, register int p_num, register int active) + /* Menu object to be modified. */ + /* Pane number to be modified. */ + /* Make selection active? */ { register XMPane *p_ptr; /* XMPane pointer. */ diff --git a/oldXMenu/SetSel.c b/oldXMenu/SetSel.c index aae161322eb..162d3434bad 100644 --- a/oldXMenu/SetSel.c +++ b/oldXMenu/SetSel.c @@ -16,11 +16,11 @@ #include "XMenuInt.h" int -XMenuSetSelection(menu, p_num, s_num, active) - register XMenu *menu; /* Menu object to be modified. */ - register int p_num; /* Pane number to be modified. */ - register int s_num; /* Selection number to modified. */ - int active; /* Make selection active? */ +XMenuSetSelection(register XMenu *menu, register int p_num, register int s_num, int active) + /* Menu object to be modified. */ + /* Pane number to be modified. */ + /* Selection number to modified. */ + /* Make selection active? */ { register XMPane *p_ptr; /* XMPane pointer. */ register XMSelect *s_ptr; /* XMSelect pointer. */ diff --git a/oldXMenu/X10.h b/oldXMenu/X10.h index e1abcbbe6c5..9a7766bc09d 100644 --- a/oldXMenu/X10.h +++ b/oldXMenu/X10.h @@ -71,8 +71,8 @@ typedef struct { int size; /* Table size (number of buckets). */ } XAssocTable; -XAssocTable *XCreateAssocTable(); -char *XLookUpAssoc(); +XAssocTable *XCreateAssocTable(int size); +char *XLookUpAssoc(Display *dpy, XAssocTable *table, XID x_id); #endif /* _X10_H_ */ diff --git a/oldXMenu/XCrAssoc.c b/oldXMenu/XCrAssoc.c index 874ed81d31f..aa98c27ff41 100644 --- a/oldXMenu/XCrAssoc.c +++ b/oldXMenu/XCrAssoc.c @@ -11,8 +11,6 @@ #define NULL 0 #endif -extern int errno; - /* * XCreateAssocTable - Create an XAssocTable. The size argument should be * a power of two for efficiency reasons. Some size suggestions: use 32 @@ -20,8 +18,8 @@ extern int errno; * buckets is 8. If there is an error creating the XAssocTable, a NULL * pointer is returned. */ -XAssocTable *XCreateAssocTable(size) - register int size; /* Desired size of the table. */ +XAssocTable *XCreateAssocTable(register int size) + /* Desired size of the table. */ { register XAssocTable *table; /* XAssocTable to be initialized. */ register XAssoc *buckets; /* Pointer to the first bucket in */ diff --git a/oldXMenu/XDelAssoc.c b/oldXMenu/XDelAssoc.c index 11e8c35a774..7aca50aa56b 100644 --- a/oldXMenu/XDelAssoc.c +++ b/oldXMenu/XDelAssoc.c @@ -5,22 +5,19 @@ #include <X11/Xlib.h> #include "X10.h" -void emacs_remque(); struct qelem { struct qelem *q_forw; struct qelem *q_back; char q_data[1]; }; +void emacs_remque(struct qelem*); /* * XDeleteAssoc - Delete an association in an XAssocTable keyed on * an XId. An association may be removed only once. Redundant * deletes are meaningless (but cause no problems). */ -XDeleteAssoc(dpy, table, x_id) - register Display *dpy; - register XAssocTable *table; - register XID x_id; +XDeleteAssoc(register Display *dpy, register XAssocTable *table, register XID x_id) { int hash; register XAssoc *bucket; diff --git a/oldXMenu/XDestAssoc.c b/oldXMenu/XDestAssoc.c index fee53eb756f..c2dd8d4d89b 100644 --- a/oldXMenu/XDestAssoc.c +++ b/oldXMenu/XDestAssoc.c @@ -10,8 +10,7 @@ * XDestroyAssocTable - Destroy (free the memory associated with) * an XAssocTable. */ -XDestroyAssocTable(table) - register XAssocTable *table; +XDestroyAssocTable(register XAssocTable *table) { register int i; register XAssoc *bucket; diff --git a/oldXMenu/XLookAssoc.c b/oldXMenu/XLookAssoc.c index 0ab71c3e78b..a1a06e900c7 100644 --- a/oldXMenu/XLookAssoc.c +++ b/oldXMenu/XLookAssoc.c @@ -18,10 +18,10 @@ * in the table the routine will return a NULL pointer. All XId's are relative * to the currently active Display. */ -caddr_t XLookUpAssoc(dpy, table, x_id) - register Display *dpy; - register XAssocTable *table; /* XAssocTable to search in. */ - register XID x_id; /* XId to search for. */ +caddr_t XLookUpAssoc(register Display *dpy, register XAssocTable *table, register XID x_id) + + /* XAssocTable to search in. */ + /* XId to search for. */ { int hash; register XAssoc *bucket; diff --git a/oldXMenu/XMakeAssoc.c b/oldXMenu/XMakeAssoc.c index cf039c8f3c1..84157399b43 100644 --- a/oldXMenu/XMakeAssoc.c +++ b/oldXMenu/XMakeAssoc.c @@ -13,25 +13,20 @@ #define NULL 0 #endif -extern int errno; - -void emacs_insque(); struct qelem { struct qelem *q_forw; struct qelem *q_back; char q_data[1]; }; +void emacs_insque (struct qelem *elem, struct qelem *prev); + /* * XMakeAssoc - Insert data into an XAssocTable keyed on an XId. * Data is inserted into the table only once. Redundant inserts are * meaningless (but cause no problems). The queue in each association * bucket is sorted (lowest XId to highest XId). */ -XMakeAssoc(dpy, table, x_id, data) - register Display *dpy; - register XAssocTable *table; - register XID x_id; - register caddr_t data; +XMakeAssoc(register Display *dpy, register XAssocTable *table, register XID x_id, register caddr_t data) { int hash; register XAssoc *bucket; diff --git a/oldXMenu/XMenu.h b/oldXMenu/XMenu.h index 2589ae68cca..88ebf5b3ac7 100644 --- a/oldXMenu/XMenu.h +++ b/oldXMenu/XMenu.h @@ -16,6 +16,7 @@ #ifndef _XMenu_h_ #define _XMenu_h_ +#include <stdlib.h> #include <X11/Xutil.h> #include "X10.h" @@ -234,31 +235,33 @@ typedef struct _xmenu { Pixmap inact_pixmap; /* Menu inactive pixmap. */ } XMenu; +typedef void (*Wait_func)(void*); + /* * XMenu library routine declarations. */ -XMenu *XMenuCreate(); -int XMenuAddPane(); -int XMenuAddSelection(); -int XMenuInsertPane(); -int XMenuInsertSelection(); -int XMenuFindPane(); -int XMenuFindSelection(); -int XMenuChangePane(); -int XMenuChangeSelection(); -int XMenuSetPane(); -int XMenuSetSelection(); -int XMenuRecompute(); -int XMenuEventHandler(); /* No value actually returned. */ -int XMenuLocate(); -int XMenuSetFreeze(); /* No value actually returned. */ -void XMenuActivateSetWaitFunction(); -int XMenuActivate(); -char *XMenuPost(); -int XMenuDeletePane(); -int XMenuDeleteSelection(); -int XMenuDestroy(); /* No value actually returned. */ -char *XMenuError(); +XMenu *XMenuCreate(Display *display, Window parent, register char *def_env); +int XMenuAddPane(Display *display, register XMenu *menu, register char *label, int active); +int XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char *help); +int XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int active); +int XMenuInsertSelection(register XMenu *menu, register int p_num, register int s_num, char *data, char *label, int active); +int XMenuFindPane(register XMenu *menu, register char *label); +int XMenuFindSelection(register XMenu *menu, int p_num, register char *label); +int XMenuChangePane(register XMenu *menu, register int p_num, char *label); +int XMenuChangeSelection(Display *display, register XMenu *menu, register int p_num, register int s_num, char *data, int data_sw, char *label, int label_sw); +int XMenuSetPane(register XMenu *menu, register int p_num, register int active); +int XMenuSetSelection(register XMenu *menu, register int p_num, register int s_num, int active); +int XMenuRecompute(Display *display, register XMenu *menu); +int XMenuEventHandler(int (*handler) (XEvent *)); /* No value actually returned. */ +int XMenuLocate(register Display *display, register XMenu *menu, int p_num, int s_num, int x_pos, int y_pos, int *ul_x, int *ul_y, int *width, int *height); +int XMenuSetFreeze(register XMenu *menu, register int freeze); /* No value actually returned. */ +void XMenuActivateSetWaitFunction(Wait_func func, void *data); +int XMenuActivate(Display *display, XMenu *menu, int *p_num, int *s_num, int x_pos, int y_pos, unsigned int event_mask, char **data, void (*help_callback) (char *, int, int)); +char *XMenuPost(register Display *display, register XMenu *menu, register int *p_num, register int *s_num, register int x_pos, register int y_pos, int event_mask); +int XMenuDeletePane(register Display *display, register XMenu *menu, register int p_num); +int XMenuDeleteSelection(register Display *display, register XMenu *menu, register int p_num, register int s_num); +int XMenuDestroy(Display *display, register XMenu *menu); /* No value actually returned. */ +char *XMenuError(void); #endif /* Don't add after this point. */ diff --git a/oldXMenu/XMenuInt.h b/oldXMenu/XMenuInt.h index d2844d8ea2b..dc6a0e5192a 100644 --- a/oldXMenu/XMenuInt.h +++ b/oldXMenu/XMenuInt.h @@ -37,7 +37,7 @@ /* * XMenu internal event handler variable. */ -extern int (*_XMEventHandler)(); +extern int (*_XMEventHandler)(XEvent*); #ifndef Pixel #define Pixel unsigned long @@ -46,19 +46,17 @@ extern int (*_XMEventHandler)(); /* * Internal routine declarations. */ -int _XMWinQueInit(); /* No value actually returned. */ -int _XMWinQueAddPane(); -int _XMWinQueAddSelection(); -int _XMWinQueFlush(); -XMPane *_XMGetPanePtr(); -XMSelect *_XMGetSelectionPtr(); -int _XMRecomputeGlobals(); /* No value actually returned. */ -int _XMRecomputePane(); -int _XMRecomputeSelection(); -int _XMTransToOrigin(); /* No value actually returned. */ -int _XMRefreshPane(); /* No value actually returned. */ -int _XMRefreshSelections(); /* No value actually returned. */ -int _XMHighlightSelection(); /* No value actually returned. */ +int _XMWinQueInit(void); /* No value actually returned. */ +int _XMWinQueAddPane(register Display *display, register XMenu *menu, register XMPane *p_ptr); +int _XMWinQueAddSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr); +int _XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane *pane, XMSelect *select); +XMPane *_XMGetPanePtr(register XMenu *menu, register int p_num); +XMSelect *_XMGetSelectionPtr(register XMPane *p_ptr, register int s_num); +int _XMRecomputeGlobals(register Display *display, register XMenu *menu); /* No value actually returned. */ +int _XMRecomputePane(register Display *display, register XMenu *menu, register XMPane *p_ptr, register int p_num); +int _XMRecomputeSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr, register int s_num); +int _XMTransToOrigin(Display *display, register XMenu *menu, register XMPane *p_ptr, register XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y); /* No value actually returned. */ +int _XMRefreshPane(register Display *display, register XMenu *menu, register XMPane *pane); /* No value actually returned. */ #endif /* Don't add stuff after this #endif */ diff --git a/oldXMenu/insque.c b/oldXMenu/insque.c index 16b194d88d3..c6f8f6ef1fb 100644 --- a/oldXMenu/insque.c +++ b/oldXMenu/insque.c @@ -30,8 +30,7 @@ struct qelem { /* Insert ELEM into a doubly-linked list, after PREV. */ void -emacs_insque (elem, prev) - struct qelem *elem, *prev; +emacs_insque (struct qelem *elem, struct qelem *prev) { struct qelem *next = prev->q_forw; prev->q_forw = elem; @@ -43,8 +42,7 @@ emacs_insque (elem, prev) /* Unlink ELEM from the doubly-linked list that it is in. */ -emacs_remque (elem) - struct qelem *elem; +emacs_remque (struct qelem *elem) { struct qelem *next = elem->q_forw; struct qelem *prev = elem->q_back; diff --git a/src/ChangeLog.trunk b/src/ChangeLog.trunk index 9e115942d39..6a0475f5741 100644 --- a/src/ChangeLog.trunk +++ b/src/ChangeLog.trunk @@ -1,3 +1,1384 @@ +2010-07-23 Juanma Barranquero <lekktu@gmail.com> + + * menu.c (cleanup_popup_menu): Set inside "#ifdef HAVE_NS"; + it is called only from NS code. + + * w32term.c (my_set_focus): #ifdef away; it is called only from + "#ifdef 0" code. + + * w32fns.c (x_edge_detection): + * xfaces.c (may_use_scalable_font_p): + Remove obsolete static declarations. + +2010-07-20 Juanma Barranquero <lekktu@gmail.com> + + * alloc.c (emacs_blocked_free, emacs_blocked_malloc) + (emacs_blocked_realloc, uninterrupt_malloc): + * fringe.c (w32_reset_fringes): + * image.c (convert_mono_to_color_image, lookup_rgb_color) + (init_color_table, XPutPixel, jpeg_resync_to_restart_wrapper): + * sound.c (be2hs, do_play_sound): + * vm-limit.c (get_lim_data, ret_lim_data): + * w32term.c (x_free_frame_resources): + * xfaces.c (x_create_gc, x_free_gc): + Convert definitions to standard C. + +2010-07-20 Stefan Monnier <monnier@iro.umontreal.ca> + + * eval.c (Feval, Ffuncall): Use the new names. + + * lisp.h (struct Lisp_Subr): Rename `am' to aMANY and add aUNEVALLED. + (DEFUN): Add braces around the union initialisation and use ## to + specify the right union alternative and avoid a cast. + +2010-07-18 Juanma Barranquero <lekktu@gmail.com> + + * makefile.w32-in ($(BLD)/keyboard.$(O)): Update dependencies. + +2010-07-17 Chong Yidong <cyd@stupidchicken.com> + + * frame.c (make_initial_frame): Use set_menu_bar_lines (Bug#6660). + +2010-07-17 Jan Djärv <jan.h.d@swipnet.se> + + * gtkutil.c (xg_event_is_for_menubar): Also check that event window + is related to the menu bar (Bug#6499). + (xg_frame_resized): GTK_IS_MAPPED => gtk_widget_get_mapped, for Gtk 3.0. + +2010-07-16 Jan Djärv <jan.h.d@swipnet.se> + + * xterm.h (x_menubar_window_to_frame): Second parameter is XEvent*. + + * xterm.c (handle_one_xevent): Pass event to x_menubar_window_to_frame. + + * xmenu.c (x_activate_menubar): Revert previous fix for Bug#6499, + i.e. don't put back ButtonRelease (Bug#6608). + + * xfns.c (x_menubar_window_to_frame): Take XEvent as second parameter + instead of Window. Call xg_event_is_for_menubar when + USE_GTK (Bug#6499). + + * gtkutil.h (xg_event_is_for_menubar): Declare. + + * gtkutil.c (xg_event_is_for_menubar): New function (Bug#6499). + +2010-07-16 Eli Zaretskii <eliz@gnu.org> + + * w32fns.c (x_set_foreground_color): Fix setting the cursor color + when it's the same as the old foreground. (Bug#6609) + +2010-07-16 Jan Djärv <jan.h.d@swipnet.se> + + * xmenu.c (free_frame_menubar): Only call x_set_window_size if + widget is non-null (Bug#6645). + +2010-07-15 Andreas Schwab <schwab@linux-m68k.org> + + * xterm.c (x_fully_uncatch_errors, x_trace_wire, x_check_font): + Convert old-style definition. + + * xmenu.c (create_and_show_popup_menu, xmenu_show): Fix type of + timestamp argument. + +2010-07-15 Eli Zaretskii <eliz@gnu.org> + + * fringe.c (update_window_fringes): Restore mistakenly reverted + code from 2010-04-17T12:33:05Z!eliz@gnu.org merged in 2010-04-20T13:31:28Z!eliz@gnu.org. + +2010-07-14 Jan Djärv <jan.h.d@swipnet.se> + + * xterm.c (xm_scroll_callback, x_process_timeouts): K&R => prototype. + (SET_SAVED_KEY_EVENT): Remove (not used). + (SET_SAVED_MENU_EVENT): Rename to SET_SAVED_BUTTON_EVENT and + remove size parameter. + (handle_one_xevent): Check popup_activated () for menu for Xt also. + Remove #ifdef USE_GTK around finish = X_EVENT_DROP. + Remove #ifdef USE_MOTIF code that did SET_SAVED_BUTTON_EVENT for + ButtonRelease. + (x_set_window_size_1): scroll_bar_actual_width is always + SCROLL_BAR_COLS * COLUMN_WIDTH for the purpose of frame sizing. + + * xdisp.c (pending_menu_activation): Remove extern declaration. + (prepare_menu_bars): Remove setting of pending_menu_activation. + + * xmenu.c (pending_menu_activation): Remove. + (x_activate_menubar): Set popup_activated_flag for Xt also. + Remove setting of pending_menu_activation. + (set_frame_menubar): Remove check of pending_menu_activation. + Declare menubar_size before code. Correct spelling in comment. + +2010-07-14 Kenichi Handa <handa@m17n.org> + + * font.c (font_open_entity): Cancel previous change. + (Ffont_get): Don't check FONT_ENTITY_INDEX of a font-object. + +2010-07-13 Eli Zaretskii <eliz@gnu.org> + + Remove subprocesses #ifdefs. + * process.c <inhibit_sentinels>: Move to the common part. + (Fwaiting_for_user_input_p): Move to the common part; return nil + if async subprocesses aren't supported. + * sysdep.c (wait_for_termination) [!MSDOS]: Don't compile on + MS-DOS. Remove "#ifdef subprocesses". + (sys_subshell, sys_select): Remove "#ifdef subprocesses". + (gettimeofday): Remove "#ifdef subprocesses". + (wait_without_blocking): Remove function. + (flush_pending_output, child_setup_tty): Don't compile on MS-DOS. + Remove "#ifdef subprocesses". + (child_setup_tty): Use WINDOWSNT instead of DOS_NT, since not + compiled on MS-DOS. + * callproc.c (Fcall_process) [!MSDOS]: Don't call + wait_for_termination on MS-DOS. + * emacs.c (shut_down_emacs): Remove "#ifndef subprocesses" from + initialization of inhibit_sentinels. + * keyboard.c (record_asynch_buffer_change): Remove "#ifdef + subprocesses" conditional. + * callproc.c (Fcall_process) [!subprocesses]: Don't call + wait_for_termination, since `buffer' cannot be an integer when + async subprocesses are not supported + * xdisp.c (decode_mode_spec): Use `MSDOS' instead of `subprocesses' + for ifdefing away the call to Fprocess_status. + + * process.c (add_keyboard_wait_descriptor) [!subprocesses]: Ifdef + away the entire body of the function. + +2010-07-13 Dan Nicolaescu <dann@ics.uci.edu> + + Remove subprocesses #ifdefs from term.c. + * process.c (add_keyboard_wait_descriptor) + (delete_keyboard_wait_descriptor): Move to common section, do + nothing when subprocesses is not defined. + * term.c (Fsuspend_tty, Fresume_tty, init_tty): + Remove subprocesses #ifdefs. + + Convert maybe_fatal to standard C. + * lisp.h (verror): Declare. + * eval.c (verror): New function containing the code from ... + (error): ... this. Call verror. + * term.c (vfatal): New function containing the code from ... + (fatal): ... this. Call vfatal. + (maybe_fatal): Convert to standard C, use variable number of + arguments. Declare as non-return. + (init_tty): Fix maybe_fatal call. + +2010-07-12 Dan Nicolaescu <dann@ics.uci.edu> + + * xterm.c (x_scroll_bar_set_handle, x_scroll_bar_expose) + (_scroll_bar_note_movement): Convert definitions to standard C. + * xmenu.c (menu_help_callback, pop_down_menu, xmenu_show): + * xfns.c (hack_wm_protocols, x_window, x_window): Likewise. + +2010-07-12 Dan Nicolaescu <dann@ics.uci.edu> + + * xterm.c (x_frame_of_widget, x_alloc_nearest_color_for_widget) + (x_alloc_lighter_color_for_widget, cvt_string_to_pixel) + (cvt_pixel_dtor, x_window_to_menu_bar, xt_action_hook) + (xaw_jump_callback, xaw_scroll_callback) + (x_create_toolkit_scroll_bar, x_set_toolkit_scroll_bar_thumb) + (x_wm_set_size_hint, x_activate_timeout_atimer): Convert + definitions to standard C. + * xmenu.c (menubar_id_to_frame, popup_get_selection) + (popup_activate_callback, popup_deactivate_callback) + (menu_highlight_callback, menubar_selection_callback) + (apply_systemfont_to_dialog, apply_systemfont_to_menu) + (free_frame_menubar, popup_selection_callback, as) + (create_and_show_popup_menu, dialog_selection_callback) + (create_and_show_dialog): + * xfns.c (hack_wm_protocols, x_window): + * xfaces.c (x_update_menu_appearance): + * widget.c (get_default_char_pixel_size, pixel_to_char_size) + (char_to_pixel_size, round_size_to_char, get_wm_shell) + (set_frame_size, update_wm_hints, setup_frame_gcs) + (update_various_frame_slots, update_from_various_frame_slots) + (EmacsFrameInitialize, EmacsFrameRealize, EmacsFrameResize) + (EmacsFrameSetValues, EmacsFrameQueryGeometry) + (EmacsFrameSetCharSize, widget_store_internal_border): Likewise. + +2010-07-12 Andreas Schwab <schwab@linux-m68k.org> + + * dbusbind.c (xd_initialize): Don't compare boolean with a constant. + +2010-07-12 Eli Zaretskii <eliz@gnu.org> + + * process.c (setup_process_coding_systems): Move to the part + shared by non-subprocesses systems, and make its body empty when + subprocesses is not defined. + (close_process_descs): Move to the part shared by non-subprocesses + systems. + (wait_reading_process_output) [!subprocesses]: Convert arg list to + ANSI C. + +2010-07-12 Andreas Schwab <schwab@linux-m68k.org> + + * editfns.c (transpose_markers): Convert old-style definition. + * emacs.c (abort, shut_down_emacs, fixup_locale) + (synchronize_system_time_locale) + (synchronize_system_messages_locale, syms_of_emacs): Likewise. + * floatfns.c (extract_float, matherr, init_floatfns) + (syms_of_floatfns): Likewise. + * fns.c (make_hash_table): Likewise. + * ftfont.c (ftfont_get_otf, ftfont_otf_features) + (ftfont_otf_capability, ftfont_get_glyph_id, ftfont_get_metrics) + (ftfont_drive_otf, ftfont_shape_by_flt, ftfont_shape) + (ftfont_variation_glyphs): Likewise. + * gtkutil.c (xg_create_widget, xg_modify_menubar_widgets): Likewise. + * keymap.c (describe_map_tree, describe_map, describe_vector): Likewise. + * lread.c (read_filtered_event): Likewise. + * minibuf.c (read_minibuf_noninteractive, read_minibuf): Likewise. + * process.c (wait_reading_process_output): Likewise. + * scroll.c (do_line_insertion_deletion_costs): Likewise. + * search.c (search_buffer, boyer_moore): Likewise. + * syntax.c (scan_sexps_forward): Likewise. + * xdisp.c (try_scrolling): Likewise. + * xfaces.c (face_at_buffer_position, face_for_overlay_string) + (face_at_string_position): Likewise. + * xfns.c (x_default_scroll_bar_color_parameter): Likewise. + * xselect.c (x_get_window_property, receive_incremental_selection) + (x_get_window_property_as_lisp_data, lisp_data_to_selection_data): + Likewise. + * xterm.c (x_draw_relief_rect, x_draw_box_rect): Likewise. + +2010-07-12 Dan Nicolaescu <dann@ics.uci.edu> + + * callproc.c (child_setup): Remove subprocesses conditional. + Remove code dealing with SET_EMACS_PRIORITY, unused. + + * buffer.c (Fset_buffer_multibyte): Remove subprocesses conditional. + * process.c (close_process_descs): Use DOS_NT instead of WINDOWSNT. + + * emacs.c (__do_global_ctors, __do_global_ctors_aux) + (__do_global_dtors, __main): Use void in definition. + (main): Remove code dealing with SET_EMACS_PRIORITY, unused. + Remove SYMS_MACHINE code, unused. Remove SYMS_SYSTEM, inline + the only users from ... + * s/ms-w32.h (SYMS_SYSTEM): ... here and ... + * s/msdos.h (SYMS_SYSTEM): ... here. Remove. + (HAVE_VOLATILE): Remove, unused. + + Convert more function definitions to standard C. + * xdisp.c (window_box_edges, handle_single_display_spec) + (display_string): Convert definition to standard C. + * scroll.c (do_direct_scrolling, scrolling_1): + * dispnew.c (allocate_matrices_for_frame_redisplay) + (mirrored_line_dance): + * coding.c (code_convert_string): + * charset.c (map_charset_chars): + * ccl.c (Fccl_program_p, Fccl_execute, Fccl_execute_on_string) + (Fregister_ccl_program, Fregister_code_conversion_map): + * keyboard.c (kbd_buffer_nr_stored): Likewise. + (head_table): Make static and const. + +2010-07-12 Andreas Schwab <schwab@linux-m68k.org> + + * Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS) + (PROFILING_LDFLAGS): Set from substitution. + (ALL_CFLAGS): Add C_WARNINGS_SWITCH and PROFILING_CFLAGS, put + CFLAGS last. + +2010-07-12 Kenichi Handa <handa@m17n.org> + + * Makefile.in (lisp): Change hebrew.el to hebrew.elc. + (shortlisp): Likewise. + + * font.h (enum font_property_index): New member FONT_ENTITY_INDEX. + + * font.c (font_open_entity): Record ENTITY in FONT_OBJECT's slot + of FONT_ENTITY_INDEX. + (Ffont_get): If KEY is :otf and the font-object doesn't have the + property, get the property value dynamically. + (Ffont_put): Accept font-entity and font-object too. + (Ffont_get_glyhphs): Renamed from Fget_font_glyphs. Arguments and + return value changed. + (syms_of_font): Adjusted for the above change. + +2010-07-11 Andreas Schwab <schwab@linux-m68k.org> + + * blockinput.h: Remove obsolete comment. + + * lisp.h: Include <stddef.h>. + (OFFSETOF): Don't define. + (VECSIZE): Use offsetof instead of OFFSETOF. + (PSEUDOVECSIZE): Likewise. + * process.c (conv_sockaddr_to_lisp): Likewise. + * alloc.c: Don't include <stddef.h>. + * buffer.h (PER_BUFFER_VAR_OFFSET): Use offsetof. + + * process.c: Remove obsolete comment. + +2010-07-11 Chong Yidong <cyd@stupidchicken.com> + + * xfaces.c (Vface_remapping_alist): Doc fix (Bug#6091). + +2010-07-11 Andreas Schwab <schwab@linux-m68k.org> + + * callint.c (Fcall_interactively): Use strchr, strrchr instead of + index, rindex. + * doc.c (get_doc_string, Fsnarf_documentation): Likewise. + * editfns.c (Fuser_full_name, Fformat): Likewise. + * emacs.c (argmatch, sort_args, decode_env_path): Likewise. + * fileio.c (Ffile_symlink_p): Likewise. + * filelock.c (current_lock_owner): Likewise. + * font.c (font_parse_name, font_parse_family_registry): Likewise. + * fontset.c (fontset_pattern_regexp): Likewise. + * lread.c (read1): Likewise. + * sysdep.c (init_system_name): Likewise. + * xfns.c (select_visual): Likewise. + * s/hpux10-20.h (index, rindex): Don't define. + * s/ms-w32.h (index): Likewise. + * s/usg5-4.h: Likewise. + + * callproc.c (relocate_fd): Use F_DUPFD if defined. + + * alloc.c (pending_malloc_warning, malloc_warning): Add const. + * callproc.c (relocate_fd, getenv_internal_1, getenv_internal) + (egetenv): Likewise. + * doprnt.c (doprnt): Likewise. + * editfns.c (set_time_zone_rule, format2): Likewise. + * emacs.c (decode_env_path): Likewise. + * eval.c (signal_error, error): Likewise. + * insdel.c (replace_range_2): Likewise. + * keyboard.c (cmd_error_internal): Likewise. + * lread.c (isfloat_string, make_symbol, dir_warning): Likewise. + * print.c (write_string, write_string_1, print_error_message): + Likewise. + * vm-limit.c (warn_function, memory_warnings): Likewise. + * xdisp.c (message1, message1_nolog, message_with_string) + (vmessage, message, message_nolog): Likewise. + * emacs.c: Remove duplicate declaration. + * keyboard.h: Likewise. + * lisp.h: Update prototypes. + + * eval.c: Fix indentation problem. + + * keyboard.c: Include "process.h" + + * eval.c: Remove obsolete noinline declaration. + * fns.c: Likewise. + +2010-07-11 Ken Raeburn <raeburn@raeburn.org> + + * doprnt.c (doprnt): Take a va_list argument instead of count and + pointer. + * eval.c (error): Change to a standard-C variadic function. + * xdisp.c (vmessage): Renamed from message, made static, and + changed to take a va_list argument. + (message): New variadic wrapper. + (message_nolog): Now a variadic function, calling vmessage. + * lisp.h: Include stdarg.h for va_list. + (doprnt, error, message, message_nolog): Decls updated. + +2010-07-11 Eli Zaretskii <eliz@gnu.org> + + * process.c (syms_of_process) <delete-exited-processes>: Define + even if !subprocesses. + (delete_exited_processes): Ditto. + + * msdos.c (syms_of_msdos) <delete-exited-processes>: Remove DEFVAR. + (delete_exited_processes): Don't define. + +2010-07-10 Chong Yidong <cyd@stupidchicken.com> + + * frame.c (make_frame): Initialize menu_bar_lines and + tool_bar_lines members. + (make_initial_frame, make_terminal_frame): Initialize + menu_bar_lines using value of menu-bar-mode. + + * msdos.c (IT_set_frame_parameters): Don't set menu-bar-lines. + +2010-07-10 Eli Zaretskii <eliz@gnu.org> + + * process.c: Reshuffle #include's. Condition some of the global + and static variables on `subprocesses'. + (hold_keyboard_input, unhold_keyboard_input, kbd_on_hold_p): + Leave only one implementation. + (Fget_buffer_process, Fprocess_inherit_coding_system_flag) + (kill_buffer_processes, Flist_system_processes) + (Fprocess_attributes, init_process, syms_of_process): Unify the + implementations for with subprocesses and without them. + +2010-07-09 Jan Djärv <jan.h.d@swipnet.se> + + * xmenu.c (set_frame_menubar): Must realize menubar_widget to get the + correct size for Motif. + (free_frame_menubar): Call x_set_window_size to update frame size. + + * xfns.c (x_window): Set borderWidth to 0 for pane and + EmacsFrame. Frame size calculation is wrong otherwise. + +2010-07-09 Michael Albinus <michael.albinus@gmx.de> + + * dbusbind.c (xd_initialize): Add new argument RAISE_ERROR, which + allows to suppress errors when polling in Emacs' main loop. + (Fdbus_init_bus, Fdbus_get_unique_name, Fdbus_call_method) + (Fdbus_call_method_asynchronously, Fdbus_method_return_internal) + (Fdbus_method_error_internal, Fdbus_send_signal) + (xd_get_dispatch_status, xd_read_message, Fdbus_register_signal) + (Fdbus_register_method): Use it. (Bug#6579) + +2010-07-08 Dan Nicolaescu <dann@ics.uci.edu> + + * alloc.c: Convert DEFUNs to standard C. + * buffer.c: + * bytecode.c: + * callint.c: + * callproc.c: + * casefiddle.c: + * casetab.c: + * category.c: + * character.c: + * charset.c: + * chartab.c: + * cmds.c: + * coding.c: + * composite.c: + * data.c: + * dbusbind.c: + * dired.c: + * dispnew.c: + * doc.c: + * dosfns.c: + * editfns.c: + * emacs.c: + * eval.c: + * fileio.c: + * filelock.c: + * floatfns.c: + * fns.c: + * font.c: + * fontset.c: + * frame.c: + * fringe.c: + * image.c: + * indent.c: + * insdel.c: + * keyboard.c: + * keymap.c: + * lread.c: + * macros.c: + * marker.c: + * menu.c: + * minibuf.c: + * msdos.c: + * nsfns.m: + * nsmenu.m: + * nsselect.m: + * print.c: + * process.c: + * search.c: + * sound.c: + * syntax.c: + * term.c: + * terminal.c: + * textprop.c: + * undo.c: + * w16select.c: + * w32console.c: + * w32fns.c: + * w32font.c: + * w32menu.c: + * w32proc.c: + * w32select.c: + * window.c: + * xdisp.c: + * xfaces.c: + * xfns.c: + * xmenu.c: + * xselect.c: + * xsettings.c: + * xsmfns.c: Likewise. + +2010-07-08 Eli Zaretskii <eliz@gnu.org> + + * process.c (kbd_is_on_hold, hold_keyboard_input) + (unhold_keyboard_input, kbd_on_hold_p) [!subprocesses]: Define. + +2010-07-08 Jan Djärv <jan.h.d@swipnet.se> + + * xmenu.c (set_frame_menubar, create_and_show_popup_menu) + (create_and_show_dialog): Don't call apply_systemfont_to_(menu|dialog) + unless USE_LUCID. + +2010-07-08 Dan Nicolaescu <dann@ics.uci.edu> + + * xdisp.c (store_mode_line_noprop_char): Remove K&R alternative + declaration. + + Clean up include guards. + * tparam.c: Remove include guards for config.h, string.h and code + that assumes #ifndef emacs. + * termcap.c: + * unexalpha.c: + * sysdep.c: + * filemode.c: + * filelock.c: + * bidi.c: Likewise. + + Remove prefix-args.c + * prefix-args.c: Remove file. + * autodeps.mk (ALLOBJS): Remove reference to prefix-args. + * Makefile.in (temacs${EXEEXT}): Remove references to + PRE_EDIT_LDFLAGS and POST_EDIT_LDFLAGS. + (mostlyclean): Remove reference to prefix-args. + (prefix-args): Remove. + + Simplify cstart_of_data, start_of_code and related code. + * mem-limits.h: Remove !emacs and _LIBC conditional code. + (start_of_data): Merge into start_of_data function. + * sysdep.c (start_of_text): Remove. Move simplified versions of + it in the only users: unexaix.c and unexec.c. + (read_input_waiting): Remove local declaration of quit_char. + (start, etext): Remove declarations. + (start_of_data): Merge with the version in mem-limits.h and move + to vm-limits.c. + * vm-limit.c (start_of_data): Merged and simplified version of the + code formerly in mem-limits.h and sysdep.c. + * unexec.c (start): New declaration, moved from sysdep.c. + (start_of_text): Simplified version of the code formerly in sysdep.c. + * unexaix.c (start_of_text): Simplified version of the code + formerly in sysdep.c. + * m/alpha.h (HAVE_TEXT_START): Remove. + (TEXT_START): Move ... + * unexalpha.c (TEXT_START): ... here. + * s/hpux10-20.h (TEXT_START): Remove. + * s/darwin.h (TEXT_START): + * m/mips.h (TEXT_START): + * m/macppc.h (HAVE_TEXT_START): + * m/m68k.h (TEXT_START): + * m/iris4d.h (TEXT_START): + * m/intel386.h (TEXT_START): + * m/ibmrs6000.h (TEXT_START): + * m/ia64.h (HAVE_TEXT_START): + * s/msdos.h (TEXT_START): Likewise. + +2010-07-07 Andreas Schwab <schwab@linux-m68k.org> + + * alloc.c (overrun_check_malloc, overrun_check_realloc) + (overrun_check_free, xstrdup, allocate_string) + (allocate_string_data, compact_small_strings, Fmake_string) + (make_unibyte_string, make_multibyte_string) + (make_string_from_bytes, make_specified_string, make_float) + (Fcons, allocate_terminal, allocate_frame, make_pure_string) + (Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by + memcpy, memmove, memset, memcmp. + * atimer.c (start_atimer, set_alarm): Likewise. + * buffer.c (clone_per_buffer_values, report_overlay_modification) + (mmap_realloc, init_buffer_once): Likewise. + * callint.c (Fcall_interactively): Likewise. + * callproc.c (Fcall_process, Fcall_process_region, child_setup) + (getenv_internal_1): Likewise. + * casefiddle.c (casify_object): Likewise. + * ccl.c (ccl_driver): Likewise. + * character.c (str_as_multibyte, str_to_multibyte): Likewise. + * charset.c (load_charset_map_from_file) + (load_charset_map_from_file, load_charset_map_from_vector) + (Fdefine_charset_internal): Likewise. + * cm.c (Wcm_clear): Likewise. + * coding.c (decode_eol, decode_coding_object) + (Fset_coding_system_priority, make_subsidiaries): Likewise. + * data.c (Faset): Likewise. + * dired.c (directory_files_internal, file_name_completion_stat): + Likewise. + * dispnew.c (new_glyph_matrix, adjust_glyph_matrix) + (clear_glyph_row, copy_row_except_pointers) + (copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool) + (save_current_matrix, restore_current_matrix) + (build_frame_matrix_from_leaf_window, mirrored_line_dance) + (mirror_line_dance, scrolling_window): Likewise. + * doc.c (Fsnarf_documentation, Fsubstitute_command_keys): + Likewise. + * doprnt.c (doprnt): Likewise. + * editfns.c (Fuser_full_name, make_buffer_string_both) + (Fmessage_box, Fformat, Ftranspose_regions): Likewise. + * emacs.c (sort_args): Likewise. + * eval.c (Fapply, Ffuncall): Likewise. + * fileio.c (Ffile_name_directory, make_temp_name) + (Fexpand_file_name, search_embedded_absfilename) + (Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents) + (auto_save_error): Likewise. + * fns.c (Fstring_equal, Fcopy_sequence, concat) + (string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte) + (internal_equal, Fclear_string, larger_vector, copy_hash_table) + (Fmake_hash_table): Likewise. + * fringe.c (Fdefine_fringe_bitmap): Likewise. + * ftfont.c (ftfont_text_extents): Likewise. + * getloadavg.c (getloadavg): Likewise. + * image.c (define_image_type, make_image, make_image_cache) + (x_create_x_image_and_pixmap, xbm_image_p) + (w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color) + (xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load) + (init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load) + (png_image_p, png_read_from_memory, png_load, jpeg_image_p) + (tiff_image_p, tiff_read_from_memory, gif_image_p) + (gif_read_from_memory, gif_load, svg_image_p, gs_image_p): + Likewise. + * indent.c (scan_for_column, compute_motion): Likewise. + * insdel.c (gap_left, gap_right, make_gap_smaller, copy_text) + (insert_1_both, insert_from_gap, replace_range_2): Likewise. + * intervals.c (reproduce_tree, reproduce_tree_obj): Likewise. + * keyboard.c (echo_char, save_getcjmp, restore_getcjmp) + (kbd_buffer_store_event_hold, apply_modifiers_uncached) + (store_user_signal_events, menu_bar_items, tool_bar_items) + (process_tool_bar_item, append_tool_bar_item) + (read_char_minibuf_menu_prompt, read_key_sequence) + (Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys): + Likewise. + * keymap.c (current_minor_maps, Fdescribe_buffer_bindings): + Likewise. + * lisp.h (STRING_COPYIN): Likewise. + * lread.c (Fload, read1, oblookup): Likewise. + * msdos.c (Frecent_doskeys): Likewise. + * nsfns.m (Fx_create_frame): Likewise. + * nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics): + Likewise. + * nsimage.m (EmacsImage-initFromSkipXBM:width:height:) + (EmacsImage-initForXPMWithDepth:width:height:flip:length:): + Likewise. + * nsmenu.m (ns_update_menubar): Likewise. + * nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise. + * print.c (print_unwind, printchar, strout, print_string) + (print_error_message): Likewise. + * process.c (conv_lisp_to_sockaddr, set_socket_option) + (Fmake_network_process, Fnetwork_interface_list) + (Fnetwork_interface_info, read_process_output, Fprocess_send_eof) + (init_process): Likewise. + * ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise. + * regex.c (init_syntax_once, regex_compile, re_compile_fastmap): + Likewise. + * scroll.c (do_scrolling, do_direct_scrolling) + (scrolling_max_lines_saved): Likewise. + * search.c (search_buffer, wordify, Freplace_match): Likewise. + * sound.c (wav_init, au_init, Fplay_sound_internal): Likewise. + * syntax.c (skip_chars, skip_syntaxes): Likewise. + * sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty) + (emacs_set_tty): Likewise. + * term.c (encode_terminal_code, calculate_costs) + (produce_special_glyphs, create_tty_output, init_tty, delete_tty): + Likewise. + * termcap.c (tgetst1, gobble_line): Likewise. + * termhooks.h (EVENT_INIT): Likewise. + * tparam.c (tparam1): Likewise. + * unexalpha.c (unexec): Likewise. + * unexec.c (write_segment): Likewise. + * unexmacosx.c (unexec_write_zero): Likewise. + * w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame) + (Fx_file_dialog, Fsystem_move_file_to_trash): Likewise. + * w32font.c (w32font_list_family, w32font_text_extents) + (w32font_list_internal, w32font_match_internal) + (w32font_open_internal, compute_metrics, Fx_select_font): + Likewise. + * w32menu.c (set_frame_menubar, add_menu_item) + (w32_menu_display_help, w32_free_submenu_strings): Likewise. + * w32term.c (XCreateGC, w32_initialize_display_info): Likewise. + * w32uniscribe.c (uniscribe_list_family): Likewise. + * w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise. + * window.c (make_window, replace_window, set_window_buffer) + (Fsplit_window): Likewise. + * xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string) + (add_to_log, message3, x_consider_frame_title) + (append_space_for_newline, extend_face_to_end_of_line) + (decode_mode_spec_coding, init_glyph_string): Likewise. + * xfaces.c (x_create_gc, get_lface_attributes_no_remap) + (Finternal_copy_lisp_face, Finternal_merge_in_global_face) + (face_attr_equal_p, make_realized_face, make_face_cache) + (free_realized_faces, lookup_named_face, smaller_face) + (face_with_height, lookup_derived_face) + (x_supports_face_attributes_p, Finternal_set_font_selection_order) + (Finternal_set_font_selection_order, realize_default_face) + (compute_char_face, face_at_buffer_position) + (face_for_overlay_string, face_at_string_position, merge_faces): + Likewise. + * xfns.c (xic_create_fontsetname, Fx_create_frame) + (Fx_window_property, x_create_tip_frame) + (Fx_backspace_delete_keys_p): Likewise. + * xfont.c (xfont_list, xfont_match, xfont_list_family) + (xfont_text_extents): Likewise. + * xmenu.c (set_frame_menubar, xmenu_show): Likewise. + * xrdb.c (magic_file_p, x_get_resource): Likewise. + * xselect.c (x_queue_event, x_get_window_property) + (receive_incremental_selection): Likewise. + * xsmfns.c (x_session_check_input): Likewise. + * xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT) + (handle_one_xevent, x_check_errors, xim_initialize, x_term_init): + Likewise. + * character.h (BCOPY_SHORT): Removed. + * config.in: Regenerate. + * dispnew.c (safe_bcopy): Only define as dummy if PROFILING. + * emacs.c (main) [PROFILING]: Don't declare + dump_opcode_frequencies. + * lisp.h (safe_bcopy): Remove declaration. + (memset) [!HAVE_MEMSET]: Declare. + (memcpy) [!HAVE_MEMCPY]: Likewise. + (memmove) [!HAVE_MEMMOVE]: Likewise. + (memcmp) [!HAVE_MEMCMP]: Likewise. + * s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY) + (BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP): + Don't define. + (HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define. + * s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE) + (BCOPY_DOWNWARD_SAFE): Don't define. + * sysdep.c (memset) [!HAVE_MEMSET]: Define. + (memcpy) [!HAVE_MEMCPY]: Define. + (memmove) [!HAVE_MEMMOVE]: Define. + (memcmp) [!HAVE_MEMCMP]: Define. + +2010-07-07 Jan Djärv <jan.h.d@swipnet.se> + + * process.c (kbd_is_on_hold): New variable. + (hold_keyboard_input, unhold_keyboard_input, kbd_on_hold_p): + New functions. + (wait_reading_process_output): If kbd_on_hold_p returns non-zero, + select on empty input mask. + (init_process): Initialize kbd_is_on_hold to 0. + + * process.h (hold_keyboard_input, unhold_keyboard_input) + (kbd_on_hold_p): Declare. + + * keyboard.c (input_available_signal): Declare. + (kbd_buffer_nr_stored): New function. + (kbd_buffer_store_event_hold): If kbd_buffer_nr_stored returns + more than KBD_BUFFER_SIZE/2, stop reding input (Bug#6571). + (kbd_buffer_get_event): If input is suspended and kbd_buffer_nr_stored + returns less than KBD_BUFFER_SIZE/4, resume reding input (Bug#6571). + (tty_read_avail_input): If input is on hold, return. + Don't read more that free slots in kbd_buffer (Bug#6571). + +2010-07-07 Eli Zaretskii <eliz@gnu.org> + + * msdos.h: + * msdos.c: + * dosfns.c: + * w16select.c: Convert function definitions to ANSI C. + + * msdos.h (ctrl_break_func, install_ctrl_break_check): + Remove unused prototypes. + +2010-07-07 Juanma Barranquero <lekktu@gmail.com> + + * coding.c, sysdep.c: Convert some more functions to standard C. + +2010-07-07 Juanma Barranquero <lekktu@gmail.com> + + * coding.c (decode_coding_gap, encode_coding_gap, decode_coding_object) + (encode_coding_object): Use SPECPDL_INDEX. + (syms_of_coding): Use DOS_NT. + +2010-07-07 Dan Nicolaescu <dann@ics.uci.edu> + + * intervals.h (interval): Use EMACS_UINT instead of unsigned EMACS_INT. + + Make the function member of Lisp_Subr use standard C prototypes. + * lisp.h (struct Lisp_Subr): Use a union for the function member. + (DECL_ALIGN): Add a cast for the function. + * eval.c (Feval, Ffuncall): Use the proper type for each type + function call. + +2010-07-06 Chong Yidong <cyd@stupidchicken.com> + + * fringe.c (draw_fringe_bitmap_1): Use lookup_named_face to get + fringe face id, so face-remapping-alist works (Bug#6091). + +2010-07-06 Juanma Barranquero <lekktu@gmail.com> + + * w32.c, w32console.c, w32fns.c, w32font.c, w32heap.c, w32inevt.c + * w32menu.c, w32proc.c, w32reg.c, w32select.c, w32term.c + * w32uniscribe.c, w32xfns.c: Convert function definitions to standard C. + +2010-07-06 Andreas Schwab <schwab@linux-m68k.org> + + * xterm.c (x_get_keysym_name): Change type of parameter to int. + * lisp.h: Declare x_get_keysym_name. + * keyboard.c (modify_event_symbol): Don't declare + x_get_keysym_name here. + +2010-07-06 Dan Nicolaescu <dann@ics.uci.edu> + + * ecrt0.c: Revert conversion to standard C. + +2010-07-05 Dan Nicolaescu <dann@ics.uci.edu> + + * vm-limit.c (memory_warnings): + * keyboard.c (modify_event_symbol): + * floatfns.c (rounding_driver, ceiling2, floor2, truncate2) + (round2, emacs_rint): + * process.c (send_process, old_sigpipe): Convert function + definitions and declarations to standard C. + +2010-07-05 Juanma Barranquero <lekktu@gmail.com> + + * buffer.c, cm.c, eval.c, keyboard.c, process.c, term.c, vm-limit.c, + * xdisp.c: Convert function definitions to standard C. + + * cm.c (cmputc): Arg C is now int, not char. + * process.c (Fmake_network_process): Cast sockaddr_in* to sockaddr*. + +2010-07-05 James Cloos <cloos@jhcloos.com> + + * xterm.h (Xatom_net_wm_name, Xatom_net_wm_icon_name): New. + + * xterm.c (x_term_init): Intern the _NET_WM_NAME and + _NET_WM_ICON_NAME atoms. + + * xfns.c (x_set_name_internal): Set the EWMH _NET_WM_NAME + and _NET_WM_ICON_NAME properties, too, matching what is + done in the Gtk+ case. + +2010-07-05 Jan Djärv <jan.h.d@swipnet.se> + + * xterm.c (XTring_bell, XTset_terminal_window): Fix wrong prototype. + + * xsmfns.c (SSDATA): New macro. + (smc_save_yourself_CB, x_session_initialize): Use SSDATA for strings + passed to strlen/strcpy/strcat. + (create_client_leader_window): Surround with #ifndef USE_GTK. Cast + 7:th arg to XChangeProperty to (unsigned char *) + + * xsettings.c (something_changedCB, parse_settings) + (apply_xft_settings): Reformat prototype. + (something_changedCB, init_gconf): Remove unused variable i. + (read_settings): Remove unused variable long_len. + + * gtkutil.c (xg_get_pixbuf_from_pix_and_mask) + (xg_get_image_for_pixmap, create_dialog) + (xg_get_file_with_selection, xg_get_file_name, update_cl_data) + (menuitem_highlight_callback, make_menu_item) + (xg_create_one_menuitem, create_menus, xg_update_menu_item) + (xg_create_scroll_bar, xg_update_scrollbar_pos) + (xg_set_toolkit_scroll_bar_thumb, xg_tool_bar_button_cb) + (xg_tool_bar_proxy_help_callback, xg_tool_bar_detach_callback) + (xg_tool_bar_attach_callback, xg_tool_bar_help_callback) + (xg_tool_bar_item_expose_callback): Reformat prototype. + (xg_update_menubar): GList *group => GSList *group. + (xg_modify_menubar_widgets): Initialize witem to 0, check witem != 0 + before use. + (update_frame_tool_bar): 4:th param to xg_get_image_for_pixmap changed + to GTK_IMAGE (wimage). + +2010-07-05 Dan Nicolaescu <dann@ics.uci.edu> + + * atimer.c: Use "" instead of <> for local includes for + consistency with the rest of the code. + + * xsmfns.c (smc_save_yourself_CB, smc_error_handler): + * xrdb.c (get_system_name): + * window.c (shrink_windows): + * syntax.c (forw_comment): + * scroll.c (calculate_scrolling, calculate_direct_scrolling) + (ins_del_costs): + * mem-limits.h (start_of_data): + * lread.c (readevalloop): + * gtkutil.c (xg_dialog_response_cb, xg_get_file_with_chooser) + (xg_get_file_with_selection, xg_update_menubar, xg_update_submenu): + * frame.c (x_get_focus_frame): + * floatfns.c (fmod_float): + * fileio.c (choose_write_coding_system): + * emacs.c (fatal_error_signal, init_cmdargs, argmatch) + (malloc_initialize_hook, sort_args, synchronize_locale): + * doprnt.c (doprnt): + * dired.c (compile_pattern): + * data.c (fmod_float): + * chartab.c (map_sub_char_table, map_sub_char_table_for_charset) + (map_char_table_for_charset): + * charset.c (define_charset_internal): + * alloc.c (Fgarbage_collect): Convert declarations or definitions + to standard C. + +2010-07-04 Tetsurou Okazaki <okazaki@be.to> (tiny change) + Stefan Monnier <monnier@iro.umontreal.ca> + + * lread.c (read1): Fix up last change to not mess up `c'. + +2010-07-04 Juanma Barranquero <lekktu@gmail.com> + + * strftime.c: Revert conversion to standard C (2010-07-04T07:50:25Z!dann@ics.uci.edu). + +2010-07-04 Juanma Barranquero <lekktu@gmail.com> + + Fix prototypes. + + * atimer.c (start_atimer): Use EMACS_TIME, not struct timeval. + * dired.c (file_name_completion_stat): Use DIRENTRY, not struct dirent. + * fileio.c (read_non_regular, read_non_regular_quit): Add Lisp_Object + arg, as required by internal_condition_case_1. + * print.c (strout): Use const char* for arg PTR. + * regex.c (bcmp_translate): Use RE_TRANSLATE_TYPE, not Lisp_Object. + (analyse_first): Fix "const const". + * sysdep.c (set_file_times): Use EMACS_TIME, not struct timeval. + * unexelf.c (round_up, find_section): Use ElfW macro for arguments. + * xgselect.c (xg_select): Use SELECT_TYPE, EMACS_TIME. + +2010-07-04 Dan Nicolaescu <dann@ics.uci.edu> + + * alloc.c: Convert function definitions to standard C. + * atimer.c: + * bidi.c: + * bytecode.c: + * callint.c: + * callproc.c: + * casefiddle.c: + * casetab.c: + * category.c: + * ccl.c: + * character.c: + * charset.c: + * chartab.c: + * cmds.c: + * coding.c: + * composite.c: + * data.c: + * dbusbind.c: + * dired.c: + * dispnew.c: + * doc.c: + * doprnt.c: + * ecrt0.c: + * editfns.c: + * fileio.c: + * filelock.c: + * filemode.c: + * fns.c: + * font.c: + * fontset.c: + * frame.c: + * fringe.c: + * ftfont.c: + * ftxfont.c: + * gtkutil.c: + * indent.c: + * insdel.c: + * intervals.c: + * keymap.c: + * lread.c: + * macros.c: + * marker.c: + * md5.c: + * menu.c: + * minibuf.c: + * prefix-args.c: + * print.c: + * ralloc.c: + * regex.c: + * region-cache.c: + * scroll.c: + * search.c: + * sound.c: + * strftime.c: + * syntax.c: + * sysdep.c: + * termcap.c: + * terminal.c: + * terminfo.c: + * textprop.c: + * tparam.c: + * undo.c: + * unexelf.c: + * window.c: + * xfaces.c: + * xfns.c: + * xfont.c: + * xftfont.c: + * xgselect.c: + * xmenu.c: + * xrdb.c: + * xselect.c: + * xsettings.c: + * xsmfns.c: + * xterm.c: Likewise. + +2010-07-03 Eli Zaretskii <eliz@gnu.org> + + * msdos.c (IT_set_frame_parameters): Fix setting of colors in + frames other than the initial one. Fix reversal of colors when + `reverse' is specified in the frame parameters. Call + update_face_from_frame_parameter instead of + internal-set-lisp-face-attribute. Initialize screen colors from + initial_screen_colors[] when f->default_face_done_p is zero, + instead of depending on being called with default-frame-alist as + the alist argument. + + * xfaces.c (update_face_from_frame_parameter): Move out of + HAVE_WINDOW_SYSTEM portion. Condition window-system only parts + with HAVE_WINDOW_SYSTEM. + + * msdos.c (IT_set_frame_parameters): Set menu-bar-lines according + to menu-bar-mode, if not set in the frame parameters or in + default-frame-alist. + + * w32console.c (sys_tputs): Adjust argument list to prototype in + term.c. + +2010-07-03 Juanma Barranquero <lekktu@gmail.com> + + * lisp.h (memory_warnings): Fix prototype. + + * cm.h (evalcost): Fix prototype. + + * cm.c (evalcost): Fix arg type. + +2010-07-02 Dan Nicolaescu <dann@ics.uci.edu> + + * term.c (term_clear_mouse_face, Fidentity): + * syssignal.h (signal_handler_t): + * lisp.h (memory_warnings): + * coding.h (preferred_coding_system): + * cm.h (evalcost): + * blockinput.h (reinvoke_input_signal): Convert to standard C prototypes. + +2010-07-02 Eli Zaretskii <eliz@gnu.org> + + * dosfns.h (msdos_stdcolor_idx, msdos_stdcolor_name): Remove P_ + from prototypes. + + * msdos.h (load_pixmap): Don't define away. + +2010-07-02 Jan Djärv <jan.h.d@swipnet.se> + + * lisp.h: + * atimer.h: Remove define for P_. + + * alloc.c: Remove __P and P_ from .c and .m files. + * atimer.c: + * buffer.c: + * callint.c: + * category.c: + * charset.c: + * chartab.c: + * cm.c: + * coding.c: + * composite.c: + * data.c: + * dired.c: + * dispnew.c: + * doc.c: + * editfns.c: + * emacs.c: + * eval.c: + * fileio.c: + * filelock.c: + * fns.c: + * font.c: + * fontset.c: + * frame.c: + * ftfont.c: + * ftxfont.c: + * gmalloc.c: + * gtkutil.c: + * image.c: + * indent.c: + * intervals.c: + * keyboard.c: + * keymap.c: + * lread.c: + * marker.c: + * menu.c: + * minibuf.c: + * print.c: + * process.c: + * scroll.c: + * search.c: + * sound.c: + * strftime.c: + * syntax.c: + * sysdep.c: + * term.c: + * terminal.c: + * textprop.c: + * unexalpha.c: + * w32console.c: + * w32fns.c: + * w32font.c: + * w32menu.c: + * w32term.c: + * w32uniscribe.c: + * window.c: + * xdisp.c: + * xfaces.c: + * xfns.c: + * xfont.c: + * xftfont.c: + * xmenu.c: + * xselect.c: + * xterm.c: Likewise. + + Remove P_ and __P macros. + * atimer.h: Remove P_ and __P macros. + * buffer.h: + * category.h: + * ccl.h: + * character.h: + * charset.h: + * cm.h: + * coding.h: + * composite.h: + * dispextern.h: + * disptab.h: + * dosfns.h: + * font.h: + * fontset.h: + * frame.h: + * gtkutil.h: + * indent.h: + * intervals.h: + * keyboard.h: + * keymap.h: + * lisp.h: + * macros.h: + * md5.h: + * menu.h: + * msdos.h: + * nsterm.h: + * puresize.h: + * region-cache.h: + * syntax.h: + * syssignal.h: + * systime.h: + * termhooks.h: + * w32font.h: + * w32term.h: + * widget.h: + * window.h: + * xgselect.h: + * xsettings.h: + * xterm.h: Likewise. + +2010-07-02 Dan Nicolaescu <dann@ics.uci.edu> + + * lisp.h: Document that USE_LISP_UNION_TYPE is now enabled using autoconf. + + Cleanup old code. + * dired.c (BSD4_3): Remove all uses, redundant with BSD4_2. + * syssignal.h: Remove code for Lynx, not supported anymore. + * vm-limit.c: Remove unused code the depends on emacs not being + defined and NO_LIM_DATA being defined. + * mem-limits.h: Remove dead code. + +2010-07-01 Jan Djärv <jan.h.d@swipnet.se> + + * window.c (Fwindow_absolute_pixel_edges): Doc fix. + + * window.c (calc_absolute_offset, Fwindow_absolute_pixel_edges) + (Fwindow_inside_absolute_pixel_edges): New functions (bug#5721). + + * nsfns.m (compute_tip_xy): Do not convert coordinates from frame + parameters, they are already absolute. + + * nsterm.m (x_set_window_size, initFrameFromEmacs): + Rename FRAME_NS_TOOLBAR_HEIGHT to FRAME_TOOLBAR_HEIGHT. + + * nsterm.h (FRAME_NS_TOOLBAR_HEIGHT): Rename to FRAME_TOOLBAR_HEIGHT. + + * nsmenu.m (update_frame_tool_bar, free_frame_tool_bar): + Update FRAME_TOOLBAR_HEIGHT. + + * nsmenu.m (free_frame_tool_bar, update_frame_tool_bar): + Add BLOCK/UNBLOCK_INPUT so asserts don't trigger. + +2010-06-30 Chong Yidong <cyd@stupidchicken.com> + + * frame.c (get_future_frame_param, Fmake_terminal_frame): Don't + check default-frame-alist. + +2010-06-30 Andreas Schwab <schwab@linux-m68k.org> + + * process.c (create_process): Avoid using invalid file descriptors. + + * callproc.c (child_setup): Avoid closing a file descriptor twice. + +2010-06-30 Jan Djärv <jan.h.d@swipnet.se> + + * xsettings.c (Ffont_get_system_normal_font, Ffont_get_system_font): + Improve documentation. Return font regardless of use_system_font. + (syms_of_xsettings): Improve documentation for font-use-system-font. + +2010-07-10 Chong Yidong <cyd@stupidchicken.com> + + * xfaces.c (realize_face): Garbage the frame if a face is removed + (Bug#6593). + +2010-07-05 Andreas Schwab <schwab@linux-m68k.org> + + * keyboard.c: Remove duplicate <setjmp.h>. + (read_key_sequence): Remove volatile qualifiers. + +2010-07-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * dispextern.h (FRINGE_HEIGHT_BITS): New define. + (struct glyph_row): New members left_fringe_offset and + right_fringe_offset. + + * xterm.c (x_draw_fringe_bitmap): Don't clip bottom aligned bitmap + specially. + * w32term.c (w32_draw_fringe_bitmap): Likewise. + * nsterm.m (ns_draw_fringe_bitmap): Likewise. + + * fringe.c (draw_fringe_bitmap_1): Don't clip bitmap here. + Take account of bitmap offset. + (draw_window_fringes): Take account of window vscroll. + (update_window_fringes): Likewise. Extend top-aligned top indicator + or bottom-aligned bottom indicator to adjacent rows if it doesn't fit + in one row. Don't set redraw_fringe_bitmaps_p outside row comparison. + Set left_fringe_offset and right_fringe_offset (Bug#5634, Bug#6325). + +2010-07-04 Juanma Barranquero <lekktu@gmail.com> + + * w32fns.c (Qtooltip): Declare. + Suggested by Andy Moreton <andrewjmoreton@gmail.com>. + +2010-07-03 Jan Djärv <jan.h.d@swipnet.se> + + * xmenu.c (x_activate_menubar): Send Press/Release for Gtk+ to avoid + grab on just Press (Bug#6499). + +2010-07-02 Chong Yidong <cyd@stupidchicken.com> + + * frame.c (Qtooltip): New var. + (delete_frame): Use it. Fix faulty if statement. Don't update + mode line for tooltip frames. Suggested by Martin Rudalics. + + * xfns.c (x_create_tip_frame): + * w32fns.c (x_create_tip_frame): Use it. + +2010-06-17 Naohiro Aota <naota@elisp.net> (tiny change) + + * xftfont.c (xftfont_open): Check font width one by one also when + spacing is dual. + + * ftfont.c (ftfont_open): Ditto. + +2010-06-30 Glenn Morris <rgm@gnu.org> + + * s/sol2-6.h (INHIBIT_X11R6_XIM): Remove, handled by configure now. + + * Makefile.in (CANNOT_DUMP): Update for configure name change. + + * s/freebsd.h (USE_MMAP_FOR_BUFFERS): + * s/irix6-5.h (USE_MMAP_FOR_BUFFERS): + * s/darwin.h (SYSTEM_MALLOC): + * s/sol2-10.h (SYSTEM_MALLOC): Move to configure. + +2010-06-29 Jan Djärv <jan.h.d@swipnet.se> + + * nsfns.m: extern declare Vmenu_bar_mode, Vtool_bar_mode. + (ns_get_screen): Don't assign integer to f. + (Fx_display_color_cells): Declarations before statements. + +2010-06-28 Jan Djärv <jan.h.d@swipnet.se> + + * xfns.c (x_default_font_parameter): Remove got_from_system + (Bug#6526). + + * xterm.h (gtk_widget_get_window, gtk_widget_get_mapped) + (gtk_adjustment_get_page_size, gtk_adjustment_get_upper): New + defines based on what configure finds. + + * xterm.c (XTflash): Use gtk_widget_get_window. + (xg_scroll_callback): Use gtk_adjustment_get_upper and + gtk_adjustment_get_page_size. + (handle_one_xevent): Use gtk_widget_get_mapped. + (x_term_init): Remove HAVE_GTK_MULTIDISPLAY and associated error + messages. + + * xmenu.c (create_and_show_popup_menu): Call gtk_widget_get_mapped. + + * gtkutil.h: Replace HAVE_GTK_FILE_BOTH with + HAVE_GTK_FILE_SELECTION_NEW. + + * gtkutil.c (xg_display_open, xg_display_close): Remove + HAVE_GTK_MULTIDISPLAY, it is always defined. + (xg_display_open): Return type is void. + (gtk_widget_set_has_window) + (gtk_dialog_get_action_area, gtk_dialog_get_content_area) + (gtk_widget_get_sensitive, gtk_adjustment_set_page_size) + (gtk_adjustment_set_page_increment) + (gtk_adjustment_get_step_increment): #define these if not found + by configure. + (remove_submenu): New define based on Gtk+ version. + (xg_set_cursor, xg_frame_resized, xg_event_is_for_scrollbar): Use + gtk_widget_get_window. + (xg_frame_resized, xg_update_frame_menubar): Use gtk_widget_get_mapped. + (xg_create_frame_widgets): Use gtk_widget_set_has_window. + (create_dialog): Use gtk_dialog_get_action_area and + gtk_dialog_get_content_area. + (xg_uses_old_file_dialog, xg_get_file_name): Remove HAVE_GTK_FILE_BOTH + and HAVE_GTK_FILE_CHOOSER_DIALOG_NEW. File chooser is always + available, so checking for HAVE_GTK_FILE_SELECTION_NEW is enough. + (xg_update_menubar, xg_update_submenu, xg_show_toolbar_item): Use + g_object_ref and g_object_unref. + (xg_update_menu_item, xg_tool_bar_menu_proxy): Use + gtk_widget_get_sensitive. + (xg_update_submenu): Use remove_submenu. + (xg_update_scrollbar_pos): Don't use GtkFixedChild, use child + properties instead to get old x and y position. + (xg_set_toolkit_scroll_bar_thumb): Use gtk_adjustment_get_page_size, + gtk_adjustment_get_step_increment, gtk_adjustment_set_page_size, + gtk_adjustment_set_step_increment and gtk_adjustment_set_page_increment. + (xg_get_tool_bar_widgets): New function. + (xg_tool_bar_menu_proxy, xg_show_toolbar_item) + (update_frame_tool_bar): Call xg_get_tool_bar_widgets. + (toolbar_set_orientation): New #define based on if configure + finds gtk_orientable_set_orientation. + (xg_create_tool_bar): Call toolbar_set_orientation. + (xg_make_tool_item, xg_show_toolbar_item): Call gtk_box_pack_start + instead of gtk_box_pack_start_defaults. + +2010-06-28 Chong Yidong <cyd@stupidchicken.com> + + * cmds.c (Fdelete_backward_char): Move into Lisp. + +2010-06-27 Dan Nicolaescu <dann@ics.uci.edu> + + * s/freebsd.h (BSD4_2): Remove redundant definition. + bsd-common.h defines it already. + +2010-06-27 Chong Yidong <cyd@stupidchicken.com> + + * xfns.c (Fx_create_frame): Don't consult X resouces when setting + menu-bar-lines and tool-bar-lines. Use menu-bar-mode and + tool-bar-mode, which are now set using these X resources at + startup, to determine the defaults (Bug#2249). + + * w32fns.c (Fx_create_frame): + * nsfns.m (Fx_create_frame): Likewise. + + * frame.c (Vmenu_bar_mode, Vtool_bar_mode): New vars. + +2010-06-24 Juanma Barranquero <lekktu@gmail.com> + + * gtkutil.c (xg_update_scrollbar_pos): + Avoid C99 mid-block variable declaration. + +2010-06-22 Jan Djärv <jan.h.d@swipnet.se> + + * xterm.c (x_scroll_bar_create): Remove call to xg_show_scroll_bar. + + * gtkutil.h (xg_show_scroll_bar): Remove. + + * gtkutil.c (xg_update_scrollbar_pos): Show/hide scroll bar as needed + if height is less than scroll bar min size. + (xg_show_scroll_bar): Remove, show moved to xg_update_scrollbar_pos. + + * xfns.c (x_default_font_parameter): Try to open font from system + before using it (bug#6478). Rename got_from_gconf to got_from_system. + +2010-06-22 Keith Packard <keithp@keithp.com> (tiny change) + + * font.c (font_parse_fcname): Allow . for sizes like 7.5 (bug#6437). + +2010-06-20 Eli Zaretskii <eliz@gnu.org> + + * xdisp.c (try_scrolling): When scroll-conservatively is set to + most-positive-fixnum, be extra accurate when scrolling window + start, to avoid missing the cursor line. + +2010-06-19 Eli Zaretskii <eliz@gnu.org> + + * xdisp.c (try_scrolling): Compute the limit for searching point + in forward scroll from scroll_max, instead of an arbitrary limit + of 10 screen lines. See + http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00766.html + and + http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00773.html + for details. + 2010-06-16 Glenn Morris <rgm@gnu.org> * editfns.c (Fbyte_to_string): Pacify compiler. @@ -35,6 +1416,30 @@ * m/ibms390x.h: Rather than duplicating ibms390.h, just include it. +2010-06-26 Andreas Schwab <schwab@linux-m68k.org> + + * alloc.c (Fmake_byte_code): Don't access undefined argument + (Bug#6517). + +2010-06-25 Chong Yidong <cyd@stupidchicken.com> + + * xdisp.c (next_element_from_image): Ensure that after-strings are + read the next time we hit handle_stop (Bug#1336). + +2010-06-23 Andreas Schwab <schwab@linux-m68k.org> + + * lread.c (read1): Signal error if #s is not followed by paren. + +2010-06-19 Chong Yidong <cyd@stupidchicken.com> + + * image.c (free_image): Mark frame as garbaged (Bug#6426). + + * keymap.c (Fdefine_key): Doc fix (Bug#6460). + +2010-06-15 Glenn Morris <rgm@gnu.org> + + * editfns.c (Fbyte_to_string): Pacify compiler. + 2010-06-09 Stefan Monnier <monnier@iro.umontreal.ca> * dbusbind.c (xd_append_arg): Don't "make-unibyte" the string. @@ -126,8 +1531,8 @@ 2010-06-03 Andreas Schwab <schwab@linux-m68k.org> - * process.c (conv_lisp_to_sockaddr): Fix conversion of IPv4 - address. (Bug#6346) + * process.c (conv_lisp_to_sockaddr): Fix conversion of IPv4 address. + (Bug#6346) 2010-06-03 Juanma Barranquero <lekktu@gmail.com> diff --git a/src/Makefile.in b/src/Makefile.in index b2fec7eb085..a8d400c7c39 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -63,6 +63,13 @@ OTHER_FILES = @OTHER_FILES@ CRT_DIR=@CRT_DIR@ +## Flags to pass for profiling builds +PROFILING_CFLAGS = @PROFILING_CFLAGS@ +PROFILING_LDFLAGS = @PROFILING_LDFLAGS@ + +## Flags to pass to the compiler to enable build warnings +C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ + ## Machine-specific CFLAGS. C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ ## System-specific CFLAGS. @@ -107,7 +114,7 @@ LD_SWITCH_SYSTEM_TEMACS=@LD_SWITCH_SYSTEM_TEMACS@ ## Flags to pass to ld only for temacs. TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(LD_SWITCH_SYSTEM_TEMACS) -## $LDFLAGS, or empty if NS_IMPL_GNUSTEP (for some reason). +## $LDFLAGS $PROFILING_LDFLAGS, or empty if NS_IMPL_GNUSTEP (for some reason). TEMACS_LDFLAGS2 = @TEMACS_LDFLAGS2@ ## Some systems define this to request special libraries. @@ -283,7 +290,7 @@ START_FILES = @START_FILES@ UNEXEC_OBJ = @UNEXEC_OBJ@ -CANNOT_DUMP=@cannot_dump@ +CANNOT_DUMP=@CANNOT_DUMP@ DEPDIR=deps ## -MMD -MF ${DEPDIR}/$*.d if AUTO_DEPEND; else empty. @@ -309,8 +316,9 @@ MKDEPDIR=@MKDEPDIR@ ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} \ ${C_SWITCH_MACHINE} ${C_SWITCH_SYSTEM} ${C_SWITCH_X_SITE} \ ${C_SWITCH_X_SYSTEM} ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${DBUS_CFLAGS} \ - ${GCONF_CFLAGS} ${CFLAGS} ${FREETYPE_CFLAGS} ${FONTCONFIG_CFLAGS} \ - ${LIBOTF_CFLAGS} ${M17N_FLT_CFLAGS} ${DEPFLAGS} + ${GCONF_CFLAGS} ${FREETYPE_CFLAGS} ${FONTCONFIG_CFLAGS} \ + ${LIBOTF_CFLAGS} ${M17N_FLT_CFLAGS} ${DEPFLAGS} ${PROFILING_CFLAGS} \ + ${C_WARNINGS_SWITCH} ${CFLAGS} ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) .SUFFIXES: .m @@ -426,7 +434,7 @@ lisp= \ ${lispsource}language/slovak.el \ ${lispsource}language/romanian.el \ ${lispsource}language/greek.el \ - ${lispsource}language/hebrew.el \ + ${lispsource}language/hebrew.elc \ ${lispsource}language/japanese.el \ ${lispsource}language/korean.el \ ${lispsource}language/lao.el \ @@ -517,7 +525,7 @@ shortlisp= \ ../lisp/language/slovak.el \ ../lisp/language/romanian.el \ ../lisp/language/greek.el \ - ../lisp/language/hebrew.el \ + ../lisp/language/hebrew.elc \ ../lisp/language/japanese.el \ ../lisp/language/korean.el \ ../lisp/language/lao.el \ @@ -628,20 +636,10 @@ buildobj.h: Makefile echo "#define BUILDOBJ \"${obj} ${otherobj} " "\"" > buildobj.h -## We cannot define variables for PRE_EDIT and POST_EDIT. -## If !ORDINARY_LINK && !LINKER && GCC, they add a -## `./prefix-args -Xlinker ... ` wrapper, otherwise they are empty. -## One alternative to this approach would be to always call prefix-args, -## and have it DTRT in all cases, by testing the above defines. -temacs${EXEEXT}: $(START_FILES) stamp-oldxmenu ${obj} ${otherobj} prefix-args${EXEEXT} - $(LD) @PRE_EDIT_LDFLAGS@ ${TEMACS_LDFLAGS} @POST_EDIT_LDFLAGS@ \ - ${TEMACS_LDFLAGS2} \ +temacs${EXEEXT}: $(START_FILES) stamp-oldxmenu ${obj} ${otherobj} + $(LD) ${TEMACS_LDFLAGS} ${TEMACS_LDFLAGS2} \ -o temacs ${START_FILES} ${obj} ${otherobj} ${LIBES} -prefix-args${EXEEXT}: prefix-args.o $(config_h) - $(CC) $(LDFLAGS) prefix-args.o -o prefix-args - - ## The following oldxmenu-related rules are only (possibly) used if ## HAVE_X11 && !USE_GTK, but there is no harm in always defining them ## (provided we take a little care that OLDXMENU is never empty). @@ -688,7 +686,7 @@ doc.o: buildobj.h mostlyclean: - rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a + rm -f temacs${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a rm -f ../etc/DOC rm -f bootstrap-emacs${EXEEXT} emacs-${version}${EXEEXT} rm -f buildobj.h diff --git a/src/alloc.c b/src/alloc.c index a23c688043c..7c8081f03df 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -23,10 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <limits.h> /* For CHAR_BIT. */ #include <setjmp.h> -#ifdef STDC_HEADERS -#include <stddef.h> /* For offsetof, used by PSEUDOVECSIZE. */ -#endif - #ifdef ALLOC_DEBUG #undef INLINE #endif @@ -298,7 +294,7 @@ static EMACS_INT pure_bytes_used_non_lisp; /* If nonzero, this is a warning delivered by malloc and not yet displayed. */ -char *pending_malloc_warning; +const char *pending_malloc_warning; /* Pre-computed signal argument for use when memory is exhausted. */ @@ -329,23 +325,23 @@ Lisp_Object Vpost_gc_hook, Qpost_gc_hook; Lisp_Object Vgc_elapsed; /* accumulated elapsed time in GC */ EMACS_INT gcs_done; /* accumulated GCs */ -static void mark_buffer P_ ((Lisp_Object)); -static void mark_terminals P_ ((void)); -extern void mark_kboards P_ ((void)); -extern void mark_ttys P_ ((void)); -extern void mark_backtrace P_ ((void)); -static void gc_sweep P_ ((void)); -static void mark_glyph_matrix P_ ((struct glyph_matrix *)); -static void mark_face_cache P_ ((struct face_cache *)); +static void mark_buffer (Lisp_Object); +static void mark_terminals (void); +extern void mark_kboards (void); +extern void mark_ttys (void); +extern void mark_backtrace (void); +static void gc_sweep (void); +static void mark_glyph_matrix (struct glyph_matrix *); +static void mark_face_cache (struct face_cache *); #ifdef HAVE_WINDOW_SYSTEM -extern void mark_fringe_data P_ ((void)); +extern void mark_fringe_data (void); #endif /* HAVE_WINDOW_SYSTEM */ -static struct Lisp_String *allocate_string P_ ((void)); -static void compact_small_strings P_ ((void)); -static void free_large_strings P_ ((void)); -static void sweep_strings P_ ((void)); +static struct Lisp_String *allocate_string (void); +static void compact_small_strings (void); +static void free_large_strings (void); +static void sweep_strings (void); extern int message_enable_multibyte; @@ -369,9 +365,9 @@ enum mem_type MEM_TYPE_VECTORLIKE }; -static POINTER_TYPE *lisp_align_malloc P_ ((size_t, enum mem_type)); -static POINTER_TYPE *lisp_malloc P_ ((size_t, enum mem_type)); -void refill_memory_reserve (); +static POINTER_TYPE *lisp_align_malloc (size_t, enum mem_type); +static POINTER_TYPE *lisp_malloc (size_t, enum mem_type); +void refill_memory_reserve (void); #if GC_MARK_STACK || defined GC_MALLOC_CHECK @@ -452,31 +448,31 @@ static void *min_heap_address, *max_heap_address; static struct mem_node mem_z; #define MEM_NIL &mem_z -static POINTER_TYPE *lisp_malloc P_ ((size_t, enum mem_type)); -static struct Lisp_Vector *allocate_vectorlike P_ ((EMACS_INT)); -static void lisp_free P_ ((POINTER_TYPE *)); -static void mark_stack P_ ((void)); -static int live_vector_p P_ ((struct mem_node *, void *)); -static int live_buffer_p P_ ((struct mem_node *, void *)); -static int live_string_p P_ ((struct mem_node *, void *)); -static int live_cons_p P_ ((struct mem_node *, void *)); -static int live_symbol_p P_ ((struct mem_node *, void *)); -static int live_float_p P_ ((struct mem_node *, void *)); -static int live_misc_p P_ ((struct mem_node *, void *)); -static void mark_maybe_object P_ ((Lisp_Object)); -static void mark_memory P_ ((void *, void *, int)); -static void mem_init P_ ((void)); -static struct mem_node *mem_insert P_ ((void *, void *, enum mem_type)); -static void mem_insert_fixup P_ ((struct mem_node *)); -static void mem_rotate_left P_ ((struct mem_node *)); -static void mem_rotate_right P_ ((struct mem_node *)); -static void mem_delete P_ ((struct mem_node *)); -static void mem_delete_fixup P_ ((struct mem_node *)); -static INLINE struct mem_node *mem_find P_ ((void *)); +static POINTER_TYPE *lisp_malloc (size_t, enum mem_type); +static struct Lisp_Vector *allocate_vectorlike (EMACS_INT); +static void lisp_free (POINTER_TYPE *); +static void mark_stack (void); +static int live_vector_p (struct mem_node *, void *); +static int live_buffer_p (struct mem_node *, void *); +static int live_string_p (struct mem_node *, void *); +static int live_cons_p (struct mem_node *, void *); +static int live_symbol_p (struct mem_node *, void *); +static int live_float_p (struct mem_node *, void *); +static int live_misc_p (struct mem_node *, void *); +static void mark_maybe_object (Lisp_Object); +static void mark_memory (void *, void *, int); +static void mem_init (void); +static struct mem_node *mem_insert (void *, void *, enum mem_type); +static void mem_insert_fixup (struct mem_node *); +static void mem_rotate_left (struct mem_node *); +static void mem_rotate_right (struct mem_node *); +static void mem_delete (struct mem_node *); +static void mem_delete_fixup (struct mem_node *); +static INLINE struct mem_node *mem_find (void *); #if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS -static void check_gcpros P_ ((void)); +static void check_gcpros (void); #endif #endif /* GC_MARK_STACK || GC_MALLOC_CHECK */ @@ -495,7 +491,7 @@ static Lisp_Object *staticvec[NSTATICS] = {&Vpurify_flag}; static int staticidx = 0; -static POINTER_TYPE *pure_alloc P_ ((size_t, int)); +static POINTER_TYPE *pure_alloc (size_t, int); /* Value is SZ rounded up to the next multiple of ALIGNMENT. @@ -514,8 +510,7 @@ static POINTER_TYPE *pure_alloc P_ ((size_t, int)); /* Function malloc calls this if it finds we are near exhausting storage. */ void -malloc_warning (str) - char *str; +malloc_warning (const char *str) { pending_malloc_warning = str; } @@ -524,7 +519,7 @@ malloc_warning (str) /* Display an already-pending malloc warning. */ void -display_malloc_warning () +display_malloc_warning (void) { call3 (intern ("display-warning"), intern ("alloc"), @@ -543,7 +538,7 @@ display_malloc_warning () /* Called if we can't allocate relocatable space for a buffer. */ void -buffer_memory_full () +buffer_memory_full (void) { /* If buffers use the relocating allocator, no need to free spare_memory, because we may have plenty of malloc space left @@ -637,10 +632,12 @@ overrun_check_malloc (size) val = (unsigned char *) malloc (size + overhead); if (val && check_depth == 1) { - bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); + memcpy (val, xmalloc_overrun_check_header, + XMALLOC_OVERRUN_CHECK_SIZE - 4); val += XMALLOC_OVERRUN_CHECK_SIZE; XMALLOC_PUT_SIZE(val, size); - bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); + memcpy (val + size, xmalloc_overrun_check_trailer, + XMALLOC_OVERRUN_CHECK_SIZE); } --check_depth; return (POINTER_TYPE *)val; @@ -660,28 +657,29 @@ overrun_check_realloc (block, size) if (val && check_depth == 1 - && bcmp (xmalloc_overrun_check_header, - val - XMALLOC_OVERRUN_CHECK_SIZE, - XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) + && memcmp (xmalloc_overrun_check_header, + val - XMALLOC_OVERRUN_CHECK_SIZE, + XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) { size_t osize = XMALLOC_GET_SIZE (val); - if (bcmp (xmalloc_overrun_check_trailer, - val + osize, - XMALLOC_OVERRUN_CHECK_SIZE)) + if (memcmp (xmalloc_overrun_check_trailer, val + osize, + XMALLOC_OVERRUN_CHECK_SIZE)) abort (); - bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); + memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE); val -= XMALLOC_OVERRUN_CHECK_SIZE; - bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); + memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE); } val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead); if (val && check_depth == 1) { - bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); + memcpy (val, xmalloc_overrun_check_header, + XMALLOC_OVERRUN_CHECK_SIZE - 4); val += XMALLOC_OVERRUN_CHECK_SIZE; XMALLOC_PUT_SIZE(val, size); - bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); + memcpy (val + size, xmalloc_overrun_check_trailer, + XMALLOC_OVERRUN_CHECK_SIZE); } --check_depth; return (POINTER_TYPE *)val; @@ -698,22 +696,21 @@ overrun_check_free (block) ++check_depth; if (val && check_depth == 1 - && bcmp (xmalloc_overrun_check_header, - val - XMALLOC_OVERRUN_CHECK_SIZE, - XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) + && memcmp (xmalloc_overrun_check_header, + val - XMALLOC_OVERRUN_CHECK_SIZE, + XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) { size_t osize = XMALLOC_GET_SIZE (val); - if (bcmp (xmalloc_overrun_check_trailer, - val + osize, - XMALLOC_OVERRUN_CHECK_SIZE)) + if (memcmp (xmalloc_overrun_check_trailer, val + osize, + XMALLOC_OVERRUN_CHECK_SIZE)) abort (); #ifdef XMALLOC_CLEAR_FREE_MEMORY val -= XMALLOC_OVERRUN_CHECK_SIZE; memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2); #else - bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); + memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE); val -= XMALLOC_OVERRUN_CHECK_SIZE; - bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); + memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE); #endif } @@ -742,8 +739,7 @@ overrun_check_free (block) /* Like malloc but check for no memory and block interrupt input.. */ POINTER_TYPE * -xmalloc (size) - size_t size; +xmalloc (size_t size) { register POINTER_TYPE *val; @@ -760,9 +756,7 @@ xmalloc (size) /* Like realloc but check for no memory and block interrupt input.. */ POINTER_TYPE * -xrealloc (block, size) - POINTER_TYPE *block; - size_t size; +xrealloc (POINTER_TYPE *block, size_t size) { register POINTER_TYPE *val; @@ -783,8 +777,7 @@ xrealloc (block, size) /* Like free but block interrupt input. */ void -xfree (block) - POINTER_TYPE *block; +xfree (POINTER_TYPE *block) { if (!block) return; @@ -800,12 +793,11 @@ xfree (block) /* Like strdup, but uses xmalloc. */ char * -xstrdup (s) - const char *s; +xstrdup (const char *s) { size_t len = strlen (s) + 1; char *p = (char *) xmalloc (len); - bcopy (s, p, len); + memcpy (p, s, len); return p; } @@ -813,8 +805,7 @@ xstrdup (s) /* Unwind for SAFE_ALLOCA */ Lisp_Object -safe_alloca_unwind (arg) - Lisp_Object arg; +safe_alloca_unwind (Lisp_Object arg) { register struct Lisp_Save_Value *p = XSAVE_VALUE (arg); @@ -835,9 +826,7 @@ static void *lisp_malloc_loser; #endif static POINTER_TYPE * -lisp_malloc (nbytes, type) - size_t nbytes; - enum mem_type type; +lisp_malloc (size_t nbytes, enum mem_type type) { register void *val; @@ -881,8 +870,7 @@ lisp_malloc (nbytes, type) call to lisp_malloc. */ static void -lisp_free (block) - POINTER_TYPE *block; +lisp_free (POINTER_TYPE *block) { MALLOC_BLOCK_INPUT; free (block); @@ -981,9 +969,7 @@ static struct ablock *free_ablock; Alignment is on a multiple of BLOCK_ALIGN and `nbytes' has to be smaller or equal to BLOCK_BYTES. */ static POINTER_TYPE * -lisp_align_malloc (nbytes, type) - size_t nbytes; - enum mem_type type; +lisp_align_malloc (size_t nbytes, enum mem_type type) { void *base, *val; struct ablocks *abase; @@ -1090,8 +1076,7 @@ lisp_align_malloc (nbytes, type) } static void -lisp_align_free (block) - POINTER_TYPE *block; +lisp_align_free (POINTER_TYPE *block) { struct ablock *ablock = block; struct ablocks *abase = ABLOCK_ABASE (ablock); @@ -1136,7 +1121,7 @@ lisp_align_free (block) a call to lisp_malloc. */ struct buffer * -allocate_buffer () +allocate_buffer (void) { struct buffer *b = (struct buffer *) lisp_malloc (sizeof (struct buffer), @@ -1164,21 +1149,19 @@ allocate_buffer () there's no need to block input around malloc. */ #ifndef DOUG_LEA_MALLOC -extern void * (*__malloc_hook) P_ ((size_t, const void *)); -extern void * (*__realloc_hook) P_ ((void *, size_t, const void *)); -extern void (*__free_hook) P_ ((void *, const void *)); +extern void * (*__malloc_hook) (size_t, const void *); +extern void * (*__realloc_hook) (void *, size_t, const void *); +extern void (*__free_hook) (void *, const void *); /* Else declared in malloc.h, perhaps with an extra arg. */ #endif /* DOUG_LEA_MALLOC */ -static void * (*old_malloc_hook) P_ ((size_t, const void *)); -static void * (*old_realloc_hook) P_ ((void *, size_t, const void*)); -static void (*old_free_hook) P_ ((void*, const void*)); +static void * (*old_malloc_hook) (size_t, const void *); +static void * (*old_realloc_hook) (void *, size_t, const void*); +static void (*old_free_hook) (void*, const void*); /* This function is used as the hook for free to call. */ static void -emacs_blocked_free (ptr, ptr2) - void *ptr; - const void *ptr2; +emacs_blocked_free (void *ptr, const void *ptr2) { BLOCK_INPUT_ALLOC; @@ -1226,9 +1209,7 @@ emacs_blocked_free (ptr, ptr2) /* This function is the malloc hook that Emacs uses. */ static void * -emacs_blocked_malloc (size, ptr) - size_t size; - const void *ptr; +emacs_blocked_malloc (size_t size, const void *ptr) { void *value; @@ -1275,10 +1256,7 @@ emacs_blocked_malloc (size, ptr) /* This function is the realloc hook that Emacs uses. */ static void * -emacs_blocked_realloc (ptr, size, ptr2) - void *ptr; - size_t size; - const void *ptr2; +emacs_blocked_realloc (void *ptr, size_t size, const void *ptr2) { void *value; @@ -1352,7 +1330,7 @@ reset_malloc_hooks () /* Called from main to set up malloc to use our hooks. */ void -uninterrupt_malloc () +uninterrupt_malloc (void) { #ifdef HAVE_GTK_AND_PTHREAD #ifdef DOUG_LEA_MALLOC @@ -1434,7 +1412,7 @@ static int n_interval_blocks; /* Initialize interval allocation. */ static void -init_intervals () +init_intervals (void) { interval_block = NULL; interval_block_index = INTERVAL_BLOCK_SIZE; @@ -1446,7 +1424,7 @@ init_intervals () /* Return a new interval. */ INTERVAL -make_interval () +make_interval (void) { INTERVAL val; @@ -1489,9 +1467,7 @@ make_interval () /* Mark Lisp objects in interval I. */ static void -mark_interval (i, dummy) - register INTERVAL i; - Lisp_Object dummy; +mark_interval (register INTERVAL i, Lisp_Object dummy) { eassert (!i->gcmarkbit); /* Intervals are never shared. */ i->gcmarkbit = 1; @@ -1503,8 +1479,7 @@ mark_interval (i, dummy) use the macro MARK_INTERVAL_TREE instead. */ static void -mark_interval_tree (tree) - register INTERVAL tree; +mark_interval_tree (register INTERVAL tree) { /* No need to test if this tree has been marked already; this function is always called through the MARK_INTERVAL_TREE macro, @@ -1751,7 +1726,7 @@ static char string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] = /* Initialize string allocation. Called from init_alloc_once. */ static void -init_strings () +init_strings (void) { total_strings = total_free_strings = total_string_size = 0; oldest_sblock = current_sblock = large_sblocks = NULL; @@ -1767,8 +1742,8 @@ init_strings () static int check_string_bytes_count; -static void check_string_bytes P_ ((int)); -static void check_sblock P_ ((struct sblock *)); +static void check_string_bytes (int); +static void check_sblock (struct sblock *); #define CHECK_STRING_BYTES(S) STRING_BYTES (S) @@ -1873,7 +1848,7 @@ check_string_free_list () /* Return a new Lisp_String. */ static struct Lisp_String * -allocate_string () +allocate_string (void) { struct Lisp_String *s; @@ -1889,7 +1864,7 @@ allocate_string () int i; b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING); - bzero (b, sizeof *b); + memset (b, 0, sizeof *b); b->next = string_blocks; string_blocks = b; ++n_string_blocks; @@ -1913,7 +1888,7 @@ allocate_string () MALLOC_UNBLOCK_INPUT; /* Probably not strictly necessary, but play it safe. */ - bzero (s, sizeof *s); + memset (s, 0, sizeof *s); --total_free_strings; ++total_strings; @@ -1944,9 +1919,7 @@ allocate_string () S->data if it was initially non-null. */ void -allocate_string_data (s, nchars, nbytes) - struct Lisp_String *s; - int nchars, nbytes; +allocate_string_data (struct Lisp_String *s, int nchars, int nbytes) { struct sdata *data, *old_data; struct sblock *b; @@ -2023,8 +1996,7 @@ allocate_string_data (s, nchars, nbytes) s->size_byte = nbytes; s->data[nbytes] = '\0'; #ifdef GC_CHECK_STRING_OVERRUN - bcopy (string_overrun_cookie, (char *) data + needed, - GC_STRING_OVERRUN_COOKIE_SIZE); + memcpy (data + needed, string_overrun_cookie, GC_STRING_OVERRUN_COOKIE_SIZE); #endif /* If S had already data assigned, mark that as free by setting its @@ -2043,7 +2015,7 @@ allocate_string_data (s, nchars, nbytes) /* Sweep and compact strings. */ static void -sweep_strings () +sweep_strings (void) { struct string_block *b, *next; struct string_block *live_blocks = NULL; @@ -2143,7 +2115,7 @@ sweep_strings () /* Free dead large strings. */ static void -free_large_strings () +free_large_strings (void) { struct sblock *b, *next; struct sblock *live_blocks = NULL; @@ -2169,7 +2141,7 @@ free_large_strings () data of live strings after compaction. */ static void -compact_small_strings () +compact_small_strings (void) { struct sblock *b, *tb, *next; struct sdata *from, *to, *end, *tb_end; @@ -2215,9 +2187,9 @@ compact_small_strings () from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA); #ifdef GC_CHECK_STRING_OVERRUN - if (bcmp (string_overrun_cookie, - ((char *) from_end) - GC_STRING_OVERRUN_COOKIE_SIZE, - GC_STRING_OVERRUN_COOKIE_SIZE)) + if (memcmp (string_overrun_cookie, + (char *) from_end - GC_STRING_OVERRUN_COOKIE_SIZE, + GC_STRING_OVERRUN_COOKIE_SIZE)) abort (); #endif @@ -2239,7 +2211,7 @@ compact_small_strings () if (from != to) { xassert (tb != b || to <= from); - safe_bcopy ((char *) from, (char *) to, nbytes + GC_STRING_EXTRA); + memmove (to, from, nbytes + GC_STRING_EXTRA); to->string->data = SDATA_DATA (to); } @@ -2267,8 +2239,7 @@ DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0, doc: /* Return a newly created string of length LENGTH, with INIT in each element. LENGTH must be an integer. INIT must be an integer that represents a character. */) - (length, init) - Lisp_Object length, init; + (Lisp_Object length, Lisp_Object init) { register Lisp_Object val; register unsigned char *p, *end; @@ -2298,7 +2269,7 @@ INIT must be an integer that represents a character. */) end = p + nbytes; while (p != end) { - bcopy (str, p, len); + memcpy (p, str, len); p += len; } } @@ -2311,8 +2282,7 @@ INIT must be an integer that represents a character. */) DEFUN ("make-bool-vector", Fmake_bool_vector, Smake_bool_vector, 2, 2, 0, doc: /* Return a new bool-vector of length LENGTH, using INIT for each element. LENGTH must be a number. INIT matters only in whether it is t or nil. */) - (length, init) - Lisp_Object length, init; + (Lisp_Object length, Lisp_Object init) { register Lisp_Object val; struct Lisp_Bool_Vector *p; @@ -2357,9 +2327,7 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */) multibyte, depending on the contents. */ Lisp_Object -make_string (contents, nbytes) - const char *contents; - int nbytes; +make_string (const char *contents, int nbytes) { register Lisp_Object val; int nchars, multibyte_nbytes; @@ -2378,13 +2346,11 @@ make_string (contents, nbytes) /* Make an unibyte string from LENGTH bytes at CONTENTS. */ Lisp_Object -make_unibyte_string (contents, length) - const char *contents; - int length; +make_unibyte_string (const char *contents, int length) { register Lisp_Object val; val = make_uninit_string (length); - bcopy (contents, SDATA (val), length); + memcpy (SDATA (val), contents, length); STRING_SET_UNIBYTE (val); return val; } @@ -2394,13 +2360,11 @@ make_unibyte_string (contents, length) bytes at CONTENTS. */ Lisp_Object -make_multibyte_string (contents, nchars, nbytes) - const char *contents; - int nchars, nbytes; +make_multibyte_string (const char *contents, int nchars, int nbytes) { register Lisp_Object val; val = make_uninit_multibyte_string (nchars, nbytes); - bcopy (contents, SDATA (val), nbytes); + memcpy (SDATA (val), contents, nbytes); return val; } @@ -2409,13 +2373,11 @@ make_multibyte_string (contents, nchars, nbytes) CONTENTS. It is a multibyte string if NBYTES != NCHARS. */ Lisp_Object -make_string_from_bytes (contents, nchars, nbytes) - const char *contents; - int nchars, nbytes; +make_string_from_bytes (const char *contents, int nchars, int nbytes) { register Lisp_Object val; val = make_uninit_multibyte_string (nchars, nbytes); - bcopy (contents, SDATA (val), nbytes); + memcpy (SDATA (val), contents, nbytes); if (SBYTES (val) == SCHARS (val)) STRING_SET_UNIBYTE (val); return val; @@ -2428,10 +2390,7 @@ make_string_from_bytes (contents, nchars, nbytes) characters by itself. */ Lisp_Object -make_specified_string (contents, nchars, nbytes, multibyte) - const char *contents; - int nchars, nbytes; - int multibyte; +make_specified_string (const char *contents, int nchars, int nbytes, int multibyte) { register Lisp_Object val; @@ -2443,7 +2402,7 @@ make_specified_string (contents, nchars, nbytes, multibyte) nchars = nbytes; } val = make_uninit_multibyte_string (nchars, nbytes); - bcopy (contents, SDATA (val), nbytes); + memcpy (SDATA (val), contents, nbytes); if (!multibyte) STRING_SET_UNIBYTE (val); return val; @@ -2454,8 +2413,7 @@ make_specified_string (contents, nchars, nbytes, multibyte) data warrants. */ Lisp_Object -build_string (str) - const char *str; +build_string (const char *str) { return make_string (str, strlen (str)); } @@ -2465,8 +2423,7 @@ build_string (str) occupying LENGTH bytes. */ Lisp_Object -make_uninit_string (length) - int length; +make_uninit_string (int length) { Lisp_Object val; @@ -2482,8 +2439,7 @@ make_uninit_string (length) which occupy NBYTES bytes. */ Lisp_Object -make_uninit_multibyte_string (nchars, nbytes) - int nchars, nbytes; +make_uninit_multibyte_string (int nchars, int nbytes) { Lisp_Object string; struct Lisp_String *s; @@ -2573,7 +2529,7 @@ struct Lisp_Float *float_free_list; /* Initialize float allocation. */ static void -init_float () +init_float (void) { float_block = NULL; float_block_index = FLOAT_BLOCK_SIZE; /* Force alloc of new float_block. */ @@ -2585,8 +2541,7 @@ init_float () /* Explicitly free a float cell by putting it on the free-list. */ static void -free_float (ptr) - struct Lisp_Float *ptr; +free_float (struct Lisp_Float *ptr) { ptr->u.chain = float_free_list; float_free_list = ptr; @@ -2596,8 +2551,7 @@ free_float (ptr) /* Return a new float object with value FLOAT_VALUE. */ Lisp_Object -make_float (float_value) - double float_value; +make_float (double float_value) { register Lisp_Object val; @@ -2621,7 +2575,7 @@ make_float (float_value) new = (struct float_block *) lisp_align_malloc (sizeof *new, MEM_TYPE_FLOAT); new->next = float_block; - bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits); + memset (new->gcmarkbits, 0, sizeof new->gcmarkbits); float_block = new; float_block_index = 0; n_float_blocks++; @@ -2697,7 +2651,7 @@ static int n_cons_blocks; /* Initialize cons allocation. */ static void -init_cons () +init_cons (void) { cons_block = NULL; cons_block_index = CONS_BLOCK_SIZE; /* Force alloc of new cons_block. */ @@ -2709,8 +2663,7 @@ init_cons () /* Explicitly free a cons cell by putting it on the free-list. */ void -free_cons (ptr) - struct Lisp_Cons *ptr; +free_cons (struct Lisp_Cons *ptr) { ptr->u.chain = cons_free_list; #if GC_MARK_STACK @@ -2721,8 +2674,7 @@ free_cons (ptr) DEFUN ("cons", Fcons, Scons, 2, 2, 0, doc: /* Create a new cons, give it CAR and CDR as components, and return it. */) - (car, cdr) - Lisp_Object car, cdr; + (Lisp_Object car, Lisp_Object cdr) { register Lisp_Object val; @@ -2744,7 +2696,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, register struct cons_block *new; new = (struct cons_block *) lisp_align_malloc (sizeof *new, MEM_TYPE_CONS); - bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits); + memset (new->gcmarkbits, 0, sizeof new->gcmarkbits); new->next = cons_block; cons_block = new; cons_block_index = 0; @@ -2766,7 +2718,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, /* Get an error now if there's any junk in the cons free list. */ void -check_cons_list () +check_cons_list (void) { #ifdef GC_CHECK_CONS_LIST struct Lisp_Cons *tail = cons_free_list; @@ -2779,39 +2731,34 @@ check_cons_list () /* Make a list of 1, 2, 3, 4 or 5 specified objects. */ Lisp_Object -list1 (arg1) - Lisp_Object arg1; +list1 (Lisp_Object arg1) { return Fcons (arg1, Qnil); } Lisp_Object -list2 (arg1, arg2) - Lisp_Object arg1, arg2; +list2 (Lisp_Object arg1, Lisp_Object arg2) { return Fcons (arg1, Fcons (arg2, Qnil)); } Lisp_Object -list3 (arg1, arg2, arg3) - Lisp_Object arg1, arg2, arg3; +list3 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) { return Fcons (arg1, Fcons (arg2, Fcons (arg3, Qnil))); } Lisp_Object -list4 (arg1, arg2, arg3, arg4) - Lisp_Object arg1, arg2, arg3, arg4; +list4 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4) { return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, Qnil)))); } Lisp_Object -list5 (arg1, arg2, arg3, arg4, arg5) - Lisp_Object arg1, arg2, arg3, arg4, arg5; +list5 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5) { return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, Fcons (arg5, Qnil))))); @@ -2822,9 +2769,7 @@ DEFUN ("list", Flist, Slist, 0, MANY, 0, doc: /* Return a newly created list with specified arguments as elements. Any number of arguments, even zero arguments, are allowed. usage: (list &rest OBJECTS) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { register Lisp_Object val; val = Qnil; @@ -2840,8 +2785,7 @@ usage: (list &rest OBJECTS) */) DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0, doc: /* Return a newly created list of length LENGTH, with each element being INIT. */) - (length, init) - register Lisp_Object length, init; + (register Lisp_Object length, Lisp_Object init) { register Lisp_Object val; register int size; @@ -2904,8 +2848,7 @@ static int n_vectors; with room for LEN Lisp_Objects. */ static struct Lisp_Vector * -allocate_vectorlike (len) - EMACS_INT len; +allocate_vectorlike (EMACS_INT len) { struct Lisp_Vector *p; size_t nbytes; @@ -2946,8 +2889,7 @@ allocate_vectorlike (len) /* Allocate a vector with NSLOTS slots. */ struct Lisp_Vector * -allocate_vector (nslots) - EMACS_INT nslots; +allocate_vector (EMACS_INT nslots) { struct Lisp_Vector *v = allocate_vectorlike (nslots); v->size = nslots; @@ -2958,9 +2900,7 @@ allocate_vector (nslots) /* Allocate other vector-like structures. */ struct Lisp_Vector * -allocate_pseudovector (memlen, lisplen, tag) - int memlen, lisplen; - EMACS_INT tag; +allocate_pseudovector (int memlen, int lisplen, EMACS_INT tag) { struct Lisp_Vector *v = allocate_vectorlike (memlen); EMACS_INT i; @@ -2982,38 +2922,38 @@ allocate_hash_table (void) struct window * -allocate_window () +allocate_window (void) { return ALLOCATE_PSEUDOVECTOR(struct window, current_matrix, PVEC_WINDOW); } struct terminal * -allocate_terminal () +allocate_terminal (void) { struct terminal *t = ALLOCATE_PSEUDOVECTOR (struct terminal, next_terminal, PVEC_TERMINAL); /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ - bzero (&(t->next_terminal), - ((char*)(t+1)) - ((char*)&(t->next_terminal))); + memset (&t->next_terminal, 0, + (char*) (t + 1) - (char*) &t->next_terminal); return t; } struct frame * -allocate_frame () +allocate_frame (void) { struct frame *f = ALLOCATE_PSEUDOVECTOR (struct frame, face_cache, PVEC_FRAME); /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ - bzero (&(f->face_cache), - ((char*)(f+1)) - ((char*)&(f->face_cache))); + memset (&f->face_cache, 0, + (char *) (f + 1) - (char *) &f->face_cache); return f; } struct Lisp_Process * -allocate_process () +allocate_process (void) { return ALLOCATE_PSEUDOVECTOR (struct Lisp_Process, pid, PVEC_PROCESS); } @@ -3022,8 +2962,7 @@ allocate_process () DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0, doc: /* Return a newly created vector of length LENGTH, with each element being INIT. See also the function `vector'. */) - (length, init) - register Lisp_Object length, init; + (register Lisp_Object length, Lisp_Object init) { Lisp_Object vector; register EMACS_INT sizei; @@ -3079,9 +3018,7 @@ DEFUN ("vector", Fvector, Svector, 0, MANY, 0, doc: /* Return a newly created vector with specified arguments as elements. Any number of arguments, even zero arguments, are allowed. usage: (vector &rest OBJECTS) */) - (nargs, args) - register int nargs; - Lisp_Object *args; + (register int nargs, Lisp_Object *args) { register Lisp_Object len, val; register int index; @@ -3126,9 +3063,7 @@ stack size, (optional) doc string, and (optional) interactive spec. The first four arguments are required; at most six have any significance. usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */) - (nargs, args) - register int nargs; - Lisp_Object *args; + (register int nargs, Lisp_Object *args) { register Lisp_Object len, val; register int index; @@ -3144,7 +3079,7 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT else val = Fmake_vector (len, Qnil); - if (STRINGP (args[1]) && STRING_MULTIBYTE (args[1])) + if (nargs > 1 && STRINGP (args[1]) && STRING_MULTIBYTE (args[1])) /* BYTECODE-STRING must have been produced by Emacs 20.2 or the earlier because they produced a raw 8-bit string for byte-code and now such a byte-code string is loaded as multibyte while @@ -3202,7 +3137,7 @@ static int n_symbol_blocks; /* Initialize symbol allocation. */ static void -init_symbol () +init_symbol (void) { symbol_block = NULL; symbol_block_index = SYMBOL_BLOCK_SIZE; @@ -3214,8 +3149,7 @@ init_symbol () DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0, doc: /* Return a newly allocated uninterned symbol whose name is NAME. Its value and function definition are void, and its property list is nil. */) - (name) - Lisp_Object name; + (Lisp_Object name) { register Lisp_Object val; register struct Lisp_Symbol *p; @@ -3294,7 +3228,7 @@ static union Lisp_Misc *marker_free_list; static int n_marker_blocks; static void -init_marker () +init_marker (void) { marker_block = NULL; marker_block_index = MARKER_BLOCK_SIZE; @@ -3305,7 +3239,7 @@ init_marker () /* Return a newly allocated Lisp_Misc object, with no substructure. */ Lisp_Object -allocate_misc () +allocate_misc (void) { Lisp_Object val; @@ -3347,8 +3281,7 @@ allocate_misc () /* Free a Lisp_Misc object */ void -free_misc (misc) - Lisp_Object misc; +free_misc (Lisp_Object misc) { XMISCTYPE (misc) = Lisp_Misc_Free; XMISC (misc)->u_free.chain = marker_free_list; @@ -3362,9 +3295,7 @@ free_misc (misc) The unwind function can get the C values back using XSAVE_VALUE. */ Lisp_Object -make_save_value (pointer, integer) - void *pointer; - int integer; +make_save_value (void *pointer, int integer) { register Lisp_Object val; register struct Lisp_Save_Value *p; @@ -3380,7 +3311,7 @@ make_save_value (pointer, integer) DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, doc: /* Return a newly allocated marker which does not point at any place. */) - () + (void) { register Lisp_Object val; register struct Lisp_Marker *p; @@ -3399,8 +3330,7 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, /* Put MARKER back on the free list after using it temporarily. */ void -free_marker (marker) - Lisp_Object marker; +free_marker (Lisp_Object marker) { unchain_marker (XMARKER (marker)); free_misc (marker); @@ -3414,9 +3344,7 @@ free_marker (marker) Any number of arguments, even zero arguments, are allowed. */ Lisp_Object -make_event_array (nargs, args) - register int nargs; - Lisp_Object *args; +make_event_array (register int nargs, Lisp_Object *args) { int i; @@ -3456,7 +3384,7 @@ make_event_array (nargs, args) /* Called if malloc returns zero. */ void -memory_full () +memory_full (void) { int i; @@ -3496,7 +3424,7 @@ memory_full () and also directly from this file, in case we're not using ralloc.c. */ void -refill_memory_reserve () +refill_memory_reserve (void) { #ifndef SYSTEM_MALLOC if (spare_memory[0] == 0) @@ -3544,7 +3472,7 @@ refill_memory_reserve () /* Initialize this part of alloc.c. */ static void -mem_init () +mem_init (void) { mem_z.left = mem_z.right = MEM_NIL; mem_z.parent = NULL; @@ -3558,8 +3486,7 @@ mem_init () MEM_NIL if there is no node in the tree containing START. */ static INLINE struct mem_node * -mem_find (start) - void *start; +mem_find (void *start) { struct mem_node *p; @@ -3582,9 +3509,7 @@ mem_find (start) pointer to the node that was inserted. */ static struct mem_node * -mem_insert (start, end, type) - void *start, *end; - enum mem_type type; +mem_insert (void *start, void *end, enum mem_type type) { struct mem_node *c, *parent, *x; @@ -3656,8 +3581,7 @@ mem_insert (start, end, type) balance the tree, after node X has been inserted; X is always red. */ static void -mem_insert_fixup (x) - struct mem_node *x; +mem_insert_fixup (struct mem_node *x) { while (x != mem_root && x->parent->color == MEM_RED) { @@ -3735,8 +3659,7 @@ mem_insert_fixup (x) b c a b */ static void -mem_rotate_left (x) - struct mem_node *x; +mem_rotate_left (struct mem_node *x) { struct mem_node *y; @@ -3775,8 +3698,7 @@ mem_rotate_left (x) a b b c */ static void -mem_rotate_right (x) - struct mem_node *x; +mem_rotate_right (struct mem_node *x) { struct mem_node *y = x->left; @@ -3805,8 +3727,7 @@ mem_rotate_right (x) /* Delete node Z from the tree. If Z is null or MEM_NIL, do nothing. */ static void -mem_delete (z) - struct mem_node *z; +mem_delete (struct mem_node *z) { struct mem_node *x, *y; @@ -3860,8 +3781,7 @@ mem_delete (z) deletion. */ static void -mem_delete_fixup (x) - struct mem_node *x; +mem_delete_fixup (struct mem_node *x) { while (x != mem_root && x->color == MEM_BLACK) { @@ -3942,9 +3862,7 @@ mem_delete_fixup (x) the heap. M is a pointer to the mem_block for P. */ static INLINE int -live_string_p (m, p) - struct mem_node *m; - void *p; +live_string_p (struct mem_node *m, void *p) { if (m->type == MEM_TYPE_STRING) { @@ -3967,9 +3885,7 @@ live_string_p (m, p) the heap. M is a pointer to the mem_block for P. */ static INLINE int -live_cons_p (m, p) - struct mem_node *m; - void *p; +live_cons_p (struct mem_node *m, void *p) { if (m->type == MEM_TYPE_CONS) { @@ -3995,9 +3911,7 @@ live_cons_p (m, p) the heap. M is a pointer to the mem_block for P. */ static INLINE int -live_symbol_p (m, p) - struct mem_node *m; - void *p; +live_symbol_p (struct mem_node *m, void *p) { if (m->type == MEM_TYPE_SYMBOL) { @@ -4023,9 +3937,7 @@ live_symbol_p (m, p) the heap. M is a pointer to the mem_block for P. */ static INLINE int -live_float_p (m, p) - struct mem_node *m; - void *p; +live_float_p (struct mem_node *m, void *p) { if (m->type == MEM_TYPE_FLOAT) { @@ -4049,9 +3961,7 @@ live_float_p (m, p) the heap. M is a pointer to the mem_block for P. */ static INLINE int -live_misc_p (m, p) - struct mem_node *m; - void *p; +live_misc_p (struct mem_node *m, void *p) { if (m->type == MEM_TYPE_MISC) { @@ -4077,9 +3987,7 @@ live_misc_p (m, p) M is a pointer to the mem_block for P. */ static INLINE int -live_vector_p (m, p) - struct mem_node *m; - void *p; +live_vector_p (struct mem_node *m, void *p) { return (p == m->start && m->type == MEM_TYPE_VECTORLIKE); } @@ -4089,9 +3997,7 @@ live_vector_p (m, p) pointer to the mem_block for P. */ static INLINE int -live_buffer_p (m, p) - struct mem_node *m; - void *p; +live_buffer_p (struct mem_node *m, void *p) { /* P must point to the start of the block, and the buffer must not have been killed. */ @@ -4134,7 +4040,7 @@ static double avg_live; DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "", doc: /* Show information about live and zombie objects. */) - () + (void) { Lisp_Object args[8], zombie_list = Qnil; int i; @@ -4157,8 +4063,7 @@ DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "", /* Mark OBJ if we can prove it's a Lisp_Object. */ static INLINE void -mark_maybe_object (obj) - Lisp_Object obj; +mark_maybe_object (Lisp_Object obj) { void *po = (void *) XPNTR (obj); struct mem_node *m = mem_find (po); @@ -4221,8 +4126,7 @@ mark_maybe_object (obj) marked. */ static INLINE void -mark_maybe_pointer (p) - void *p; +mark_maybe_pointer (void *p) { struct mem_node *m; @@ -4302,9 +4206,7 @@ mark_maybe_pointer (p) or END+OFFSET..START. */ static void -mark_memory (start, end, offset) - void *start, *end; - int offset; +mark_memory (void *start, void *end, int offset) { Lisp_Object *p; void **pp; @@ -4520,7 +4422,7 @@ dump_zombies () equally on the stack. */ static void -mark_stack () +mark_stack (void) { int i; /* jmp_buf may not be aligned enough on darwin-ppc64 */ @@ -4595,8 +4497,7 @@ mark_stack () /* Determine whether it is safe to access memory at address P. */ static int -valid_pointer_p (p) - void *p; +valid_pointer_p (void *p) { #ifdef WINDOWSNT return w32_valid_pointer_p (p, 16); @@ -4627,8 +4528,7 @@ valid_pointer_p (p) so it should only be used in code for manual debugging. */ int -valid_lisp_object_p (obj) - Lisp_Object obj; +valid_lisp_object_p (Lisp_Object obj) { void *p; #if GC_MARK_STACK @@ -4706,9 +4606,7 @@ valid_lisp_object_p (obj) allocated. TYPE < 0 means it's not used for a Lisp object. */ static POINTER_TYPE * -pure_alloc (size, type) - size_t size; - int type; +pure_alloc (size_t size, int type) { POINTER_TYPE *result; #ifdef USE_LSB_TAG @@ -4762,7 +4660,7 @@ pure_alloc (size, type) /* Print a warning if PURESIZE is too small. */ void -check_pure_size () +check_pure_size (void) { if (pure_bytes_used_before_overflow) message ("emacs:0:Pure Lisp storage overflow (approx. %d bytes needed)", @@ -4775,9 +4673,7 @@ check_pure_size () address. Return NULL if not found. */ static char * -find_string_data_in_pure (data, nbytes) - const char *data; - int nbytes; +find_string_data_in_pure (const char *data, int nbytes) { int i, skip, bm_skip[256], last_char_skip, infinity, start, start_max; const unsigned char *p; @@ -4846,10 +4742,7 @@ find_string_data_in_pure (data, nbytes) string; then the string is not protected from gc. */ Lisp_Object -make_pure_string (data, nchars, nbytes, multibyte) - const char *data; - int nchars, nbytes; - int multibyte; +make_pure_string (const char *data, int nchars, int nbytes, int multibyte) { Lisp_Object string; struct Lisp_String *s; @@ -4859,7 +4752,7 @@ make_pure_string (data, nchars, nbytes, multibyte) if (s->data == NULL) { s->data = (unsigned char *) pure_alloc (nbytes + 1, -1); - bcopy (data, s->data, nbytes); + memcpy (s->data, data, nbytes); s->data[nbytes] = '\0'; } s->size = nchars; @@ -4892,8 +4785,7 @@ make_pure_c_string (const char *data) of CAR as car and CDR as cdr. */ Lisp_Object -pure_cons (car, cdr) - Lisp_Object car, cdr; +pure_cons (Lisp_Object car, Lisp_Object cdr) { register Lisp_Object new; struct Lisp_Cons *p; @@ -4909,8 +4801,7 @@ pure_cons (car, cdr) /* Value is a float object with value NUM allocated from pure space. */ static Lisp_Object -make_pure_float (num) - double num; +make_pure_float (double num) { register Lisp_Object new; struct Lisp_Float *p; @@ -4926,8 +4817,7 @@ make_pure_float (num) pure space. */ Lisp_Object -make_pure_vector (len) - EMACS_INT len; +make_pure_vector (EMACS_INT len) { Lisp_Object new; struct Lisp_Vector *p; @@ -4944,8 +4834,7 @@ DEFUN ("purecopy", Fpurecopy, Spurecopy, 1, 1, 0, doc: /* Make a copy of object OBJ in pure storage. Recursively copies contents of vectors and cons cells. Does not copy symbols. Copies strings without text properties. */) - (obj) - register Lisp_Object obj; + (register Lisp_Object obj) { if (NILP (Vpurify_flag)) return obj; @@ -5010,8 +4899,7 @@ Does not copy symbols. Copies strings without text properties. */) VARADDRESS. */ void -staticpro (varaddress) - Lisp_Object *varaddress; +staticpro (Lisp_Object *varaddress) { staticvec[staticidx++] = varaddress; if (staticidx >= NSTATICS) @@ -5026,7 +4914,7 @@ staticpro (varaddress) /* Temporarily prevent garbage collection. */ int -inhibit_garbage_collection () +inhibit_garbage_collection (void) { int count = SPECPDL_INDEX (); int nbits = min (VALBITS, BITS_PER_INT); @@ -5047,7 +4935,7 @@ Garbage collection happens automatically if you cons more than (USED-STRINGS . FREE-STRINGS)) However, if there was overflow in pure space, `garbage-collect' returns nil, because real GC can't be done. */) - () + (void) { register struct specbinding *bind; struct catchtag *catch; @@ -5130,9 +5018,9 @@ returns nil, because real GC can't be done. */) if (stack_copy) { if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0) - bcopy (stack_bottom, stack_copy, i); + memcpy (stack_copy, stack_bottom, i); else - bcopy (&stack_top_variable, stack_copy, i); + memcpy (stack_copy, &stack_top_variable, i); } } } @@ -5165,7 +5053,7 @@ returns nil, because real GC can't be done. */) #ifdef USE_GTK { - extern void xg_mark_data (); + extern void xg_mark_data (void); xg_mark_data (); } #endif @@ -5358,8 +5246,7 @@ returns nil, because real GC can't be done. */) only interesting objects referenced from glyphs are strings. */ static void -mark_glyph_matrix (matrix) - struct glyph_matrix *matrix; +mark_glyph_matrix (struct glyph_matrix *matrix) { struct glyph_row *row = matrix->rows; struct glyph_row *end = row + matrix->nrows; @@ -5385,8 +5272,7 @@ mark_glyph_matrix (matrix) /* Mark Lisp faces in the face cache C. */ static void -mark_face_cache (c) - struct face_cache *c; +mark_face_cache (struct face_cache *c) { if (c) { @@ -5421,8 +5307,7 @@ int last_marked_index; static int mark_object_loop_halt; static void -mark_vectorlike (ptr) - struct Lisp_Vector *ptr; +mark_vectorlike (struct Lisp_Vector *ptr) { register EMACS_INT size = ptr->size; register int i; @@ -5445,8 +5330,7 @@ mark_vectorlike (ptr) symbols. */ static void -mark_char_table (ptr) - struct Lisp_Vector *ptr; +mark_char_table (struct Lisp_Vector *ptr) { register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK; register int i; @@ -5470,8 +5354,7 @@ mark_char_table (ptr) } void -mark_object (arg) - Lisp_Object arg; +mark_object (Lisp_Object arg) { register Lisp_Object obj = arg; #ifdef GC_CHECK_MARKED_OBJECTS @@ -5780,8 +5663,7 @@ mark_object (arg) /* Mark the pointers in a buffer structure. */ static void -mark_buffer (buf) - Lisp_Object buf; +mark_buffer (Lisp_Object buf) { register struct buffer *buffer = XBUFFER (buf); register Lisp_Object *ptr, tmp; @@ -5848,8 +5730,7 @@ mark_terminals (void) either marked or does not need to be marked to survive. */ int -survives_gc_p (obj) - Lisp_Object obj; +survives_gc_p (Lisp_Object obj) { int survives_p; @@ -5895,7 +5776,7 @@ survives_gc_p (obj) /* Sweep: find all structures not marked, and free them. */ static void -gc_sweep () +gc_sweep (void) { /* Remove or mark entries in weak hash tables. This must be done before any object is unmarked. */ @@ -6271,7 +6152,7 @@ DEFUN ("memory-limit", Fmemory_limit, Smemory_limit, 0, 0, 0, doc: /* Return the address of the last byte Emacs has allocated, divided by 1024. This may be helpful in debugging Emacs's memory usage. We divide the value by 1024 to make sure it fits in a Lisp integer. */) - () + (void) { Lisp_Object end; @@ -6293,7 +6174,7 @@ objects consed. MISCS include overlays, markers, and some internal types. Frames, windows, buffers, and subprocesses count as vectors (but the contents of a buffer's text do not count here). */) - () + (void) { Lisp_Object consed[8]; @@ -6312,10 +6193,7 @@ Frames, windows, buffers, and subprocesses count as vectors int suppress_checking; void -die (msg, file, line) - const char *msg; - const char *file; - int line; +die (const char *msg, const char *file, int line) { fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", file, line, msg); @@ -6325,7 +6203,7 @@ die (msg, file, line) /* Initialization */ void -init_alloc_once () +init_alloc_once (void) { /* Used to do Vpurify_flag = Qt here, but Qt isn't set up yet! */ purebeg = PUREBEG; @@ -6380,7 +6258,7 @@ init_alloc_once () } void -init_alloc () +init_alloc (void) { gcprolist = 0; byte_stack_list = 0; @@ -6394,7 +6272,7 @@ init_alloc () } void -syms_of_alloc () +syms_of_alloc (void) { DEFVAR_INT ("gc-cons-threshold", &gc_cons_threshold, doc: /* *Number of bytes of consing between garbage collections. diff --git a/src/atimer.c b/src/atimer.c index 556272d7918..9fd9dee835e 100644 --- a/src/atimer.c +++ b/src/atimer.c @@ -21,11 +21,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <signal.h> #include <stdio.h> #include <setjmp.h> -#include <lisp.h> -#include <syssignal.h> -#include <systime.h> -#include <blockinput.h> -#include <atimer.h> +#include "lisp.h" +#include "syssignal.h" +#include "systime.h" +#include "blockinput.h" +#include "atimer.h" #ifdef HAVE_UNISTD_H #include <unistd.h> @@ -64,11 +64,11 @@ int pending_atimers; /* Function prototypes. */ -static void set_alarm P_ ((void)); -static void schedule_atimer P_ ((struct atimer *)); -static struct atimer *append_atimer_lists P_ ((struct atimer *, - struct atimer *)); -SIGTYPE alarm_signal_handler (); +static void set_alarm (void); +static void schedule_atimer (struct atimer *); +static struct atimer *append_atimer_lists (struct atimer *, + struct atimer *); +SIGTYPE alarm_signal_handler (int signo); /* Start a new atimer of type TYPE. TIME specifies when the timer is @@ -90,11 +90,8 @@ SIGTYPE alarm_signal_handler (); to cancel_atimer; don't free it yourself. */ struct atimer * -start_atimer (type, time, fn, client_data) - enum atimer_type type; - EMACS_TIME time; - atimer_callback fn; - void *client_data; +start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn, + void *client_data) { struct atimer *t; @@ -119,7 +116,7 @@ start_atimer (type, time, fn, client_data) t = (struct atimer *) xmalloc (sizeof *t); /* Fill the atimer structure. */ - bzero (t, sizeof *t); + memset (t, 0, sizeof *t); t->type = type; t->fn = fn; t->client_data = client_data; @@ -159,8 +156,7 @@ start_atimer (type, time, fn, client_data) /* Cancel and free atimer TIMER. */ void -cancel_atimer (timer) - struct atimer *timer; +cancel_atimer (struct atimer *timer) { int i; @@ -199,8 +195,7 @@ cancel_atimer (timer) result list. */ static struct atimer * -append_atimer_lists (list1, list2) - struct atimer *list1, *list2; +append_atimer_lists (struct atimer *list1, struct atimer *list2) { if (list1 == NULL) return list2; @@ -221,8 +216,7 @@ append_atimer_lists (list1, list2) /* Stop all timers except timer T. T null means stop all timers. */ void -stop_other_atimers (t) - struct atimer *t; +stop_other_atimers (struct atimer *t) { BLOCK_ATIMERS; @@ -257,7 +251,7 @@ stop_other_atimers (t) stop_other_atimers. */ void -run_all_atimers () +run_all_atimers (void) { if (stopped_atimers) { @@ -283,8 +277,7 @@ run_all_atimers () /* A version of run_all_timers suitable for a record_unwind_protect. */ Lisp_Object -unwind_stop_other_atimers (dummy) - Lisp_Object dummy; +unwind_stop_other_atimers (Lisp_Object dummy) { run_all_atimers (); return Qnil; @@ -294,7 +287,7 @@ unwind_stop_other_atimers (dummy) /* Arrange for a SIGALRM to arrive when the next timer is ripe. */ static void -set_alarm () +set_alarm (void) { if (atimers) { @@ -315,7 +308,7 @@ set_alarm () EMACS_SET_USECS (time, 1000); } - bzero (&it, sizeof it); + memset (&it, 0, sizeof it); it.it_value = time; setitimer (ITIMER_REAL, &it, 0); #else /* not HAVE_SETITIMER */ @@ -330,8 +323,7 @@ set_alarm () already. */ static void -schedule_atimer (t) - struct atimer *t; +schedule_atimer (struct atimer *t) { struct atimer *a = atimers, *prev = NULL; @@ -349,7 +341,7 @@ schedule_atimer (t) } static void -run_timers () +run_timers (void) { EMACS_TIME now; @@ -401,8 +393,7 @@ run_timers () SIGALRM. */ SIGTYPE -alarm_signal_handler (signo) - int signo; +alarm_signal_handler (int signo) { #ifndef SYNC_INPUT SIGNAL_THREAD_CHECK (signo); @@ -420,7 +411,7 @@ alarm_signal_handler (signo) /* Call alarm_signal_handler for pending timers. */ void -do_pending_atimers () +do_pending_atimers (void) { if (pending_atimers) { @@ -435,8 +426,7 @@ do_pending_atimers () some systems like HPUX (see process.c). */ void -turn_on_atimers (on) - int on; +turn_on_atimers (int on) { if (on) { @@ -449,7 +439,7 @@ turn_on_atimers (on) void -init_atimer () +init_atimer (void) { free_atimers = stopped_atimers = atimers = NULL; pending_atimers = 0; diff --git a/src/atimer.h b/src/atimer.h index fd354caf54d..c2245d30e6b 100644 --- a/src/atimer.h +++ b/src/atimer.h @@ -20,13 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifndef EMACS_ATIMER_H #define EMACS_ATIMER_H -/* Declare the prototype for a general external function. */ -#if defined (PROTOTYPES) || defined (WINDOWSNT) -#define P_(proto) proto -#else -#define P_(proto) () -#endif - #include "systime.h" /* for EMACS_TIME */ /* Forward declaration. */ @@ -49,7 +42,7 @@ enum atimer_type /* Type of timer callback functions. */ -typedef void (* atimer_callback) P_ ((struct atimer *timer)); +typedef void (* atimer_callback) (struct atimer *timer); /* Structure describing an asynchronous timer. */ @@ -77,15 +70,15 @@ struct atimer /* Function prototypes. */ -struct atimer *start_atimer P_ ((enum atimer_type, EMACS_TIME, - atimer_callback, void *)); -void cancel_atimer P_ ((struct atimer *)); -void do_pending_atimers P_ ((void)); -void init_atimer P_ ((void)); -void turn_on_atimers P_ ((int)); -void stop_other_atimers P_ ((struct atimer *)); -void run_all_atimers P_ ((void)); -Lisp_Object unwind_stop_other_atimers P_ ((Lisp_Object)); +struct atimer *start_atimer (enum atimer_type, EMACS_TIME, + atimer_callback, void *); +void cancel_atimer (struct atimer *); +void do_pending_atimers (void); +void init_atimer (void); +void turn_on_atimers (int); +void stop_other_atimers (struct atimer *); +void run_all_atimers (void); +Lisp_Object unwind_stop_other_atimers (Lisp_Object); #endif /* EMACS_ATIMER_H */ diff --git a/src/autodeps.mk b/src/autodeps.mk index c3cc91e22a7..fb0e21366c7 100644 --- a/src/autodeps.mk +++ b/src/autodeps.mk @@ -2,5 +2,5 @@ ## This is inserted in src/Makefile if AUTO_DEPEND=yes. -ALLOBJS=$(START_FILES) ${obj} ${otherobj} prefix-args.o +ALLOBJS=$(START_FILES) ${obj} ${otherobj} -include $(ALLOBJS:%.o=${DEPDIR}/%.d) diff --git a/src/bidi.c b/src/bidi.c index bca32cf110e..e17676ea6d7 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -49,16 +49,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ rule X9 and to its modifications decribed in the "Implementation Notes" section of UAX#9, under "Retaining Format Codes". */ -#ifdef HAVE_CONFIG_H #include <config.h> -#endif - #include <stdio.h> - -#ifdef HAVE_STRING_H #include <string.h> -#endif - #include <setjmp.h> #include "lisp.h" @@ -106,7 +99,7 @@ static Lisp_Object paragraph_start_re, paragraph_separate_re; static Lisp_Object Qparagraph_start, Qparagraph_separate; static void -bidi_initialize () +bidi_initialize (void) { #include "biditype.h" diff --git a/src/blockinput.h b/src/blockinput.h index 890adcbcd86..7ba6fc264fd 100644 --- a/src/blockinput.h +++ b/src/blockinput.h @@ -122,8 +122,7 @@ extern int pending_atimers; #define INPUT_BLOCKED_P (interrupt_input_blocked > 0) /* Defined in keyboard.c */ -/* Don't use a prototype here; it causes trouble in some files. */ -extern void reinvoke_input_signal (); +extern void reinvoke_input_signal (void); #endif /* EMACS_BLOCKINPUT_H */ diff --git a/src/buffer.c b/src/buffer.c index e907c295e8d..bfef1c369ef 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -106,13 +106,13 @@ static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS]; int last_per_buffer_idx; EXFUN (Fset_buffer, 1); -void set_buffer_internal P_ ((struct buffer *b)); -void set_buffer_internal_1 P_ ((struct buffer *b)); -static void call_overlay_mod_hooks P_ ((Lisp_Object list, Lisp_Object overlay, - int after, Lisp_Object arg1, - Lisp_Object arg2, Lisp_Object arg3)); -static void swap_out_buffer_local_variables P_ ((struct buffer *b)); -static void reset_buffer_local_variables P_ ((struct buffer *b, int permanent_too)); +void set_buffer_internal (struct buffer *b); +void set_buffer_internal_1 (struct buffer *b); +static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, + int after, Lisp_Object arg1, + Lisp_Object arg2, Lisp_Object arg3); +static void swap_out_buffer_local_variables (struct buffer *b); +static void reset_buffer_local_variables (struct buffer *b, int permanent_too); /* Alist of all buffer names vs the buffers. */ /* This used to be a variable, but is no longer, @@ -168,20 +168,19 @@ Lisp_Object Qmodification_hooks; Lisp_Object Qinsert_in_front_hooks; Lisp_Object Qinsert_behind_hooks; -static void alloc_buffer_text P_ ((struct buffer *, size_t)); -static void free_buffer_text P_ ((struct buffer *b)); -static struct Lisp_Overlay * copy_overlays P_ ((struct buffer *, struct Lisp_Overlay *)); -static void modify_overlay P_ ((struct buffer *, EMACS_INT, EMACS_INT)); -static Lisp_Object buffer_lisp_local_variables P_ ((struct buffer *)); +static void alloc_buffer_text (struct buffer *, size_t); +static void free_buffer_text (struct buffer *b); +static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *); +static void modify_overlay (struct buffer *, EMACS_INT, EMACS_INT); +static Lisp_Object buffer_lisp_local_variables (struct buffer *); -extern char * emacs_strerror P_ ((int)); +extern char * emacs_strerror (int); /* For debugging; temporary. See set_buffer_internal. */ /* Lisp_Object Qlisp_mode, Vcheck_symbol; */ void -nsberror (spec) - Lisp_Object spec; +nsberror (Lisp_Object spec) { if (STRINGP (spec)) error ("No buffer named %s", SDATA (spec)); @@ -191,8 +190,7 @@ nsberror (spec) DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0, doc: /* Return non-nil if OBJECT is a buffer which has not been killed. Value is nil if OBJECT is not a buffer or if it has been killed. */) - (object) - Lisp_Object object; + (Lisp_Object object) { return ((BUFFERP (object) && ! NILP (XBUFFER (object)->name)) ? Qt : Qnil); @@ -203,8 +201,7 @@ DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 1, 0, If the optional arg FRAME is a frame, we return the buffer list in the proper order for that frame: the buffers in FRAME's `buffer-list' frame parameter come first, followed by the rest of the buffers. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { Lisp_Object general; general = Fmapcar (Qcdr, Vbuffer_alist); @@ -248,9 +245,7 @@ frame parameter come first, followed by the rest of the buffers. */) and don't ever QUIT. */ static Lisp_Object -assoc_ignore_text_properties (key, list) - register Lisp_Object key; - Lisp_Object list; +assoc_ignore_text_properties (register Lisp_Object key, Lisp_Object list) { register Lisp_Object tail; for (tail = list; CONSP (tail); tail = XCDR (tail)) @@ -269,8 +264,7 @@ DEFUN ("get-buffer", Fget_buffer, Sget_buffer, 1, 1, 0, BUFFER-OR-NAME must be either a string or a buffer. If BUFFER-OR-NAME is a string and there is no buffer with that name, return nil. If BUFFER-OR-NAME is a buffer, return it as given. */) - (buffer_or_name) - register Lisp_Object buffer_or_name; + (register Lisp_Object buffer_or_name) { if (BUFFERP (buffer_or_name)) return buffer_or_name; @@ -284,8 +278,7 @@ DEFUN ("get-file-buffer", Fget_file_buffer, Sget_file_buffer, 1, 1, 0, The buffer's `buffer-file-name' must match exactly the expansion of FILENAME. If there is no such live buffer, return nil. See also `find-buffer-visiting'. */) - (filename) - register Lisp_Object filename; + (register Lisp_Object filename) { register Lisp_Object tail, buf, tem; Lisp_Object handler; @@ -312,8 +305,7 @@ See also `find-buffer-visiting'. */) } Lisp_Object -get_truename_buffer (filename) - register Lisp_Object filename; +get_truename_buffer (register Lisp_Object filename) { register Lisp_Object tail, buf, tem; @@ -341,8 +333,7 @@ buffer does not keep undo information. If BUFFER-OR-NAME is a buffer instead of a string, return it as given, even if it is dead. The return value is never nil. */) - (buffer_or_name) - register Lisp_Object buffer_or_name; + (register Lisp_Object buffer_or_name) { register Lisp_Object buffer, name; register struct buffer *b; @@ -437,9 +428,7 @@ even if it is dead. The return value is never nil. */) LIST, but for buffer B. */ static struct Lisp_Overlay * -copy_overlays (b, list) - struct buffer *b; - struct Lisp_Overlay *list; +copy_overlays (struct buffer *b, struct Lisp_Overlay *list) { Lisp_Object buffer; struct Lisp_Overlay *result = NULL, *tail = NULL; @@ -489,8 +478,7 @@ copy_overlays (b, list) copied. */ static void -clone_per_buffer_values (from, to) - struct buffer *from, *to; +clone_per_buffer_values (struct buffer *from, struct buffer *to) { Lisp_Object to_buffer; int offset; @@ -521,7 +509,7 @@ clone_per_buffer_values (from, to) PER_BUFFER_VALUE (to, offset) = obj; } - bcopy (from->local_flags, to->local_flags, sizeof to->local_flags); + memcpy (to->local_flags, from->local_flags, sizeof to->local_flags); to->overlays_before = copy_overlays (to, from->overlays_before); to->overlays_after = copy_overlays (to, from->overlays_after); @@ -540,8 +528,7 @@ NAME should be a string which is not the name of an existing buffer. Optional argument CLONE non-nil means preserve BASE-BUFFER's state, such as major and minor modes, in the indirect buffer. CLONE nil means the indirect buffer's state is reset to default values. */) - (base_buffer, name, clone) - Lisp_Object base_buffer, name, clone; + (Lisp_Object base_buffer, Lisp_Object name, Lisp_Object clone) { Lisp_Object buf, tem; struct buffer *b; @@ -658,8 +645,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) } void -delete_all_overlays (b) - struct buffer *b; +delete_all_overlays (struct buffer *b) { Lisp_Object overlay; @@ -689,8 +675,7 @@ delete_all_overlays (b) claims it doesn't belong to it. */ void -reset_buffer (b) - register struct buffer *b; +reset_buffer (register struct buffer *b) { b->filename = Qnil; b->file_truename = Qnil; @@ -734,9 +719,7 @@ reset_buffer (b) we preserve those. */ static void -reset_buffer_local_variables (b, permanent_too) - register struct buffer *b; - int permanent_too; +reset_buffer_local_variables (register struct buffer *b, int permanent_too) { register int offset; int i; @@ -840,8 +823,7 @@ Otherwise modify name by appending `<NUMBER>', incrementing NUMBER \(starting at 2) until an unused name is found, and then return that name. Optional second argument IGNORE specifies a name that is okay to use (if it is in the sequence to be tried) even if a buffer with that name exists. */) - (name, ignore) - register Lisp_Object name, ignore; + (register Lisp_Object name, Lisp_Object ignore) { register Lisp_Object gentemp, tem; int count; @@ -875,8 +857,7 @@ DEFUN ("buffer-name", Fbuffer_name, Sbuffer_name, 0, 1, 0, doc: /* Return the name of BUFFER, as a string. BUFFER defaults to the current buffer. Return nil if BUFFER has been killed. */) - (buffer) - register Lisp_Object buffer; + (register Lisp_Object buffer) { if (NILP (buffer)) return current_buffer->name; @@ -887,8 +868,7 @@ Return nil if BUFFER has been killed. */) DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, doc: /* Return name of file BUFFER is visiting, or nil if none. No argument or nil as argument means use the current buffer. */) - (buffer) - register Lisp_Object buffer; + (register Lisp_Object buffer) { if (NILP (buffer)) return current_buffer->filename; @@ -901,8 +881,7 @@ DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer, doc: /* Return the base buffer of indirect buffer BUFFER. If BUFFER is not indirect, return nil. BUFFER defaults to the current buffer. */) - (buffer) - register Lisp_Object buffer; + (register Lisp_Object buffer) { struct buffer *base; Lisp_Object base_buffer; @@ -926,9 +905,7 @@ DEFUN ("buffer-local-value", Fbuffer_local_value, doc: /* Return the value of VARIABLE in BUFFER. If VARIABLE does not have a buffer-local binding in BUFFER, the value is the default binding of the variable. */) - (variable, buffer) - register Lisp_Object variable; - register Lisp_Object buffer; + (register Lisp_Object variable, register Lisp_Object buffer) { register struct buffer *buf; register Lisp_Object result; @@ -993,8 +970,7 @@ is the default binding of the variable. */) in special slots in the buffer object. */ static Lisp_Object -buffer_lisp_local_variables (buf) - struct buffer *buf; +buffer_lisp_local_variables (struct buffer *buf) { Lisp_Object result = Qnil; register Lisp_Object tail; @@ -1027,8 +1003,7 @@ Most elements look like (SYMBOL . VALUE), describing one variable. For a symbol that is locally unbound, just the symbol appears in the value. Note that storing new VALUEs in these elements doesn't change the variables. No argument or nil as argument means use current buffer as BUFFER. */) - (buffer) - register Lisp_Object buffer; + (register Lisp_Object buffer) { register struct buffer *buf; register Lisp_Object result; @@ -1070,8 +1045,7 @@ DEFUN ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p, 0, 1, 0, doc: /* Return t if BUFFER was modified since its file was last read or saved. No argument or nil as argument means use current buffer as BUFFER. */) - (buffer) - register Lisp_Object buffer; + (register Lisp_Object buffer) { register struct buffer *buf; if (NILP (buffer)) @@ -1089,8 +1063,7 @@ DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, 1, 1, 0, doc: /* Mark current buffer as modified or unmodified according to FLAG. A non-nil FLAG means mark the buffer modified. */) - (flag) - register Lisp_Object flag; + (register Lisp_Object flag) { register int already; register Lisp_Object fn; @@ -1159,8 +1132,7 @@ DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p, doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay. It is not ensured that mode lines will be updated to show the modified state of the current buffer. Use with care. */) - (flag) - Lisp_Object flag; + (Lisp_Object flag) { #ifdef CLASH_DETECTION Lisp_Object fn; @@ -1190,8 +1162,7 @@ DEFUN ("buffer-modified-tick", Fbuffer_modified_tick, Sbuffer_modified_tick, Each buffer has a tick counter which is incremented each time the text in that buffer is changed. It wraps around occasionally. No argument or nil as argument means use current buffer as BUFFER. */) - (buffer) - register Lisp_Object buffer; + (register Lisp_Object buffer) { register struct buffer *buf; if (NILP (buffer)) @@ -1215,8 +1186,7 @@ values returned by two individual calls of `buffer-chars-modified-tick', you can tell whether a character change occurred in that buffer in between these calls. No argument or nil as argument means use current buffer as BUFFER. */) - (buffer) - register Lisp_Object buffer; + (register Lisp_Object buffer) { register struct buffer *buf; if (NILP (buffer)) @@ -1242,8 +1212,7 @@ If UNIQUE is non-nil, come up with a new name using Interactively, you can set UNIQUE with a prefix argument. We return the name we actually gave the buffer. This does not change the name of the visited file (if any). */) - (newname, unique) - register Lisp_Object newname, unique; + (register Lisp_Object newname, Lisp_Object unique) { register Lisp_Object tem, buf; @@ -1290,10 +1259,9 @@ If the optional third argument FRAME is non-nil, use that frame's buffer list instead of the selected frame's buffer list. If no other buffer exists, the buffer `*scratch*' is returned. If BUFFER is omitted or nil, some interesting buffer is returned. */) - (buffer, visible_ok, frame) - register Lisp_Object buffer, visible_ok, frame; + (register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame) { - Lisp_Object Fset_buffer_major_mode (); + Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer); register Lisp_Object tail, buf, notsogood, tem, pred, add_ons; notsogood = Qnil; @@ -1362,8 +1330,7 @@ DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo, 0, 1, "", doc: /* Start keeping undo information for buffer BUFFER. No argument or nil as argument means do this for the current buffer. */) - (buffer) - register Lisp_Object buffer; + (register Lisp_Object buffer) { Lisp_Object real_buffer; @@ -1404,8 +1371,7 @@ is running. Any processes that have this buffer as the `process-buffer' are killed with SIGHUP. */) - (buffer_or_name) - Lisp_Object buffer_or_name; + (Lisp_Object buffer_or_name) { Lisp_Object buffer; register struct buffer *b; @@ -1618,8 +1584,7 @@ with SIGHUP. */) means that other_buffer is more likely to choose a relevant buffer. */ void -record_buffer (buf) - Lisp_Object buf; +record_buffer (Lisp_Object buf) { register Lisp_Object link, prev; Lisp_Object frame; @@ -1695,8 +1660,7 @@ For the *scratch* buffer, use `initial-major-mode', otherwise choose a mode according to `default-major-mode'. Use this function before selecting the buffer, since it may need to inspect the current buffer's major mode. */) - (buffer) - Lisp_Object buffer; + (Lisp_Object buffer) { int count; Lisp_Object function; @@ -1734,8 +1698,7 @@ the current buffer's major mode. */) If NORECORD is non-nil, don't call record_buffer. */ Lisp_Object -switch_to_buffer_1 (buffer_or_name, norecord) - Lisp_Object buffer_or_name, norecord; +switch_to_buffer_1 (Lisp_Object buffer_or_name, Lisp_Object norecord) { register Lisp_Object buffer; @@ -1784,8 +1747,7 @@ its buffer, use `pop-to-buffer' for displaying the buffer. WARNING: This is NOT the way to work on another buffer temporarily within a Lisp program! Use `set-buffer' instead. That avoids messing with the window-buffer correspondences. */) - (buffer_or_name, norecord) - Lisp_Object buffer_or_name, norecord; + (Lisp_Object buffer_or_name, Lisp_Object norecord) { if (EQ (buffer_or_name, Fwindow_buffer (selected_window))) { @@ -1814,7 +1776,7 @@ messing with the window-buffer correspondences. */) DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0, doc: /* Return the current buffer as a Lisp object. */) - () + (void) { register Lisp_Object buf; XSETBUFFER (buf, current_buffer); @@ -1831,8 +1793,7 @@ DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0, time, and that increments windows_or_buffers_changed. */ void -set_buffer_internal (b) - register struct buffer *b; +set_buffer_internal (register struct buffer *b) { if (current_buffer != b) set_buffer_internal_1 (b); @@ -1842,8 +1803,7 @@ set_buffer_internal (b) This is used by redisplay. */ void -set_buffer_internal_1 (b) - register struct buffer *b; +set_buffer_internal_1 (register struct buffer *b) { register struct buffer *old_buf; register Lisp_Object tail; @@ -1939,8 +1899,7 @@ set_buffer_internal_1 (b) This avoids certain things that don't need to be done within redisplay. */ void -set_buffer_temp (b) - struct buffer *b; +set_buffer_temp (struct buffer *b) { register struct buffer *old_buf; @@ -2003,8 +1962,7 @@ also `save-excursion' when you want to make a buffer current temporarily. This function does not display the buffer, so its effect ends when the current command terminates. Use `switch-to-buffer' or `pop-to-buffer' to switch buffers permanently. */) - (buffer_or_name) - register Lisp_Object buffer_or_name; + (register Lisp_Object buffer_or_name) { register Lisp_Object buffer; buffer = Fget_buffer (buffer_or_name); @@ -2019,8 +1977,7 @@ ends when the current command terminates. Use `switch-to-buffer' or /* Set the current buffer to BUFFER provided it is alive. */ Lisp_Object -set_buffer_if_live (buffer) - Lisp_Object buffer; +set_buffer_if_live (Lisp_Object buffer) { if (! NILP (XBUFFER (buffer)->name)) Fset_buffer (buffer); @@ -2030,7 +1987,7 @@ set_buffer_if_live (buffer) DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, Sbarf_if_buffer_read_only, 0, 0, 0, doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) - () + (void) { if (!NILP (current_buffer->read_only) && NILP (Vinhibit_read_only)) @@ -2050,8 +2007,7 @@ from the selected window if it is displayed there. If the selected window is dedicated to its buffer, delete that window if there are other windows on the same frame. If the selected window is the only window on its frame, iconify that frame. */) - (buffer_or_name) - register Lisp_Object buffer_or_name; + (register Lisp_Object buffer_or_name) { Lisp_Object buffer; @@ -2105,7 +2061,7 @@ DEFUN ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*", doc: /* Delete the entire contents of the current buffer. Any narrowing restriction in effect (see `narrow-to-region') is removed, so the buffer is truly empty after this. */) - () + (void) { Fwiden (); @@ -2120,8 +2076,7 @@ so the buffer is truly empty after this. */) } void -validate_region (b, e) - register Lisp_Object *b, *e; +validate_region (register Lisp_Object *b, register Lisp_Object *e) { CHECK_NUMBER_COERCE_MARKER (*b); CHECK_NUMBER_COERCE_MARKER (*e); @@ -2141,8 +2096,7 @@ validate_region (b, e) and return the adjusted position. */ static int -advance_to_char_boundary (byte_pos) - int byte_pos; +advance_to_char_boundary (int byte_pos) { int c; @@ -2175,14 +2129,13 @@ advance_to_char_boundary (byte_pos) } #ifdef REL_ALLOC -extern void r_alloc_reset_variable P_ ((POINTER_TYPE *, POINTER_TYPE *)); +extern void r_alloc_reset_variable (POINTER_TYPE *, POINTER_TYPE *); #endif /* REL_ALLOC */ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, 1, 1, 0, doc: /* Swap the text between current buffer and BUFFER. */) - (buffer) - Lisp_Object buffer; + (Lisp_Object buffer) { struct buffer *other_buffer; CHECK_BUFFER (buffer); @@ -2320,8 +2273,7 @@ If FLAG is `to', this makes the buffer a multibyte buffer by changing all eight-bit bytes to eight-bit characters. If the multibyte flag was really changed, undo information of the current buffer is cleared. */) - (flag) - Lisp_Object flag; + (Lisp_Object flag) { struct Lisp_Marker *tail, *markers; struct buffer *other; @@ -2588,7 +2540,6 @@ current buffer is cleared. */) if (!modified_p && !NILP (Fbuffer_modified_p (Qnil))) Fset_buffer_modified_p (Qnil); -#ifdef subprocesses /* Update coding systems of this buffer's process (if any). */ { Lisp_Object process; @@ -2597,7 +2548,6 @@ current buffer is cleared. */) if (PROCESSP (process)) setup_process_coding_systems (process); } -#endif /* subprocesses */ return flag; } @@ -2619,7 +2569,7 @@ a non-nil `permanent-local' property are not eliminated by this function. The first thing this function does is run the normal hook `change-major-mode-hook'. */) - () + (void) { if (!NILP (Vrun_hooks)) call1 (Vrun_hooks, Qchange_major_mode_hook); @@ -2644,8 +2594,7 @@ the normal hook `change-major-mode-hook'. */) for their current values. */ static void -swap_out_buffer_local_variables (b) - struct buffer *b; +swap_out_buffer_local_variables (struct buffer *b) { Lisp_Object oalist, alist, buffer; @@ -2690,14 +2639,8 @@ swap_out_buffer_local_variables (b) default (BEGV or ZV). */ int -overlays_at (pos, extend, vec_ptr, len_ptr, next_ptr, prev_ptr, change_req) - EMACS_INT pos; - int extend; - Lisp_Object **vec_ptr; - int *len_ptr; - EMACS_INT *next_ptr; - EMACS_INT *prev_ptr; - int change_req; +overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, int *len_ptr, + EMACS_INT *next_ptr, EMACS_INT *prev_ptr, int change_req) { Lisp_Object overlay, start, end; struct Lisp_Overlay *tail; @@ -2835,13 +2778,8 @@ overlays_at (pos, extend, vec_ptr, len_ptr, next_ptr, prev_ptr, change_req) But we still return the total number of overlays. */ static int -overlays_in (beg, end, extend, vec_ptr, len_ptr, next_ptr, prev_ptr) - int beg, end; - int extend; - Lisp_Object **vec_ptr; - int *len_ptr; - int *next_ptr; - int *prev_ptr; +overlays_in (int beg, int end, int extend, Lisp_Object **vec_ptr, int *len_ptr, + int *next_ptr, int *prev_ptr) { Lisp_Object overlay, ostart, oend; struct Lisp_Overlay *tail; @@ -2962,8 +2900,7 @@ overlays_in (beg, end, extend, vec_ptr, len_ptr, next_ptr, prev_ptr) `mouse-face' property overlapping OVERLAY. */ int -mouse_face_overlay_overlaps (overlay) - Lisp_Object overlay; +mouse_face_overlay_overlaps (Lisp_Object overlay) { int start = OVERLAY_POSITION (OVERLAY_START (overlay)); int end = OVERLAY_POSITION (OVERLAY_END (overlay)); @@ -2992,8 +2929,7 @@ mouse_face_overlay_overlaps (overlay) /* Fast function to just test if we're at an overlay boundary. */ int -overlay_touches_p (pos) - int pos; +overlay_touches_p (int pos) { Lisp_Object overlay; struct Lisp_Overlay *tail; @@ -3038,8 +2974,7 @@ struct sortvec }; static int -compare_overlays (v1, v2) - const void *v1, *v2; +compare_overlays (const void *v1, const void *v2) { const struct sortvec *s1 = (const struct sortvec *) v1; const struct sortvec *s2 = (const struct sortvec *) v2; @@ -3056,10 +2991,7 @@ compare_overlays (v1, v2) The return value is the new size; this may be smaller than the original size if some of the overlays were invalid or were window-specific. */ int -sort_overlays (overlay_vec, noverlays, w) - Lisp_Object *overlay_vec; - int noverlays; - struct window *w; +sort_overlays (Lisp_Object *overlay_vec, int noverlays, struct window *w) { int i, j; struct sortvec *sortvec; @@ -3139,8 +3071,7 @@ static int overlay_str_len; /* A comparison function suitable for passing to qsort. */ static int -cmp_for_strings (as1, as2) - char *as1, *as2; +cmp_for_strings (const void *as1, const void *as2) { struct sortstr *s1 = (struct sortstr *)as1; struct sortstr *s2 = (struct sortstr *)as2; @@ -3152,10 +3083,7 @@ cmp_for_strings (as1, as2) } static void -record_overlay_string (ssl, str, str2, pri, size) - struct sortstrlist *ssl; - Lisp_Object str, str2, pri; - int size; +record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str2, Lisp_Object pri, int size) { int nbytes; @@ -3211,10 +3139,7 @@ record_overlay_string (ssl, str, str2, pri, size) subsequent calls. */ int -overlay_strings (pos, w, pstr) - EMACS_INT pos; - struct window *w; - unsigned char **pstr; +overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) { Lisp_Object overlay, window, str; struct Lisp_Overlay *ov; @@ -3337,9 +3262,7 @@ overlay_strings (pos, w, pstr) /* Shift overlays in BUF's overlay lists, to center the lists at POS. */ void -recenter_overlay_lists (buf, pos) - struct buffer *buf; - EMACS_INT pos; +recenter_overlay_lists (struct buffer *buf, EMACS_INT pos) { Lisp_Object overlay, beg, end; struct Lisp_Overlay *prev, *tail, *next; @@ -3488,9 +3411,7 @@ recenter_overlay_lists (buf, pos) } void -adjust_overlays_for_insert (pos, length) - EMACS_INT pos; - EMACS_INT length; +adjust_overlays_for_insert (EMACS_INT pos, EMACS_INT length) { /* After an insertion, the lists are still sorted properly, but we may need to update the value of the overlay center. */ @@ -3499,9 +3420,7 @@ adjust_overlays_for_insert (pos, length) } void -adjust_overlays_for_delete (pos, length) - EMACS_INT pos; - EMACS_INT length; +adjust_overlays_for_delete (EMACS_INT pos, EMACS_INT length) { if (current_buffer->overlay_center < pos) /* The deletion was to our right. No change needed; the before- and @@ -3526,8 +3445,7 @@ adjust_overlays_for_delete (pos, length) Such an overlay might even have negative size at this point. If so, we'll make the overlay empty. */ void -fix_start_end_in_overlays (start, end) - register int start, end; +fix_start_end_in_overlays (register int start, register int end) { Lisp_Object overlay; struct Lisp_Overlay *before_list, *after_list; @@ -3673,9 +3591,7 @@ fix_start_end_in_overlays (start, end) was at PREV, and now is at POS. */ void -fix_overlays_before (bp, prev, pos) - struct buffer *bp; - EMACS_INT prev, pos; +fix_overlays_before (struct buffer *bp, EMACS_INT prev, EMACS_INT pos) { /* If parent is nil, replace overlays_before; otherwise, parent->next. */ struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair; @@ -3754,8 +3670,7 @@ fix_overlays_before (bp, prev, pos) DEFUN ("overlayp", Foverlayp, Soverlayp, 1, 1, 0, doc: /* Return t if OBJECT is an overlay. */) - (object) - Lisp_Object object; + (Lisp_Object object) { return (OVERLAYP (object) ? Qt : Qnil); } @@ -3770,9 +3685,7 @@ for the front of the overlay advance when text is inserted there The fifth arg REAR-ADVANCE, if non-nil, makes the marker for the rear of the overlay advance when text is inserted there \(which means the text *is* included in the overlay). */) - (beg, end, buffer, front_advance, rear_advance) - Lisp_Object beg, end, buffer; - Lisp_Object front_advance, rear_advance; + (Lisp_Object beg, Lisp_Object end, Lisp_Object buffer, Lisp_Object front_advance, Lisp_Object rear_advance) { Lisp_Object overlay; struct buffer *b; @@ -3841,9 +3754,7 @@ for the rear of the overlay advance when text is inserted there /* Mark a section of BUF as needing redisplay because of overlays changes. */ static void -modify_overlay (buf, start, end) - struct buffer *buf; - EMACS_INT start, end; +modify_overlay (struct buffer *buf, EMACS_INT start, EMACS_INT end) { if (start > end) { @@ -3870,11 +3781,10 @@ modify_overlay (buf, start, end) } -Lisp_Object Fdelete_overlay (); +Lisp_Object Fdelete_overlay (Lisp_Object overlay); static struct Lisp_Overlay * -unchain_overlay (list, overlay) - struct Lisp_Overlay *list, *overlay; +unchain_overlay (struct Lisp_Overlay *list, struct Lisp_Overlay *overlay) { struct Lisp_Overlay *tmp, *prev; for (tmp = list, prev = NULL; tmp; prev = tmp, tmp = tmp->next) @@ -3895,8 +3805,7 @@ DEFUN ("move-overlay", Fmove_overlay, Smove_overlay, 3, 4, 0, If BUFFER is omitted, leave OVERLAY in the same buffer it inhabits now. If BUFFER is omitted, and OVERLAY is in no buffer, put it in the current buffer. */) - (overlay, beg, end, buffer) - Lisp_Object overlay, beg, end, buffer; + (Lisp_Object overlay, Lisp_Object beg, Lisp_Object end, Lisp_Object buffer) { struct buffer *b, *ob; Lisp_Object obuffer; @@ -4005,8 +3914,7 @@ buffer. */) DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, doc: /* Delete the overlay OVERLAY from its buffer. */) - (overlay) - Lisp_Object overlay; + (Lisp_Object overlay) { Lisp_Object buffer; struct buffer *b; @@ -4046,8 +3954,7 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, DEFUN ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0, doc: /* Return the position at which OVERLAY starts. */) - (overlay) - Lisp_Object overlay; + (Lisp_Object overlay) { CHECK_OVERLAY (overlay); @@ -4056,8 +3963,7 @@ DEFUN ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0, DEFUN ("overlay-end", Foverlay_end, Soverlay_end, 1, 1, 0, doc: /* Return the position at which OVERLAY ends. */) - (overlay) - Lisp_Object overlay; + (Lisp_Object overlay) { CHECK_OVERLAY (overlay); @@ -4067,8 +3973,7 @@ DEFUN ("overlay-end", Foverlay_end, Soverlay_end, 1, 1, 0, DEFUN ("overlay-buffer", Foverlay_buffer, Soverlay_buffer, 1, 1, 0, doc: /* Return the buffer OVERLAY belongs to. Return nil if OVERLAY has been deleted. */) - (overlay) - Lisp_Object overlay; + (Lisp_Object overlay) { CHECK_OVERLAY (overlay); @@ -4079,8 +3984,7 @@ DEFUN ("overlay-properties", Foverlay_properties, Soverlay_properties, 1, 1, 0, doc: /* Return a list of the properties on OVERLAY. This is a copy of OVERLAY's plist; modifying its conses has no effect on OVERLAY. */) - (overlay) - Lisp_Object overlay; + (Lisp_Object overlay) { CHECK_OVERLAY (overlay); @@ -4090,8 +3994,7 @@ OVERLAY. */) DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, doc: /* Return a list of the overlays that contain the character at POS. */) - (pos) - Lisp_Object pos; + (Lisp_Object pos) { int noverlays; Lisp_Object *overlay_vec; @@ -4123,8 +4026,7 @@ and also contained within the specified region. Empty overlays are included in the result if they are located at BEG, between BEG and END, or at END provided END denotes the position at the end of the buffer. */) - (beg, end) - Lisp_Object beg, end; + (Lisp_Object beg, Lisp_Object end) { int noverlays; Lisp_Object *overlay_vec; @@ -4154,8 +4056,7 @@ DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change, doc: /* Return the next position after POS where an overlay starts or ends. If there are no overlay boundaries from POS to (point-max), the value is (point-max). */) - (pos) - Lisp_Object pos; + (Lisp_Object pos) { int noverlays; EMACS_INT endpos; @@ -4196,8 +4097,7 @@ DEFUN ("previous-overlay-change", Fprevious_overlay_change, doc: /* Return the previous position before POS where an overlay starts or ends. If there are no overlay boundaries from (point-min) to POS, the value is (point-min). */) - (pos) - Lisp_Object pos; + (Lisp_Object pos) { int noverlays; EMACS_INT prevpos; @@ -4233,7 +4133,7 @@ the cdr has all the overlays after the overlay center. Recentering overlays moves overlays between these lists. The lists you get are copies, so that changing them has no effect. However, the overlays you get are the real objects that the buffer uses. */) - () + (void) { struct Lisp_Overlay *ol; Lisp_Object before = Qnil, after = Qnil, tmp; @@ -4254,8 +4154,7 @@ DEFUN ("overlay-recenter", Foverlay_recenter, Soverlay_recenter, 1, 1, 0, doc: /* Recenter the overlays of the current buffer around position POS. That makes overlay lookup faster for positions near POS (but perhaps slower for positions far away from POS). */) - (pos) - Lisp_Object pos; + (Lisp_Object pos) { CHECK_NUMBER_COERCE_MARKER (pos); @@ -4265,8 +4164,7 @@ for positions far away from POS). */) DEFUN ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0, doc: /* Get the property of overlay OVERLAY with property name PROP. */) - (overlay, prop) - Lisp_Object overlay, prop; + (Lisp_Object overlay, Lisp_Object prop) { CHECK_OVERLAY (overlay); return lookup_char_property (XOVERLAY (overlay)->plist, prop, 0); @@ -4274,8 +4172,7 @@ DEFUN ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0, DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0, doc: /* Set one property of overlay OVERLAY: give property PROP value VALUE. */) - (overlay, prop, value) - Lisp_Object overlay, prop, value; + (Lisp_Object overlay, Lisp_Object prop, Lisp_Object value) { Lisp_Object tail, buffer; int changed; @@ -4333,8 +4230,7 @@ static int last_overlay_modification_hooks_used; to the end of last_overlay_modification_hooks. */ static void -add_overlay_mod_hooklist (functionlist, overlay) - Lisp_Object functionlist, overlay; +add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay) { int oldsize = XVECTOR (last_overlay_modification_hooks)->size; @@ -4362,10 +4258,8 @@ add_overlay_mod_hooklist (functionlist, overlay) and the length of deleted or replaced old text. */ void -report_overlay_modification (start, end, after, arg1, arg2, arg3) - Lisp_Object start, end; - int after; - Lisp_Object arg1, arg2, arg3; +report_overlay_modification (Lisp_Object start, Lisp_Object end, int after, + Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) { Lisp_Object prop, overlay; struct Lisp_Overlay *tail; @@ -4473,8 +4367,8 @@ report_overlay_modification (start, end, after, arg1, arg2, arg3) Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object)); int i; - bcopy (XVECTOR (last_overlay_modification_hooks)->contents, - copy, size * sizeof (Lisp_Object)); + memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, + size * sizeof (Lisp_Object)); gcpro1.var = copy; gcpro1.nvars = size; @@ -4490,10 +4384,8 @@ report_overlay_modification (start, end, after, arg1, arg2, arg3) } static void -call_overlay_mod_hooks (list, overlay, after, arg1, arg2, arg3) - Lisp_Object list, overlay; - int after; - Lisp_Object arg1, arg2, arg3; +call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, int after, + Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) { struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; @@ -4513,8 +4405,7 @@ call_overlay_mod_hooks (list, overlay, after, arg1, arg2, arg3) /* Delete any zero-sized overlays at position POS, if the `evaporate' property is set. */ void -evaporate_overlays (pos) - EMACS_INT pos; +evaporate_overlays (EMACS_INT pos) { Lisp_Object overlay, hit_list; struct Lisp_Overlay *tail; @@ -4552,9 +4443,7 @@ evaporate_overlays (pos) in the slot with offset OFFSET. */ void -buffer_slot_type_mismatch (newval, type) - Lisp_Object newval; - int type; +buffer_slot_type_mismatch (Lisp_Object newval, int type) { Lisp_Object predicate; @@ -4693,13 +4582,13 @@ static int mmap_initialized_p; /* Function prototypes. */ -static int mmap_free_1 P_ ((struct mmap_region *)); -static int mmap_enlarge P_ ((struct mmap_region *, int)); -static struct mmap_region *mmap_find P_ ((POINTER_TYPE *, POINTER_TYPE *)); -static POINTER_TYPE *mmap_alloc P_ ((POINTER_TYPE **, size_t)); -static POINTER_TYPE *mmap_realloc P_ ((POINTER_TYPE **, size_t)); -static void mmap_free P_ ((POINTER_TYPE **ptr)); -static void mmap_init P_ ((void)); +static int mmap_free_1 (struct mmap_region *); +static int mmap_enlarge (struct mmap_region *, int); +static struct mmap_region *mmap_find (POINTER_TYPE *, POINTER_TYPE *); +static POINTER_TYPE *mmap_alloc (POINTER_TYPE **, size_t); +static POINTER_TYPE *mmap_realloc (POINTER_TYPE **, size_t); +static void mmap_free (POINTER_TYPE **ptr); +static void mmap_init (void); /* Return a region overlapping address range START...END, or null if @@ -4942,7 +4831,7 @@ mmap_realloc (var, nbytes) } else if (mmap_alloc (var, nbytes)) { - bcopy (old_ptr, *var, r->nbytes_specified); + memcpy (*var, old_ptr, r->nbytes_specified); mmap_free_1 (MMAP_REGION (old_ptr)); result = *var; r = MMAP_REGION (result); @@ -5032,18 +4921,16 @@ mmap_init () ***********************************************************************/ #ifdef REL_ALLOC -extern POINTER_TYPE *r_alloc P_ ((POINTER_TYPE **, size_t)); -extern POINTER_TYPE *r_re_alloc P_ ((POINTER_TYPE **, size_t)); -extern void r_alloc_free P_ ((POINTER_TYPE **ptr)); +extern POINTER_TYPE *r_alloc (POINTER_TYPE **, size_t); +extern POINTER_TYPE *r_re_alloc (POINTER_TYPE **, size_t); +extern void r_alloc_free (POINTER_TYPE **ptr); #endif /* REL_ALLOC */ /* Allocate NBYTES bytes for buffer B's text buffer. */ static void -alloc_buffer_text (b, nbytes) - struct buffer *b; - size_t nbytes; +alloc_buffer_text (struct buffer *b, size_t nbytes) { POINTER_TYPE *p; @@ -5098,8 +4985,7 @@ enlarge_buffer_text (struct buffer *b, EMACS_INT delta) /* Free buffer B's text buffer. */ static void -free_buffer_text (b) - struct buffer *b; +free_buffer_text (struct buffer *b) { BLOCK_INPUT; @@ -5122,11 +5008,11 @@ free_buffer_text (b) ***********************************************************************/ void -init_buffer_once () +init_buffer_once (void) { int idx; - bzero (buffer_permanent_local_flags, sizeof buffer_permanent_local_flags); + memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags); /* Make sure all markable slots in buffer_defaults are initialized reasonably, so mark_buffer won't choke. */ @@ -5214,7 +5100,7 @@ init_buffer_once () if (sizeof (EMACS_INT) != sizeof (Lisp_Object)) abort (); /* 0 means not a lisp var, -1 means always local, else mask */ - bzero (&buffer_local_flags, sizeof buffer_local_flags); + memset (&buffer_local_flags, 0, sizeof buffer_local_flags); XSETINT (buffer_local_flags.filename, -1); XSETINT (buffer_local_flags.directory, -1); XSETINT (buffer_local_flags.backed_up, -1); @@ -5318,7 +5204,7 @@ init_buffer_once () } void -init_buffer () +init_buffer (void) { char *pwd; Lisp_Object temp; @@ -5402,12 +5288,8 @@ init_buffer () } while (0) static void -defvar_per_buffer (bo_fwd, namestring, address, type, doc) - struct Lisp_Buffer_Objfwd *bo_fwd; - char *namestring; - Lisp_Object *address; - Lisp_Object type; - char *doc; +defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, char *namestring, + Lisp_Object *address, Lisp_Object type, char *doc) { struct Lisp_Symbol *sym; int offset; @@ -5436,7 +5318,7 @@ defvar_per_buffer (bo_fwd, namestring, address, type, doc) /* initialize the buffer routines */ void -syms_of_buffer () +syms_of_buffer (void) { staticpro (&last_overlay_modification_hooks); last_overlay_modification_hooks @@ -6339,7 +6221,7 @@ The function `kill-all-local-variables' runs this before doing anything else. * } void -keys_of_buffer () +keys_of_buffer (void) { initial_define_key (control_x_map, 'b', "switch-to-buffer"); initial_define_key (control_x_map, 'k', "kill-buffer"); diff --git a/src/buffer.h b/src/buffer.h index d03152abd85..339e7d9bb6d 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -225,12 +225,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define BUF_TEMP_SET_PT(buffer, position) \ (temp_set_point ((buffer), (position))) -extern void set_point P_ ((EMACS_INT)); -extern INLINE void temp_set_point P_ ((struct buffer *, EMACS_INT)); -extern void set_point_both P_ ((EMACS_INT, EMACS_INT)); -extern INLINE void temp_set_point_both P_ ((struct buffer *, - EMACS_INT, EMACS_INT)); -extern void enlarge_buffer_text P_ ((struct buffer *, EMACS_INT)); +extern void set_point (EMACS_INT); +extern INLINE void temp_set_point (struct buffer *, EMACS_INT); +extern void set_point_both (EMACS_INT, EMACS_INT); +extern INLINE void temp_set_point_both (struct buffer *, + EMACS_INT, EMACS_INT); +extern void enlarge_buffer_text (struct buffer *, EMACS_INT); /* Macros for setting the BEGV, ZV or PT of a given buffer. @@ -857,23 +857,23 @@ extern struct buffer buffer_local_flags; extern struct buffer buffer_local_symbols; -extern void delete_all_overlays P_ ((struct buffer *)); -extern void reset_buffer P_ ((struct buffer *)); -extern void evaporate_overlays P_ ((EMACS_INT)); -extern int overlays_at P_ ((EMACS_INT pos, int extend, Lisp_Object **vec_ptr, - int *len_ptr, EMACS_INT *next_ptr, - EMACS_INT *prev_ptr, int change_req)); -extern int sort_overlays P_ ((Lisp_Object *, int, struct window *)); -extern void recenter_overlay_lists P_ ((struct buffer *, EMACS_INT)); -extern int overlay_strings P_ ((EMACS_INT, struct window *, unsigned char **)); -extern void validate_region P_ ((Lisp_Object *, Lisp_Object *)); -extern void set_buffer_internal P_ ((struct buffer *)); -extern void set_buffer_internal_1 P_ ((struct buffer *)); -extern void set_buffer_temp P_ ((struct buffer *)); -extern void record_buffer P_ ((Lisp_Object)); -extern void buffer_slot_type_mismatch P_ ((Lisp_Object, int)) NO_RETURN; -extern void fix_overlays_before P_ ((struct buffer *, EMACS_INT, EMACS_INT)); -extern void mmap_set_vars P_ ((int)); +extern void delete_all_overlays (struct buffer *); +extern void reset_buffer (struct buffer *); +extern void evaporate_overlays (EMACS_INT); +extern int overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, + int *len_ptr, EMACS_INT *next_ptr, + EMACS_INT *prev_ptr, int change_req); +extern int sort_overlays (Lisp_Object *, int, struct window *); +extern void recenter_overlay_lists (struct buffer *, EMACS_INT); +extern int overlay_strings (EMACS_INT, struct window *, unsigned char **); +extern void validate_region (Lisp_Object *, Lisp_Object *); +extern void set_buffer_internal (struct buffer *); +extern void set_buffer_internal_1 (struct buffer *); +extern void set_buffer_temp (struct buffer *); +extern void record_buffer (Lisp_Object); +extern void buffer_slot_type_mismatch (Lisp_Object, int) NO_RETURN; +extern void fix_overlays_before (struct buffer *, EMACS_INT, EMACS_INT); +extern void mmap_set_vars (int); /* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements. If NEXTP is non-NULL, return next overlay there. @@ -954,7 +954,7 @@ extern int last_per_buffer_idx; from the start of a buffer structure. */ #define PER_BUFFER_VAR_OFFSET(VAR) \ - ((char *) &((struct buffer *)0)->VAR - (char *) ((struct buffer *)0)) + offsetof (struct buffer, VAR) /* Return the index of buffer-local variable VAR. Each per-buffer variable has an index > 0 associated with it, except when it always diff --git a/src/bytecode.c b/src/bytecode.c index 192d397c45f..d94b19b2d07 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -281,7 +281,7 @@ struct byte_stack *byte_stack_list; /* Mark objects on byte_stack_list. Called during GC. */ void -mark_byte_stack () +mark_byte_stack (void) { struct byte_stack *stack; Lisp_Object *obj; @@ -310,7 +310,7 @@ mark_byte_stack () counters. Called when GC has completed. */ void -unmark_byte_stack () +unmark_byte_stack (void) { struct byte_stack *stack; @@ -418,9 +418,7 @@ according to which any remaining arguments are pushed on the stack before executing BYTESTR. usage: (byte-code BYTESTR VECTOR MAXDEP &optional ARGS-TEMPLATE &rest ARGS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { Lisp_Object args_tmpl = nargs >= 4 ? args[3] : Qnil; int pnargs = nargs >= 4 ? nargs - 4 : 0; @@ -437,10 +435,8 @@ usage: (byte-code BYTESTR VECTOR MAXDEP &optional ARGS-TEMPLATE &rest ARGS) */) executing BYTESTR. */ Lisp_Object -exec_byte_code (bytestr, vector, maxdepth, args_template, nargs, args) - Lisp_Object bytestr, vector, maxdepth, args_template; - int nargs; - Lisp_Object *args; +exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, + Lisp_Object args_template, int nargs, Lisp_Object *args) { int count = SPECPDL_INDEX (); #ifdef BYTE_CODE_METER @@ -1794,7 +1790,7 @@ exec_byte_code (bytestr, vector, maxdepth, args_template, nargs, args) } void -syms_of_bytecode () +syms_of_bytecode (void) { Qbytecode = intern_c_string ("byte-code"); staticpro (&Qbytecode); diff --git a/src/callint.c b/src/callint.c index a45f8a372b8..fa0be112bea 100644 --- a/src/callint.c +++ b/src/callint.c @@ -29,10 +29,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "window.h" #include "keymap.h" -#ifdef HAVE_INDEX -extern char *index P_ ((const char *, int)); -#endif - extern Lisp_Object Qcursor_in_echo_area; extern Lisp_Object Qfile_directory_p; extern Lisp_Object Qonly; @@ -131,8 +127,7 @@ If the string begins with `^' and `shift-select-mode' is non-nil, You may use `@', `*', and `^' together. They are processed in the order that they appear, before reading any arguments. usage: (interactive &optional ARGS) */) - (args) - Lisp_Object args; + (Lisp_Object args) { return Qnil; } @@ -140,8 +135,7 @@ usage: (interactive &optional ARGS) */) /* Quotify EXP: if EXP is constant, return it. If EXP is not constant, return (quote EXP). */ Lisp_Object -quotify_arg (exp) - register Lisp_Object exp; +quotify_arg (register Lisp_Object exp) { if (!INTEGERP (exp) && !STRINGP (exp) && !NILP (exp) && !EQ (exp, Qt)) @@ -152,8 +146,7 @@ quotify_arg (exp) /* Modify EXP by quotifying each element (except the first). */ Lisp_Object -quotify_args (exp) - Lisp_Object exp; +quotify_args (Lisp_Object exp) { register Lisp_Object tail; Lisp_Object next; @@ -169,8 +162,7 @@ char *callint_argfuns[] = {"", "point", "mark", "region-beginning", "region-end"}; static void -check_mark (for_region) - int for_region; +check_mark (int for_region) { Lisp_Object tem; tem = Fmarker_buffer (current_buffer->mark); @@ -191,8 +183,7 @@ check_mark (for_region) of VALUES to do its job. */ static void -fix_command (input, values) - Lisp_Object input, values; +fix_command (Lisp_Object input, Lisp_Object values) { if (CONSP (input)) { @@ -267,8 +258,7 @@ Optional third arg KEYS, if given, specifies the sequence of events to supply, as a vector, if the command inquires which events were used to invoke it. If KEYS is omitted or nil, the return value of `this-command-keys-vector' is used. */) - (function, record_flag, keys) - Lisp_Object function, record_flag, keys; + (Lisp_Object function, Lisp_Object record_flag, Lisp_Object keys) { Lisp_Object *args, *visargs; Lisp_Object specs; @@ -352,8 +342,7 @@ invoke it. If KEYS is omitted or nil, the return value of /* Make a copy of string so that if a GC relocates specs, `string' will still be valid. */ string = (unsigned char *) alloca (SBYTES (specs) + 1); - bcopy (SDATA (specs), string, - SBYTES (specs) + 1); + memcpy (string, SDATA (specs), SBYTES (specs) + 1); } else { @@ -476,7 +465,7 @@ invoke it. If KEYS is omitted or nil, the return value of j += 2; else j++; - tem = (unsigned char *) index (tem, '\n'); + tem = (unsigned char *) strchr (tem, '\n'); if (tem) ++tem; else @@ -507,11 +496,11 @@ invoke it. If KEYS is omitted or nil, the return value of { strncpy (prompt1, tem + 1, sizeof prompt1 - 1); prompt1[sizeof prompt1 - 1] = 0; - tem1 = (char *) index (prompt1, '\n'); + tem1 = strchr (prompt1, '\n'); if (tem1) *tem1 = 0; visargs[0] = build_string (prompt1); - if (index (prompt1, '%')) + if (strchr (prompt1, '%')) callint_message = Fformat (i, visargs); else callint_message = visargs[0]; @@ -816,7 +805,7 @@ invoke it. If KEYS is omitted or nil, the return value of if (NILP (visargs[i]) && STRINGP (args[i])) visargs[i] = args[i]; - tem = (unsigned char *) index (tem, '\n'); + tem = (unsigned char *) strchr (tem, '\n'); if (tem) tem++; else tem = (unsigned char *) ""; } @@ -877,8 +866,7 @@ DEFUN ("prefix-numeric-value", Fprefix_numeric_value, Sprefix_numeric_value, doc: /* Return numeric meaning of raw prefix argument RAW. A raw prefix argument is what you get from `(interactive "P")'. Its numeric meaning is what you would get from `(interactive "p")'. */) - (raw) - Lisp_Object raw; + (Lisp_Object raw) { Lisp_Object val; @@ -897,7 +885,7 @@ Its numeric meaning is what you would get from `(interactive "p")'. */) } void -syms_of_callint () +syms_of_callint (void) { point_marker = Fmake_marker (); staticpro (&point_marker); diff --git a/src/callproc.c b/src/callproc.c index 82a5ebb90da..4286ab1ae29 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -137,8 +137,7 @@ static int call_process_exited; EXFUN (Fgetenv_internal, 2); static Lisp_Object -call_process_kill (fdpid) - Lisp_Object fdpid; +call_process_kill (Lisp_Object fdpid) { emacs_close (XFASTINT (Fcar (fdpid))); EMACS_KILLPG (XFASTINT (Fcdr (fdpid)), SIGKILL); @@ -147,8 +146,7 @@ call_process_kill (fdpid) } Lisp_Object -call_process_cleanup (arg) - Lisp_Object arg; +call_process_cleanup (Lisp_Object arg) { Lisp_Object fdpid = Fcdr (arg); #if defined (MSDOS) @@ -217,9 +215,7 @@ and returns a numeric exit status or a signal description string. If you quit, the process is killed with SIGINT, or SIGKILL if you quit again. usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { Lisp_Object infile, buffer, current_dir, path; int display_p; @@ -616,12 +612,6 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) { if (fd[0] >= 0) emacs_close (fd[0]); -#ifndef subprocesses - /* If Emacs has been built with asynchronous subprocess support, - we don't need to do this, I think because it will then have - the facilities for handling SIGCHLD. */ - wait_without_blocking (); -#endif /* subprocesses */ return Qnil; } @@ -777,10 +767,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) PT_BYTE + process_coding.produced); carryover = process_coding.carryover_bytes; if (carryover > 0) - /* As CARRYOVER should not be that large, we had - better avoid overhead of bcopy. */ - BCOPY_SHORT (process_coding.carryover, buf, - process_coding.carryover_bytes); + memcpy (buf, process_coding.carryover, + process_coding.carryover_bytes); } } @@ -817,8 +805,10 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) make_number (total_read)); } +#ifndef MSDOS /* Wait for it to terminate, unless it already has. */ wait_for_termination (pid); +#endif immediate_quit = 0; @@ -848,8 +838,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) } static Lisp_Object -delete_temp_file (name) - Lisp_Object name; +delete_temp_file (Lisp_Object name) { /* Suppress jka-compr handling, etc. */ int count = SPECPDL_INDEX (); @@ -882,9 +871,7 @@ and returns a numeric exit status or a signal description string. If you quit, the process is killed with SIGINT, or SIGKILL if you quit again. usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &rest ARGS) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { struct gcpro gcpro1; Lisp_Object filename_string; @@ -919,7 +906,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir); tempfile = (char *) alloca (SBYTES (pattern) + 1); - bcopy (SDATA (pattern), tempfile, SBYTES (pattern) + 1); + memcpy (tempfile, SDATA (pattern), SBYTES (pattern) + 1); coding_systems = Qt; #ifdef HAVE_MKSTEMP @@ -997,7 +984,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r RETURN_UNGCPRO (unbind_to (count, Fcall_process (nargs, args))); } -static int relocate_fd (); +static int relocate_fd (int fd, int minfd); static char ** add_env (char **env, char **new_env, char *string) @@ -1052,11 +1039,7 @@ add_env (char **env, char **new_env, char *string) executable directory by the parent. */ int -child_setup (in, out, err, new_argv, set_pgrp, current_dir) - int in, out, err; - register char **new_argv; - int set_pgrp; - Lisp_Object current_dir; +child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, Lisp_Object current_dir) { char **env; char *pwd_var; @@ -1067,19 +1050,9 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) int pid = getpid (); -#ifdef SET_EMACS_PRIORITY - { - extern EMACS_INT emacs_priority; - - if (emacs_priority < 0) - nice (- emacs_priority); - } -#endif - -#ifdef subprocesses /* Close Emacs's descriptors that this process should not have. */ close_process_descs (); -#endif + /* DOS_NT isn't in a vfork, so if we are in the middle of load-file, we will lose if we call close_load_descs here. */ #ifndef DOS_NT @@ -1106,8 +1079,8 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) pwd_var = (char *) alloca (i + 6); #endif temp = pwd_var + 4; - bcopy ("PWD=", pwd_var, 4); - bcopy (SDATA (current_dir), temp, i); + memcpy (pwd_var, "PWD=", 4); + memcpy (temp, SDATA (current_dir), i); if (!IS_DIRECTORY_SEP (temp[i - 1])) temp[i++] = DIRECTORY_SEP; temp[i] = 0; @@ -1244,8 +1217,10 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) dup2 (out, 1); dup2 (err, 2); emacs_close (in); - emacs_close (out); - emacs_close (err); + if (out != in) + emacs_close (out); + if (err != in && err != out) + emacs_close (err); #endif /* not MSDOS */ #endif /* not WINDOWSNT */ @@ -1293,39 +1268,40 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) /* Move the file descriptor FD so that its number is not less than MINFD. If the file descriptor is moved at all, the original is freed. */ static int -relocate_fd (fd, minfd) - int fd, minfd; +relocate_fd (int fd, int minfd) { if (fd >= minfd) return fd; else { - int new = dup (fd); + int new; +#ifdef F_DUPFD + new = fcntl (fd, F_DUPFD, minfd); +#else + new = dup (fd); + if (new != -1) + /* Note that we hold the original FD open while we recurse, + to guarantee we'll get a new FD if we need it. */ + new = relocate_fd (new, minfd); +#endif if (new == -1) { - char *message1 = "Error while setting up child: "; - char *errmessage = strerror (errno); - char *message2 = "\n"; + const char *message1 = "Error while setting up child: "; + const char *errmessage = strerror (errno); + const char *message2 = "\n"; emacs_write (2, message1, strlen (message1)); emacs_write (2, errmessage, strlen (errmessage)); emacs_write (2, message2, strlen (message2)); _exit (1); } - /* Note that we hold the original FD open while we recurse, - to guarantee we'll get a new FD if we need it. */ - new = relocate_fd (new, minfd); emacs_close (fd); return new; } } static int -getenv_internal_1 (var, varlen, value, valuelen, env) - char *var; - int varlen; - char **value; - int *valuelen; - Lisp_Object env; +getenv_internal_1 (const char *var, int varlen, char **value, int *valuelen, + Lisp_Object env) { for (; CONSP (env); env = XCDR (env)) { @@ -1336,7 +1312,7 @@ getenv_internal_1 (var, varlen, value, valuelen, env) /* NT environment variables are case insensitive. */ && ! strnicmp (SDATA (entry), var, varlen) #else /* not WINDOWSNT */ - && ! bcmp (SDATA (entry), var, varlen) + && ! memcmp (SDATA (entry), var, varlen) #endif /* not WINDOWSNT */ ) { @@ -1359,12 +1335,8 @@ getenv_internal_1 (var, varlen, value, valuelen, env) } static int -getenv_internal (var, varlen, value, valuelen, frame) - char *var; - int varlen; - char **value; - int *valuelen; - Lisp_Object frame; +getenv_internal (const char *var, int varlen, char **value, int *valuelen, + Lisp_Object frame) { /* Try to find VAR in Vprocess_environment first. */ if (getenv_internal_1 (var, varlen, value, valuelen, @@ -1401,8 +1373,7 @@ This function searches `process-environment' for VARIABLE. If optional parameter ENV is a list, then search this list instead of `process-environment', and return t when encountering a negative entry \(an entry for a variable with no value). */) - (variable, env) - Lisp_Object variable, env; + (Lisp_Object variable, Lisp_Object env) { char *value; int valuelen; @@ -1426,8 +1397,7 @@ If optional parameter ENV is a list, then search this list instead of /* A version of getenv that consults the Lisp environment lists, easily callable from C. */ char * -egetenv (var) - char *var; +egetenv (const char *var) { char *value; int valuelen; @@ -1442,7 +1412,7 @@ egetenv (var) /* This is run before init_cmdargs. */ void -init_callproc_1 () +init_callproc_1 (void) { char *data_dir = egetenv ("EMACSDATA"); char *doc_dir = egetenv ("EMACSDOC"); @@ -1464,7 +1434,7 @@ init_callproc_1 () /* This is run after init_cmdargs, when Vinstallation_directory is valid. */ void -init_callproc () +init_callproc (void) { char *data_dir = egetenv ("EMACSDATA"); @@ -1553,7 +1523,7 @@ init_callproc () } void -set_initial_environment () +set_initial_environment (void) { register char **envp; #ifndef CANNOT_DUMP @@ -1573,7 +1543,7 @@ set_initial_environment () } void -syms_of_callproc () +syms_of_callproc (void) { #ifdef DOS_NT Qbuffer_file_type = intern ("buffer-file-type"); diff --git a/src/casefiddle.c b/src/casefiddle.c index 30bb457b17d..9545cf697a8 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -33,9 +33,7 @@ enum case_action {CASE_UP, CASE_DOWN, CASE_CAPITALIZE, CASE_CAPITALIZE_UP}; Lisp_Object Qidentity; Lisp_Object -casify_object (flag, obj) - enum case_action flag; - Lisp_Object obj; +casify_object (enum case_action flag, Lisp_Object obj) { register int c, c1; register int inword = flag == CASE_DOWN; @@ -130,7 +128,7 @@ casify_object (flag, obj) unsigned char *old_dst = dst; o_size += o_size; /* Probably overkill, but extremely rare. */ SAFE_ALLOCA (dst, void *, o_size); - bcopy (old_dst, dst, o - old_dst); + memcpy (dst, old_dst, o - old_dst); o = dst + (o - old_dst); } c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len); @@ -155,8 +153,7 @@ DEFUN ("upcase", Fupcase, Supcase, 1, 1, 0, The argument may be a character or string. The result has the same type. The argument object is not altered--the value is a copy. See also `capitalize', `downcase' and `upcase-initials'. */) - (obj) - Lisp_Object obj; + (Lisp_Object obj) { return casify_object (CASE_UP, obj); } @@ -165,8 +162,7 @@ DEFUN ("downcase", Fdowncase, Sdowncase, 1, 1, 0, doc: /* Convert argument to lower case and return that. The argument may be a character or string. The result has the same type. The argument object is not altered--the value is a copy. */) - (obj) - Lisp_Object obj; + (Lisp_Object obj) { return casify_object (CASE_DOWN, obj); } @@ -177,8 +173,7 @@ This means that each word's first character is upper case and the rest is lower case. The argument may be a character or string. The result has the same type. The argument object is not altered--the value is a copy. */) - (obj) - Lisp_Object obj; + (Lisp_Object obj) { return casify_object (CASE_CAPITALIZE, obj); } @@ -190,8 +185,7 @@ DEFUN ("upcase-initials", Fupcase_initials, Supcase_initials, 1, 1, 0, Do not change the other letters of each word. The argument may be a character or string. The result has the same type. The argument object is not altered--the value is a copy. */) - (obj) - Lisp_Object obj; + (Lisp_Object obj) { return casify_object (CASE_CAPITALIZE_UP, obj); } @@ -200,9 +194,7 @@ The argument object is not altered--the value is a copy. */) b and e specify range of buffer to operate on. */ void -casify_region (flag, b, e) - enum case_action flag; - Lisp_Object b, e; +casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) { register int c; register int inword = flag == CASE_DOWN; @@ -310,8 +302,7 @@ These arguments specify the starting and ending character numbers of the region to operate on. When used as a command, the text between point and the mark is operated on. See also `capitalize-region'. */) - (beg, end) - Lisp_Object beg, end; + (Lisp_Object beg, Lisp_Object end) { casify_region (CASE_UP, beg, end); return Qnil; @@ -322,8 +313,7 @@ DEFUN ("downcase-region", Fdowncase_region, Sdowncase_region, 2, 2, "r", These arguments specify the starting and ending character numbers of the region to operate on. When used as a command, the text between point and the mark is operated on. */) - (beg, end) - Lisp_Object beg, end; + (Lisp_Object beg, Lisp_Object end) { casify_region (CASE_DOWN, beg, end); return Qnil; @@ -335,8 +325,7 @@ Capitalized form means each word's first character is upper case and the rest of it is lower case. In programs, give two arguments, the starting and ending character positions to operate on. */) - (beg, end) - Lisp_Object beg, end; + (Lisp_Object beg, Lisp_Object end) { casify_region (CASE_CAPITALIZE, beg, end); return Qnil; @@ -350,17 +339,14 @@ DEFUN ("upcase-initials-region", Fupcase_initials_region, Subsequent letters of each word are not changed. In programs, give two arguments, the starting and ending character positions to operate on. */) - (beg, end) - Lisp_Object beg, end; + (Lisp_Object beg, Lisp_Object end) { casify_region (CASE_CAPITALIZE_UP, beg, end); return Qnil; } static Lisp_Object -operate_on_word (arg, newpoint) - Lisp_Object arg; - EMACS_INT *newpoint; +operate_on_word (Lisp_Object arg, EMACS_INT *newpoint) { Lisp_Object val; int farend; @@ -382,8 +368,7 @@ DEFUN ("upcase-word", Fupcase_word, Supcase_word, 1, 1, "p", doc: /* Convert following word (or ARG words) to upper case, moving over. With negative argument, convert previous words but do not move. See also `capitalize-word'. */) - (arg) - Lisp_Object arg; + (Lisp_Object arg) { Lisp_Object beg, end; EMACS_INT newpoint; @@ -397,8 +382,7 @@ See also `capitalize-word'. */) DEFUN ("downcase-word", Fdowncase_word, Sdowncase_word, 1, 1, "p", doc: /* Convert following word (or ARG words) to lower case, moving over. With negative argument, convert previous words but do not move. */) - (arg) - Lisp_Object arg; + (Lisp_Object arg) { Lisp_Object beg, end; EMACS_INT newpoint; @@ -414,8 +398,7 @@ DEFUN ("capitalize-word", Fcapitalize_word, Scapitalize_word, 1, 1, "p", This gives the word(s) a first character in upper case and the rest lower case. With negative argument, capitalize previous words but do not move. */) - (arg) - Lisp_Object arg; + (Lisp_Object arg) { Lisp_Object beg, end; EMACS_INT newpoint; @@ -427,7 +410,7 @@ With negative argument, capitalize previous words but do not move. */) } void -syms_of_casefiddle () +syms_of_casefiddle (void) { Qidentity = intern_c_string ("identity"); staticpro (&Qidentity); @@ -445,7 +428,7 @@ syms_of_casefiddle () } void -keys_of_casefiddle () +keys_of_casefiddle (void) { initial_define_key (control_x_map, Ctl('U'), "upcase-region"); Fput (intern ("upcase-region"), Qdisabled, Qt); diff --git a/src/casetab.c b/src/casetab.c index e0a9ec49157..eed6e22087f 100644 --- a/src/casetab.c +++ b/src/casetab.c @@ -34,15 +34,14 @@ Lisp_Object Vascii_canon_table, Vascii_eqv_table; int case_temp1; Lisp_Object case_temp2; -static void set_canon (); -static void set_identity (); -static void shuffle (); +static void set_canon (Lisp_Object case_table, Lisp_Object range, Lisp_Object elt); +static void set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt); +static void shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt); DEFUN ("case-table-p", Fcase_table_p, Scase_table_p, 1, 1, 0, doc: /* Return t if OBJECT is a case table. See `set-case-table' for more information on these data structures. */) - (object) - Lisp_Object object; + (Lisp_Object object) { Lisp_Object up, canon, eqv; @@ -63,8 +62,7 @@ See `set-case-table' for more information on these data structures. */) } static Lisp_Object -check_case_table (obj) - Lisp_Object obj; +check_case_table (Lisp_Object obj) { CHECK_TYPE (!NILP (Fcase_table_p (obj)), Qcase_table_p, obj); return (obj); @@ -72,7 +70,7 @@ check_case_table (obj) DEFUN ("current-case-table", Fcurrent_case_table, Scurrent_case_table, 0, 0, 0, doc: /* Return the case table of the current buffer. */) - () + (void) { return current_buffer->downcase_table; } @@ -80,12 +78,12 @@ DEFUN ("current-case-table", Fcurrent_case_table, Scurrent_case_table, 0, 0, 0, DEFUN ("standard-case-table", Fstandard_case_table, Sstandard_case_table, 0, 0, 0, doc: /* Return the standard case table. This is the one used for new buffers. */) - () + (void) { return Vascii_downcase_table; } -static Lisp_Object set_case_table (); +static Lisp_Object set_case_table (Lisp_Object table, int standard); DEFUN ("set-case-table", Fset_case_table, Sset_case_table, 1, 1, 0, doc: /* Select a new case table for the current buffer. @@ -104,8 +102,7 @@ CANONICALIZE maps each character to a canonical equivalent; EQUIVALENCES is a map that cyclicly permutes each equivalence class (of characters with the same canonical equivalent); it may be nil, in which case it is deduced from CANONICALIZE. */) - (table) - Lisp_Object table; + (Lisp_Object table) { return set_case_table (table, 0); } @@ -113,16 +110,13 @@ EQUIVALENCES is a map that cyclicly permutes each equivalence class DEFUN ("set-standard-case-table", Fset_standard_case_table, Sset_standard_case_table, 1, 1, 0, doc: /* Select a new standard case table for new buffers. See `set-case-table' for more info on case tables. */) - (table) - Lisp_Object table; + (Lisp_Object table) { return set_case_table (table, 1); } static Lisp_Object -set_case_table (table, standard) - Lisp_Object table; - int standard; +set_case_table (Lisp_Object table, int standard) { Lisp_Object up, canon, eqv; @@ -184,8 +178,7 @@ set_case_table (table, standard) CASE_TABLE. */ static void -set_canon (case_table, range, elt) - Lisp_Object case_table, range, elt; +set_canon (Lisp_Object case_table, Lisp_Object range, Lisp_Object elt) { Lisp_Object up = XCHAR_TABLE (case_table)->extras[0]; Lisp_Object canon = XCHAR_TABLE (case_table)->extras[1]; @@ -200,8 +193,7 @@ set_canon (case_table, range, elt) character. This is called in map_char_table. */ static void -set_identity (table, c, elt) - Lisp_Object table, c, elt; +set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt) { if (NATNUMP (elt)) { @@ -225,8 +217,7 @@ set_identity (table, c, elt) operated. */ static void -shuffle (table, c, elt) - Lisp_Object table, c, elt; +shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt) { if (NATNUMP (elt)) { @@ -250,7 +241,7 @@ shuffle (table, c, elt) } void -init_casetab_once () +init_casetab_once (void) { register int i; Lisp_Object down, up; @@ -296,7 +287,7 @@ init_casetab_once () } void -syms_of_casetab () +syms_of_casetab (void) { Qcase_table_p = intern_c_string ("case-table-p"); staticpro (&Qcase_table_p); diff --git a/src/category.c b/src/category.c index b56d62b6b80..5c38f351d01 100644 --- a/src/category.c +++ b/src/category.c @@ -59,11 +59,10 @@ Lisp_Object _temp_category_set; /* Category set staff. */ -static Lisp_Object hash_get_category_set P_ ((Lisp_Object, Lisp_Object)); +static Lisp_Object hash_get_category_set (Lisp_Object, Lisp_Object); static Lisp_Object -hash_get_category_set (table, category_set) - Lisp_Object table, category_set; +hash_get_category_set (Lisp_Object table, Lisp_Object category_set) { Lisp_Object val; struct Lisp_Hash_Table *h; @@ -90,8 +89,7 @@ DEFUN ("make-category-set", Fmake_category_set, Smake_category_set, 1, 1, 0, CATEGORIES is a string of category mnemonics. The value is a bool-vector which has t at the indices corresponding to those categories. */) - (categories) - Lisp_Object categories; + (Lisp_Object categories) { Lisp_Object val; int len; @@ -117,7 +115,7 @@ those categories. */) /* Category staff. */ -Lisp_Object check_category_table (); +Lisp_Object check_category_table (Lisp_Object table); DEFUN ("define-category", Fdefine_category, Sdefine_category, 2, 3, 0, doc: /* Define CATEGORY as a category which is described by DOCSTRING. @@ -127,8 +125,7 @@ should be a terse text (preferably less than 16 characters), and the rest lines should be the full description. The category is defined only in category table TABLE, which defaults to the current buffer's category table. */) - (category, docstring, table) - Lisp_Object category, docstring, table; + (Lisp_Object category, Lisp_Object docstring, Lisp_Object table) { CHECK_CATEGORY (category); CHECK_STRING (docstring); @@ -147,8 +144,7 @@ DEFUN ("category-docstring", Fcategory_docstring, Scategory_docstring, 1, 2, 0, doc: /* Return the documentation string of CATEGORY, as defined in TABLE. TABLE should be a category table and defaults to the current buffer's category table. */) - (category, table) - Lisp_Object category, table; + (Lisp_Object category, Lisp_Object table) { CHECK_CATEGORY (category); table = check_category_table (table); @@ -162,8 +158,7 @@ DEFUN ("get-unused-category", Fget_unused_category, Sget_unused_category, If no category remains available, return nil. The optional argument TABLE specifies which category table to modify; it defaults to the current buffer's category table. */) - (table) - Lisp_Object table; + (Lisp_Object table) { int i; @@ -181,8 +176,7 @@ it defaults to the current buffer's category table. */) DEFUN ("category-table-p", Fcategory_table_p, Scategory_table_p, 1, 1, 0, doc: /* Return t if ARG is a category table. */) - (arg) - Lisp_Object arg; + (Lisp_Object arg) { if (CHAR_TABLE_P (arg) && EQ (XCHAR_TABLE (arg)->purpose, Qcategory_table)) @@ -196,8 +190,7 @@ DEFUN ("category-table-p", Fcategory_table_p, Scategory_table_p, 1, 1, 0, wrong-type-argument. */ Lisp_Object -check_category_table (table) - Lisp_Object table; +check_category_table (Lisp_Object table) { if (NILP (table)) return current_buffer->category_table; @@ -208,7 +201,7 @@ check_category_table (table) DEFUN ("category-table", Fcategory_table, Scategory_table, 0, 0, 0, doc: /* Return the current category table. This is the one specified by the current buffer. */) - () + (void) { return current_buffer->category_table; } @@ -217,15 +210,14 @@ DEFUN ("standard-category-table", Fstandard_category_table, Sstandard_category_table, 0, 0, 0, doc: /* Return the standard category table. This is the one used for new buffers. */) - () + (void) { return Vstandard_category_table; } static void -copy_category_entry (table, c, val) - Lisp_Object table, c, val; +copy_category_entry (Lisp_Object table, Lisp_Object c, Lisp_Object val) { val = Fcopy_sequence (val); if (CONSP (c)) @@ -240,8 +232,7 @@ copy_category_entry (table, c, val) binding TABLE to a sub char table. */ Lisp_Object -copy_category_table (table) - Lisp_Object table; +copy_category_table (Lisp_Object table) { table = copy_char_table (table); @@ -259,8 +250,7 @@ DEFUN ("copy-category-table", Fcopy_category_table, Scopy_category_table, 0, 1, 0, doc: /* Construct a new category table and return it. It is a copy of the TABLE, which defaults to the standard category table. */) - (table) - Lisp_Object table; + (Lisp_Object table) { if (!NILP (table)) check_category_table (table); @@ -273,7 +263,7 @@ It is a copy of the TABLE, which defaults to the standard category table. */) DEFUN ("make-category-table", Fmake_category_table, Smake_category_table, 0, 0, 0, doc: /* Construct a new and empty category table and return it. */) - () + (void) { Lisp_Object val; int i; @@ -290,8 +280,7 @@ DEFUN ("make-category-table", Fmake_category_table, Smake_category_table, DEFUN ("set-category-table", Fset_category_table, Sset_category_table, 1, 1, 0, doc: /* Specify TABLE as the category table for the current buffer. Return TABLE. */) - (table) - Lisp_Object table; + (Lisp_Object table) { int idx; table = check_category_table (table); @@ -304,8 +293,7 @@ Return TABLE. */) Lisp_Object -char_category_set (c) - int c; +char_category_set (int c) { return CHAR_TABLE_REF (current_buffer->category_table, c); } @@ -313,8 +301,7 @@ char_category_set (c) DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0, doc: /* Return the category set of CHAR. usage: (char-category-set CHAR) */) - (ch) - Lisp_Object ch; + (Lisp_Object ch) { CHECK_NUMBER (ch); return CATEGORY_SET (XFASTINT (ch)); @@ -326,8 +313,7 @@ DEFUN ("category-set-mnemonics", Fcategory_set_mnemonics, CATEGORY-SET is a bool-vector, and the categories \"in\" it are those that are indexes where t occurs in the bool-vector. The return value is a string containing those same categories. */) - (category_set) - Lisp_Object category_set; + (Lisp_Object category_set) { int i, j; char str[96]; @@ -344,8 +330,7 @@ The return value is a string containing those same categories. */) } void -set_category_set (category_set, category, val) - Lisp_Object category_set, category, val; +set_category_set (Lisp_Object category_set, Lisp_Object category, Lisp_Object val) { do { int idx = XINT (category) / 8; @@ -367,8 +352,7 @@ CHARACTER can be either a single character or a cons representing the lower and upper ends of an inclusive character range to modify. If optional fourth argument RESET is non-nil, then delete CATEGORY from the category set instead of adding it. */) - (character, category, table, reset) - Lisp_Object character, category, table, reset; + (Lisp_Object character, Lisp_Object category, Lisp_Object table, Lisp_Object reset) { Lisp_Object set_value; /* Actual value to be set in category sets. */ Lisp_Object category_set; @@ -420,8 +404,7 @@ then delete CATEGORY from the category set instead of adding it. */) directly. */ int -word_boundary_p (c1, c2) - int c1, c2; +word_boundary_p (int c1, int c2) { Lisp_Object category_set1, category_set2; Lisp_Object tail; @@ -466,7 +449,7 @@ word_boundary_p (c1, c2) void -init_category_once () +init_category_once (void) { /* This has to be done here, before we call Fmake_char_table. */ Qcategory_table = intern_c_string ("category-table"); @@ -489,7 +472,7 @@ init_category_once () } void -syms_of_category () +syms_of_category (void) { Qcategoryp = intern_c_string ("categoryp"); staticpro (&Qcategoryp); diff --git a/src/category.h b/src/category.h index b0fca6c7155..e636e32827d 100644 --- a/src/category.h +++ b/src/category.h @@ -113,8 +113,8 @@ extern Lisp_Object _temp_category_set; (!(SINGLE_BYTE_CHAR_P (c1) && SINGLE_BYTE_CHAR_P (c2)) \ && word_boundary_p (c1, c2)) -extern int word_boundary_p P_ ((int, int)); -extern void set_category_set P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); +extern int word_boundary_p (int, int); +extern void set_category_set (Lisp_Object, Lisp_Object, Lisp_Object); /* arch-tag: 309dfe83-c3e2-4d22-8e81-faae5aece0ff (do not change this comment) */ diff --git a/src/ccl.c b/src/ccl.c index c33df9e56de..b5a4f26197c 100644 --- a/src/ccl.c +++ b/src/ccl.c @@ -862,11 +862,7 @@ struct ccl_prog_stack static struct ccl_prog_stack ccl_prog_stack_struct[256]; void -ccl_driver (ccl, source, destination, src_size, dst_size, charset_list) - struct ccl_program *ccl; - int *source, *destination; - int src_size, dst_size; - Lisp_Object charset_list; +ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size, int dst_size, Lisp_Object charset_list) { register int *reg = ccl->reg; register int ic = ccl->ic; @@ -1719,7 +1715,7 @@ ccl_driver (ccl, source, destination, src_size, dst_size, charset_list) msglen = strlen (msg); if (dst + msglen <= (dst_bytes ? dst_end : src)) { - bcopy (msg, dst, msglen); + memcpy (dst, msg, msglen); dst += msglen; } @@ -1732,7 +1728,7 @@ ccl_driver (ccl, source, destination, src_size, dst_size, charset_list) msglen = strlen (msg); if (dst + msglen > (dst_bytes ? dst_end : src)) break; - bcopy (msg, dst, msglen); + memcpy (dst, msg, msglen); dst += msglen; } goto ccl_finish; @@ -1765,7 +1761,7 @@ ccl_driver (ccl, source, destination, src_size, dst_size, charset_list) int i = src_end - src; if (dst_bytes && (dst_end - dst) < i) i = dst_end - dst; - bcopy (src, dst, i); + memcpy (dst, src, i); src += i; dst += i; #else @@ -1795,8 +1791,7 @@ ccl_driver (ccl, source, destination, src_size, dst_size, charset_list) or nil if CCL contains invalid data. */ static Lisp_Object -resolve_symbol_ccl_program (ccl) - Lisp_Object ccl; +resolve_symbol_ccl_program (Lisp_Object ccl) { int i, veclen, unresolved = 0; Lisp_Object result, contents, val; @@ -1867,9 +1862,7 @@ resolve_symbol_ccl_program (ccl) symbols, return Qnil. */ static Lisp_Object -ccl_get_compiled_code (ccl_prog, idx) - Lisp_Object ccl_prog; - int *idx; +ccl_get_compiled_code (Lisp_Object ccl_prog, int *idx) { Lisp_Object val, slot; @@ -1910,9 +1903,7 @@ ccl_get_compiled_code (ccl_prog, idx) If CCL_PROG is nil, we just reset the structure pointed by CCL. */ int -setup_ccl_program (ccl, ccl_prog) - struct ccl_program *ccl; - Lisp_Object ccl_prog; +setup_ccl_program (struct ccl_program *ccl, Lisp_Object ccl_prog) { int i; @@ -1953,8 +1944,7 @@ setup_ccl_program (ccl, ccl_prog) /* Check if CCL is updated or not. If not, re-setup members of CCL. */ int -check_ccl_update (ccl) - struct ccl_program *ccl; +check_ccl_update (struct ccl_program *ccl) { Lisp_Object slot, ccl_prog; @@ -1978,8 +1968,7 @@ check_ccl_update (ccl) DEFUN ("ccl-program-p", Fccl_program_p, Sccl_program_p, 1, 1, 0, doc: /* Return t if OBJECT is a CCL program name or a compiled CCL program code. See the documentation of `define-ccl-program' for the detail of CCL program. */) - (object) - Lisp_Object object; + (Lisp_Object object) { Lisp_Object val; @@ -2013,8 +2002,7 @@ the corresponding register after the execution. See the documentation of `define-ccl-program' for a definition of CCL programs. */) - (ccl_prog, reg) - Lisp_Object ccl_prog, reg; + (Lisp_Object ccl_prog, Lisp_Object reg) { struct ccl_program ccl; int i; @@ -2068,8 +2056,7 @@ is a unibyte string. By default it is a multibyte string. See the documentation of `define-ccl-program' for the detail of CCL program. usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBYTE-P) */) - (ccl_prog, status, str, contin, unibyte_p) - Lisp_Object ccl_prog, status, str, contin, unibyte_p; + (Lisp_Object ccl_prog, Lisp_Object status, Lisp_Object str, Lisp_Object contin, Lisp_Object unibyte_p) { Lisp_Object val; struct ccl_program ccl; @@ -2199,8 +2186,7 @@ DEFUN ("register-ccl-program", Fregister_ccl_program, Sregister_ccl_program, CCL-PROG should be a compiled CCL program (vector), or nil. If it is nil, just reserve NAME as a CCL program name. Return index number of the registered CCL program. */) - (name, ccl_prog) - Lisp_Object name, ccl_prog; + (Lisp_Object name, Lisp_Object ccl_prog) { int len = ASIZE (Vccl_program_table); int idx; @@ -2275,8 +2261,7 @@ DEFUN ("register-code-conversion-map", Fregister_code_conversion_map, 2, 2, 0, doc: /* Register SYMBOL as code conversion map MAP. Return index number of the registered map. */) - (symbol, map) - Lisp_Object symbol, map; + (Lisp_Object symbol, Lisp_Object map) { int len = ASIZE (Vcode_conversion_map_vector); int i; @@ -2315,7 +2300,7 @@ Return index number of the registered map. */) void -syms_of_ccl () +syms_of_ccl (void) { staticpro (&Vccl_program_table); Vccl_program_table = Fmake_vector (make_number (32), Qnil); diff --git a/src/ccl.h b/src/ccl.h index 54fc576c7e0..e4414ddf65c 100644 --- a/src/ccl.h +++ b/src/ccl.h @@ -97,13 +97,13 @@ extern Lisp_Object Vfont_ccl_encoder_alist; /* Setup fields of the structure pointed by CCL appropriately for the execution of ccl program CCL_PROG (symbol or vector). */ -extern int setup_ccl_program P_ ((struct ccl_program *, Lisp_Object)); +extern int setup_ccl_program (struct ccl_program *, Lisp_Object); /* Check if CCL is updated or not. If not, re-setup members of CCL. */ -extern int check_ccl_update P_ ((struct ccl_program *)); +extern int check_ccl_update (struct ccl_program *); -extern void ccl_driver P_ ((struct ccl_program *, int *, int *, int, int, - Lisp_Object)); +extern void ccl_driver (struct ccl_program *, int *, int *, int, int, + Lisp_Object); /* Vector of CCL program names vs corresponding program data. */ extern Lisp_Object Vccl_program_table; diff --git a/src/character.c b/src/character.c index 7cd1eedcef4..470157b36ed 100644 --- a/src/character.c +++ b/src/character.c @@ -93,8 +93,7 @@ Lisp_Object Vunicode_category_table; character code if possible. Return the resulting code. */ int -char_resolve_modifier_mask (c) - int c; +char_resolve_modifier_mask (int c) { /* A non-ASCII character can't reflect modifier bits to the code. */ if (! ASCII_CHAR_P ((c & ~CHAR_MODIFIER_MASK))) @@ -143,9 +142,7 @@ char_resolve_modifier_mask (c) handle them appropriately. */ int -char_string (c, p) - unsigned c; - unsigned char *p; +char_string (unsigned int c, unsigned char *p) { int bytes; @@ -199,10 +196,7 @@ char_string (c, p) character) of the multibyte form. */ int -string_char (p, advanced, len) - const unsigned char *p; - const unsigned char **advanced; - int *len; +string_char (const unsigned char *p, const unsigned char **advanced, int *len) { int c; const unsigned char *saved_p = p; @@ -245,9 +239,7 @@ string_char (p, advanced, len) case, translace C by all tables. */ int -translate_char (table, c) - Lisp_Object table; - int c; +translate_char (Lisp_Object table, int c) { if (CHAR_TABLE_P (table)) { @@ -272,9 +264,7 @@ translate_char (table, c) future. */ int -multibyte_char_to_unibyte (c, rev_tbl) - int c; - Lisp_Object rev_tbl; +multibyte_char_to_unibyte (int c, Lisp_Object rev_tbl) { if (c < 0x80) return c; @@ -287,8 +277,7 @@ multibyte_char_to_unibyte (c, rev_tbl) by charset_unibyte. */ int -multibyte_char_to_unibyte_safe (c) - int c; +multibyte_char_to_unibyte_safe (int c) { if (c < 0x80) return c; @@ -299,15 +288,14 @@ multibyte_char_to_unibyte_safe (c) DEFUN ("characterp", Fcharacterp, Scharacterp, 1, 2, 0, doc: /* Return non-nil if OBJECT is a character. */) - (object, ignore) - Lisp_Object object, ignore; + (Lisp_Object object, Lisp_Object ignore) { return (CHARACTERP (object) ? Qt : Qnil); } DEFUN ("max-char", Fmax_char, Smax_char, 0, 0, 0, doc: /* Return the character of the maximum code. */) - () + (void) { return make_number (MAX_CHAR); } @@ -315,8 +303,7 @@ DEFUN ("max-char", Fmax_char, Smax_char, 0, 0, 0, DEFUN ("unibyte-char-to-multibyte", Funibyte_char_to_multibyte, Sunibyte_char_to_multibyte, 1, 1, 0, doc: /* Convert the byte CH to multibyte character. */) - (ch) - Lisp_Object ch; + (Lisp_Object ch) { int c; @@ -332,8 +319,7 @@ DEFUN ("multibyte-char-to-unibyte", Fmultibyte_char_to_unibyte, Smultibyte_char_to_unibyte, 1, 1, 0, doc: /* Convert the multibyte character CH to a byte. If the multibyte character does not represent a byte, return -1. */) - (ch) - Lisp_Object ch; + (Lisp_Object ch) { int cm; @@ -354,8 +340,7 @@ DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0, doc: /* Return 1 regardless of the argument CHAR. This is now an obsolete function. We keep it just for backward compatibility. usage: (char-bytes CHAR) */) - (ch) - Lisp_Object ch; + (Lisp_Object ch) { CHECK_CHARACTER (ch); return make_number (1); @@ -366,8 +351,7 @@ DEFUN ("char-width", Fchar_width, Schar_width, 1, 1, 0, The width is measured by how many columns it occupies on the screen. Tab is taken to occupy `tab-width' columns. usage: (char-width CHAR) */) - (ch) - Lisp_Object ch; + (Lisp_Object ch) { Lisp_Object disp; int c, width; @@ -446,9 +430,7 @@ c_string_width (const unsigned char *str, int len, int precision, int *nchars, i occupies on the screen. */ int -strwidth (str, len) - unsigned char *str; - int len; +strwidth (unsigned char *str, int len) { return c_string_width (str, len, -1, NULL, NULL); } @@ -461,9 +443,7 @@ strwidth (str, len) in *NCHARS and *NBYTES respectively. */ int -lisp_string_width (string, precision, nchars, nbytes) - Lisp_Object string; - int precision, *nchars, *nbytes; +lisp_string_width (Lisp_Object string, int precision, int *nchars, int *nbytes) { int len = SCHARS (string); /* This set multibyte to 0 even if STRING is multibyte when it @@ -542,8 +522,7 @@ only the base leading-code is considered; the validity of the following bytes is not checked. Tabs in STRING are always taken to occupy `tab-width' columns. usage: (string-width STRING) */) - (str) - Lisp_Object str; + (Lisp_Object str) { Lisp_Object val; @@ -556,8 +535,7 @@ DEFUN ("char-direction", Fchar_direction, Schar_direction, 1, 1, 0, doc: /* Return the direction of CHAR. The returned value is 0 for left-to-right and 1 for right-to-left. usage: (char-direction CHAR) */) - (ch) - Lisp_Object ch; + (Lisp_Object ch) { int c; @@ -573,9 +551,7 @@ usage: (char-direction CHAR) */) nil, we treat each byte as a character. */ EMACS_INT -chars_in_text (ptr, nbytes) - const unsigned char *ptr; - EMACS_INT nbytes; +chars_in_text (const unsigned char *ptr, EMACS_INT nbytes) { /* current_buffer is null at early stages of Emacs initialization. */ if (current_buffer == 0 @@ -591,9 +567,7 @@ chars_in_text (ptr, nbytes) ignores enable-multibyte-characters. */ EMACS_INT -multibyte_chars_in_text (ptr, nbytes) - const unsigned char *ptr; - EMACS_INT nbytes; +multibyte_chars_in_text (const unsigned char *ptr, EMACS_INT nbytes) { const unsigned char *endp = ptr + nbytes; int chars = 0; @@ -618,9 +592,7 @@ multibyte_chars_in_text (ptr, nbytes) represented by 2-byte in a multibyte text. */ void -parse_str_as_multibyte (str, len, nchars, nbytes) - const unsigned char *str; - int len, *nchars, *nbytes; +parse_str_as_multibyte (const unsigned char *str, int len, int *nchars, int *nbytes) { const unsigned char *endp = str + len; int n, chars = 0, bytes = 0; @@ -662,9 +634,7 @@ parse_str_as_multibyte (str, len, nchars, nbytes) resulting text. */ int -str_as_multibyte (str, len, nbytes, nchars) - unsigned char *str; - int len, nbytes, *nchars; +str_as_multibyte (unsigned char *str, int len, int nbytes, int *nchars) { unsigned char *p = str, *endp = str + nbytes; unsigned char *to; @@ -691,7 +661,7 @@ str_as_multibyte (str, len, nbytes, nchars) to = p; nbytes = endp - p; endp = str + len; - safe_bcopy ((char *) p, (char *) (endp - nbytes), nbytes); + memmove (endp - nbytes, p, nbytes); p = endp - nbytes; if (nbytes >= MAX_MULTIBYTE_LENGTH) @@ -740,9 +710,7 @@ str_as_multibyte (str, len, nbytes, nchars) `str_to_multibyte'. */ int -parse_str_to_multibyte (str, len) - unsigned char *str; - int len; +parse_str_to_multibyte (unsigned char *str, int len) { unsigned char *endp = str + len; int bytes; @@ -760,9 +728,7 @@ parse_str_to_multibyte (str, len) enough. */ int -str_to_multibyte (str, len, bytes) - unsigned char *str; - int len, bytes; +str_to_multibyte (unsigned char *str, int len, int bytes) { unsigned char *p = str, *endp = str + bytes; unsigned char *to; @@ -773,7 +739,7 @@ str_to_multibyte (str, len, bytes) to = p; bytes = endp - p; endp = str + len; - safe_bcopy ((char *) p, (char *) (endp - bytes), bytes); + memmove (endp - bytes, p, bytes); p = endp - bytes; while (p < endp) { @@ -791,9 +757,7 @@ str_to_multibyte (str, len, bytes) unibyte. */ int -str_as_unibyte (str, bytes) - unsigned char *str; - int bytes; +str_as_unibyte (unsigned char *str, int bytes) { const unsigned char *p = str, *endp = str + bytes; unsigned char *to; @@ -835,11 +799,7 @@ str_as_unibyte (str, bytes) Note: Currently the arg ACCEPT_LATIN_1 is not used. */ EMACS_INT -str_to_unibyte (src, dst, chars, accept_latin_1) - const unsigned char *src; - unsigned char *dst; - EMACS_INT chars; - int accept_latin_1; +str_to_unibyte (const unsigned char *src, unsigned char *dst, EMACS_INT chars, int accept_latin_1) { EMACS_INT i; @@ -859,8 +819,7 @@ str_to_unibyte (src, dst, chars, accept_latin_1) int -string_count_byte8 (string) - Lisp_Object string; +string_count_byte8 (Lisp_Object string) { int multibyte = STRING_MULTIBYTE (string); int nbytes = SBYTES (string); @@ -890,8 +849,7 @@ string_count_byte8 (string) Lisp_Object -string_escape_byte8 (string) - Lisp_Object string; +string_escape_byte8 (Lisp_Object string) { int nchars = SCHARS (string); int nbytes = SBYTES (string); @@ -957,9 +915,7 @@ DEFUN ("string", Fstring, Sstring, 0, MANY, 0, doc: /* Concatenate all the argument characters and make the result a string. usage: (string &rest CHARACTERS) */) - (n, args) - int n; - Lisp_Object *args; + (int n, Lisp_Object *args) { int i, c; unsigned char *buf, *p; @@ -984,9 +940,7 @@ usage: (string &rest CHARACTERS) */) DEFUN ("unibyte-string", Funibyte_string, Sunibyte_string, 0, MANY, 0, doc: /* Concatenate all the argument bytes and make the result a unibyte string. usage: (unibyte-string &rest BYTES) */) - (n, args) - int n; - Lisp_Object *args; + (int n, Lisp_Object *args) { int i, c; unsigned char *buf, *p; @@ -1016,8 +970,7 @@ DEFUN ("char-resolve-modifiers", Fchar_resolve_modifiers, The value is a character with modifiers resolved into the character code. Unresolved modifiers are kept in the value. usage: (char-resolve-modifiers CHAR) */) - (character) - Lisp_Object character; + (Lisp_Object character) { int c; @@ -1036,8 +989,7 @@ non-nil, is an index of a target character in the string. If the current buffer (or STRING) is multibyte, and the target character is not ASCII nor 8-bit character, an error is signalled. */) - (position, string) - Lisp_Object position, string; + (Lisp_Object position, Lisp_Object string) { int c; EMACS_INT pos; @@ -1088,14 +1040,14 @@ character is not ASCII nor 8-bit character, an error is signalled. */) void -init_character_once () +init_character_once (void) { } #ifdef emacs void -syms_of_character () +syms_of_character (void) { DEFSYM (Qcharacterp, "characterp"); DEFSYM (Qauto_fill_chars, "auto-fill-chars"); diff --git a/src/character.h b/src/character.h index 429435e28d0..b32dabba12e 100644 --- a/src/character.h +++ b/src/character.h @@ -596,24 +596,24 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ : 0) -extern int char_resolve_modifier_mask P_ ((int)); -extern int char_string P_ ((unsigned, unsigned char *)); -extern int string_char P_ ((const unsigned char *, - const unsigned char **, int *)); +extern int char_resolve_modifier_mask (int); +extern int char_string (unsigned, unsigned char *); +extern int string_char (const unsigned char *, + const unsigned char **, int *); -extern int translate_char P_ ((Lisp_Object, int c)); -extern int char_printable_p P_ ((int c)); -extern void parse_str_as_multibyte P_ ((const unsigned char *, int, int *, - int *)); -extern int parse_str_to_multibyte P_ ((unsigned char *, int)); -extern int str_as_multibyte P_ ((unsigned char *, int, int, int *)); -extern int str_to_multibyte P_ ((unsigned char *, int, int)); -extern int str_as_unibyte P_ ((unsigned char *, int)); -extern EMACS_INT str_to_unibyte P_ ((const unsigned char *, unsigned char *, - EMACS_INT, int)); -extern int strwidth P_ ((unsigned char *, int)); -extern int c_string_width P_ ((const unsigned char *, int, int, int *, int *)); -extern int lisp_string_width P_ ((Lisp_Object, int, int *, int *)); +extern int translate_char (Lisp_Object, int c); +extern int char_printable_p (int c); +extern void parse_str_as_multibyte (const unsigned char *, int, int *, + int *); +extern int parse_str_to_multibyte (unsigned char *, int); +extern int str_as_multibyte (unsigned char *, int, int, int *); +extern int str_to_multibyte (unsigned char *, int, int); +extern int str_as_unibyte (unsigned char *, int); +extern EMACS_INT str_to_unibyte (const unsigned char *, unsigned char *, + EMACS_INT, int); +extern int strwidth (unsigned char *, int); +extern int c_string_width (const unsigned char *, int, int, int *, int *); +extern int lisp_string_width (Lisp_Object, int, int *, int *); extern Lisp_Object Vprintable_chars; @@ -624,7 +624,7 @@ extern Lisp_Object Vchar_direction_table; extern Lisp_Object Vchar_unify_table; extern Lisp_Object Vunicode_category_table; -extern Lisp_Object string_escape_byte8 P_ ((Lisp_Object)); +extern Lisp_Object string_escape_byte8 (Lisp_Object); /* Return a translation table of id number ID. */ #define GET_TRANSLATION_TABLE(id) \ @@ -636,18 +636,6 @@ extern Lisp_Object Vauto_fill_chars; extern Lisp_Object Vchar_script_table; extern Lisp_Object Vscript_representative_chars; -/* Copy LEN bytes from FROM to TO. This macro should be used only - when a caller knows that LEN is short and the obvious copy loop is - faster than calling bcopy which has some overhead. Copying a - multibyte sequence of a character is the typical case. */ - -#define BCOPY_SHORT(from, to, len) \ - do { \ - int i = len; \ - unsigned char *from_p = from, *to_p = to; \ - while (i--) *to_p++ = *from_p++; \ - } while (0) - #define DEFSYM(sym, name) \ do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0) diff --git a/src/charset.c b/src/charset.c index f83fa994536..84df00da63a 100644 --- a/src/charset.c +++ b/src/charset.c @@ -129,10 +129,10 @@ Lisp_Object Vcurrent_iso639_language; /* Defined in chartab.c */ extern void -map_char_table_for_charset P_ ((void (*c_function) (Lisp_Object, Lisp_Object), - Lisp_Object function, Lisp_Object table, - Lisp_Object arg, struct charset *charset, - unsigned from, unsigned to)); +map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object), + Lisp_Object function, Lisp_Object table, + Lisp_Object arg, struct charset *charset, + unsigned from, unsigned to); #define CODE_POINT_TO_INDEX(charset, code) \ ((charset)->code_linear_p \ @@ -267,11 +267,7 @@ struct charset_map_entries */ static void -load_charset_map (charset, entries, n_entries, control_flag) - struct charset *charset; - struct charset_map_entries *entries; - int n_entries; - int control_flag; +load_charset_map (struct charset *charset, struct charset_map_entries *entries, int n_entries, int control_flag) { Lisp_Object vec, table; unsigned max_code = CHARSET_MAX_CODE (charset); @@ -440,9 +436,7 @@ load_charset_map (charset, entries, n_entries, control_flag) paying attention to comment charcter '#'. */ static INLINE unsigned -read_hex (fp, eof) - FILE *fp; - int *eof; +read_hex (FILE *fp, int *eof) { int c; unsigned n; @@ -497,13 +491,10 @@ extern Lisp_Object Qfile_name_handler_alist; Note that this function uses `openp' to open MAPFILE but ignores `file-name-handler-alist' to avoid running any Lisp code. */ -extern void add_to_log P_ ((char *, Lisp_Object, Lisp_Object)); +extern void add_to_log (char *, Lisp_Object, Lisp_Object); static void -load_charset_map_from_file (charset, mapfile, control_flag) - struct charset *charset; - Lisp_Object mapfile; - int control_flag; +load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int control_flag) { unsigned min_code = CHARSET_MIN_CODE (charset); unsigned max_code = CHARSET_MAX_CODE (charset); @@ -531,7 +522,7 @@ load_charset_map_from_file (charset, mapfile, control_flag) SAFE_ALLOCA (head, struct charset_map_entries *, sizeof (struct charset_map_entries)); entries = head; - bzero (entries, sizeof (struct charset_map_entries)); + memset (entries, 0, sizeof (struct charset_map_entries)); n_entries = 0; eof = 0; @@ -558,7 +549,7 @@ load_charset_map_from_file (charset, mapfile, control_flag) SAFE_ALLOCA (entries->next, struct charset_map_entries *, sizeof (struct charset_map_entries)); entries = entries->next; - bzero (entries, sizeof (struct charset_map_entries)); + memset (entries, 0, sizeof (struct charset_map_entries)); } idx = n_entries % 0x10000; entries->entry[idx].from = from; @@ -573,10 +564,7 @@ load_charset_map_from_file (charset, mapfile, control_flag) } static void -load_charset_map_from_vector (charset, vec, control_flag) - struct charset *charset; - Lisp_Object vec; - int control_flag; +load_charset_map_from_vector (struct charset *charset, Lisp_Object vec, int control_flag) { unsigned min_code = CHARSET_MIN_CODE (charset); unsigned max_code = CHARSET_MAX_CODE (charset); @@ -597,7 +585,7 @@ load_charset_map_from_vector (charset, vec, control_flag) SAFE_ALLOCA (head, struct charset_map_entries *, sizeof (struct charset_map_entries)); entries = head; - bzero (entries, sizeof (struct charset_map_entries)); + memset (entries, 0, sizeof (struct charset_map_entries)); n_entries = 0; for (i = 0; i < len; i += 2) @@ -634,7 +622,7 @@ load_charset_map_from_vector (charset, vec, control_flag) SAFE_ALLOCA (entries->next, struct charset_map_entries *, sizeof (struct charset_map_entries)); entries = entries->next; - bzero (entries, sizeof (struct charset_map_entries)); + memset (entries, 0, sizeof (struct charset_map_entries)); } idx = n_entries % 0x10000; entries->entry[idx].from = from; @@ -652,9 +640,7 @@ load_charset_map_from_vector (charset, vec, control_flag) map it is (see the comment of load_charset_map for the detail). */ static void -load_charset (charset, control_flag) - struct charset *charset; - int control_flag; +load_charset (struct charset *charset, int control_flag) { Lisp_Object map; @@ -677,22 +663,18 @@ load_charset (charset, control_flag) DEFUN ("charsetp", Fcharsetp, Scharsetp, 1, 1, 0, doc: /* Return non-nil if and only if OBJECT is a charset.*/) - (object) - Lisp_Object object; + (Lisp_Object object) { return (CHARSETP (object) ? Qt : Qnil); } -void map_charset_for_dump P_ ((void (*c_function) (Lisp_Object, Lisp_Object), - Lisp_Object function, Lisp_Object arg, - unsigned from, unsigned to)); +void map_charset_for_dump (void (*c_function) (Lisp_Object, Lisp_Object), + Lisp_Object function, Lisp_Object arg, + unsigned from, unsigned to); void -map_charset_for_dump (c_function, function, arg, from, to) - void (*c_function) (Lisp_Object, Lisp_Object); - Lisp_Object function, arg; - unsigned from, to; +map_charset_for_dump (void (*c_function) (Lisp_Object, Lisp_Object), Lisp_Object function, Lisp_Object arg, unsigned int from, unsigned int to) { int from_idx = CODE_POINT_TO_INDEX (temp_charset_work->current, from); int to_idx = CODE_POINT_TO_INDEX (temp_charset_work->current, to); @@ -748,12 +730,8 @@ map_charset_for_dump (c_function, function, arg, from, to) } void -map_charset_chars (c_function, function, arg, - charset, from, to) - void (*c_function) P_ ((Lisp_Object, Lisp_Object)); - Lisp_Object function, arg; - struct charset *charset; - unsigned from, to; +map_charset_chars (void (*c_function)(Lisp_Object, Lisp_Object), Lisp_Object function, + Lisp_Object arg, struct charset *charset, unsigned from, unsigned to) { Lisp_Object range; int partial; @@ -847,8 +825,7 @@ characters contained in CHARSET. The optional 4th and 5th arguments FROM-CODE and TO-CODE specify the range of code points (in CHARSET) of target characters. */) - (function, charset, arg, from_code, to_code) - Lisp_Object function, charset, arg, from_code, to_code; + (Lisp_Object function, Lisp_Object charset, Lisp_Object arg, Lisp_Object from_code, Lisp_Object to_code) { struct charset *cs; unsigned from, to; @@ -886,9 +863,7 @@ DEFUN ("define-charset-internal", Fdefine_charset_internal, Sdefine_charset_internal, charset_arg_max, MANY, 0, doc: /* For internal use only. usage: (define-charset-internal ...) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { /* Charset attr vector. */ Lisp_Object attrs; @@ -952,7 +927,7 @@ usage: (define-charset-internal ...) */) if (! charset.code_linear_p) { charset.code_space_mask = (unsigned char *) xmalloc (256); - bzero (charset.code_space_mask, 256); + memset (charset.code_space_mask, 0, 256); for (i = 0; i < 4; i++) for (j = charset.code_space[i * 4]; j <= charset.code_space[i * 4 + 1]; j++) @@ -1075,7 +1050,7 @@ usage: (define-charset-internal ...) */) charset.unified_p = 0; - bzero (charset.fast_map, sizeof (charset.fast_map)); + memset (charset.fast_map, 0, sizeof (charset.fast_map)); if (! NILP (args[charset_arg_code_offset])) { @@ -1208,8 +1183,8 @@ usage: (define-charset-internal ...) */) struct charset *new_table = (struct charset *) xmalloc (sizeof (struct charset) * (charset_table_size + 16)); - bcopy (charset_table, new_table, - sizeof (struct charset) * charset_table_size); + memcpy (new_table, charset_table, + sizeof (struct charset) * charset_table_size); charset_table_size += 16; charset_table = new_table; } @@ -1299,17 +1274,13 @@ usage: (define-charset-internal ...) */) charset. */ static int -define_charset_internal (name, dimension, code_space, min_code, max_code, - iso_final, iso_revision, emacs_mule_id, - ascii_compatible, supplementary, - code_offset) - Lisp_Object name; - int dimension; - unsigned char *code_space; - unsigned min_code, max_code; - int iso_final, iso_revision, emacs_mule_id; - int ascii_compatible, supplementary; - int code_offset; +define_charset_internal (Lisp_Object name, + int dimension, + unsigned char *code_space, + unsigned min_code, unsigned max_code, + int iso_final, int iso_revision, int emacs_mule_id, + int ascii_compatible, int supplementary, + int code_offset) { Lisp_Object args[charset_arg_max]; Lisp_Object plist[14]; @@ -1363,8 +1334,7 @@ define_charset_internal (name, dimension, code_space, min_code, max_code, DEFUN ("define-charset-alias", Fdefine_charset_alias, Sdefine_charset_alias, 2, 2, 0, doc: /* Define ALIAS as an alias for charset CHARSET. */) - (alias, charset) - Lisp_Object alias, charset; + (Lisp_Object alias, Lisp_Object charset) { Lisp_Object attr; @@ -1377,8 +1347,7 @@ DEFUN ("define-charset-alias", Fdefine_charset_alias, DEFUN ("charset-plist", Fcharset_plist, Scharset_plist, 1, 1, 0, doc: /* Return the property list of CHARSET. */) - (charset) - Lisp_Object charset; + (Lisp_Object charset) { Lisp_Object attrs; @@ -1389,8 +1358,7 @@ DEFUN ("charset-plist", Fcharset_plist, Scharset_plist, 1, 1, 0, DEFUN ("set-charset-plist", Fset_charset_plist, Sset_charset_plist, 2, 2, 0, doc: /* Set CHARSET's property list to PLIST. */) - (charset, plist) - Lisp_Object charset, plist; + (Lisp_Object charset, Lisp_Object plist) { Lisp_Object attrs; @@ -1410,8 +1378,7 @@ the same meaning as the `:unify-map' attribute in the function `define-charset' (which see). Optional third argument DEUNIFY, if non-nil, means to de-unify CHARSET. */) - (charset, unify_map, deunify) - Lisp_Object charset, unify_map, deunify; + (Lisp_Object charset, Lisp_Object unify_map, Lisp_Object deunify) { int id; struct charset *cs; @@ -1466,8 +1433,7 @@ CHARS is the number of characters in a dimension: 94 or 96. This final char is for private use, thus the range is `0' (48) .. `?' (63). If there's no unused final char for the specified kind of charset, return nil. */) - (dimension, chars) - Lisp_Object dimension, chars; + (Lisp_Object dimension, Lisp_Object chars) { int final_char; @@ -1484,8 +1450,7 @@ return nil. */) } static void -check_iso_charset_parameter (dimension, chars, final_char) - Lisp_Object dimension, chars, final_char; +check_iso_charset_parameter (Lisp_Object dimension, Lisp_Object chars, Lisp_Object final_char) { CHECK_NATNUM (dimension); CHECK_NATNUM (chars); @@ -1507,8 +1472,7 @@ DEFUN ("declare-equiv-charset", Fdeclare_equiv_charset, Sdeclare_equiv_charset, On decoding by an ISO-2022 base coding system, when a charset specified by DIMENSION, CHARS, and FINAL-CHAR is designated, behave as if CHARSET is designated instead. */) - (dimension, chars, final_char, charset) - Lisp_Object dimension, chars, final_char, charset; + (Lisp_Object dimension, Lisp_Object chars, Lisp_Object final_char, Lisp_Object charset) { int id; int chars_flag; @@ -1535,8 +1499,7 @@ if CHARSET is designated instead. */) */ int -string_xstring_p (string) - Lisp_Object string; +string_xstring_p (Lisp_Object string) { const unsigned char *p = SDATA (string); const unsigned char *endp = p + SBYTES (string); @@ -1563,11 +1526,7 @@ string_xstring_p (string) It may lookup a translation table TABLE if supplied. */ static void -find_charsets_in_text (ptr, nchars, nbytes, charsets, table, multibyte) - const unsigned char *ptr; - EMACS_INT nchars, nbytes; - Lisp_Object charsets, table; - int multibyte; +find_charsets_in_text (const unsigned char *ptr, EMACS_INT nchars, EMACS_INT nbytes, Lisp_Object charsets, Lisp_Object table, int multibyte) { const unsigned char *pend = ptr + nbytes; @@ -1611,8 +1570,7 @@ Optional arg TABLE if non-nil is a translation table to look up. If the current buffer is unibyte, the returned list may contain only `ascii', `eight-bit-control', and `eight-bit-graphic'. */) - (beg, end, table) - Lisp_Object beg, end, table; + (Lisp_Object beg, Lisp_Object end, Lisp_Object table) { Lisp_Object charsets; EMACS_INT from, from_byte, to, stop, stop_byte; @@ -1663,8 +1621,7 @@ Optional arg TABLE if non-nil is a translation table to look up. If STR is unibyte, the returned list may contain only `ascii', `eight-bit-control', and `eight-bit-graphic'. */) - (str, table) - Lisp_Object str, table; + (Lisp_Object str, Lisp_Object table) { Lisp_Object charsets; int i; @@ -1689,9 +1646,7 @@ only `ascii', `eight-bit-control', and `eight-bit-graphic'. */) value of Vchar_unify_table for C; i.e. it is nil, an integer, or a charset symbol. */ int -maybe_unify_char (c, val) - int c; - Lisp_Object val; +maybe_unify_char (int c, Lisp_Object val) { struct charset *charset; @@ -1724,9 +1679,7 @@ maybe_unify_char (c, val) CHARSET. */ int -decode_char (charset, code) - struct charset *charset; - unsigned code; +decode_char (struct charset *charset, unsigned int code) { int c, char_index; enum charset_method method = CHARSET_METHOD (charset); @@ -1805,9 +1758,7 @@ Lisp_Object charset_work; use CHARSET's strict_max_char instead of max_char. */ unsigned -encode_char (charset, c) - struct charset *charset; - int c; +encode_char (struct charset *charset, int c) { unsigned code; enum charset_method method = CHARSET_METHOD (charset); @@ -1921,8 +1872,7 @@ CODE-POINT may be a cons (HIGHER-16-BIT-VALUE . LOWER-16-BIT-VALUE). Optional argument RESTRICTION specifies a way to map the pair of CCS and CODE-POINT to a character. Currently not supported and just ignored. */) - (charset, code_point, restriction) - Lisp_Object charset, code_point, restriction; + (Lisp_Object charset, Lisp_Object code_point, Lisp_Object restriction) { int c, id; unsigned code; @@ -1952,8 +1902,7 @@ Return nil if CHARSET doesn't include CH. Optional argument RESTRICTION specifies a way to map CH to a code-point in CCS. Currently not supported and just ignored. */) - (ch, charset, restriction) - Lisp_Object ch, charset, restriction; + (Lisp_Object ch, Lisp_Object charset, Lisp_Object restriction) { int id; unsigned code; @@ -1978,8 +1927,7 @@ DEFUN ("make-char", Fmake_char, Smake_char, 1, 5, 0, CODE1 through CODE4 are optional, but if you don't supply sufficient position codes, it is assumed that the minimum code in each dimension is specified. */) - (charset, code1, code2, code3, code4) - Lisp_Object charset, code1, code2, code3, code4; + (Lisp_Object charset, Lisp_Object code1, Lisp_Object code2, Lisp_Object code3, Lisp_Object code4) { int id, dimension; struct charset *charsetp; @@ -2057,10 +2005,7 @@ is specified. */) Vcharset_ordered_list. */ struct charset * -char_charset (c, charset_list, code_return) - int c; - Lisp_Object charset_list; - unsigned *code_return; +char_charset (int c, Lisp_Object charset_list, unsigned int *code_return) { int maybe_null = 0; @@ -2098,8 +2043,7 @@ DEFUN ("split-char", Fsplit_char, Ssplit_char, 1, 1, 0, The charset is decided by the current priority order of charsets. A position-code is a byte value of each dimension of the code-point of CH in the charset. */) - (ch) - Lisp_Object ch; + (Lisp_Object ch) { struct charset *charset; int c, dimension; @@ -2129,8 +2073,7 @@ DEFUN ("char-charset", Fchar_charset, Schar_charset, 1, 2, 0, If optional 2nd arg RESTRICTION is non-nil, it is a list of charsets from which to find the charset. It may also be a coding system. In that case, find the charset from what supported by that coding system. */) - (ch, restriction) - Lisp_Object ch, restriction; + (Lisp_Object ch, Lisp_Object restriction) { struct charset *charset; @@ -2168,8 +2111,7 @@ DEFUN ("charset-after", Fcharset_after, Scharset_after, 0, 1, 0, Return charset of a character in the current buffer at position POS. If POS is nil, it defauls to the current point. If POS is out of range, the value is nil. */) - (pos) - Lisp_Object pos; + (Lisp_Object pos) { Lisp_Object ch; struct charset *charset; @@ -2191,8 +2133,7 @@ by their DIMENSION, CHARS, and FINAL-CHAR, whereas Emacs distinguishes them by charset symbol. See the documentation of the function `charset-info' for the meanings of DIMENSION, CHARS, and FINAL-CHAR. */) - (dimension, chars, final_char) - Lisp_Object dimension, chars, final_char; + (Lisp_Object dimension, Lisp_Object chars, Lisp_Object final_char) { int id; int chars_flag; @@ -2211,7 +2152,7 @@ DEFUN ("clear-charset-maps", Fclear_charset_maps, Sclear_charset_maps, Internal use only. Clear temporary charset mapping tables. It should be called only from temacs invoked for dumping. */) - () + (void) { if (temp_charset_work) { @@ -2229,8 +2170,7 @@ DEFUN ("charset-priority-list", Fcharset_priority_list, Scharset_priority_list, 0, 1, 0, doc: /* Return the list of charsets ordered by priority. HIGHESTP non-nil means just return the highest priority one. */) - (highestp) - Lisp_Object highestp; + (Lisp_Object highestp) { Lisp_Object val = Qnil, list = Vcharset_ordered_list; @@ -2249,9 +2189,7 @@ DEFUN ("set-charset-priority", Fset_charset_priority, Sset_charset_priority, 1, MANY, 0, doc: /* Assign higher priority to the charsets given as arguments. usage: (set-charset-priority &rest charsets) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { Lisp_Object new_head, old_list, arglist[2]; Lisp_Object list_2022, list_emacs_mule; @@ -2303,8 +2241,7 @@ DEFUN ("charset-id-internal", Fcharset_id_internal, Scharset_id_internal, 0, 1, 0, doc: /* Internal use only. Return charset identification number of CHARSET. */) - (charset) - Lisp_Object charset; + (Lisp_Object charset) { int id; @@ -2314,7 +2251,7 @@ Return charset identification number of CHARSET. */) void -init_charset () +init_charset (void) { Lisp_Object tempdir; tempdir = Fexpand_file_name (build_string ("charsets"), Vdata_directory); @@ -2332,7 +2269,7 @@ Please check your installation!\n", void -init_charset_once () +init_charset_once (void) { int i, j, k; @@ -2353,7 +2290,7 @@ init_charset_once () #ifdef emacs void -syms_of_charset () +syms_of_charset (void) { DEFSYM (Qcharsetp, "charsetp"); diff --git a/src/charset.h b/src/charset.h index 718859929df..095dcefe15b 100644 --- a/src/charset.h +++ b/src/charset.h @@ -534,17 +534,17 @@ extern int charset_ksc5601; extern int charset_unibyte; -extern struct charset *char_charset P_ ((int, Lisp_Object, unsigned *)); -extern Lisp_Object charset_attributes P_ ((int)); +extern struct charset *char_charset (int, Lisp_Object, unsigned *); +extern Lisp_Object charset_attributes (int); -extern int maybe_unify_char P_ ((int, Lisp_Object)); -extern int decode_char P_ ((struct charset *, unsigned)); -extern unsigned encode_char P_ ((struct charset *, int)); -extern int string_xstring_p P_ ((Lisp_Object)); +extern int maybe_unify_char (int, Lisp_Object); +extern int decode_char (struct charset *, unsigned); +extern unsigned encode_char (struct charset *, int); +extern int string_xstring_p (Lisp_Object); -extern void map_charset_chars P_ ((void (*) (Lisp_Object, Lisp_Object), - Lisp_Object, Lisp_Object, - struct charset *, unsigned, unsigned)); +extern void map_charset_chars (void (*) (Lisp_Object, Lisp_Object), + Lisp_Object, Lisp_Object, + struct charset *, unsigned, unsigned); EXFUN (Funify_charset, 3); diff --git a/src/chartab.c b/src/chartab.c index 2b547184b21..fddd8a3d406 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -62,8 +62,7 @@ PURPOSE should be a symbol. If it has a `char-table-extra-slots' property, the property's value should be an integer between 0 and 10 that specifies how many extra slots the char-table has. Otherwise, the char-table has no extra slot. */) - (purpose, init) - register Lisp_Object purpose, init; + (register Lisp_Object purpose, Lisp_Object init) { Lisp_Object vector; Lisp_Object n; @@ -92,9 +91,7 @@ the char-table has no extra slot. */) } static Lisp_Object -make_sub_char_table (depth, min_char, defalt) - int depth, min_char; - Lisp_Object defalt; +make_sub_char_table (int depth, int min_char, Lisp_Object defalt) { Lisp_Object table; int size = VECSIZE (struct Lisp_Sub_Char_Table) - 1 + chartab_size[depth]; @@ -108,8 +105,7 @@ make_sub_char_table (depth, min_char, defalt) } static Lisp_Object -char_table_ascii (table) - Lisp_Object table; +char_table_ascii (Lisp_Object table) { Lisp_Object sub; @@ -123,8 +119,7 @@ char_table_ascii (table) } Lisp_Object -copy_sub_char_table (table) - Lisp_Object table; +copy_sub_char_table (Lisp_Object table) { Lisp_Object copy; int depth = XINT (XSUB_CHAR_TABLE (table)->depth); @@ -148,8 +143,7 @@ copy_sub_char_table (table) Lisp_Object -copy_char_table (table) - Lisp_Object table; +copy_char_table (Lisp_Object table) { Lisp_Object copy; int size = XCHAR_TABLE (table)->size & PSEUDOVECTOR_SIZE_MASK; @@ -175,9 +169,7 @@ copy_char_table (table) } Lisp_Object -sub_char_table_ref (table, c) - Lisp_Object table; - int c; +sub_char_table_ref (Lisp_Object table, int c) { struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); int depth = XINT (tbl->depth); @@ -191,9 +183,7 @@ sub_char_table_ref (table, c) } Lisp_Object -char_table_ref (table, c) - Lisp_Object table; - int c; +char_table_ref (Lisp_Object table, int c) { struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); Lisp_Object val; @@ -220,11 +210,7 @@ char_table_ref (table, c) } static Lisp_Object -sub_char_table_ref_and_range (table, c, from, to, defalt) - Lisp_Object table; - int c; - int *from, *to; - Lisp_Object defalt; +sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp_Object defalt) { struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); int depth = XINT (tbl->depth); @@ -286,10 +272,7 @@ sub_char_table_ref_and_range (table, c, from, to, defalt) 1) are different from that of C. */ Lisp_Object -char_table_ref_and_range (table, c, from, to) - Lisp_Object table; - int c; - int *from, *to; +char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to) { struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); int index = CHARTAB_IDX (c, 0, 0), idx; @@ -363,10 +346,7 @@ char_table_ref_and_range (table, c, from, to) static void -sub_char_table_set (table, c, val) - Lisp_Object table; - int c; - Lisp_Object val; +sub_char_table_set (Lisp_Object table, int c, Lisp_Object val) { struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); int depth = XINT ((tbl)->depth); @@ -390,10 +370,7 @@ sub_char_table_set (table, c, val) } Lisp_Object -char_table_set (table, c, val) - Lisp_Object table; - int c; - Lisp_Object val; +char_table_set (Lisp_Object table, int c, Lisp_Object val) { struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); @@ -421,12 +398,7 @@ char_table_set (table, c, val) } static void -sub_char_table_set_range (table, depth, min_char, from, to, val) - Lisp_Object *table; - int depth; - int min_char; - int from, to; - Lisp_Object val; +sub_char_table_set_range (Lisp_Object *table, int depth, int min_char, int from, int to, Lisp_Object val) { int max_char = min_char + chartab_chars[depth] - 1; @@ -454,10 +426,7 @@ sub_char_table_set_range (table, depth, min_char, from, to, val) Lisp_Object -char_table_set_range (table, from, to, val) - Lisp_Object table; - int from, to; - Lisp_Object val; +char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val) { struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); Lisp_Object *contents = tbl->contents; @@ -482,8 +451,7 @@ DEFUN ("char-table-subtype", Fchar_table_subtype, Schar_table_subtype, 1, 1, 0, doc: /* Return the subtype of char-table CHAR-TABLE. The value is a symbol. */) - (char_table) - Lisp_Object char_table; + (Lisp_Object char_table) { CHECK_CHAR_TABLE (char_table); @@ -497,8 +465,7 @@ The value is either nil or another char-table. If CHAR-TABLE holds nil for a given character, then the actual applicable value is inherited from the parent char-table \(or from its parents, if necessary). */) - (char_table) - Lisp_Object char_table; + (Lisp_Object char_table) { CHECK_CHAR_TABLE (char_table); @@ -509,8 +476,7 @@ DEFUN ("set-char-table-parent", Fset_char_table_parent, Sset_char_table_parent, 2, 2, 0, doc: /* Set the parent char-table of CHAR-TABLE to PARENT. Return PARENT. PARENT must be either nil or another char-table. */) - (char_table, parent) - Lisp_Object char_table, parent; + (Lisp_Object char_table, Lisp_Object parent) { Lisp_Object temp; @@ -533,8 +499,7 @@ Return PARENT. PARENT must be either nil or another char-table. */) DEFUN ("char-table-extra-slot", Fchar_table_extra_slot, Schar_table_extra_slot, 2, 2, 0, doc: /* Return the value of CHAR-TABLE's extra-slot number N. */) - (char_table, n) - Lisp_Object char_table, n; + (Lisp_Object char_table, Lisp_Object n) { CHECK_CHAR_TABLE (char_table); CHECK_NUMBER (n); @@ -549,8 +514,7 @@ DEFUN ("set-char-table-extra-slot", Fset_char_table_extra_slot, Sset_char_table_extra_slot, 3, 3, 0, doc: /* Set CHAR-TABLE's extra-slot number N to VALUE. */) - (char_table, n, value) - Lisp_Object char_table, n, value; + (Lisp_Object char_table, Lisp_Object n, Lisp_Object value) { CHECK_CHAR_TABLE (char_table); CHECK_NUMBER (n); @@ -566,8 +530,7 @@ DEFUN ("char-table-range", Fchar_table_range, Schar_table_range, doc: /* Return the value in CHAR-TABLE for a range of characters RANGE. RANGE should be nil (for the default value), a cons of character codes (for characters in the range), or a character code. */) - (char_table, range) - Lisp_Object char_table, range; + (Lisp_Object char_table, Lisp_Object range) { Lisp_Object val; CHECK_CHAR_TABLE (char_table); @@ -597,8 +560,7 @@ DEFUN ("set-char-table-range", Fset_char_table_range, Sset_char_table_range, RANGE should be t (for all characters), nil (for the default value), a cons of character codes (for characters in the range), or a character code. Return VALUE. */) - (char_table, range, value) - Lisp_Object char_table, range, value; + (Lisp_Object char_table, Lisp_Object range, Lisp_Object value) { CHECK_CHAR_TABLE (char_table); if (EQ (range, Qt)) @@ -630,8 +592,7 @@ DEFUN ("set-char-table-default", Fset_char_table_default, Sset_char_table_default, 3, 3, 0, doc: /* This function is obsolete and has no effect. */) - (char_table, ch, value) - Lisp_Object char_table, ch, value; + (Lisp_Object char_table, Lisp_Object ch, Lisp_Object value) { return Qnil; } @@ -640,9 +601,7 @@ This function is obsolete and has no effect. */) integer. If the element is not a character, return CH itself. */ int -char_table_translate (table, ch) - Lisp_Object table; - int ch; +char_table_translate (Lisp_Object table, int ch) { Lisp_Object value; value = Faref (table, make_number (ch)); @@ -652,8 +611,7 @@ char_table_translate (table, ch) } static Lisp_Object -optimize_sub_char_table (table, test) - Lisp_Object table, test; +optimize_sub_char_table (Lisp_Object table, Lisp_Object test) { struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); int depth = XINT (tbl->depth); @@ -686,8 +644,7 @@ DEFUN ("optimize-char-table", Foptimize_char_table, Soptimize_char_table, doc: /* Optimize CHAR-TABLE. TEST is the comparison function used to decide whether two entries are equivalent and can be merged. It defaults to `equal'. */) - (char_table, test) - Lisp_Object char_table, test; + (Lisp_Object char_table, Lisp_Object test) { Lisp_Object elt; int i; @@ -723,10 +680,9 @@ equivalent and can be merged. It defaults to `equal'. */) following characters in TABLE have the same value. */ static Lisp_Object -map_sub_char_table (c_function, function, table, arg, val, range, - default_val, parent) - void (*c_function) P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); - Lisp_Object function, table, arg, val, range, default_val, parent; +map_sub_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object), + Lisp_Object function, Lisp_Object table, Lisp_Object arg, Lisp_Object val, + Lisp_Object range, Lisp_Object default_val, Lisp_Object parent) { /* Pointer to the elements of TABLE. */ Lisp_Object *contents; @@ -840,9 +796,7 @@ map_sub_char_table (c_function, function, table, arg, val, range, ARG is passed to C_FUNCTION when that is called. */ void -map_char_table (c_function, function, table, arg) - void (*c_function) P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); - Lisp_Object function, table, arg; +map_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object), Lisp_Object function, Lisp_Object table, Lisp_Object arg) { Lisp_Object range, val; struct gcpro gcpro1, gcpro2, gcpro3; @@ -902,8 +856,7 @@ Call FUNCTION for each character in CHAR-TABLE that has non-nil value. FUNCTION is called with two arguments--a key and a value. The key is a character code or a cons of character codes specifying a range of characters that have the same value. */) - (function, char_table) - Lisp_Object function, char_table; + (Lisp_Object function, Lisp_Object char_table) { CHECK_CHAR_TABLE (char_table); @@ -913,12 +866,10 @@ range of characters that have the same value. */) static void -map_sub_char_table_for_charset (c_function, function, table, arg, range, - charset, from, to) - void (*c_function) P_ ((Lisp_Object, Lisp_Object)); - Lisp_Object function, table, arg, range; - struct charset *charset; - unsigned from, to; +map_sub_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object), + Lisp_Object function, Lisp_Object table, Lisp_Object arg, + Lisp_Object range, struct charset *charset, + unsigned from, unsigned to) { struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); int depth = XINT (tbl->depth); @@ -1000,12 +951,10 @@ map_sub_char_table_for_charset (c_function, function, table, arg, range, map_charset_chars. */ void -map_char_table_for_charset (c_function, function, table, arg, - charset, from, to) - void (*c_function) P_ ((Lisp_Object, Lisp_Object)); - Lisp_Object function, table, arg; - struct charset *charset; - unsigned from, to; +map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object), + Lisp_Object function, Lisp_Object table, Lisp_Object arg, + struct charset *charset, + unsigned from, unsigned to) { Lisp_Object range; int c, i; @@ -1049,7 +998,7 @@ map_char_table_for_charset (c_function, function, table, arg, void -syms_of_chartab () +syms_of_chartab (void) { defsubr (&Smake_char_table); defsubr (&Schar_table_parent); diff --git a/src/cm.c b/src/cm.c index 73d3791074e..dac6ece7b2d 100644 --- a/src/cm.c +++ b/src/cm.c @@ -33,8 +33,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* For now, don't try to include termcap.h. On some systems, configure finds a non-standard termcap.h that the main build won't find. */ -extern void tputs P_ ((const char *, int, int (*)(int))); -extern char *tgoto P_ ((const char *, int, int)); +extern void tputs (const char *, int, int (*)(int)); +extern char *tgoto (const char *, int, int); #define BIG 9999 /* 9999 good on VAXen. For 16 bit machines use about 2000.... */ @@ -45,8 +45,7 @@ int cost; /* sums up costs */ /* ARGSUSED */ int -evalcost (c) - char c; +evalcost (int c) { cost++; return c; @@ -56,8 +55,7 @@ evalcost (c) struct tty_display_info *current_tty; int -cmputc (c) - char c; +cmputc (int c) { if (current_tty->termscript) putc (c & 0177, current_tty->termscript); @@ -326,9 +324,7 @@ losecursor () #define USECR 3 void -cmgoto (tty, row, col) - struct tty_display_info *tty; - int row, col; +cmgoto (struct tty_display_info *tty, int row, int col) { int homecost, crcost, @@ -434,7 +430,7 @@ cmgoto (tty, row, col) void Wcm_clear (struct tty_display_info *tty) { - bzero (tty->Wcm, sizeof (struct cm)); + memset (tty->Wcm, 0, sizeof (struct cm)); UP = 0; BC = 0; } diff --git a/src/cm.h b/src/cm.h index 4364a39962e..0ede5e0cc98 100644 --- a/src/cm.h +++ b/src/cm.h @@ -158,17 +158,17 @@ extern char PC; /* Pad character */ #define losecursor(tty) (curX(tty) = -1, curY(tty) = -1) extern int cost; -extern int evalcost (); +extern int evalcost (int c); #define emacs_tputs(tty, str, affcnt, putc) (current_tty = (tty), tputs (str, affcnt, putc)) extern struct tty_display_info *current_tty; -extern void cmcheckmagic P_ ((struct tty_display_info *)); -extern int cmputc P_ ((int)); -extern void cmcostinit P_ ((struct tty_display_info *)); -extern void cmgoto P_ ((struct tty_display_info *, int, int)); -extern void Wcm_clear P_ ((struct tty_display_info *)); -extern int Wcm_init P_ ((struct tty_display_info *)); +extern void cmcheckmagic (struct tty_display_info *); +extern int cmputc (int); +extern void cmcostinit (struct tty_display_info *); +extern void cmgoto (struct tty_display_info *, int, int); +extern void Wcm_clear (struct tty_display_info *); +extern int Wcm_init (struct tty_display_info *); /* arch-tag: acc1535a-7136-49d6-b22d-9bc85702251b (do not change this comment) */ diff --git a/src/cmds.c b/src/cmds.c index ba89c532be8..81f975a9885 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -48,8 +48,7 @@ extern Lisp_Object Vtranslation_table_for_input; DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0, doc: /* Return buffer position N characters after (before if N negative) point. */) - (n) - Lisp_Object n; + (Lisp_Object n) { CHECK_NUMBER (n); @@ -63,8 +62,7 @@ On reaching end or beginning of buffer, stop and signal error. Depending on the bidirectional context, the movement may be to the right or to the left on the screen. This is in contrast with \\[right-char], which see. */) - (n) - Lisp_Object n; + (Lisp_Object n) { if (NILP (n)) XSETFASTINT (n, 1); @@ -103,8 +101,7 @@ On attempt to pass beginning or end of buffer, stop and signal error. Depending on the bidirectional context, the movement may be to the right or to the left on the screen. This is in contrast with \\[left-char], which see. */) - (n) - Lisp_Object n; + (Lisp_Object n) { if (NILP (n)) XSETFASTINT (n, 1); @@ -123,8 +120,7 @@ Returns the count of lines left to move. If moving forward, that is N - number of lines moved; if backward, N + number moved. With positive N, a non-empty line at the end counts as one line successfully moved (for the return value). */) - (n) - Lisp_Object n; + (Lisp_Object n) { int opoint = PT, opoint_byte = PT_BYTE; int pos, pos_byte; @@ -173,8 +169,7 @@ does not move. To ignore field boundaries bind `inhibit-field-text-motion' to t, or use the `forward-line' function instead. For instance, `(forward-line 0)' does the same thing as `(beginning-of-line)', except that it ignores field boundaries. */) - (n) - Lisp_Object n; + (Lisp_Object n) { if (NILP (n)) XSETFASTINT (n, 1); @@ -197,8 +192,7 @@ point to a different line than the original, unconstrained result. If N is nil or 1, and a rear-sticky field ends at point, the point does not move. To ignore field boundaries bind `inhibit-field-text-motion' to t. */) - (n) - Lisp_Object n; + (Lisp_Object n) { int newpos; @@ -240,9 +234,10 @@ DEFUN ("delete-char", Fdelete_char, Sdelete_char, 1, 2, "p\nP", doc: /* Delete the following N characters (previous if N is negative). Optional second arg KILLFLAG non-nil means kill instead (save in kill ring). Interactively, N is the prefix arg, and KILLFLAG is set if -N was explicitly specified. */) - (n, killflag) - Lisp_Object n, killflag; +N was explicitly specified. + +The command `delete-forward' is preferable for interactive use. */) + (Lisp_Object n, Lisp_Object killflag) { int pos; @@ -273,60 +268,6 @@ N was explicitly specified. */) return Qnil; } -DEFUN ("delete-backward-char", Fdelete_backward_char, Sdelete_backward_char, - 1, 2, "p\nP", - doc: /* Delete the previous N characters (following if N is negative). -Optional second arg KILLFLAG non-nil means kill instead (save in kill ring). -Interactively, N is the prefix arg, and KILLFLAG is set if -N was explicitly specified. -This is meant for interactive use only; from Lisp, better use `delete-char' -with a negated argument. */) - (n, killflag) - Lisp_Object n, killflag; -{ - Lisp_Object value; - int deleted_special = 0; - int pos, pos_byte, i; - - CHECK_NUMBER (n); - - /* See if we are about to delete a tab or newline backwards. */ - pos = PT; - pos_byte = PT_BYTE; - for (i = 0; i < XINT (n) && pos_byte > BEGV_BYTE; i++) - { - int c; - - DEC_BOTH (pos, pos_byte); - c = FETCH_BYTE (pos_byte); - if (c == '\t' || c == '\n') - { - deleted_special = 1; - break; - } - } - - /* In overwrite mode, back over columns while clearing them out, - unless at end of line. */ - if (XINT (n) > 0 - && ! NILP (current_buffer->overwrite_mode) - && ! deleted_special - && ! (PT == ZV || FETCH_BYTE (PT_BYTE) == '\n')) - { - int column = (int) current_column (); /* iftc */ - - value = Fdelete_char (make_number (-XINT (n)), killflag); - i = column - (int) current_column (); /* iftc */ - Finsert_char (make_number (' '), make_number (i), Qnil); - /* Whitespace chars are ASCII chars, so we can simply subtract. */ - SET_PT_BOTH (PT - i, PT_BYTE - i); - } - else - value = Fdelete_char (make_number (-XINT (n)), killflag); - - return value; -} - static int nonundocount; /* Note that there's code in command_loop_1 which typically avoids @@ -338,8 +279,7 @@ Before insertion, `expand-abbrev' is executed if the inserted character does not have word syntax and the previous character in the buffer does. After insertion, the value of `auto-fill-function' is called if the `auto-fill-chars' table has a non-nil value for the inserted character. */) - (n) - Lisp_Object n; + (Lisp_Object n) { int remove_boundary = 1; CHECK_NUMBER (n); @@ -408,9 +348,7 @@ After insertion, the value of `auto-fill-function' is called if the static Lisp_Object Qexpand_abbrev; int -internal_self_insert (c, noautofill) - int c; - int noautofill; +internal_self_insert (int c, int noautofill) { int hairy = 0; Lisp_Object tem; @@ -598,7 +536,7 @@ internal_self_insert (c, noautofill) /* module initialization */ void -syms_of_cmds () +syms_of_cmds (void) { Qkill_backward_chars = intern_c_string ("kill-backward-chars"); staticpro (&Qkill_backward_chars); @@ -635,13 +573,11 @@ More precisely, a char with closeparen syntax is self-inserted. */); defsubr (&Send_of_line); defsubr (&Sdelete_char); - defsubr (&Sdelete_backward_char); - defsubr (&Sself_insert_command); } void -keys_of_cmds () +keys_of_cmds (void) { int n; @@ -658,10 +594,8 @@ keys_of_cmds () initial_define_key (global_map, Ctl ('A'), "beginning-of-line"); initial_define_key (global_map, Ctl ('B'), "backward-char"); - initial_define_key (global_map, Ctl ('D'), "delete-char"); initial_define_key (global_map, Ctl ('E'), "end-of-line"); initial_define_key (global_map, Ctl ('F'), "forward-char"); - initial_define_key (global_map, 0177, "delete-backward-char"); } /* arch-tag: 022ba3cd-67f9-4978-9c5d-7d2b18d8644e diff --git a/src/coding.c b/src/coding.c index 6435fa1ddb1..dcd31fe9f28 100644 --- a/src/coding.c +++ b/src/coding.c @@ -154,9 +154,8 @@ STRUCT CODING_SYSTEM #if 0 static int -detect_coding_XXX (coding, detect_info) - struct coding_system *coding; - struct coding_detection_info *detect_info; +detect_coding_XXX (struct coding_system *coding, + struct coding_detection_info *detect_info) { const unsigned char *src = coding->source; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -203,8 +202,7 @@ detect_coding_XXX (coding, detect_info) #if 0 static void -decode_coding_XXXX (coding) - struct coding_system *coding; +decode_coding_XXXX (struct coding_system *coding) { const unsigned char *src = coding->source + coding->consumed; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -261,8 +259,7 @@ decode_coding_XXXX (coding) Below is a template of these functions. */ #if 0 static void -encode_coding_XXX (coding) - struct coding_system *coding; +encode_coding_XXX (struct coding_system *coding) { int multibytep = coding->dst_multibyte; int *charbuf = coding->charbuf; @@ -896,80 +893,80 @@ static struct coding_system coding_categories[coding_category_max]; /* Prototypes for static functions. */ -static void record_conversion_result P_ ((struct coding_system *coding, - enum coding_result_code result)); -static int detect_coding_utf_8 P_ ((struct coding_system *, - struct coding_detection_info *info)); -static void decode_coding_utf_8 P_ ((struct coding_system *)); -static int encode_coding_utf_8 P_ ((struct coding_system *)); +static void record_conversion_result (struct coding_system *coding, + enum coding_result_code result); +static int detect_coding_utf_8 (struct coding_system *, + struct coding_detection_info *info); +static void decode_coding_utf_8 (struct coding_system *); +static int encode_coding_utf_8 (struct coding_system *); -static int detect_coding_utf_16 P_ ((struct coding_system *, - struct coding_detection_info *info)); -static void decode_coding_utf_16 P_ ((struct coding_system *)); -static int encode_coding_utf_16 P_ ((struct coding_system *)); +static int detect_coding_utf_16 (struct coding_system *, + struct coding_detection_info *info); +static void decode_coding_utf_16 (struct coding_system *); +static int encode_coding_utf_16 (struct coding_system *); -static int detect_coding_iso_2022 P_ ((struct coding_system *, - struct coding_detection_info *info)); -static void decode_coding_iso_2022 P_ ((struct coding_system *)); -static int encode_coding_iso_2022 P_ ((struct coding_system *)); +static int detect_coding_iso_2022 (struct coding_system *, + struct coding_detection_info *info); +static void decode_coding_iso_2022 (struct coding_system *); +static int encode_coding_iso_2022 (struct coding_system *); -static int detect_coding_emacs_mule P_ ((struct coding_system *, - struct coding_detection_info *info)); -static void decode_coding_emacs_mule P_ ((struct coding_system *)); -static int encode_coding_emacs_mule P_ ((struct coding_system *)); +static int detect_coding_emacs_mule (struct coding_system *, + struct coding_detection_info *info); +static void decode_coding_emacs_mule (struct coding_system *); +static int encode_coding_emacs_mule (struct coding_system *); -static int detect_coding_sjis P_ ((struct coding_system *, - struct coding_detection_info *info)); -static void decode_coding_sjis P_ ((struct coding_system *)); -static int encode_coding_sjis P_ ((struct coding_system *)); +static int detect_coding_sjis (struct coding_system *, + struct coding_detection_info *info); +static void decode_coding_sjis (struct coding_system *); +static int encode_coding_sjis (struct coding_system *); -static int detect_coding_big5 P_ ((struct coding_system *, - struct coding_detection_info *info)); -static void decode_coding_big5 P_ ((struct coding_system *)); -static int encode_coding_big5 P_ ((struct coding_system *)); +static int detect_coding_big5 (struct coding_system *, + struct coding_detection_info *info); +static void decode_coding_big5 (struct coding_system *); +static int encode_coding_big5 (struct coding_system *); -static int detect_coding_ccl P_ ((struct coding_system *, - struct coding_detection_info *info)); -static void decode_coding_ccl P_ ((struct coding_system *)); -static int encode_coding_ccl P_ ((struct coding_system *)); +static int detect_coding_ccl (struct coding_system *, + struct coding_detection_info *info); +static void decode_coding_ccl (struct coding_system *); +static int encode_coding_ccl (struct coding_system *); -static void decode_coding_raw_text P_ ((struct coding_system *)); -static int encode_coding_raw_text P_ ((struct coding_system *)); +static void decode_coding_raw_text (struct coding_system *); +static int encode_coding_raw_text (struct coding_system *); -static void coding_set_source P_ ((struct coding_system *)); -static void coding_set_destination P_ ((struct coding_system *)); -static void coding_alloc_by_realloc P_ ((struct coding_system *, EMACS_INT)); -static void coding_alloc_by_making_gap P_ ((struct coding_system *, - EMACS_INT, EMACS_INT)); -static unsigned char *alloc_destination P_ ((struct coding_system *, - EMACS_INT, unsigned char *)); -static void setup_iso_safe_charsets P_ ((Lisp_Object)); -static unsigned char *encode_designation_at_bol P_ ((struct coding_system *, - int *, int *, - unsigned char *)); -static int detect_eol P_ ((const unsigned char *, - EMACS_INT, enum coding_category)); -static Lisp_Object adjust_coding_eol_type P_ ((struct coding_system *, int)); -static void decode_eol P_ ((struct coding_system *)); -static Lisp_Object get_translation_table P_ ((Lisp_Object, int, int *)); -static Lisp_Object get_translation P_ ((Lisp_Object, int *, int *)); -static int produce_chars P_ ((struct coding_system *, Lisp_Object, int)); -static INLINE void produce_charset P_ ((struct coding_system *, int *, - EMACS_INT)); -static void produce_annotation P_ ((struct coding_system *, EMACS_INT)); -static int decode_coding P_ ((struct coding_system *)); -static INLINE int *handle_composition_annotation P_ ((EMACS_INT, EMACS_INT, - struct coding_system *, - int *, EMACS_INT *)); -static INLINE int *handle_charset_annotation P_ ((EMACS_INT, EMACS_INT, - struct coding_system *, - int *, EMACS_INT *)); -static void consume_chars P_ ((struct coding_system *, Lisp_Object, int)); -static int encode_coding P_ ((struct coding_system *)); -static Lisp_Object make_conversion_work_buffer P_ ((int)); -static Lisp_Object code_conversion_restore P_ ((Lisp_Object)); -static INLINE int char_encodable_p P_ ((int, Lisp_Object)); -static Lisp_Object make_subsidiaries P_ ((Lisp_Object)); +static void coding_set_source (struct coding_system *); +static void coding_set_destination (struct coding_system *); +static void coding_alloc_by_realloc (struct coding_system *, EMACS_INT); +static void coding_alloc_by_making_gap (struct coding_system *, + EMACS_INT, EMACS_INT); +static unsigned char *alloc_destination (struct coding_system *, + EMACS_INT, unsigned char *); +static void setup_iso_safe_charsets (Lisp_Object); +static unsigned char *encode_designation_at_bol (struct coding_system *, + int *, int *, + unsigned char *); +static int detect_eol (const unsigned char *, + EMACS_INT, enum coding_category); +static Lisp_Object adjust_coding_eol_type (struct coding_system *, int); +static void decode_eol (struct coding_system *); +static Lisp_Object get_translation_table (Lisp_Object, int, int *); +static Lisp_Object get_translation (Lisp_Object, int *, int *); +static int produce_chars (struct coding_system *, Lisp_Object, int); +static INLINE void produce_charset (struct coding_system *, int *, + EMACS_INT); +static void produce_annotation (struct coding_system *, EMACS_INT); +static int decode_coding (struct coding_system *); +static INLINE int *handle_composition_annotation (EMACS_INT, EMACS_INT, + struct coding_system *, + int *, EMACS_INT *); +static INLINE int *handle_charset_annotation (EMACS_INT, EMACS_INT, + struct coding_system *, + int *, EMACS_INT *); +static void consume_chars (struct coding_system *, Lisp_Object, int); +static int encode_coding (struct coding_system *); +static Lisp_Object make_conversion_work_buffer (int); +static Lisp_Object code_conversion_restore (Lisp_Object); +static INLINE int char_encodable_p (int, Lisp_Object); +static Lisp_Object make_subsidiaries (Lisp_Object); static void record_conversion_result (struct coding_system *coding, @@ -1106,8 +1103,7 @@ record_conversion_result (struct coding_system *coding, static void -coding_set_source (coding) - struct coding_system *coding; +coding_set_source (struct coding_system *coding) { if (BUFFERP (coding->src_object)) { @@ -1129,8 +1125,7 @@ coding_set_source (coding) } static void -coding_set_destination (coding) - struct coding_system *coding; +coding_set_destination (struct coding_system *coding) { if (BUFFERP (coding->dst_object)) { @@ -1159,9 +1154,7 @@ coding_set_destination (coding) static void -coding_alloc_by_realloc (coding, bytes) - struct coding_system *coding; - EMACS_INT bytes; +coding_alloc_by_realloc (struct coding_system *coding, EMACS_INT bytes) { coding->destination = (unsigned char *) xrealloc (coding->destination, coding->dst_bytes + bytes); @@ -1169,9 +1162,8 @@ coding_alloc_by_realloc (coding, bytes) } static void -coding_alloc_by_making_gap (coding, gap_head_used, bytes) - struct coding_system *coding; - EMACS_INT gap_head_used, bytes; +coding_alloc_by_making_gap (struct coding_system *coding, + EMACS_INT gap_head_used, EMACS_INT bytes) { if (EQ (coding->src_object, coding->dst_object)) { @@ -1200,10 +1192,8 @@ coding_alloc_by_making_gap (coding, gap_head_used, bytes) static unsigned char * -alloc_destination (coding, nbytes, dst) - struct coding_system *coding; - EMACS_INT nbytes; - unsigned char *dst; +alloc_destination (struct coding_system *coding, EMACS_INT nbytes, + unsigned char *dst) { EMACS_INT offset = dst - coding->destination; @@ -1301,9 +1291,8 @@ alloc_destination (coding, nbytes, dst) #define UTF_8_BOM_3 0xBF static int -detect_coding_utf_8 (coding, detect_info) - struct coding_system *coding; - struct coding_detection_info *detect_info; +detect_coding_utf_8 (struct coding_system *coding, + struct coding_detection_info *detect_info) { const unsigned char *src = coding->source, *src_base; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -1386,8 +1375,7 @@ detect_coding_utf_8 (coding, detect_info) static void -decode_coding_utf_8 (coding) - struct coding_system *coding; +decode_coding_utf_8 (struct coding_system *coding) { const unsigned char *src = coding->source + coding->consumed; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -1435,8 +1423,6 @@ decode_coding_utf_8 (coding) } CODING_UTF_8_BOM (coding) = utf_without_bom; - - while (1) { int c, c1, c2, c3, c4, c5; @@ -1459,7 +1445,7 @@ decode_coding_utf_8 (coding) { c = - c1; } - else if (UTF_8_1_OCTET_P(c1)) + else if (UTF_8_1_OCTET_P (c1)) { if (eol_crlf && c1 == '\r') ONE_MORE_BYTE (byte_after_cr); @@ -1543,8 +1529,7 @@ decode_coding_utf_8 (coding) static int -encode_coding_utf_8 (coding) - struct coding_system *coding; +encode_coding_utf_8 (struct coding_system *coding) { int multibytep = coding->dst_multibyte; int *charbuf = coding->charbuf; @@ -1623,9 +1608,8 @@ encode_coding_utf_8 (coding) static int -detect_coding_utf_16 (coding, detect_info) - struct coding_system *coding; - struct coding_detection_info *detect_info; +detect_coding_utf_16 (struct coding_system *coding, + struct coding_detection_info *detect_info) { const unsigned char *src = coding->source, *src_base = src; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -1708,8 +1692,7 @@ detect_coding_utf_16 (coding, detect_info) } static void -decode_coding_utf_16 (coding) - struct coding_system *coding; +decode_coding_utf_16 (struct coding_system *coding) { const unsigned char *src = coding->source + coding->consumed; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -1837,8 +1820,7 @@ decode_coding_utf_16 (coding) } static int -encode_coding_utf_16 (coding) - struct coding_system *coding; +encode_coding_utf_16 (struct coding_system *coding) { int multibytep = coding->dst_multibyte; int *charbuf = coding->charbuf; @@ -1979,9 +1961,8 @@ char emacs_mule_bytes[256]; else return 0. */ static int -detect_coding_emacs_mule (coding, detect_info) - struct coding_system *coding; - struct coding_detection_info *detect_info; +detect_coding_emacs_mule (struct coding_system *coding, + struct coding_detection_info *detect_info) { const unsigned char *src = coding->source, *src_base; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -2069,11 +2050,9 @@ detect_coding_emacs_mule (coding, detect_info) -1. If SRC is too short, return -2. */ int -emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) - struct coding_system *coding; - const unsigned char *src; - int *nbytes, *nchars, *id; - struct composition_status *cmp_status; +emacs_mule_char (struct coding_system *coding, const unsigned char *src, + int *nbytes, int *nchars, int *id, + struct composition_status *cmp_status) { const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_base = src; @@ -2210,7 +2189,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) (3) alt&rule composition: 0x80 0xF5 BYTES CHARS | ALT RULE ... ALT CHAR ... and these old form: - + (4) relative composition: 0x80 | MSEQ ... MSEQ (5) rulebase composition: 0x80 0xFF | MSEQ MRULE ... MSEQ @@ -2391,9 +2370,8 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) static int -emacs_mule_finish_composition (charbuf, cmp_status) - int *charbuf; - struct composition_status *cmp_status; +emacs_mule_finish_composition (int *charbuf, + struct composition_status *cmp_status) { int idx = - cmp_status->length; int new_chars; @@ -2448,8 +2426,7 @@ emacs_mule_finish_composition (charbuf, cmp_status) static void -decode_coding_emacs_mule (coding) - struct coding_system *coding; +decode_coding_emacs_mule (struct coding_system *coding) { const unsigned char *src = coding->source + coding->consumed; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -2713,8 +2690,7 @@ decode_coding_emacs_mule (coding) static int -encode_coding_emacs_mule (coding) - struct coding_system *coding; +encode_coding_emacs_mule (struct coding_system *coding) { int multibytep = coding->dst_multibyte; int *charbuf = coding->charbuf; @@ -3007,8 +2983,7 @@ enum iso_code_class_type iso_code_class[256]; (CODING_ISO_INITIAL (&coding_categories[category], 1) >= 0) static void -setup_iso_safe_charsets (attrs) - Lisp_Object attrs; +setup_iso_safe_charsets (Lisp_Object attrs) { Lisp_Object charset_list, safe_charsets; Lisp_Object request; @@ -3076,9 +3051,8 @@ setup_iso_safe_charsets (attrs) If it is, return 1, else return 0. */ static int -detect_coding_iso_2022 (coding, detect_info) - struct coding_system *coding; - struct coding_detection_info *detect_info; +detect_coding_iso_2022 (struct coding_system *coding, + struct coding_detection_info *detect_info) { const unsigned char *src = coding->source, *src_base = src; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -3442,12 +3416,10 @@ detect_coding_iso_2022 (coding, detect_info) /* Finish the current composition as invalid. */ -static int finish_composition P_ ((int *, struct composition_status *)); +static int finish_composition (int *, struct composition_status *); static int -finish_composition (charbuf, cmp_status) - int *charbuf; - struct composition_status *cmp_status; +finish_composition (int *charbuf, struct composition_status *cmp_status) { int idx = - cmp_status->length; int new_chars; @@ -3584,8 +3556,7 @@ finish_composition (charbuf, cmp_status) /* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */ static void -decode_coding_iso_2022 (coding) - struct coding_system *coding; +decode_coding_iso_2022 (struct coding_system *coding) { const unsigned char *src = coding->source + coding->consumed; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -4317,7 +4288,7 @@ decode_coding_iso_2022 (coding) #define ENCODE_ISO_CHARACTER(charset, c) \ do { \ - int code = ENCODE_CHAR ((charset),(c)); \ + int code = ENCODE_CHAR ((charset), (c)); \ \ if (CHARSET_DIMENSION (charset) == 1) \ ENCODE_ISO_CHARACTER_DIMENSION1 ((charset), code); \ @@ -4331,11 +4302,9 @@ decode_coding_iso_2022 (coding) Return new DST. */ unsigned char * -encode_invocation_designation (charset, coding, dst, p_nchars) - struct charset *charset; - struct coding_system *coding; - unsigned char *dst; - int *p_nchars; +encode_invocation_designation (struct charset *charset, + struct coding_system *coding, + unsigned char *dst, int *p_nchars) { int multibytep = coding->dst_multibyte; int produced_chars = *p_nchars; @@ -4447,10 +4416,8 @@ encode_invocation_designation (charset, coding, dst, p_nchars) find all the necessary designations. */ static unsigned char * -encode_designation_at_bol (coding, charbuf, charbuf_end, dst) - struct coding_system *coding; - int *charbuf, *charbuf_end; - unsigned char *dst; +encode_designation_at_bol (struct coding_system *coding, int *charbuf, + int *charbuf_end, unsigned char *dst) { struct charset *charset; /* Table of charsets to be designated to each graphic register. */ @@ -4500,8 +4467,7 @@ encode_designation_at_bol (coding, charbuf, charbuf_end, dst) /* See the above "GENERAL NOTES on `encode_coding_XXX ()' functions". */ static int -encode_coding_iso_2022 (coding) - struct coding_system *coding; +encode_coding_iso_2022 (struct coding_system *coding) { int multibytep = coding->dst_multibyte; int *charbuf = coding->charbuf; @@ -4691,9 +4657,8 @@ encode_coding_iso_2022 (coding) CATEGORY_MASK_SJIS, else return 0. */ static int -detect_coding_sjis (coding, detect_info) - struct coding_system *coding; - struct coding_detection_info *detect_info; +detect_coding_sjis (struct coding_system *coding, + struct coding_detection_info *detect_info) { const unsigned char *src = coding->source, *src_base; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -4749,9 +4714,8 @@ detect_coding_sjis (coding, detect_info) CATEGORY_MASK_BIG5, else return 0. */ static int -detect_coding_big5 (coding, detect_info) - struct coding_system *coding; - struct coding_detection_info *detect_info; +detect_coding_big5 (struct coding_system *coding, + struct coding_detection_info *detect_info) { const unsigned char *src = coding->source, *src_base; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -4797,8 +4761,7 @@ detect_coding_big5 (coding, detect_info) If SJIS_P is 1, decode SJIS text, else decode BIG5 test. */ static void -decode_coding_sjis (coding) - struct coding_system *coding; +decode_coding_sjis (struct coding_system *coding) { const unsigned char *src = coding->source + coding->consumed; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -4916,8 +4879,7 @@ decode_coding_sjis (coding) } static void -decode_coding_big5 (coding) - struct coding_system *coding; +decode_coding_big5 (struct coding_system *coding) { const unsigned char *src = coding->source + coding->consumed; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -5021,8 +4983,7 @@ decode_coding_big5 (coding) SJIS text, else encode BIG5 text. */ static int -encode_coding_sjis (coding) - struct coding_system *coding; +encode_coding_sjis (struct coding_system *coding) { int multibytep = coding->dst_multibyte; int *charbuf = coding->charbuf; @@ -5114,8 +5075,7 @@ encode_coding_sjis (coding) } static int -encode_coding_big5 (coding) - struct coding_system *coding; +encode_coding_big5 (struct coding_system *coding) { int multibytep = coding->dst_multibyte; int *charbuf = coding->charbuf; @@ -5193,9 +5153,8 @@ encode_coding_big5 (coding) CATEGORY_MASK_CCL, else return 0. */ static int -detect_coding_ccl (coding, detect_info) - struct coding_system *coding; - struct coding_detection_info *detect_info; +detect_coding_ccl (struct coding_system *coding, + struct coding_detection_info *detect_info) { const unsigned char *src = coding->source, *src_base; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -5234,8 +5193,7 @@ detect_coding_ccl (coding, detect_info) } static void -decode_coding_ccl (coding) - struct coding_system *coding; +decode_coding_ccl (struct coding_system *coding) { const unsigned char *src = coding->source + coding->consumed; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -5304,8 +5262,7 @@ decode_coding_ccl (coding) } static int -encode_coding_ccl (coding) - struct coding_system *coding; +encode_coding_ccl (struct coding_system *coding) { struct ccl_program *ccl = &coding->spec.ccl->ccl; int multibytep = coding->dst_multibyte; @@ -5374,8 +5331,7 @@ encode_coding_ccl (coding) /* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */ static void -decode_coding_raw_text (coding) - struct coding_system *coding; +decode_coding_raw_text (struct coding_system *coding) { int eol_crlf = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); @@ -5394,8 +5350,7 @@ decode_coding_raw_text (coding) } static int -encode_coding_raw_text (coding) - struct coding_system *coding; +encode_coding_raw_text (struct coding_system *coding) { int multibytep = coding->dst_multibyte; int *charbuf = coding->charbuf; @@ -5478,9 +5433,8 @@ encode_coding_raw_text (coding) is, return 1, else return 0. */ static int -detect_coding_charset (coding, detect_info) - struct coding_system *coding; - struct coding_detection_info *detect_info; +detect_coding_charset (struct coding_system *coding, + struct coding_detection_info *detect_info) { const unsigned char *src = coding->source, *src_base; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -5582,8 +5536,7 @@ detect_coding_charset (coding, detect_info) } static void -decode_coding_charset (coding) - struct coding_system *coding; +decode_coding_charset (struct coding_system *coding) { const unsigned char *src = coding->source + coding->consumed; const unsigned char *src_end = coding->source + coding->src_bytes; @@ -5711,8 +5664,7 @@ decode_coding_charset (coding) } static int -encode_coding_charset (coding) - struct coding_system *coding; +encode_coding_charset (struct coding_system *coding) { int multibytep = coding->dst_multibyte; int *charbuf = coding->charbuf; @@ -5782,9 +5734,7 @@ encode_coding_charset (coding) CODING_SYSTEM is invalid, signal an error. */ void -setup_coding_system (coding_system, coding) - Lisp_Object coding_system; - struct coding_system *coding; +setup_coding_system (Lisp_Object coding_system, struct coding_system *coding) { Lisp_Object attrs; Lisp_Object eol_type; @@ -5987,8 +5937,7 @@ setup_coding_system (coding_system, coding) /* Return a list of charsets supported by CODING. */ Lisp_Object -coding_charset_list (coding) - struct coding_system *coding; +coding_charset_list (struct coding_system *coding) { Lisp_Object attrs, charset_list; @@ -6011,8 +5960,7 @@ coding_charset_list (coding) /* Return a list of charsets supported by CODING-SYSTEM. */ Lisp_Object -coding_system_charset_list (coding_system) - Lisp_Object coding_system; +coding_system_charset_list (Lisp_Object coding_system) { int id; Lisp_Object attrs, charset_list; @@ -6045,8 +5993,7 @@ coding_system_charset_list (coding_system) eol_type as CODING-SYSTEM. */ Lisp_Object -raw_text_coding_system (coding_system) - Lisp_Object coding_system; +raw_text_coding_system (Lisp_Object coding_system) { Lisp_Object spec, attrs; Lisp_Object eol_type, raw_text_eol_type; @@ -6077,8 +6024,7 @@ raw_text_coding_system (coding_system) (system_eol_type). */ Lisp_Object -coding_inherit_eol_type (coding_system, parent) - Lisp_Object coding_system, parent; +coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent) { Lisp_Object spec, eol_type; @@ -6233,10 +6179,8 @@ coding_inherit_eol_type (coding_system, parent) #define MAX_EOL_CHECK_COUNT 3 static int -detect_eol (source, src_bytes, category) - const unsigned char *source; - EMACS_INT src_bytes; - enum coding_category category; +detect_eol (const unsigned char *source, EMACS_INT src_bytes, + enum coding_category category) { const unsigned char *src = source, *src_end = src + src_bytes; unsigned char c; @@ -6334,9 +6278,7 @@ detect_eol (source, src_bytes, category) static Lisp_Object -adjust_coding_eol_type (coding, eol_seen) - struct coding_system *coding; - int eol_seen; +adjust_coding_eol_type (struct coding_system *coding, int eol_seen) { Lisp_Object eol_type; @@ -6364,8 +6306,7 @@ adjust_coding_eol_type (coding, eol_seen) system. */ void -detect_coding (coding) - struct coding_system *coding; +detect_coding (struct coding_system *coding) { const unsigned char *src, *src_end; int saved_mode = coding->mode; @@ -6544,8 +6485,7 @@ detect_coding (coding) static void -decode_eol (coding) - struct coding_system *coding; +decode_eol (struct coding_system *coding) { Lisp_Object eol_type; unsigned char *p, *pbeg, *pend; @@ -6610,7 +6550,7 @@ decode_eol (coding) for (p = pend - 2; p >= pbeg; p--) if (*p == '\r') { - safe_bcopy ((char *) (p + 1), (char *) p, pend-- - p - 1); + memmove (p, p + 1, pend-- - p - 1); n++; } } @@ -6647,9 +6587,7 @@ decode_eol (coding) decoding (ENCODEP is zero). */ static Lisp_Object -get_translation_table (attrs, encodep, max_lookup) - Lisp_Object attrs; - int encodep, *max_lookup; +get_translation_table (Lisp_Object attrs, int encodep, int *max_lookup) { Lisp_Object standard, translation_table; Lisp_Object val; @@ -6751,9 +6689,7 @@ get_translation_table (attrs, encodep, max_lookup) If BUF is too short to lookup characters in FROM, return Qt. */ static Lisp_Object -get_translation (trans, buf, buf_end) - Lisp_Object trans; - int *buf, *buf_end; +get_translation (Lisp_Object trans, int *buf, int *buf_end) { if (INTEGERP (trans)) @@ -6780,10 +6716,8 @@ get_translation (trans, buf, buf_end) static int -produce_chars (coding, translation_table, last_block) - struct coding_system *coding; - Lisp_Object translation_table; - int last_block; +produce_chars (struct coding_system *coding, Lisp_Object translation_table, + int last_block) { unsigned char *dst = coding->destination + coding->produced; unsigned char *dst_end = coding->destination + coding->dst_bytes; @@ -6981,10 +6915,7 @@ produce_chars (coding, translation_table, last_block) */ static INLINE void -produce_composition (coding, charbuf, pos) - struct coding_system *coding; - int *charbuf; - EMACS_INT pos; +produce_composition (struct coding_system *coding, int *charbuf, EMACS_INT pos) { int len; EMACS_INT to; @@ -7028,10 +6959,7 @@ produce_composition (coding, charbuf, pos) */ static INLINE void -produce_charset (coding, charbuf, pos) - struct coding_system *coding; - int *charbuf; - EMACS_INT pos; +produce_charset (struct coding_system *coding, int *charbuf, EMACS_INT pos) { EMACS_INT from = pos - charbuf[2]; struct charset *charset = CHARSET_FROM_ID (charbuf[3]); @@ -7066,9 +6994,7 @@ produce_charset (coding, charbuf, pos) static void -produce_annotation (coding, pos) - struct coding_system *coding; - EMACS_INT pos; +produce_annotation (struct coding_system *coding, EMACS_INT pos) { int *charbuf = coding->charbuf; int *charbuf_end = charbuf + coding->charbuf_used; @@ -7123,8 +7049,7 @@ produce_annotation (coding, pos) */ static int -decode_coding (coding) - struct coding_system *coding; +decode_coding (struct coding_system *coding) { Lisp_Object attrs; Lisp_Object undo_list; @@ -7262,11 +7187,9 @@ decode_coding (coding) return BUF. */ static INLINE int * -handle_composition_annotation (pos, limit, coding, buf, stop) - EMACS_INT pos, limit; - struct coding_system *coding; - int *buf; - EMACS_INT *stop; +handle_composition_annotation (EMACS_INT pos, EMACS_INT limit, + struct coding_system *coding, int *buf, + EMACS_INT *stop) { EMACS_INT start, end; Lisp_Object prop; @@ -7347,11 +7270,9 @@ handle_composition_annotation (pos, limit, coding, buf, stop) property value is non-nil (limiting by LIMIT), and return BUF. */ static INLINE int * -handle_charset_annotation (pos, limit, coding, buf, stop) - EMACS_INT pos, limit; - struct coding_system *coding; - int *buf; - EMACS_INT *stop; +handle_charset_annotation (EMACS_INT pos, EMACS_INT limit, + struct coding_system *coding, int *buf, + EMACS_INT *stop) { Lisp_Object val, next; int id; @@ -7371,10 +7292,8 @@ handle_charset_annotation (pos, limit, coding, buf, stop) static void -consume_chars (coding, translation_table, max_lookup) - struct coding_system *coding; - Lisp_Object translation_table; - int max_lookup; +consume_chars (struct coding_system *coding, Lisp_Object translation_table, + int max_lookup) { int *buf = coding->charbuf; int *buf_end = coding->charbuf + coding->charbuf_size; @@ -7530,8 +7449,7 @@ consume_chars (coding, translation_table, max_lookup) memory area specified by CODING->destination. */ static int -encode_coding (coding) - struct coding_system *coding; +encode_coding (struct coding_system *coding) { Lisp_Object attrs; Lisp_Object translation_table; @@ -7595,8 +7513,7 @@ static int reused_workbuf_in_use; multibyteness of returning buffer. */ static Lisp_Object -make_conversion_work_buffer (multibyte) - int multibyte; +make_conversion_work_buffer (int multibyte) { Lisp_Object name, workbuf; struct buffer *current; @@ -7628,8 +7545,7 @@ make_conversion_work_buffer (multibyte) static Lisp_Object -code_conversion_restore (arg) - Lisp_Object arg; +code_conversion_restore (Lisp_Object arg) { Lisp_Object current, workbuf; struct gcpro gcpro1; @@ -7650,8 +7566,7 @@ code_conversion_restore (arg) } Lisp_Object -code_conversion_save (with_work_buf, multibyte) - int with_work_buf, multibyte; +code_conversion_save (int with_work_buf, int multibyte) { Lisp_Object workbuf = Qnil; @@ -7663,11 +7578,10 @@ code_conversion_save (with_work_buf, multibyte) } int -decode_coding_gap (coding, chars, bytes) - struct coding_system *coding; - EMACS_INT chars, bytes; +decode_coding_gap (struct coding_system *coding, + EMACS_INT chars, EMACS_INT bytes) { - int count = specpdl_ptr - specpdl; + int count = SPECPDL_INDEX (); Lisp_Object attrs; code_conversion_save (0, 0); @@ -7710,11 +7624,10 @@ decode_coding_gap (coding, chars, bytes) } int -encode_coding_gap (coding, chars, bytes) - struct coding_system *coding; - EMACS_INT chars, bytes; +encode_coding_gap (struct coding_system *coding, + EMACS_INT chars, EMACS_INT bytes) { - int count = specpdl_ptr - specpdl; + int count = SPECPDL_INDEX (); code_conversion_save (0, 0); @@ -7765,14 +7678,13 @@ encode_coding_gap (coding, chars, bytes) */ void -decode_coding_object (coding, src_object, from, from_byte, to, to_byte, - dst_object) - struct coding_system *coding; - Lisp_Object src_object; - EMACS_INT from, from_byte, to, to_byte; - Lisp_Object dst_object; +decode_coding_object (struct coding_system *coding, + Lisp_Object src_object, + EMACS_INT from, EMACS_INT from_byte, + EMACS_INT to, EMACS_INT to_byte, + Lisp_Object dst_object) { - int count = specpdl_ptr - specpdl; + int count = SPECPDL_INDEX (); unsigned char *destination; EMACS_INT dst_bytes; EMACS_INT chars = to - from; @@ -7902,7 +7814,7 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte, } if (BEGV < GPT && GPT < BEGV + coding->produced_char) move_gap_both (BEGV, BEGV_BYTE); - bcopy (BEGV_ADDR, destination, coding->produced); + memcpy (destination, BEGV_ADDR, coding->produced); coding->destination = destination; } } @@ -7956,14 +7868,13 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte, void -encode_coding_object (coding, src_object, from, from_byte, to, to_byte, - dst_object) - struct coding_system *coding; - Lisp_Object src_object; - EMACS_INT from, from_byte, to, to_byte; - Lisp_Object dst_object; +encode_coding_object (struct coding_system *coding, + Lisp_Object src_object, + EMACS_INT from, EMACS_INT from_byte, + EMACS_INT to, EMACS_INT to_byte, + Lisp_Object dst_object) { - int count = specpdl_ptr - specpdl; + int count = SPECPDL_INDEX (); EMACS_INT chars = to - from; EMACS_INT bytes = to_byte - from_byte; Lisp_Object attrs; @@ -8165,7 +8076,7 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte, Lisp_Object -preferred_coding_system () +preferred_coding_system (void) { int id = coding_categories[coding_priorities[0]].id; @@ -8180,8 +8091,7 @@ DEFUN ("coding-system-p", Fcoding_system_p, Scoding_system_p, 1, 1, 0, doc: /* Return t if OBJECT is nil or a coding-system. See the documentation of `define-coding-system' for information about coding-system objects. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (NILP (object) || CODING_SYSTEM_ID (object) >= 0) @@ -8195,8 +8105,7 @@ about coding-system objects. */) DEFUN ("read-non-nil-coding-system", Fread_non_nil_coding_system, Sread_non_nil_coding_system, 1, 1, 0, doc: /* Read a coding system from the minibuffer, prompting with string PROMPT. */) - (prompt) - Lisp_Object prompt; + (Lisp_Object prompt) { Lisp_Object val; do @@ -8213,8 +8122,7 @@ DEFUN ("read-coding-system", Fread_coding_system, Sread_coding_system, 1, 2, 0, If the user enters null input, return second argument DEFAULT-CODING-SYSTEM. Ignores case when completing coding systems (all Emacs coding systems are lower-case). */) - (prompt, default_coding_system) - Lisp_Object prompt, default_coding_system; + (Lisp_Object prompt, Lisp_Object default_coding_system) { Lisp_Object val; int count = SPECPDL_INDEX (); @@ -8235,8 +8143,7 @@ DEFUN ("check-coding-system", Fcheck_coding_system, Scheck_coding_system, If valid, return CODING-SYSTEM, else signal a `coding-system-error' error. It is valid if it is nil or a symbol defined as a coding system by the function `define-coding-system'. */) - (coding_system) - Lisp_Object coding_system; + (Lisp_Object coding_system) { Lisp_Object define_form; @@ -8269,13 +8176,10 @@ function `define-coding-system'. */) detect only text-format. */ Lisp_Object -detect_coding_system (src, src_chars, src_bytes, highest, multibytep, - coding_system) - const unsigned char *src; - EMACS_INT src_chars, src_bytes; - int highest; - int multibytep; - Lisp_Object coding_system; +detect_coding_system (const unsigned char *src, + EMACS_INT src_chars, EMACS_INT src_bytes, + int highest, int multibytep, + Lisp_Object coding_system) { const unsigned char *src_end = src + src_bytes; Lisp_Object attrs, eol_type; @@ -8591,8 +8495,7 @@ format. If optional argument HIGHEST is non-nil, return the coding system of highest priority. */) - (start, end, highest) - Lisp_Object start, end, highest; + (Lisp_Object start, Lisp_Object end, Lisp_Object highest) { int from, to; int from_byte, to_byte; @@ -8630,8 +8533,7 @@ format. If optional argument HIGHEST is non-nil, return the coding system of highest priority. */) - (string, highest) - Lisp_Object string, highest; + (Lisp_Object string, Lisp_Object highest) { CHECK_STRING (string); @@ -8643,9 +8545,7 @@ highest priority. */) static INLINE int -char_encodable_p (c, attrs) - int c; - Lisp_Object attrs; +char_encodable_p (int c, Lisp_Object attrs) { Lisp_Object tail; struct charset *charset; @@ -8675,8 +8575,7 @@ DEFUN ("find-coding-systems-region-internal", Ffind_coding_systems_region_internal, Sfind_coding_systems_region_internal, 2, 3, 0, doc: /* Internal use only. */) - (start, end, exclude) - Lisp_Object start, end, exclude; + (Lisp_Object start, Lisp_Object end, Lisp_Object exclude) { Lisp_Object coding_attrs_list, safe_codings; EMACS_INT start_byte, end_byte; @@ -8809,8 +8708,7 @@ list of positions. If optional 5th argument STRING is non-nil, it is a string to search for un-encodable characters. In that case, START and END are indexes to the string. */) - (start, end, coding_system, count, string) - Lisp_Object start, end, coding_system, count, string; + (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object count, Lisp_Object string) { int n; struct coding_system coding; @@ -8925,8 +8823,7 @@ buffer positions. END is ignored. If the current buffer (or START if it is a string) is unibyte, the value is nil. */) - (start, end, coding_system_list) - Lisp_Object start, end, coding_system_list; + (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system_list) { Lisp_Object list; EMACS_INT start_byte, end_byte; @@ -9031,9 +8928,9 @@ is nil. */) Lisp_Object -code_convert_region (start, end, coding_system, dst_object, encodep, norecord) - Lisp_Object start, end, coding_system, dst_object; - int encodep, norecord; +code_convert_region (Lisp_Object start, Lisp_Object end, + Lisp_Object coding_system, Lisp_Object dst_object, + int encodep, int norecord) { struct coding_system coding; EMACS_INT from, from_byte, to, to_byte; @@ -9092,8 +8989,7 @@ If DESTINATION is t, the decoded text is returned. This function sets `last-coding-system-used' to the precise coding system used (which may be different from CODING-SYSTEM if CODING-SYSTEM is not fully specified.) */) - (start, end, coding_system, destination) - Lisp_Object start, end, coding_system, destination; + (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object destination) { return code_convert_region (start, end, coding_system, destination, 0, 0); } @@ -9115,17 +9011,14 @@ If DESTINATION is t, the encoded text is returned. This function sets `last-coding-system-used' to the precise coding system used (which may be different from CODING-SYSTEM if CODING-SYSTEM is not fully specified.) */) - (start, end, coding_system, destination) - Lisp_Object start, end, coding_system, destination; + (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object destination) { return code_convert_region (start, end, coding_system, destination, 1, 0); } Lisp_Object -code_convert_string (string, coding_system, dst_object, - encodep, nocopy, norecord) - Lisp_Object string, coding_system, dst_object; - int encodep, nocopy, norecord; +code_convert_string (Lisp_Object string, Lisp_Object coding_system, + Lisp_Object dst_object, int encodep, int nocopy, int norecord) { struct coding_system coding; EMACS_INT chars, bytes; @@ -9172,9 +9065,8 @@ code_convert_string (string, coding_system, dst_object, ENCODE_FILE, thus we ignore character composition. */ Lisp_Object -code_convert_string_norecord (string, coding_system, encodep) - Lisp_Object string, coding_system; - int encodep; +code_convert_string_norecord (Lisp_Object string, Lisp_Object coding_system, + int encodep) { return code_convert_string (string, coding_system, Qt, encodep, 0, 1); } @@ -9194,8 +9086,7 @@ case, the return value is the length of the decoded text. This function sets `last-coding-system-used' to the precise coding system used (which may be different from CODING-SYSTEM if CODING-SYSTEM is not fully specified.) */) - (string, coding_system, nocopy, buffer) - Lisp_Object string, coding_system, nocopy, buffer; + (Lisp_Object string, Lisp_Object coding_system, Lisp_Object nocopy, Lisp_Object buffer) { return code_convert_string (string, coding_system, buffer, 0, ! NILP (nocopy), 0); @@ -9215,8 +9106,7 @@ case, the return value is the length of the encoded text. This function sets `last-coding-system-used' to the precise coding system used (which may be different from CODING-SYSTEM if CODING-SYSTEM is not fully specified.) */) - (string, coding_system, nocopy, buffer) - Lisp_Object string, coding_system, nocopy, buffer; + (Lisp_Object string, Lisp_Object coding_system, Lisp_Object nocopy, Lisp_Object buffer) { return code_convert_string (string, coding_system, buffer, 1, ! NILP (nocopy), 1); @@ -9226,8 +9116,7 @@ not fully specified.) */) DEFUN ("decode-sjis-char", Fdecode_sjis_char, Sdecode_sjis_char, 1, 1, 0, doc: /* Decode a Japanese character which has CODE in shift_jis encoding. Return the corresponding character. */) - (code) - Lisp_Object code; + (Lisp_Object code) { Lisp_Object spec, attrs, val; struct charset *charset_roman, *charset_kanji, *charset_kana, *charset; @@ -9274,8 +9163,7 @@ Return the corresponding character. */) DEFUN ("encode-sjis-char", Fencode_sjis_char, Sencode_sjis_char, 1, 1, 0, doc: /* Encode a Japanese character CH to shift_jis encoding. Return the corresponding code in SJIS. */) - (ch) - Lisp_Object ch; + (Lisp_Object ch) { Lisp_Object spec, attrs, charset_list; int c; @@ -9303,8 +9191,7 @@ Return the corresponding code in SJIS. */) DEFUN ("decode-big5-char", Fdecode_big5_char, Sdecode_big5_char, 1, 1, 0, doc: /* Decode a Big5 character which has CODE in BIG5 coding system. Return the corresponding character. */) - (code) - Lisp_Object code; + (Lisp_Object code) { Lisp_Object spec, attrs, val; struct charset *charset_roman, *charset_big5, *charset; @@ -9342,8 +9229,7 @@ Return the corresponding character. */) DEFUN ("encode-big5-char", Fencode_big5_char, Sencode_big5_char, 1, 1, 0, doc: /* Encode the Big5 character CH to BIG5 coding system. Return the corresponding character code in Big5. */) - (ch) - Lisp_Object ch; + (Lisp_Object ch) { Lisp_Object spec, attrs, charset_list; struct charset *charset; @@ -9370,9 +9256,7 @@ Return the corresponding character code in Big5. */) DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_internal, Sset_terminal_coding_system_internal, 1, 2, 0, doc: /* Internal use only. */) - (coding_system, terminal) - Lisp_Object coding_system; - Lisp_Object terminal; + (Lisp_Object coding_system, Lisp_Object terminal) { struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1)); CHECK_SYMBOL (coding_system); @@ -9390,8 +9274,7 @@ DEFUN ("set-safe-terminal-coding-system-internal", Fset_safe_terminal_coding_system_internal, Sset_safe_terminal_coding_system_internal, 1, 1, 0, doc: /* Internal use only. */) - (coding_system) - Lisp_Object coding_system; + (Lisp_Object coding_system) { CHECK_SYMBOL (coding_system); setup_coding_system (Fcheck_coding_system (coding_system), @@ -9408,8 +9291,7 @@ DEFUN ("terminal-coding-system", Fterminal_coding_system, doc: /* Return coding system specified for terminal output on the given terminal. TERMINAL may be a terminal object, a frame, or nil for the selected frame's terminal device. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1)); @@ -9422,9 +9304,7 @@ frame's terminal device. */) DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal, Sset_keyboard_coding_system_internal, 1, 2, 0, doc: /* Internal use only. */) - (coding_system, terminal) - Lisp_Object coding_system; - Lisp_Object terminal; + (Lisp_Object coding_system, Lisp_Object terminal) { struct terminal *t = get_terminal (terminal, 1); CHECK_SYMBOL (coding_system); @@ -9442,8 +9322,7 @@ DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_intern DEFUN ("keyboard-coding-system", Fkeyboard_coding_system, Skeyboard_coding_system, 0, 1, 0, doc: /* Return coding system specified for decoding keyboard input. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { return CODING_ID_NAME (TERMINAL_KEYBOARD_CODING (get_terminal (terminal, 1))->id); @@ -9491,9 +9370,7 @@ function to call for FILENAME, that function should examine the contents of BUFFER instead of reading the file. usage: (find-operation-coding-system OPERATION ARGUMENTS...) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { Lisp_Object operation, target_idx, target, val; register Lisp_Object chain; @@ -9569,15 +9446,13 @@ If multiple coding systems belong to the same category, all but the first one are ignored. usage: (set-coding-system-priority &rest coding-systems) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { int i, j; int changed[coding_category_max]; enum coding_category priorities[coding_category_max]; - bzero (changed, sizeof changed); + memset (changed, 0, sizeof changed); for (i = j = 0; i < nargs; i++) { @@ -9612,7 +9487,7 @@ usage: (set-coding-system-priority &rest coding-systems) */) priorities[i] = coding_priorities[j]; } - bcopy (priorities, coding_priorities, sizeof priorities); + memcpy (coding_priorities, priorities, sizeof priorities); /* Update `coding-category-list'. */ Vcoding_category_list = Qnil; @@ -9631,8 +9506,7 @@ The list contains a subset of coding systems; i.e. coding systems assigned to each coding category (see `coding-category-list'). HIGHESTP non-nil means just return the highest priority one. */) - (highestp) - Lisp_Object highestp; + (Lisp_Object highestp) { int i; Lisp_Object val; @@ -9656,19 +9530,18 @@ HIGHESTP non-nil means just return the highest priority one. */) static const char *const suffixes[] = { "-unix", "-dos", "-mac" }; static Lisp_Object -make_subsidiaries (base) - Lisp_Object base; +make_subsidiaries (Lisp_Object base) { Lisp_Object subsidiaries; int base_name_len = SBYTES (SYMBOL_NAME (base)); char *buf = (char *) alloca (base_name_len + 6); int i; - bcopy (SDATA (SYMBOL_NAME (base)), buf, base_name_len); + memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len); subsidiaries = Fmake_vector (make_number (3), Qnil); for (i = 0; i < 3; i++) { - bcopy (suffixes[i], buf + base_name_len, strlen (suffixes[i]) + 1); + memcpy (buf + base_name_len, suffixes[i], strlen (suffixes[i]) + 1); ASET (subsidiaries, i, intern (buf)); } return subsidiaries; @@ -9679,9 +9552,7 @@ DEFUN ("define-coding-system-internal", Fdefine_coding_system_internal, Sdefine_coding_system_internal, coding_arg_max, MANY, 0, doc: /* For internal use only. usage: (define-coding-system-internal ...) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { Lisp_Object name; Lisp_Object spec_vec; /* [ ATTRS ALIASE EOL_TYPE ] */ @@ -10210,8 +10081,7 @@ usage: (define-coding-system-internal ...) */) DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put, 3, 3, 0, doc: /* Change value in CODING-SYSTEM's property list PROP to VAL. */) - (coding_system, prop, val) - Lisp_Object coding_system, prop, val; + (Lisp_Object coding_system, Lisp_Object prop, Lisp_Object val) { Lisp_Object spec, attrs; @@ -10267,8 +10137,7 @@ DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put, DEFUN ("define-coding-system-alias", Fdefine_coding_system_alias, Sdefine_coding_system_alias, 2, 2, 0, doc: /* Define ALIAS as an alias for CODING-SYSTEM. */) - (alias, coding_system) - Lisp_Object alias, coding_system; + (Lisp_Object alias, Lisp_Object coding_system) { Lisp_Object spec, aliases, eol_type, val; @@ -10308,8 +10177,7 @@ DEFUN ("coding-system-base", Fcoding_system_base, Scoding_system_base, 1, 1, 0, doc: /* Return the base of CODING-SYSTEM. Any alias or subsidiary coding system is not a base coding system. */) - (coding_system) - Lisp_Object coding_system; + (Lisp_Object coding_system) { Lisp_Object spec, attrs; @@ -10323,8 +10191,7 @@ Any alias or subsidiary coding system is not a base coding system. */) DEFUN ("coding-system-plist", Fcoding_system_plist, Scoding_system_plist, 1, 1, 0, doc: "Return the property list of CODING-SYSTEM.") - (coding_system) - Lisp_Object coding_system; + (Lisp_Object coding_system) { Lisp_Object spec, attrs; @@ -10339,8 +10206,7 @@ DEFUN ("coding-system-plist", Fcoding_system_plist, Scoding_system_plist, DEFUN ("coding-system-aliases", Fcoding_system_aliases, Scoding_system_aliases, 1, 1, 0, doc: /* Return the list of aliases of CODING-SYSTEM. */) - (coding_system) - Lisp_Object coding_system; + (Lisp_Object coding_system) { Lisp_Object spec; @@ -10361,8 +10227,7 @@ and CR respectively. A vector value indicates that a format of end-of-line should be detected automatically. Nth element of the vector is the subsidiary coding system whose eol-type is N. */) - (coding_system) - Lisp_Object coding_system; + (Lisp_Object coding_system) { Lisp_Object spec, eol_type; int n; @@ -10385,7 +10250,7 @@ coding system whose eol-type is N. */) /*** 9. Post-amble ***/ void -init_coding_once () +init_coding_once (void) { int i; @@ -10427,7 +10292,7 @@ init_coding_once () #ifdef emacs void -syms_of_coding () +syms_of_coding (void) { staticpro (&Vcoding_system_hash_table); { @@ -10968,7 +10833,7 @@ character."); for (i = 0; i < coding_category_max; i++) Fset (AREF (Vcoding_category_table, i), Qno_conversion); } -#if defined (MSDOS) || defined (WINDOWSNT) +#if defined (DOS_NT) system_eol_type = Qdos; #else system_eol_type = Qunix; @@ -10977,8 +10842,7 @@ character."); } char * -emacs_strerror (error_number) - int error_number; +emacs_strerror (int error_number) { char *str; diff --git a/src/coding.h b/src/coding.h index f47c33847f9..75ed84bef71 100644 --- a/src/coding.h +++ b/src/coding.h @@ -499,10 +499,10 @@ struct coding_system int default_char; - int (*detector) P_ ((struct coding_system *, - struct coding_detection_info *)); - void (*decoder) P_ ((struct coding_system *)); - int (*encoder) P_ ((struct coding_system *)); + int (*detector) (struct coding_system *, + struct coding_detection_info *); + void (*decoder) (struct coding_system *); + int (*encoder) (struct coding_system *); }; /* Meanings of bits in the member `common_flags' of the structure @@ -691,33 +691,33 @@ struct coding_system #define ENCODE_UTF_8(str) code_convert_string_norecord (str, Qutf_8, 1) /* Extern declarations. */ -extern Lisp_Object code_conversion_save P_ ((int, int)); -extern int decoding_buffer_size P_ ((struct coding_system *, int)); -extern int encoding_buffer_size P_ ((struct coding_system *, int)); -extern void setup_coding_system P_ ((Lisp_Object, struct coding_system *)); -extern Lisp_Object coding_charset_list P_ ((struct coding_system *)); -extern Lisp_Object coding_system_charset_list P_ ((Lisp_Object)); -extern void detect_coding P_ ((struct coding_system *)); -extern Lisp_Object code_convert_region P_ ((Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object, - int, int)); -extern Lisp_Object code_convert_string P_ ((Lisp_Object, Lisp_Object, - Lisp_Object, int, int, int)); -extern Lisp_Object code_convert_string_norecord P_ ((Lisp_Object, Lisp_Object, - int)); -extern Lisp_Object raw_text_coding_system P_ ((Lisp_Object)); -extern Lisp_Object coding_inherit_eol_type P_ ((Lisp_Object, Lisp_Object)); +extern Lisp_Object code_conversion_save (int, int); +extern int decoding_buffer_size (struct coding_system *, int); +extern int encoding_buffer_size (struct coding_system *, int); +extern void setup_coding_system (Lisp_Object, struct coding_system *); +extern Lisp_Object coding_charset_list (struct coding_system *); +extern Lisp_Object coding_system_charset_list (Lisp_Object); +extern void detect_coding (struct coding_system *); +extern Lisp_Object code_convert_region (Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object, + int, int); +extern Lisp_Object code_convert_string (Lisp_Object, Lisp_Object, + Lisp_Object, int, int, int); +extern Lisp_Object code_convert_string_norecord (Lisp_Object, Lisp_Object, + int); +extern Lisp_Object raw_text_coding_system (Lisp_Object); +extern Lisp_Object coding_inherit_eol_type (Lisp_Object, Lisp_Object); -extern int decode_coding_gap P_ ((struct coding_system *, - EMACS_INT, EMACS_INT)); -extern int encode_coding_gap P_ ((struct coding_system *, - EMACS_INT, EMACS_INT)); -extern void decode_coding_object P_ ((struct coding_system *, - Lisp_Object, EMACS_INT, EMACS_INT, - EMACS_INT, EMACS_INT, Lisp_Object)); -extern void encode_coding_object P_ ((struct coding_system *, - Lisp_Object, EMACS_INT, EMACS_INT, - EMACS_INT, EMACS_INT, Lisp_Object)); +extern int decode_coding_gap (struct coding_system *, + EMACS_INT, EMACS_INT); +extern int encode_coding_gap (struct coding_system *, + EMACS_INT, EMACS_INT); +extern void decode_coding_object (struct coding_system *, + Lisp_Object, EMACS_INT, EMACS_INT, + EMACS_INT, EMACS_INT, Lisp_Object); +extern void encode_coding_object (struct coding_system *, + Lisp_Object, EMACS_INT, EMACS_INT, + EMACS_INT, EMACS_INT, Lisp_Object); /* Macros for backward compatibility. */ @@ -753,7 +753,7 @@ extern void encode_coding_object P_ ((struct coding_system *, } while (0) -extern Lisp_Object preferred_coding_system P_ (()); +extern Lisp_Object preferred_coding_system (void); extern Lisp_Object Qutf_8, Qutf_8_emacs; @@ -780,7 +780,7 @@ extern Lisp_Object Qcall_process, Qcall_process_region; extern Lisp_Object Qstart_process, Qopen_network_stream; extern Lisp_Object Qwrite_region; -extern char *emacs_strerror P_ ((int)); +extern char *emacs_strerror (int); /* Coding-system for reading files and receiving data from process. */ extern Lisp_Object Vcoding_system_for_read; @@ -823,7 +823,7 @@ extern Lisp_Object Vdefault_file_name_coding_system; extern Lisp_Object Qcoding_system_error; extern char emacs_mule_bytes[256]; -extern int emacs_mule_string_char P_ ((unsigned char *)); +extern int emacs_mule_string_char (unsigned char *); #endif /* EMACS_CODING_H */ diff --git a/src/composite.c b/src/composite.c index cab57e824a9..4568698619f 100644 --- a/src/composite.c +++ b/src/composite.c @@ -180,9 +180,7 @@ Lisp_Object composition_temp; If the composition is invalid, return -1. */ int -get_composition_id (charpos, bytepos, nchars, prop, string) - int charpos, bytepos, nchars; - Lisp_Object prop, string; +get_composition_id (int charpos, int bytepos, int nchars, Lisp_Object prop, Lisp_Object string) { Lisp_Object id, length, components, key, *key_contents; int glyph_len; @@ -429,10 +427,7 @@ get_composition_id (charpos, bytepos, nchars, prop, string) This doesn't check the validity of composition. */ int -find_composition (pos, limit, start, end, prop, object) - int pos, limit; - EMACS_INT *start, *end; - Lisp_Object *prop, object; +find_composition (int pos, int limit, EMACS_INT *start, EMACS_INT *end, Lisp_Object *prop, Lisp_Object object) { Lisp_Object val; @@ -470,9 +465,7 @@ find_composition (pos, limit, start, end, prop, object) FROM and TO with property PROP. */ static void -run_composition_function (from, to, prop) - int from, to; - Lisp_Object prop; +run_composition_function (int from, int to, Lisp_Object prop) { Lisp_Object func; EMACS_INT start, end; @@ -504,9 +497,7 @@ run_composition_function (from, to, prop) change is deletion, FROM == TO. Otherwise, FROM < TO. */ void -update_compositions (from, to, check_mask) - EMACS_INT from, to; - int check_mask; +update_compositions (EMACS_INT from, EMACS_INT to, int check_mask) { Lisp_Object prop; EMACS_INT start, end; @@ -612,8 +603,7 @@ update_compositions (from, to, check_mask) top-level copies of them so that none of them are `eq'. */ void -make_composition_value_copy (list) - Lisp_Object list; +make_composition_value_copy (Lisp_Object list) { Lisp_Object plist, val; @@ -638,9 +628,7 @@ make_composition_value_copy (list) indices START and END in STRING. */ void -compose_text (start, end, components, modification_func, string) - int start, end; - Lisp_Object components, modification_func, string; +compose_text (int start, int end, Lisp_Object components, Lisp_Object modification_func, Lisp_Object string) { Lisp_Object prop; @@ -651,9 +639,9 @@ compose_text (start, end, components, modification_func, string) } -static Lisp_Object autocmp_chars P_ ((Lisp_Object, EMACS_INT, EMACS_INT, - EMACS_INT, struct window *, - struct face *, Lisp_Object)); +static Lisp_Object autocmp_chars (Lisp_Object, EMACS_INT, EMACS_INT, + EMACS_INT, struct window *, + struct face *, Lisp_Object); /* Lisp glyph-string handlers */ @@ -664,11 +652,10 @@ static Lisp_Object autocmp_chars P_ ((Lisp_Object, EMACS_INT, EMACS_INT, static Lisp_Object gstring_hash_table; -static Lisp_Object gstring_lookup_cache P_ ((Lisp_Object)); +static Lisp_Object gstring_lookup_cache (Lisp_Object); static Lisp_Object -gstring_lookup_cache (header) - Lisp_Object header; +gstring_lookup_cache (Lisp_Object header) { struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table); int i = hash_lookup (h, header, NULL); @@ -677,9 +664,7 @@ gstring_lookup_cache (header) } Lisp_Object -composition_gstring_put_cache (gstring, len) - Lisp_Object gstring; - int len; +composition_gstring_put_cache (Lisp_Object gstring, int len) { struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table); unsigned hash; @@ -707,21 +692,19 @@ composition_gstring_put_cache (gstring, len) } Lisp_Object -composition_gstring_from_id (id) - int id; +composition_gstring_from_id (int id) { struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table); return HASH_VALUE (h, id); } -static Lisp_Object fill_gstring_header P_ ((Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object, - Lisp_Object)); +static Lisp_Object fill_gstring_header (Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object, + Lisp_Object); int -composition_gstring_p (gstring) - Lisp_Object gstring; +composition_gstring_p (Lisp_Object gstring) { Lisp_Object header; int i; @@ -752,10 +735,7 @@ composition_gstring_p (gstring) } int -composition_gstring_width (gstring, from, to, metrics) - Lisp_Object gstring; - int from, to; - struct font_metrics *metrics; +composition_gstring_width (Lisp_Object gstring, int from, int to, struct font_metrics *metrics) { Lisp_Object *glyph; int width = 0; @@ -811,8 +791,7 @@ static Lisp_Object gstring_work; static Lisp_Object gstring_work_headers; static Lisp_Object -fill_gstring_header (header, start, end, font_object, string) - Lisp_Object header, start, end, font_object, string; +fill_gstring_header (Lisp_Object header, Lisp_Object start, Lisp_Object end, Lisp_Object font_object, Lisp_Object string) { EMACS_INT from, to, from_byte; EMACS_INT len, i; @@ -869,11 +848,10 @@ fill_gstring_header (header, start, end, font_object, string) return header; } -extern void font_fill_lglyph_metrics P_ ((Lisp_Object, Lisp_Object)); +extern void font_fill_lglyph_metrics (Lisp_Object, Lisp_Object); static void -fill_gstring_body (gstring) - Lisp_Object gstring; +fill_gstring_body (Lisp_Object gstring) { Lisp_Object font_object = LGSTRING_FONT (gstring); Lisp_Object header = AREF (gstring, 0); @@ -923,12 +901,7 @@ fill_gstring_body (gstring) object. Otherwise return nil. */ static Lisp_Object -autocmp_chars (rule, charpos, bytepos, limit, win, face, string) - Lisp_Object rule; - EMACS_INT charpos, bytepos, limit; - struct window *win; - struct face *face; - Lisp_Object string; +autocmp_chars (Lisp_Object rule, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT limit, struct window *win, struct face *face, Lisp_Object string) { int count = SPECPDL_INDEX (); FRAME_PTR f = XFRAME (win->frame); @@ -1020,10 +993,7 @@ static int _work_char; composition. */ void -composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string) - struct composition_it *cmp_it; - EMACS_INT charpos, bytepos, endpos; - Lisp_Object string; +composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT endpos, Lisp_Object string) { EMACS_INT start, end, c; Lisp_Object prop, val; @@ -1253,12 +1223,7 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string) CMP_IT->stop_pos, and return 0. */ int -composition_reseat_it (cmp_it, charpos, bytepos, endpos, w, face, string) - struct composition_it *cmp_it; - EMACS_INT charpos, bytepos, endpos; - struct window *w; - struct face *face; - Lisp_Object string; +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) { @@ -1417,10 +1382,7 @@ composition_reseat_it (cmp_it, charpos, bytepos, endpos, w, face, string) the cluster, or -1 if the composition is somehow broken. */ int -composition_update_it (cmp_it, charpos, bytepos, string) - struct composition_it *cmp_it; - EMACS_INT charpos, bytepos; - Lisp_Object string; +composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, Lisp_Object string) { int i, c; @@ -1543,9 +1505,7 @@ struct position_record the composition, and return 1. Otherwise, return 0. */ static int -find_automatic_composition (pos, limit, start, end, gstring, string) - EMACS_INT pos, limit, *start, *end; - Lisp_Object *gstring, string; +find_automatic_composition (EMACS_INT pos, EMACS_INT limit, EMACS_INT *start, EMACS_INT *end, Lisp_Object *gstring, Lisp_Object string) { EMACS_INT head, tail, stop; /* Limit to check a composition after POS. */ @@ -1716,8 +1676,7 @@ find_automatic_composition (pos, limit, start, end, gstring, string) to NEW_PT. */ int -composition_adjust_point (last_pt, new_pt) - EMACS_INT last_pt, new_pt; +composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt) { EMACS_INT charpos, bytepos, startpos, beg, end, pos; Lisp_Object val; @@ -1799,8 +1758,7 @@ where If GLYPH is nil, the remaining elements of the glyph-string vector should be ignored. */) - (from, to, font_object, string) - Lisp_Object font_object, from, to, string; + (Lisp_Object from, Lisp_Object to, Lisp_Object font_object, Lisp_Object string) { Lisp_Object gstring, header; EMACS_INT frompos, topos; @@ -1845,8 +1803,7 @@ DEFUN ("compose-region-internal", Fcompose_region_internal, Compose text in the region between START and END. Optional 3rd and 4th arguments are COMPONENTS and MODIFICATION-FUNC for the composition. See `compose-region' for more details. */) - (start, end, components, modification_func) - Lisp_Object start, end, components, modification_func; + (Lisp_Object start, Lisp_Object end, Lisp_Object components, Lisp_Object modification_func) { validate_region (&start, &end); if (!NILP (components) @@ -1866,8 +1823,7 @@ DEFUN ("compose-string-internal", Fcompose_string_internal, Compose text between indices START and END of STRING. Optional 4th and 5th arguments are COMPONENTS and MODIFICATION-FUNC for the composition. See `compose-string' for more details. */) - (string, start, end, components, modification_func) - Lisp_Object string, start, end, components, modification_func; + (Lisp_Object string, Lisp_Object start, Lisp_Object end, Lisp_Object components, Lisp_Object modification_func) { CHECK_STRING (string); CHECK_NUMBER (start); @@ -1888,8 +1844,7 @@ DEFUN ("find-composition-internal", Ffind_composition_internal, Return information about composition at or nearest to position POS. See `find-composition' for more details. */) - (pos, limit, string, detail_p) - Lisp_Object pos, limit, string, detail_p; + (Lisp_Object pos, Lisp_Object limit, Lisp_Object string, Lisp_Object detail_p) { Lisp_Object prop, tail, gstring; EMACS_INT start, end, from, to; @@ -1974,7 +1929,7 @@ See `find-composition' for more details. */) void -syms_of_composite () +syms_of_composite (void) { int i; diff --git a/src/composite.h b/src/composite.h index 59c237c8de2..554ab554115 100644 --- a/src/composite.h +++ b/src/composite.h @@ -212,16 +212,16 @@ extern Lisp_Object Vauto_composition_function; extern Lisp_Object Qauto_composition_function; extern Lisp_Object Vcomposition_function_table; -extern int get_composition_id P_ ((int, int, int, Lisp_Object, Lisp_Object)); -extern int find_composition P_ ((int, int, EMACS_INT *, EMACS_INT *, Lisp_Object *, - Lisp_Object)); -extern void update_compositions P_ ((EMACS_INT, EMACS_INT, int)); -extern void make_composition_value_copy P_ ((Lisp_Object)); -extern void compose_region P_ ((int, int, Lisp_Object, Lisp_Object, - Lisp_Object)); -extern void syms_of_composite P_ ((void)); -extern void compose_text P_ ((int, int, Lisp_Object, Lisp_Object, - Lisp_Object)); +extern int get_composition_id (int, int, int, Lisp_Object, Lisp_Object); +extern int find_composition (int, int, EMACS_INT *, EMACS_INT *, Lisp_Object *, + Lisp_Object); +extern void update_compositions (EMACS_INT, EMACS_INT, int); +extern void make_composition_value_copy (Lisp_Object); +extern void compose_region (int, int, Lisp_Object, Lisp_Object, + Lisp_Object); +extern void syms_of_composite (void); +extern void compose_text (int, int, Lisp_Object, Lisp_Object, + Lisp_Object); /* Macros for lispy glyph-string. This is completely different from struct glyph_string. */ @@ -303,23 +303,23 @@ struct composition_it; struct face; struct font_metrics; -extern Lisp_Object composition_gstring_put_cache P_ ((Lisp_Object, int)); -extern Lisp_Object composition_gstring_from_id P_ ((int)); -extern int composition_gstring_p P_ ((Lisp_Object)); -extern int composition_gstring_width P_ ((Lisp_Object, int, int, - struct font_metrics *)); +extern Lisp_Object composition_gstring_put_cache (Lisp_Object, int); +extern Lisp_Object composition_gstring_from_id (int); +extern int composition_gstring_p (Lisp_Object); +extern int composition_gstring_width (Lisp_Object, int, int, + struct font_metrics *); -extern void composition_compute_stop_pos P_ ((struct composition_it *, - EMACS_INT, EMACS_INT, EMACS_INT, - Lisp_Object)); -extern int composition_reseat_it P_ ((struct composition_it *, - EMACS_INT, EMACS_INT, EMACS_INT, - struct window *, struct face *, - Lisp_Object)); -extern int composition_update_it P_ ((struct composition_it *, - EMACS_INT, EMACS_INT, Lisp_Object)); +extern void composition_compute_stop_pos (struct composition_it *, + EMACS_INT, EMACS_INT, EMACS_INT, + Lisp_Object); +extern int composition_reseat_it (struct composition_it *, + EMACS_INT, EMACS_INT, EMACS_INT, + struct window *, struct face *, + Lisp_Object); +extern int composition_update_it (struct composition_it *, + EMACS_INT, EMACS_INT, Lisp_Object); -extern int composition_adjust_point P_ ((EMACS_INT, EMACS_INT)); +extern int composition_adjust_point (EMACS_INT, EMACS_INT); EXFUN (Fcompose_region_internal, 4); EXFUN (Fcompose_string_internal, 5); diff --git a/src/config.in b/src/config.in index 3fa3c30ce0e..40b62633446 100644 --- a/src/config.in +++ b/src/config.in @@ -30,6 +30,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if the mktime function is broken. */ #undef BROKEN_MKTIME +/* Define if Emacs cannot be dumped on your system. */ +#undef CANNOT_DUMP + /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ @@ -99,15 +102,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if ALSA is available. */ #undef HAVE_ALSA -/* Define to 1 if you have the `bcmp' function. */ -#undef HAVE_BCMP - -/* Define to 1 if you have the `bcopy' function. */ -#undef HAVE_BCOPY - -/* Define to 1 if you have the `bzero' function. */ -#undef HAVE_BZERO - /* Define to 1 if you have the `cbrt' function. */ #undef HAVE_CBRT @@ -195,9 +189,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if using GConf. */ #undef HAVE_GCONF -/* Define to 1 if you have the `gdk_display_open' function. */ -#undef HAVE_GDK_DISPLAY_OPEN - /* Define to 1 if you have the `getaddrinfo' function. */ #undef HAVE_GETADDRINFO @@ -264,14 +255,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if you have the `grantpt' function. */ #undef HAVE_GRANTPT +/* Define to 1 if you have the `gtk_adjustment_get_page_size' function. */ +#undef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE + /* Define to 1 if you have GTK and pthread (-lpthread). */ #undef HAVE_GTK_AND_PTHREAD -/* Define to 1 if GTK has both file selection and chooser dialog. */ -#undef HAVE_GTK_FILE_BOTH - -/* Define to 1 if you have the `gtk_file_chooser_dialog_new' function. */ -#undef HAVE_GTK_FILE_CHOOSER_DIALOG_NEW +/* Define to 1 if you have the `gtk_dialog_get_action_area' function. */ +#undef HAVE_GTK_DIALOG_GET_ACTION_AREA /* Define to 1 if you have the `gtk_file_selection_new' function. */ #undef HAVE_GTK_FILE_SELECTION_NEW @@ -279,15 +270,24 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if you have the `gtk_main' function. */ #undef HAVE_GTK_MAIN -/* Define to 1 if GTK can handle more than one display. */ -#undef HAVE_GTK_MULTIDISPLAY +/* Define to 1 if you have the `gtk_orientable_set_orientation' function. */ +#undef HAVE_GTK_ORIENTABLE_SET_ORIENTATION + +/* Define to 1 if you have the `gtk_widget_get_mapped' function. */ +#undef HAVE_GTK_WIDGET_GET_MAPPED + +/* Define to 1 if you have the `gtk_widget_get_sensitive' function. */ +#undef HAVE_GTK_WIDGET_GET_SENSITIVE + +/* Define to 1 if you have the `gtk_widget_get_window' function. */ +#undef HAVE_GTK_WIDGET_GET_WINDOW + +/* Define to 1 if you have the `gtk_widget_set_has_window' function. */ +#undef HAVE_GTK_WIDGET_SET_HAS_WINDOW /* Define to 1 if netdb.h declares h_errno. */ #undef HAVE_H_ERRNO -/* Define to 1 if you have the `index' function. */ -#undef HAVE_INDEX - /* Define to 1 if you have inet sockets. */ #undef HAVE_INET_SOCKETS @@ -534,9 +534,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if res_init is available. */ #undef HAVE_RES_INIT -/* Define to 1 if you have the `rindex' function. */ -#undef HAVE_RINDEX - /* Define to 1 if you have the `rint' function. */ #undef HAVE_RINT @@ -576,6 +573,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if the system has the type `size_t'. */ #undef HAVE_SIZE_T +/* Define to 1 if you have sound support. */ +#undef HAVE_SOUND + /* Define to 1 if you have the <soundcard.h> header file. */ #undef HAVE_SOUNDCARD_H @@ -591,6 +591,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR @@ -603,6 +606,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if you have the <string.h> header file. */ #undef HAVE_STRING_H +/* Define to 1 if you have the `strrchr' function. */ +#undef HAVE_STRRCHR + /* Define to 1 if you have the `strsignal' function. */ #undef HAVE_STRSIGNAL @@ -753,6 +759,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if you have the X11R6 or newer version of Xlib. */ #undef HAVE_X11R6 +/* Define if you have usable X11R6-style XIM support. */ +#undef HAVE_X11R6_XIM + /* Define to 1 if you have the X11R6 or newer version of Xt. */ #undef HAVE_X11XTR6 @@ -783,6 +792,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if you have the `XSetWMProtocols' function. */ #undef HAVE_XSETWMPROTOCOLS +/* Define if you have usable i18n support. */ +#undef HAVE_X_I18N + /* Define to 1 if you have the SM library (-lSM). */ #undef HAVE_X_SM @@ -890,6 +902,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Process async input synchronously. */ #undef SYNC_INPUT +/* Define to use system malloc. */ +#undef SYSTEM_MALLOC + /* Define to 1 if you use terminfo instead of termcap. */ #undef TERMINFO @@ -909,9 +924,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if using GTK. */ #undef USE_GTK +/* Define this to use a lisp union for the Lisp_Object data type. */ +#undef USE_LISP_UNION_TYPE + /* Define to 1 if using the Lucid X toolkit. */ #undef USE_LUCID +/* Define to use mmap to allocate buffer text. */ +#undef USE_MMAP_FOR_BUFFERS + /* Define to 1 if using the Motif X toolkit. */ #undef USE_MOTIF @@ -1018,25 +1039,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Turned on June 1996 supposing nobody will mind it. */ #define AMPERSAND_FULL_NAME -/* Define HAVE_SOUND if we have sound support. We know it works - and compiles only on the specified platforms. For others, - it probably doesn't make sense to try. */ - -#if defined __FreeBSD__ || defined __NetBSD__ || defined __linux__ -#ifdef HAVE_MACHINE_SOUNDCARD_H -#define HAVE_SOUND 1 -#endif -#ifdef HAVE_SYS_SOUNDCARD_H -#define HAVE_SOUND 1 -#endif -#ifdef HAVE_SOUNDCARD_H -#define HAVE_SOUND 1 -#endif -#ifdef HAVE_ALSA -#define HAVE_SOUND 1 -#endif -#endif /* __FreeBSD__ || __NetBSD__ || __linux__ */ - /* If using GNU, then support inline function declarations. */ /* Don't try to switch on inline handling as detected by AC_C_INLINE generally, because even if non-gcc compilers accept `inline', they @@ -1096,11 +1098,6 @@ SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */ #define my_strftime nstrftime /* for strftime.c */ -/* Some of the files of Emacs which are intended for use with other - programs assume that if you have a config.h file, you must declare - the type of getenv. */ -extern char *getenv (); - /* These default definitions are good for almost all machines. The exceptions override them in m/MACHINE.h. */ @@ -1127,27 +1124,14 @@ extern char *getenv (); #endif #endif -/* Define if the compiler supports function prototypes. It may do so - but not define __STDC__ (e.g. DEC C by default) or may define it as - zero. */ +/* Define if the compiler supports function prototypes. It may do so but + not define __STDC__ (e.g. DEC C by default) or may define it as zero. */ #undef PROTOTYPES -/* For mktime.c: */ -#ifndef __P -# if defined PROTOTYPES -# define __P(args) args -# else -# define __P(args) () -# endif /* GCC. */ -#endif /* __P */ #ifdef HAVE_STRING_H #include <string.h> #endif -#ifdef HAVE_STRINGS_H -#include <strings.h> /* May be needed for bcopy & al. */ -#endif - #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif @@ -1170,16 +1154,12 @@ void *alloca (size_t); typedef unsigned size_t; #endif -/* Define HAVE_X_I18N if we have usable i18n support. */ - -#ifdef HAVE_X11R6 -#define HAVE_X_I18N +#ifndef HAVE_STRCHR +#define strchr(a, b) index (a, b) #endif -/* Define HAVE_X11R6_XIM if we have usable X11R6-style XIM support. */ - -#if defined HAVE_X11R6 && !defined INHIBIT_X11R6_XIM -#define HAVE_X11R6_XIM +#ifndef HAVE_STRRCHR +#define strrchr(a, b) rindex (a, b) #endif #if defined __GNUC__ && (__GNUC__ > 2 \ @@ -1201,16 +1181,6 @@ typedef unsigned size_t; # endif #endif -#ifndef HAVE_BCOPY -#define bcopy(a,b,s) memcpy (b,a,s) -#endif -#ifndef HAVE_BZERO -#define bzero(a,s) memset (a,0,s) -#endif -#ifndef HAVE_BCMP -#define BCMP memcmp -#endif - #endif /* EMACS_CONFIG_H */ /* diff --git a/src/data.c b/src/data.c index 6a21ad44720..cccd53f6076 100644 --- a/src/data.c +++ b/src/data.c @@ -50,7 +50,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <math.h> #if !defined (atof) -extern double atof (); +extern double atof (const char *); #endif /* !atof */ Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound; @@ -97,16 +97,14 @@ Lisp_Object Vmost_positive_fixnum, Vmost_negative_fixnum; void -circular_list_error (list) - Lisp_Object list; +circular_list_error (Lisp_Object list) { xsignal (Qcircular_list, list); } Lisp_Object -wrong_type_argument (predicate, value) - register Lisp_Object predicate, value; +wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value) { /* If VALUE is not even a valid Lisp object, we'd want to abort here where we can get a backtrace showing where it came from. We used @@ -119,21 +117,19 @@ wrong_type_argument (predicate, value) } void -pure_write_error () +pure_write_error (void) { error ("Attempt to modify read-only object"); } void -args_out_of_range (a1, a2) - Lisp_Object a1, a2; +args_out_of_range (Lisp_Object a1, Lisp_Object a2) { xsignal2 (Qargs_out_of_range, a1, a2); } void -args_out_of_range_3 (a1, a2, a3) - Lisp_Object a1, a2, a3; +args_out_of_range_3 (Lisp_Object a1, Lisp_Object a2, Lisp_Object a3) { xsignal3 (Qargs_out_of_range, a1, a2, a3); } @@ -146,8 +142,7 @@ int sign_extend_temp; /* On a few machines, XINT can only be done by calling this. */ int -sign_extend_lisp_int (num) - EMACS_INT num; +sign_extend_lisp_int (EMACS_INT num) { if (num & (((EMACS_INT) 1) << (VALBITS - 1))) return num | (((EMACS_INT) (-1)) << VALBITS); @@ -159,8 +154,7 @@ sign_extend_lisp_int (num) DEFUN ("eq", Feq, Seq, 2, 2, 0, doc: /* Return t if the two args are the same Lisp object. */) - (obj1, obj2) - Lisp_Object obj1, obj2; + (Lisp_Object obj1, Lisp_Object obj2) { if (EQ (obj1, obj2)) return Qt; @@ -169,8 +163,7 @@ DEFUN ("eq", Feq, Seq, 2, 2, 0, DEFUN ("null", Fnull, Snull, 1, 1, 0, doc: /* Return t if OBJECT is nil. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (NILP (object)) return Qt; @@ -181,8 +174,7 @@ DEFUN ("type-of", Ftype_of, Stype_of, 1, 1, 0, doc: /* Return a symbol representing the type of OBJECT. The symbol returned names the object's basic type; for example, (type-of 1) returns `integer'. */) - (object) - Lisp_Object object; + (Lisp_Object object) { switch (XTYPE (object)) { @@ -252,8 +244,7 @@ for example, (type-of 1) returns `integer'. */) DEFUN ("consp", Fconsp, Sconsp, 1, 1, 0, doc: /* Return t if OBJECT is a cons cell. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (CONSP (object)) return Qt; @@ -262,8 +253,7 @@ DEFUN ("consp", Fconsp, Sconsp, 1, 1, 0, DEFUN ("atom", Fatom, Satom, 1, 1, 0, doc: /* Return t if OBJECT is not a cons cell. This includes nil. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (CONSP (object)) return Qnil; @@ -273,8 +263,7 @@ DEFUN ("atom", Fatom, Satom, 1, 1, 0, DEFUN ("listp", Flistp, Slistp, 1, 1, 0, doc: /* Return t if OBJECT is a list, that is, a cons cell or nil. Otherwise, return nil. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (CONSP (object) || NILP (object)) return Qt; @@ -283,8 +272,7 @@ Otherwise, return nil. */) DEFUN ("nlistp", Fnlistp, Snlistp, 1, 1, 0, doc: /* Return t if OBJECT is not a list. Lists include nil. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (CONSP (object) || NILP (object)) return Qnil; @@ -293,8 +281,7 @@ DEFUN ("nlistp", Fnlistp, Snlistp, 1, 1, 0, DEFUN ("symbolp", Fsymbolp, Ssymbolp, 1, 1, 0, doc: /* Return t if OBJECT is a symbol. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (SYMBOLP (object)) return Qt; @@ -307,8 +294,7 @@ DEFUN ("keywordp", Fkeywordp, Skeywordp, 1, 1, 0, doc: /* Return t if OBJECT is a keyword. This means that it is a symbol with a print name beginning with `:' interned in the initial obarray. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (SYMBOLP (object) && SREF (SYMBOL_NAME (object), 0) == ':' @@ -319,8 +305,7 @@ interned in the initial obarray. */) DEFUN ("vectorp", Fvectorp, Svectorp, 1, 1, 0, doc: /* Return t if OBJECT is a vector. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (VECTORP (object)) return Qt; @@ -329,8 +314,7 @@ DEFUN ("vectorp", Fvectorp, Svectorp, 1, 1, 0, DEFUN ("stringp", Fstringp, Sstringp, 1, 1, 0, doc: /* Return t if OBJECT is a string. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (STRINGP (object)) return Qt; @@ -340,8 +324,7 @@ DEFUN ("stringp", Fstringp, Sstringp, 1, 1, 0, DEFUN ("multibyte-string-p", Fmultibyte_string_p, Smultibyte_string_p, 1, 1, 0, doc: /* Return t if OBJECT is a multibyte string. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (STRINGP (object) && STRING_MULTIBYTE (object)) return Qt; @@ -350,8 +333,7 @@ DEFUN ("multibyte-string-p", Fmultibyte_string_p, Smultibyte_string_p, DEFUN ("char-table-p", Fchar_table_p, Schar_table_p, 1, 1, 0, doc: /* Return t if OBJECT is a char-table. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (CHAR_TABLE_P (object)) return Qt; @@ -361,8 +343,7 @@ DEFUN ("char-table-p", Fchar_table_p, Schar_table_p, 1, 1, 0, DEFUN ("vector-or-char-table-p", Fvector_or_char_table_p, Svector_or_char_table_p, 1, 1, 0, doc: /* Return t if OBJECT is a char-table or vector. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (VECTORP (object) || CHAR_TABLE_P (object)) return Qt; @@ -371,8 +352,7 @@ DEFUN ("vector-or-char-table-p", Fvector_or_char_table_p, DEFUN ("bool-vector-p", Fbool_vector_p, Sbool_vector_p, 1, 1, 0, doc: /* Return t if OBJECT is a bool-vector. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (BOOL_VECTOR_P (object)) return Qt; @@ -381,8 +361,7 @@ DEFUN ("bool-vector-p", Fbool_vector_p, Sbool_vector_p, 1, 1, 0, DEFUN ("arrayp", Farrayp, Sarrayp, 1, 1, 0, doc: /* Return t if OBJECT is an array (string or vector). */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (ARRAYP (object)) return Qt; @@ -391,8 +370,7 @@ DEFUN ("arrayp", Farrayp, Sarrayp, 1, 1, 0, DEFUN ("sequencep", Fsequencep, Ssequencep, 1, 1, 0, doc: /* Return t if OBJECT is a sequence (list or array). */) - (object) - register Lisp_Object object; + (register Lisp_Object object) { if (CONSP (object) || NILP (object) || ARRAYP (object)) return Qt; @@ -401,8 +379,7 @@ DEFUN ("sequencep", Fsequencep, Ssequencep, 1, 1, 0, DEFUN ("bufferp", Fbufferp, Sbufferp, 1, 1, 0, doc: /* Return t if OBJECT is an editor buffer. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (BUFFERP (object)) return Qt; @@ -411,8 +388,7 @@ DEFUN ("bufferp", Fbufferp, Sbufferp, 1, 1, 0, DEFUN ("markerp", Fmarkerp, Smarkerp, 1, 1, 0, doc: /* Return t if OBJECT is a marker (editor pointer). */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (MARKERP (object)) return Qt; @@ -421,8 +397,7 @@ DEFUN ("markerp", Fmarkerp, Smarkerp, 1, 1, 0, DEFUN ("subrp", Fsubrp, Ssubrp, 1, 1, 0, doc: /* Return t if OBJECT is a built-in function. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (SUBRP (object)) return Qt; @@ -432,8 +407,7 @@ DEFUN ("subrp", Fsubrp, Ssubrp, 1, 1, 0, DEFUN ("byte-code-function-p", Fbyte_code_function_p, Sbyte_code_function_p, 1, 1, 0, doc: /* Return t if OBJECT is a byte-compiled function object. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (COMPILEDP (object)) return Qt; @@ -450,8 +424,7 @@ DEFUN ("funvecp", Ffunvecp, Sfunvecp, 1, 1, 0, DEFUN ("char-or-string-p", Fchar_or_string_p, Schar_or_string_p, 1, 1, 0, doc: /* Return t if OBJECT is a character or a string. */) - (object) - register Lisp_Object object; + (register Lisp_Object object) { if (CHARACTERP (object) || STRINGP (object)) return Qt; @@ -460,8 +433,7 @@ DEFUN ("char-or-string-p", Fchar_or_string_p, Schar_or_string_p, 1, 1, 0, DEFUN ("integerp", Fintegerp, Sintegerp, 1, 1, 0, doc: /* Return t if OBJECT is an integer. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (INTEGERP (object)) return Qt; @@ -470,8 +442,7 @@ DEFUN ("integerp", Fintegerp, Sintegerp, 1, 1, 0, DEFUN ("integer-or-marker-p", Finteger_or_marker_p, Sinteger_or_marker_p, 1, 1, 0, doc: /* Return t if OBJECT is an integer or a marker (editor pointer). */) - (object) - register Lisp_Object object; + (register Lisp_Object object) { if (MARKERP (object) || INTEGERP (object)) return Qt; @@ -480,8 +451,7 @@ DEFUN ("integer-or-marker-p", Finteger_or_marker_p, Sinteger_or_marker_p, 1, 1, DEFUN ("natnump", Fnatnump, Snatnump, 1, 1, 0, doc: /* Return t if OBJECT is a nonnegative integer. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (NATNUMP (object)) return Qt; @@ -490,8 +460,7 @@ DEFUN ("natnump", Fnatnump, Snatnump, 1, 1, 0, DEFUN ("numberp", Fnumberp, Snumberp, 1, 1, 0, doc: /* Return t if OBJECT is a number (floating point or integer). */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (NUMBERP (object)) return Qt; @@ -502,8 +471,7 @@ DEFUN ("numberp", Fnumberp, Snumberp, 1, 1, 0, DEFUN ("number-or-marker-p", Fnumber_or_marker_p, Snumber_or_marker_p, 1, 1, 0, doc: /* Return t if OBJECT is a number or a marker. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (NUMBERP (object) || MARKERP (object)) return Qt; @@ -512,8 +480,7 @@ DEFUN ("number-or-marker-p", Fnumber_or_marker_p, DEFUN ("floatp", Ffloatp, Sfloatp, 1, 1, 0, doc: /* Return t if OBJECT is a floating point number. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (FLOATP (object)) return Qt; @@ -529,16 +496,14 @@ Error if arg is not nil and not a cons cell. See also `car-safe'. See Info node `(elisp)Cons Cells' for a discussion of related basic Lisp concepts such as car, cdr, cons cell and list. */) - (list) - register Lisp_Object list; + (register Lisp_Object list) { return CAR (list); } DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0, doc: /* Return the car of OBJECT if it is a cons cell, or else nil. */) - (object) - Lisp_Object object; + (Lisp_Object object) { return CAR_SAFE (object); } @@ -549,24 +514,21 @@ Error if arg is not nil and not a cons cell. See also `cdr-safe'. See Info node `(elisp)Cons Cells' for a discussion of related basic Lisp concepts such as cdr, car, cons cell and list. */) - (list) - register Lisp_Object list; + (register Lisp_Object list) { return CDR (list); } DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0, doc: /* Return the cdr of OBJECT if it is a cons cell, or else nil. */) - (object) - Lisp_Object object; + (Lisp_Object object) { return CDR_SAFE (object); } DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0, doc: /* Set the car of CELL to be NEWCAR. Returns NEWCAR. */) - (cell, newcar) - register Lisp_Object cell, newcar; + (register Lisp_Object cell, Lisp_Object newcar) { CHECK_CONS (cell); CHECK_IMPURE (cell); @@ -576,8 +538,7 @@ DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0, DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0, doc: /* Set the cdr of CELL to be NEWCDR. Returns NEWCDR. */) - (cell, newcdr) - register Lisp_Object cell, newcdr; + (register Lisp_Object cell, Lisp_Object newcdr) { CHECK_CONS (cell); CHECK_IMPURE (cell); @@ -589,8 +550,7 @@ DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0, DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0, doc: /* Return t if SYMBOL's value is not void. */) - (symbol) - register Lisp_Object symbol; + (register Lisp_Object symbol) { Lisp_Object valcontents; struct Lisp_Symbol *sym; @@ -628,8 +588,7 @@ DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0, DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, doc: /* Return t if SYMBOL's function definition is not void. */) - (symbol) - register Lisp_Object symbol; + (register Lisp_Object symbol) { CHECK_SYMBOL (symbol); return (EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt); @@ -638,8 +597,7 @@ DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, doc: /* Make SYMBOL's value be void. Return SYMBOL. */) - (symbol) - register Lisp_Object symbol; + (register Lisp_Object symbol) { CHECK_SYMBOL (symbol); if (SYMBOL_CONSTANT_P (symbol)) @@ -651,8 +609,7 @@ Return SYMBOL. */) DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0, doc: /* Make SYMBOL's function definition be void. Return SYMBOL. */) - (symbol) - register Lisp_Object symbol; + (register Lisp_Object symbol) { CHECK_SYMBOL (symbol); if (NILP (symbol) || EQ (symbol, Qt)) @@ -663,8 +620,7 @@ Return SYMBOL. */) DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0, doc: /* Return SYMBOL's function definition. Error if that is void. */) - (symbol) - register Lisp_Object symbol; + (register Lisp_Object symbol) { CHECK_SYMBOL (symbol); if (!EQ (XSYMBOL (symbol)->function, Qunbound)) @@ -674,8 +630,7 @@ DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0, DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, doc: /* Return SYMBOL's property list. */) - (symbol) - register Lisp_Object symbol; + (register Lisp_Object symbol) { CHECK_SYMBOL (symbol); return XSYMBOL (symbol)->plist; @@ -683,8 +638,7 @@ DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0, doc: /* Return SYMBOL's name, a string. */) - (symbol) - register Lisp_Object symbol; + (register Lisp_Object symbol) { register Lisp_Object name; @@ -695,8 +649,7 @@ DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0, DEFUN ("fset", Ffset, Sfset, 2, 2, 0, doc: /* Set SYMBOL's function definition to DEFINITION, and return DEFINITION. */) - (symbol, definition) - register Lisp_Object symbol, definition; + (register Lisp_Object symbol, Lisp_Object definition) { register Lisp_Object function; @@ -730,8 +683,7 @@ Associates the function with the current load file, if any. The optional third argument DOCSTRING specifies the documentation string for SYMBOL; if it is omitted or nil, SYMBOL uses the documentation string determined by DEFINITION. */) - (symbol, definition, docstring) - register Lisp_Object symbol, definition, docstring; + (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring) { CHECK_SYMBOL (symbol); if (CONSP (XSYMBOL (symbol)->function) @@ -746,8 +698,7 @@ determined by DEFINITION. */) DEFUN ("setplist", Fsetplist, Ssetplist, 2, 2, 0, doc: /* Set SYMBOL's property list to NEWPLIST, and return NEWPLIST. */) - (symbol, newplist) - register Lisp_Object symbol, newplist; + (register Lisp_Object symbol, Lisp_Object newplist) { CHECK_SYMBOL (symbol); XSYMBOL (symbol)->plist = newplist; @@ -760,8 +711,7 @@ SUBR must be a built-in function. The returned value is a pair (MIN . MAX). MIN is the minimum number of args. MAX is the maximum number or the symbol `many', for a function with `&rest' args, or `unevalled' for a special form. */) - (subr) - Lisp_Object subr; + (Lisp_Object subr) { short minargs, maxargs; CHECK_SUBR (subr); @@ -778,8 +728,7 @@ function with `&rest' args, or `unevalled' for a special form. */) DEFUN ("subr-name", Fsubr_name, Ssubr_name, 1, 1, 0, doc: /* Return name of subroutine SUBR. SUBR must be a built-in function. */) - (subr) - Lisp_Object subr; + (Lisp_Object subr) { const char *name; CHECK_SUBR (subr); @@ -791,8 +740,7 @@ DEFUN ("interactive-form", Finteractive_form, Sinteractive_form, 1, 1, 0, doc: /* Return the interactive form of CMD or nil if none. If CMD is not a command, the return value is nil. Value, if non-nil, is a list \(interactive SPEC). */) - (cmd) - Lisp_Object cmd; + (Lisp_Object cmd) { Lisp_Object fun = indirect_function (cmd); /* Check cycles. */ @@ -851,8 +799,7 @@ Value, if non-nil, is a list \(interactive SPEC). */) indirections contains a loop. */ struct Lisp_Symbol * -indirect_variable (symbol) - struct Lisp_Symbol *symbol; +indirect_variable (struct Lisp_Symbol *symbol) { struct Lisp_Symbol *tortoise, *hare; @@ -885,8 +832,7 @@ If OBJECT is a symbol, follow all variable indirections and return the final variable. If OBJECT is not a symbol, just return it. Signal a cyclic-variable-indirection error if there is a loop in the variable chain of symbols. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (SYMBOLP (object)) XSETSYMBOL (object, indirect_variable (XSYMBOL (object))); @@ -903,8 +849,7 @@ variable chain of symbols. */) ((blv)->forwarded ? do_symval_forwarding (BLV_FWD (blv)) : BLV_VALUE (blv)) Lisp_Object -do_symval_forwarding (valcontents) - register union Lisp_Fwd *valcontents; +do_symval_forwarding (register union Lisp_Fwd *valcontents) { register Lisp_Object val; switch (XFWDTYPE (valcontents)) @@ -958,11 +903,7 @@ do_symval_forwarding (valcontents) } while (0) static void -store_symval_forwarding (/* symbol, */ valcontents, newval, buf) - /* struct Lisp_Symbol *symbol; */ - union Lisp_Fwd *valcontents; - register Lisp_Object newval; - struct buffer *buf; +store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newval, struct buffer *buf) { switch (XFWDTYPE (valcontents)) { @@ -1043,8 +984,7 @@ store_symval_forwarding (/* symbol, */ valcontents, newval, buf) This makes it safe to alter the status of other bindings. */ void -swap_in_global_binding (symbol) - struct Lisp_Symbol *symbol; +swap_in_global_binding (struct Lisp_Symbol *symbol) { struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (symbol); @@ -1070,9 +1010,7 @@ swap_in_global_binding (symbol) This could be another forwarding pointer. */ static void -swap_in_symval_forwarding (symbol, blv) - struct Lisp_Symbol *symbol; - struct Lisp_Buffer_Local_Value *blv; +swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_Value *blv) { register Lisp_Object tem1; @@ -1122,8 +1060,7 @@ swap_in_symval_forwarding (symbol, blv) within this function. Great care is required for this. */ Lisp_Object -find_symbol_value (symbol) - Lisp_Object symbol; +find_symbol_value (Lisp_Object symbol) { struct Lisp_Symbol *sym; @@ -1150,8 +1087,7 @@ find_symbol_value (symbol) DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0, doc: /* Return SYMBOL's value. Error if that is void. */) - (symbol) - Lisp_Object symbol; + (Lisp_Object symbol) { Lisp_Object val; @@ -1164,8 +1100,7 @@ DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0, DEFUN ("set", Fset, Sset, 2, 2, 0, doc: /* Set SYMBOL's value to NEWVAL, and return NEWVAL. */) - (symbol, newval) - register Lisp_Object symbol, newval; + (register Lisp_Object symbol, Lisp_Object newval) { set_internal (symbol, newval, Qnil, 0); return newval; @@ -1194,8 +1129,7 @@ let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol) } static int -let_shadows_global_binding_p (symbol) - Lisp_Object symbol; +let_shadows_global_binding_p (Lisp_Object symbol) { struct specbinding *p; @@ -1215,9 +1149,7 @@ let_shadows_global_binding_p (symbol) If BINDFLAG is nonzero, we don't do that. */ void -set_internal (symbol, newval, where, bindflag) - register Lisp_Object symbol, newval, where; - int bindflag; +set_internal (register Lisp_Object symbol, register Lisp_Object newval, register Lisp_Object where, int bindflag) { int voide = EQ (newval, Qunbound); struct Lisp_Symbol *sym; @@ -1368,8 +1300,7 @@ set_internal (symbol, newval, where, bindflag) Return Qunbound if it is void. */ Lisp_Object -default_value (symbol) - Lisp_Object symbol; +default_value (Lisp_Object symbol) { struct Lisp_Symbol *sym; @@ -1417,8 +1348,7 @@ DEFUN ("default-boundp", Fdefault_boundp, Sdefault_boundp, 1, 1, 0, doc: /* Return t if SYMBOL has a non-void default value. This is the value that is seen in buffers that do not have their own values for this variable. */) - (symbol) - Lisp_Object symbol; + (Lisp_Object symbol) { register Lisp_Object value; @@ -1431,8 +1361,7 @@ DEFUN ("default-value", Fdefault_value, Sdefault_value, 1, 1, 0, This is the value that is seen in buffers that do not have their own values for this variable. The default value is meaningful for variables with local bindings in certain buffers. */) - (symbol) - Lisp_Object symbol; + (Lisp_Object symbol) { register Lisp_Object value; @@ -1447,8 +1376,7 @@ DEFUN ("set-default", Fset_default, Sset_default, 2, 2, 0, doc: /* Set SYMBOL's default value to VALUE. SYMBOL and VALUE are evaluated. The default value is seen in buffers that do not have their own values for this variable. */) - (symbol, value) - Lisp_Object symbol, value; + (Lisp_Object symbol, Lisp_Object value) { struct Lisp_Symbol *sym; @@ -1527,8 +1455,7 @@ This sets each VAR's default value to the corresponding VALUE. The VALUE for the Nth VAR can refer to the new default values of previous VARs. usage: (setq-default [VAR VALUE]...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { register Lisp_Object args_left; register Lisp_Object val, symbol; @@ -1602,8 +1529,7 @@ In most cases it is better to use `make-local-variable', which makes a variable local in just one buffer. The function `default-value' gets the default value and `set-default' sets it. */) - (variable) - register Lisp_Object variable; + (register Lisp_Object variable) { struct Lisp_Symbol *sym; struct Lisp_Buffer_Local_Value *blv = NULL; @@ -1680,8 +1606,7 @@ See also `make-variable-buffer-local'. Do not use `make-local-variable' to make a hook variable buffer-local. Instead, use `add-hook' and specify t for the LOCAL argument. */) - (variable) - register Lisp_Object variable; + (register Lisp_Object variable) { register Lisp_Object tem; int forwarded; @@ -1782,8 +1707,7 @@ DEFUN ("kill-local-variable", Fkill_local_variable, Skill_local_variable, 1, 1, "vKill Local Variable: ", doc: /* Make VARIABLE no longer have a separate value in the current buffer. From now on the default value will apply in this buffer. Return VARIABLE. */) - (variable) - register Lisp_Object variable; + (register Lisp_Object variable) { register Lisp_Object tem; struct Lisp_Buffer_Local_Value *blv; @@ -1871,8 +1795,7 @@ is to set the VARIABLE frame parameter of that frame. See Note that since Emacs 23.1, variables cannot be both buffer-local and frame-local any more (buffer-local bindings used to take precedence over frame-local bindings). */) - (variable) - register Lisp_Object variable; + (register Lisp_Object variable) { int forwarded; union Lisp_Val_Fwd valcontents; @@ -1927,8 +1850,7 @@ DEFUN ("local-variable-p", Flocal_variable_p, Slocal_variable_p, 1, 2, 0, doc: /* Non-nil if VARIABLE has a local binding in buffer BUFFER. BUFFER defaults to the current buffer. */) - (variable, buffer) - register Lisp_Object variable, buffer; + (register Lisp_Object variable, Lisp_Object buffer) { register struct buffer *buf; struct Lisp_Symbol *sym; @@ -1992,8 +1914,7 @@ while it does not have a `let'-style binding that was made in BUFFER, will produce a buffer local binding. See Info node `(elisp)Creating Buffer-Local'. BUFFER defaults to the current buffer. */) - (variable, buffer) - register Lisp_Object variable, buffer; + (register Lisp_Object variable, Lisp_Object buffer) { struct Lisp_Symbol *sym; @@ -2026,8 +1947,7 @@ DEFUN ("variable-binding-locus", Fvariable_binding_locus, Svariable_binding_locu If the current binding is buffer-local, the value is the current buffer. If the current binding is frame-local, the value is the selected frame. If the current binding is global (the default), the value is nil. */) - (variable) - register Lisp_Object variable; + (register Lisp_Object variable) { struct Lisp_Symbol *sym; @@ -2068,7 +1988,7 @@ If the current binding is global (the default), the value is nil. */) /* This code is disabled now that we use the selected frame to return keyboard-local-values. */ #if 0 -extern struct terminal *get_terminal P_ ((Lisp_Object display, int)); +extern struct terminal *get_terminal (Lisp_Object display, int); DEFUN ("terminal-local-value", Fterminal_local_value, Sterminal_local_value, 2, 2, 0, doc: /* Return the terminal-local value of SYMBOL on TERMINAL. @@ -2077,9 +1997,7 @@ value, like `symbol-value'. TERMINAL may be a terminal object, a frame, or nil (meaning the selected frame's terminal device). */) - (symbol, terminal) - Lisp_Object symbol; - Lisp_Object terminal; + (Lisp_Object symbol, Lisp_Object terminal) { Lisp_Object result; struct terminal *t = get_terminal (terminal, 1); @@ -2096,10 +2014,7 @@ binding, like `set'. TERMINAL may be a terminal object, a frame, or nil (meaning the selected frame's terminal device). */) - (symbol, terminal, value) - Lisp_Object symbol; - Lisp_Object terminal; - Lisp_Object value; + (Lisp_Object symbol, Lisp_Object terminal, Lisp_Object value) { Lisp_Object result; struct terminal *t = get_terminal (terminal, 1); @@ -2120,8 +2035,7 @@ selected frame's terminal device). */) This is like Findirect_function, except that it doesn't signal an error if the chain ends up unbound. */ Lisp_Object -indirect_function (object) - register Lisp_Object object; +indirect_function (register Lisp_Object object) { Lisp_Object tortoise, hare; @@ -2153,9 +2067,7 @@ If the final symbol in the chain is unbound, signal a void-function error. Optional arg NOERROR non-nil means to return nil instead of signalling. Signal a cyclic-function-indirection error if there is a loop in the function chain of symbols. */) - (object, noerror) - register Lisp_Object object; - Lisp_Object noerror; + (register Lisp_Object object, Lisp_Object noerror) { Lisp_Object result; @@ -2179,9 +2091,7 @@ DEFUN ("aref", Faref, Saref, 2, 2, 0, doc: /* Return the element of ARRAY at index IDX. ARRAY may be a vector, a string, a char-table, a bool-vector, or a byte-code object. IDX starts at 0. */) - (array, idx) - register Lisp_Object array; - Lisp_Object idx; + (register Lisp_Object array, Lisp_Object idx) { register int idxval; @@ -2235,9 +2145,7 @@ DEFUN ("aset", Faset, Saset, 3, 3, 0, doc: /* Store into the element of ARRAY at index IDX the value NEWELT. Return NEWELT. ARRAY may be a vector, a string, a char-table or a bool-vector. IDX starts at 0. */) - (array, idx, newelt) - register Lisp_Object array; - Lisp_Object idx, newelt; + (register Lisp_Object array, Lisp_Object idx, Lisp_Object newelt) { register int idxval; @@ -2295,13 +2203,13 @@ bool-vector. IDX starts at 0. */) USE_SAFE_ALLOCA; SAFE_ALLOCA (str, unsigned char *, nbytes); - bcopy (SDATA (array), str, nbytes); + memcpy (str, SDATA (array), nbytes); allocate_string_data (XSTRING (array), nchars, nbytes + new_bytes - prev_bytes); - bcopy (str, SDATA (array), idxval_byte); + memcpy (SDATA (array), str, idxval_byte); p1 = SDATA (array) + idxval_byte; - bcopy (str + idxval_byte + prev_bytes, p1 + new_bytes, - nbytes - (idxval_byte + prev_bytes)); + memcpy (p1 + new_bytes, str + idxval_byte + prev_bytes, + nbytes - (idxval_byte + prev_bytes)); SAFE_FREE (); clear_string_char_byte_cache (); } @@ -2337,9 +2245,7 @@ bool-vector. IDX starts at 0. */) enum comparison { equal, notequal, less, grtr, less_or_equal, grtr_or_equal }; Lisp_Object -arithcompare (num1, num2, comparison) - Lisp_Object num1, num2; - enum comparison comparison; +arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison) { double f1 = 0, f2 = 0; int floatp = 0; @@ -2393,24 +2299,21 @@ arithcompare (num1, num2, comparison) DEFUN ("=", Feqlsign, Seqlsign, 2, 2, 0, doc: /* Return t if two args, both numbers or markers, are equal. */) - (num1, num2) - register Lisp_Object num1, num2; + (register Lisp_Object num1, Lisp_Object num2) { return arithcompare (num1, num2, equal); } DEFUN ("<", Flss, Slss, 2, 2, 0, doc: /* Return t if first arg is less than second arg. Both must be numbers or markers. */) - (num1, num2) - register Lisp_Object num1, num2; + (register Lisp_Object num1, Lisp_Object num2) { return arithcompare (num1, num2, less); } DEFUN (">", Fgtr, Sgtr, 2, 2, 0, doc: /* Return t if first arg is greater than second arg. Both must be numbers or markers. */) - (num1, num2) - register Lisp_Object num1, num2; + (register Lisp_Object num1, Lisp_Object num2) { return arithcompare (num1, num2, grtr); } @@ -2418,8 +2321,7 @@ DEFUN (">", Fgtr, Sgtr, 2, 2, 0, DEFUN ("<=", Fleq, Sleq, 2, 2, 0, doc: /* Return t if first arg is less than or equal to second arg. Both must be numbers or markers. */) - (num1, num2) - register Lisp_Object num1, num2; + (register Lisp_Object num1, Lisp_Object num2) { return arithcompare (num1, num2, less_or_equal); } @@ -2427,24 +2329,21 @@ Both must be numbers or markers. */) DEFUN (">=", Fgeq, Sgeq, 2, 2, 0, doc: /* Return t if first arg is greater than or equal to second arg. Both must be numbers or markers. */) - (num1, num2) - register Lisp_Object num1, num2; + (register Lisp_Object num1, Lisp_Object num2) { return arithcompare (num1, num2, grtr_or_equal); } DEFUN ("/=", Fneq, Sneq, 2, 2, 0, doc: /* Return t if first arg is not equal to second arg. Both must be numbers or markers. */) - (num1, num2) - register Lisp_Object num1, num2; + (register Lisp_Object num1, Lisp_Object num2) { return arithcompare (num1, num2, notequal); } DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0, doc: /* Return t if NUMBER is zero. */) - (number) - register Lisp_Object number; + (register Lisp_Object number) { CHECK_NUMBER_OR_FLOAT (number); @@ -2465,8 +2364,7 @@ DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0, when the value fits in one. */ Lisp_Object -long_to_cons (i) - unsigned long i; +long_to_cons (long unsigned int i) { unsigned long top = i >> 16; unsigned int bot = i & 0xFFFF; @@ -2478,8 +2376,7 @@ long_to_cons (i) } unsigned long -cons_to_long (c) - Lisp_Object c; +cons_to_long (Lisp_Object c) { Lisp_Object top, bot; if (INTEGERP (c)) @@ -2495,8 +2392,7 @@ DEFUN ("number-to-string", Fnumber_to_string, Snumber_to_string, 1, 1, 0, doc: /* Return the decimal representation of NUMBER as a string. Uses a minus sign if negative. NUMBER may be an integer or a floating point number. */) - (number) - Lisp_Object number; + (Lisp_Object number) { char buffer[VALBITS]; @@ -2520,8 +2416,7 @@ NUMBER may be an integer or a floating point number. */) } INLINE static int -digit_to_number (character, base) - int character, base; +digit_to_number (int character, int base) { int digit; @@ -2548,8 +2443,7 @@ It ignores leading spaces and tabs, and all trailing chars. If BASE, interpret STRING as a number in that base. If BASE isn't present, base 10 is used. BASE must be between 2 and 16 (inclusive). If the base used is not 10, STRING is always parsed as integer. */) - (string, base) - register Lisp_Object string, base; + (register Lisp_Object string, Lisp_Object base) { register unsigned char *p; register int b; @@ -2616,15 +2510,12 @@ enum arithop Amin }; -static Lisp_Object float_arith_driver P_ ((double, int, enum arithop, - int, Lisp_Object *)); -extern Lisp_Object fmod_float (); +static Lisp_Object float_arith_driver (double, int, enum arithop, + int, Lisp_Object *); +extern Lisp_Object fmod_float (Lisp_Object, Lisp_Object); Lisp_Object -arith_driver (code, nargs, args) - enum arithop code; - int nargs; - register Lisp_Object *args; +arith_driver (enum arithop code, int nargs, register Lisp_Object *args) { register Lisp_Object val; register int argnum; @@ -2709,12 +2600,7 @@ arith_driver (code, nargs, args) #define isnan(x) ((x) != (x)) static Lisp_Object -float_arith_driver (accum, argnum, code, nargs, args) - double accum; - register int argnum; - enum arithop code; - int nargs; - register Lisp_Object *args; +float_arith_driver (double accum, register int argnum, enum arithop code, int nargs, register Lisp_Object *args) { register Lisp_Object val; double next; @@ -2776,9 +2662,7 @@ float_arith_driver (accum, argnum, code, nargs, args) DEFUN ("+", Fplus, Splus, 0, MANY, 0, doc: /* Return sum of any number of arguments, which are numbers or markers. usage: (+ &rest NUMBERS-OR-MARKERS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { return arith_driver (Aadd, nargs, args); } @@ -2788,9 +2672,7 @@ DEFUN ("-", Fminus, Sminus, 0, MANY, 0, With one arg, negates it. With more than one arg, subtracts all but the first from the first. usage: (- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { return arith_driver (Asub, nargs, args); } @@ -2798,9 +2680,7 @@ usage: (- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS) */) DEFUN ("*", Ftimes, Stimes, 0, MANY, 0, doc: /* Return product of any number of arguments, which are numbers or markers. usage: (* &rest NUMBERS-OR-MARKERS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { return arith_driver (Amult, nargs, args); } @@ -2809,9 +2689,7 @@ DEFUN ("/", Fquo, Squo, 2, MANY, 0, doc: /* Return first argument divided by all the remaining arguments. The arguments must be numbers or markers. usage: (/ DIVIDEND DIVISOR &rest DIVISORS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { int argnum; for (argnum = 2; argnum < nargs; argnum++) @@ -2823,8 +2701,7 @@ usage: (/ DIVIDEND DIVISOR &rest DIVISORS) */) DEFUN ("%", Frem, Srem, 2, 2, 0, doc: /* Return remainder of X divided by Y. Both must be integers or markers. */) - (x, y) - register Lisp_Object x, y; + (register Lisp_Object x, Lisp_Object y) { Lisp_Object val; @@ -2865,8 +2742,7 @@ DEFUN ("mod", Fmod, Smod, 2, 2, 0, doc: /* Return X modulo Y. The result falls between zero (inclusive) and Y (exclusive). Both X and Y must be numbers or markers. */) - (x, y) - register Lisp_Object x, y; + (register Lisp_Object x, Lisp_Object y) { Lisp_Object val; EMACS_INT i1, i2; @@ -2897,9 +2773,7 @@ DEFUN ("max", Fmax, Smax, 1, MANY, 0, doc: /* Return largest of all the arguments (which must be numbers or markers). The value is always a number; markers are converted to numbers. usage: (max NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { return arith_driver (Amax, nargs, args); } @@ -2908,9 +2782,7 @@ DEFUN ("min", Fmin, Smin, 1, MANY, 0, doc: /* Return smallest of all the arguments (which must be numbers or markers). The value is always a number; markers are converted to numbers. usage: (min NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { return arith_driver (Amin, nargs, args); } @@ -2919,9 +2791,7 @@ DEFUN ("logand", Flogand, Slogand, 0, MANY, 0, doc: /* Return bitwise-and of all the arguments. Arguments may be integers, or markers converted to integers. usage: (logand &rest INTS-OR-MARKERS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { return arith_driver (Alogand, nargs, args); } @@ -2930,9 +2800,7 @@ DEFUN ("logior", Flogior, Slogior, 0, MANY, 0, doc: /* Return bitwise-or of all the arguments. Arguments may be integers, or markers converted to integers. usage: (logior &rest INTS-OR-MARKERS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { return arith_driver (Alogior, nargs, args); } @@ -2941,9 +2809,7 @@ DEFUN ("logxor", Flogxor, Slogxor, 0, MANY, 0, doc: /* Return bitwise-exclusive-or of all the arguments. Arguments may be integers, or markers converted to integers. usage: (logxor &rest INTS-OR-MARKERS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { return arith_driver (Alogxor, nargs, args); } @@ -2952,8 +2818,7 @@ DEFUN ("ash", Fash, Sash, 2, 2, 0, doc: /* Return VALUE with its bits shifted left by COUNT. If COUNT is negative, shifting is actually to the right. In this case, the sign bit is duplicated. */) - (value, count) - register Lisp_Object value, count; + (register Lisp_Object value, Lisp_Object count) { register Lisp_Object val; @@ -2975,8 +2840,7 @@ DEFUN ("lsh", Flsh, Slsh, 2, 2, 0, doc: /* Return VALUE with its bits shifted left by COUNT. If COUNT is negative, shifting is actually to the right. In this case, zeros are shifted in on the left. */) - (value, count) - register Lisp_Object value, count; + (register Lisp_Object value, Lisp_Object count) { register Lisp_Object val; @@ -2997,8 +2861,7 @@ In this case, zeros are shifted in on the left. */) DEFUN ("1+", Fadd1, Sadd1, 1, 1, 0, doc: /* Return NUMBER plus one. NUMBER may be a number or a marker. Markers are converted to integers. */) - (number) - register Lisp_Object number; + (register Lisp_Object number) { CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (number); @@ -3012,8 +2875,7 @@ Markers are converted to integers. */) DEFUN ("1-", Fsub1, Ssub1, 1, 1, 0, doc: /* Return NUMBER minus one. NUMBER may be a number or a marker. Markers are converted to integers. */) - (number) - register Lisp_Object number; + (register Lisp_Object number) { CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (number); @@ -3026,8 +2888,7 @@ Markers are converted to integers. */) DEFUN ("lognot", Flognot, Slognot, 1, 1, 0, doc: /* Return the bitwise complement of NUMBER. NUMBER must be an integer. */) - (number) - register Lisp_Object number; + (register Lisp_Object number) { CHECK_NUMBER (number); XSETINT (number, ~XINT (number)); @@ -3038,7 +2899,7 @@ DEFUN ("byteorder", Fbyteorder, Sbyteorder, 0, 0, 0, doc: /* Return the byteorder for the machine. Returns 66 (ASCII uppercase B) for big endian machines or 108 (ASCII lowercase l) for small endian machines. */) - () + (void) { unsigned i = 0x04030201; int order = *(char *)&i == 1 ? 108 : 66; @@ -3049,7 +2910,7 @@ lowercase l) for small endian machines. */) void -syms_of_data () +syms_of_data (void) { Lisp_Object error_tail, arith_tail; @@ -3481,8 +3342,7 @@ syms_of_data () } SIGTYPE -arith_error (signo) - int signo; +arith_error (int signo) { sigsetmask (SIGEMPTYMASK); @@ -3491,7 +3351,7 @@ arith_error (signo) } void -init_data () +init_data (void) { /* Don't do this if just dumping out. We don't want to call `signal' in this case diff --git a/src/dbusbind.c b/src/dbusbind.c index e813d0b5ad8..683d6f047fa 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -163,8 +163,7 @@ int xd_in_read_queued_messages = 0; /* Determine the DBusType of a given Lisp symbol. OBJECT must be one of the predefined D-Bus type symbols. */ static int -xd_symbol_to_dbus_type (object) - Lisp_Object object; +xd_symbol_to_dbus_type (Lisp_Object object) { return ((EQ (object, QCdbus_type_byte)) ? DBUS_TYPE_BYTE @@ -221,10 +220,7 @@ xd_symbol_to_dbus_type (object) signature is embedded, or DBUS_TYPE_INVALID. It is needed for the check that DBUS_TYPE_DICT_ENTRY occurs only as array element. */ static void -xd_signature (signature, dtype, parent_type, object) - char *signature; - unsigned int dtype, parent_type; - Lisp_Object object; +xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lisp_Object object) { unsigned int subtype; Lisp_Object elt; @@ -393,10 +389,7 @@ xd_signature (signature, dtype, parent_type, object) `dbus-send-signal', into corresponding C values appended as arguments to a D-Bus message. */ static void -xd_append_arg (dtype, object, iter) - unsigned int dtype; - Lisp_Object object; - DBusMessageIter *iter; +xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) { char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; DBusMessageIter subiter; @@ -604,9 +597,7 @@ xd_append_arg (dtype, object, iter) D-Bus message must be a valid DBusType. Compound D-Bus types result always in a Lisp list. */ static Lisp_Object -xd_retrieve_arg (dtype, iter) - unsigned int dtype; - DBusMessageIter *iter; +xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter) { switch (dtype) @@ -723,10 +714,11 @@ xd_retrieve_arg (dtype, iter) } /* Initialize D-Bus connection. BUS is a Lisp symbol, either :system - or :session. It tells which D-Bus to be initialized. */ + or :session. 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 (bus) - Lisp_Object bus; +xd_initialize (Lisp_Object bus, int raise_error) { DBusConnection *connection; DBusError derror; @@ -734,12 +726,18 @@ xd_initialize (bus) /* Parameter check. */ CHECK_SYMBOL (bus); if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus))) - XD_SIGNAL2 (build_string ("Wrong bus name"), 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) - XD_SIGNAL2 (build_string ("No connection to bus"), bus); + 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); @@ -750,9 +748,12 @@ xd_initialize (bus) connection = dbus_bus_get (DBUS_BUS_SESSION, &derror); if (dbus_error_is_set (&derror)) - XD_ERROR (derror); + if (raise_error) + XD_ERROR (derror); + else + connection = NULL; - if (connection == NULL) + if (connection == NULL && raise_error) XD_SIGNAL2 (build_string ("No connection to bus"), bus); /* Cleanup. */ @@ -766,9 +767,7 @@ xd_initialize (bus) /* Add connection file descriptor to input_wait_mask, in order to let select() detect, whether a new message has been arrived. */ dbus_bool_t -xd_add_watch (watch, data) - DBusWatch *watch; - void *data; +xd_add_watch (DBusWatch *watch, void *data) { /* We check only for incoming data. */ if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE) @@ -797,9 +796,7 @@ xd_add_watch (watch, data) /* Remove connection file descriptor from input_wait_mask. DATA is the used bus, either QCdbus_system_bus or QCdbus_session_bus. */ void -xd_remove_watch (watch, data) - DBusWatch *watch; - void *data; +xd_remove_watch (DBusWatch *watch, void *data) { /* We check only for incoming data. */ if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE) @@ -835,8 +832,7 @@ xd_remove_watch (watch, 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. */) - (bus) - Lisp_Object bus; + (Lisp_Object bus) { DBusConnection *connection; @@ -844,7 +840,7 @@ This is an internal function, it shall not be used outside dbus.el. */) CHECK_SYMBOL (bus); /* Open a connection to the bus. */ - connection = xd_initialize (bus); + connection = xd_initialize (bus, TRUE); /* Add the watch functions. We pass also the bus as data, in order to distinguish between the busses in xd_remove_watch. */ @@ -861,8 +857,7 @@ This is an internal function, it shall not be used outside dbus.el. */) DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name, 1, 1, 0, doc: /* Return the unique name of Emacs registered at D-Bus BUS. */) - (bus) - Lisp_Object bus; + (Lisp_Object bus) { DBusConnection *connection; const char *name; @@ -871,7 +866,7 @@ DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name, CHECK_SYMBOL (bus); /* Open a connection to the bus. */ - connection = xd_initialize (bus); + connection = xd_initialize (bus, TRUE); /* Request the name. */ name = dbus_bus_get_unique_name (connection); @@ -950,9 +945,7 @@ object is returned instead of a list containing this single Lisp object. => "i686" usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TIMEOUT &rest ARGS) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { Lisp_Object bus, service, path, interface, method; Lisp_Object result; @@ -988,7 +981,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI SDATA (method)); /* Open a connection to the bus. */ - connection = xd_initialize (bus); + connection = xd_initialize (bus, TRUE); /* Create the message. */ dmessage = dbus_message_new_method_call (SDATA (service), @@ -1134,9 +1127,7 @@ HANDLER is called. -| i686 usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLER &optional :timeout TIMEOUT &rest ARGS) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { Lisp_Object bus, service, path, interface, method, handler; Lisp_Object result; @@ -1173,7 +1164,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE SDATA (method)); /* Open a connection to the bus. */ - connection = xd_initialize (bus); + connection = xd_initialize (bus, TRUE); /* Create the message. */ dmessage = dbus_message_new_method_call (SDATA (service), @@ -1264,9 +1255,7 @@ DEFUN ("dbus-method-return-internal", Fdbus_method_return_internal, This is an internal function, it shall not be used outside dbus.el. usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { Lisp_Object bus, serial, service; struct gcpro gcpro1, gcpro2, gcpro3; @@ -1290,7 +1279,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) XD_DEBUG_MESSAGE ("%lu %s ", (unsigned long) XUINT (serial), SDATA (service)); /* Open a connection to the bus. */ - connection = xd_initialize (bus); + connection = xd_initialize (bus, TRUE); /* Create the message. */ dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_RETURN); @@ -1358,9 +1347,7 @@ DEFUN ("dbus-method-error-internal", Fdbus_method_error_internal, This is an internal function, it shall not be used outside dbus.el. usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { Lisp_Object bus, serial, service; struct gcpro gcpro1, gcpro2, gcpro3; @@ -1384,7 +1371,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) XD_DEBUG_MESSAGE ("%lu %s ", (unsigned long) XUINT (serial), SDATA (service)); /* Open a connection to the bus. */ - connection = xd_initialize (bus); + connection = xd_initialize (bus, TRUE); /* Create the message. */ dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_ERROR); @@ -1475,9 +1462,7 @@ type symbols, see Info node `(dbus)Type Conversion'. "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs") usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { Lisp_Object bus, service, path, interface, signal; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; @@ -1509,7 +1494,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) SDATA (signal)); /* Open a connection to the bus. */ - connection = xd_initialize (bus); + connection = xd_initialize (bus, TRUE); /* Create the message. */ dmessage = dbus_message_new_signal (SDATA (path), @@ -1569,13 +1554,13 @@ 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. */ int -xd_get_dispatch_status (bus) - Lisp_Object bus; +xd_get_dispatch_status (Lisp_Object bus) { DBusConnection *connection; /* Open a connection to the bus. */ - connection = xd_initialize (bus); + connection = xd_initialize (bus, FALSE); + if (connection == NULL) return FALSE; /* Non blocking read of the next available message. */ dbus_connection_read_write (connection, 0); @@ -1589,7 +1574,7 @@ xd_get_dispatch_status (bus) /* Check for queued incoming messages from the system and session buses. */ int -xd_pending_messages () +xd_pending_messages (void) { /* Vdbus_registered_objects_table will be initialized as hash table @@ -1606,8 +1591,7 @@ xd_pending_messages () /* Read queued incoming message of the D-Bus BUS. BUS is a Lisp symbol, either :system or :session. */ static Lisp_Object -xd_read_message (bus) - Lisp_Object bus; +xd_read_message (Lisp_Object bus) { Lisp_Object args, key, value; struct gcpro gcpro1; @@ -1620,7 +1604,7 @@ xd_read_message (bus) const char *uname, *path, *interface, *member; /* Open a connection to the bus. */ - connection = xd_initialize (bus); + connection = xd_initialize (bus, TRUE); /* Non blocking read of the next available message. */ dbus_connection_read_write (connection, 0); @@ -1764,7 +1748,7 @@ xd_read_message (bus) /* Read queued incoming messages from the system and session buses. */ void -xd_read_queued_messages () +xd_read_queued_messages (void) { /* Vdbus_registered_objects_table will be initialized as hash table @@ -1819,9 +1803,7 @@ INTERFACE, SIGNAL and HANDLER must not be nil. Example: `dbus-unregister-object' for removing the registration. usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARGS) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { Lisp_Object bus, service, path, interface, signal, handler; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; @@ -1872,7 +1854,7 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG if (NILP (uname) || (SBYTES (uname) > 0)) { /* Open a connection to the bus. */ - connection = xd_initialize (bus); + connection = xd_initialize (bus, TRUE); /* Create a rule to receive related signals. */ sprintf (rule, @@ -1943,8 +1925,7 @@ interface offered by SERVICE. It must provide METHOD. HANDLER is a Lisp function to be called when a method call is received. It must accept the input arguments of METHOD. The return value of HANDLER is used for composing the returning D-Bus message. */) - (bus, service, path, interface, method, handler) - Lisp_Object bus, service, path, interface, method, handler; + (Lisp_Object bus, Lisp_Object service, Lisp_Object path, Lisp_Object interface, Lisp_Object method, Lisp_Object handler) { Lisp_Object key, key1, value; DBusConnection *connection; @@ -1963,7 +1944,7 @@ used for composing the returning D-Bus message. */) a segmentation fault. */ /* Open a connection to the bus. */ - connection = xd_initialize (bus); + connection = xd_initialize (bus, TRUE); /* Request the known name from the bus. We can ignore the result, it is set to -1 if there is an error - kind of redundancy. */ @@ -1990,7 +1971,7 @@ used for composing the returning D-Bus message. */) void -syms_of_dbusbind () +syms_of_dbusbind (void) { Qdbus_init_bus = intern_c_string ("dbus-init-bus"); diff --git a/src/dired.c b/src/dired.c index a3ea23df2f6..cdb4545e81c 100644 --- a/src/dired.c +++ b/src/dired.c @@ -90,10 +90,10 @@ extern struct direct *readdir (); #include "blockinput.h" /* Returns a search buffer, with a fastmap allocated and ready to go. */ -extern struct re_pattern_buffer *compile_pattern (); +extern struct re_pattern_buffer *compile_pattern (Lisp_Object, struct re_registers *, Lisp_Object, int, int); /* From filemode.c. Can't go in Lisp.h because of `stat'. */ -extern void filemodestring P_ ((struct stat *, char *)); +extern void filemodestring (struct stat *, char *); /* if system does not have symbolic links, it does not have lstat. In that case, use ordinary stat instead. */ @@ -115,7 +115,7 @@ Lisp_Object Qfile_name_all_completions; Lisp_Object Qfile_attributes; Lisp_Object Qfile_attributes_lessp; -static int scmp P_ ((unsigned char *, unsigned char *, int)); +static int scmp (unsigned char *, unsigned char *, int); #ifdef WINDOWSNT Lisp_Object @@ -127,8 +127,7 @@ directory_files_internal_w32_unwind (Lisp_Object arg) #endif Lisp_Object -directory_files_internal_unwind (dh) - Lisp_Object dh; +directory_files_internal_unwind (Lisp_Object dh) { DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer; BLOCK_INPUT; @@ -143,10 +142,7 @@ directory_files_internal_unwind (dh) In the latter case, ID_FORMAT is passed to Ffile_attributes. */ Lisp_Object -directory_files_internal (directory, full, match, nosort, attrs, id_format) - Lisp_Object directory, full, match, nosort; - int attrs; - Lisp_Object id_format; +directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort, int attrs, Lisp_Object id_format) { DIR *d; int directory_nbytes; @@ -293,15 +289,14 @@ directory_files_internal (directory, full, match, nosort, attrs, id_format) int nchars; fullname = make_uninit_multibyte_string (nbytes, nbytes); - bcopy (SDATA (directory), SDATA (fullname), - directory_nbytes); + memcpy (SDATA (fullname), SDATA (directory), + directory_nbytes); if (needsep) SSET (fullname, directory_nbytes, DIRECTORY_SEP); - bcopy (SDATA (name), - SDATA (fullname) + directory_nbytes + needsep, - len); + memcpy (SDATA (fullname) + directory_nbytes + needsep, + SDATA (name), len); nchars = chars_in_text (SDATA (fullname), nbytes); @@ -371,8 +366,7 @@ If MATCH is non-nil, mention only file names that match the regexp MATCH. If NOSORT is non-nil, the list is not sorted--its order is unpredictable. Otherwise, the list returned is sorted with `string-lessp'. NOSORT is useful if you plan to sort the result yourself. */) - (directory, full, match, nosort) - Lisp_Object directory, full, match, nosort; + (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort) { Lisp_Object handler; directory = Fexpand_file_name (directory, Qnil); @@ -400,8 +394,7 @@ ID-FORMAT specifies the preferred format of attributes uid and gid, see `file-attributes' for further documentation. On MS-Windows, performance depends on `w32-get-true-file-attributes', which see. */) - (directory, full, match, nosort, id_format) - Lisp_Object directory, full, match, nosort, id_format; + (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort, Lisp_Object id_format) { Lisp_Object handler; directory = Fexpand_file_name (directory, Qnil); @@ -417,7 +410,7 @@ which see. */) } -Lisp_Object file_name_completion (); +Lisp_Object file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag, Lisp_Object predicate); DEFUN ("file-name-completion", Ffile_name_completion, Sfile_name_completion, 2, 3, 0, @@ -432,8 +425,7 @@ completion (in absolute form) and ignore it if PREDICATE returns nil. This function ignores some of the possible completions as determined by the variable `completion-ignored-extensions', which see. */) - (file, directory, predicate) - Lisp_Object file, directory, predicate; + (Lisp_Object file, Lisp_Object directory, Lisp_Object predicate) { Lisp_Object handler; @@ -456,8 +448,7 @@ DEFUN ("file-name-all-completions", Ffile_name_all_completions, Sfile_name_all_completions, 2, 2, 0, doc: /* Return a list of all completions of file name FILE in directory DIRECTORY. These are all file names in directory DIRECTORY which begin with FILE. */) - (file, directory) - Lisp_Object file, directory; + (Lisp_Object file, Lisp_Object directory) { Lisp_Object handler; @@ -476,14 +467,11 @@ These are all file names in directory DIRECTORY which begin with FILE. */) return file_name_completion (file, directory, 1, 0, Qnil); } -static int file_name_completion_stat (); +static int file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr); Lisp_Object Qdefault_directory; Lisp_Object -file_name_completion (file, dirname, all_flag, ver_flag, predicate) - Lisp_Object file, dirname; - int all_flag, ver_flag; - Lisp_Object predicate; +file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag, Lisp_Object predicate) { DIR *d; int bestmatchsize = 0; @@ -825,9 +813,7 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate) else number of chars that match at the beginning. */ static int -scmp (s1, s2, len) - register unsigned char *s1, *s2; - int len; +scmp (register unsigned char *s1, register unsigned char *s2, int len) { register int l = len; @@ -848,10 +834,7 @@ scmp (s1, s2, len) } static int -file_name_completion_stat (dirname, dp, st_addr) - Lisp_Object dirname; - DIRENTRY *dp; - struct stat *st_addr; +file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr) { int len = NAMLEN (dp); int pos = SCHARS (dirname); @@ -869,11 +852,11 @@ file_name_completion_stat (dirname, dp, st_addr) _djstat_flags = _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE; #endif /* MSDOS */ - bcopy (SDATA (dirname), fullname, pos); + memcpy (fullname, SDATA (dirname), pos); if (!IS_DIRECTORY_SEP (fullname[pos - 1])) fullname[pos++] = DIRECTORY_SEP; - bcopy (dp->d_name, fullname + pos, len); + memcpy (fullname + pos, dp->d_name, len); fullname[pos + len] = 0; #ifdef S_IFLNK @@ -893,8 +876,7 @@ file_name_completion_stat (dirname, dp, st_addr) } Lisp_Object -make_time (time) - time_t time; +make_time (time_t time) { return Fcons (make_number (time >> 16), Fcons (make_number (time & 0177777), Qnil)); @@ -973,16 +955,15 @@ which see. On some FAT-based filesystems, only the date of last access is recorded, so last access time will always be midnight of that day. */) - (filename, id_format) - Lisp_Object filename, id_format; + (Lisp_Object filename, Lisp_Object id_format) { Lisp_Object values[12]; Lisp_Object encoded; struct stat s; -#if defined (BSD4_2) || defined (BSD4_3) +#ifdef BSD4_2 Lisp_Object dirname; struct stat sdir; -#endif +#endif /* BSD4_2 */ char modes[10]; Lisp_Object handler; struct gcpro gcpro1; @@ -1049,7 +1030,7 @@ so last access time will always be midnight of that day. */) filemodestring (&s, modes); values[8] = make_string (modes, 10); -#if defined (BSD4_2) || defined (BSD4_3) /* file gid will be dir gid */ +#ifdef BSD4_2 /* file gid will be dir gid */ dirname = Ffile_name_directory (filename); if (! NILP (dirname)) encoded = ENCODE_FILE (dirname); @@ -1059,7 +1040,7 @@ so last access time will always be midnight of that day. */) values[9] = Qt; #else /* file gid will be egid */ values[9] = (s.st_gid != getegid ()) ? Qt : Qnil; -#endif /* BSD4_2 (or BSD4_3) */ +#endif /* not BSD4_2 */ if (!FIXNUM_OVERFLOW_P (s.st_ino)) /* Keep the most common cases as integers. */ values[10] = make_number (s.st_ino); @@ -1096,14 +1077,13 @@ so last access time will always be midnight of that day. */) DEFUN ("file-attributes-lessp", Ffile_attributes_lessp, Sfile_attributes_lessp, 2, 2, 0, doc: /* Return t if first arg file attributes list is less than second. Comparison is in lexicographic order and case is significant. */) - (f1, f2) - Lisp_Object f1, f2; + (Lisp_Object f1, Lisp_Object f2) { return Fstring_lessp (Fcar (f1), Fcar (f2)); } void -syms_of_dired () +syms_of_dired (void) { Qdirectory_files = intern_c_string ("directory-files"); Qdirectory_files_and_attributes = intern_c_string ("directory-files-and-attributes"); diff --git a/src/dispextern.h b/src/dispextern.h index f0d14c0e487..5ca7e813a1e 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -105,6 +105,8 @@ enum window_part /* Number of bits allocated to store fringe bitmap numbers. */ #define FRINGE_ID_BITS 16 +/* Number of bits allocated to store fringe bitmap height. */ +#define FRINGE_HEIGHT_BITS 8 /*********************************************************************** @@ -642,7 +644,7 @@ struct glyph_matrix This aborts if any pointer is found twice. */ #if GLYPH_DEBUG -void check_matrix_pointer_lossage P_ ((struct glyph_matrix *)); +void check_matrix_pointer_lossage (struct glyph_matrix *); #define CHECK_MATRIX(MATRIX) check_matrix_pointer_lossage ((MATRIX)) #else #define CHECK_MATRIX(MATRIX) (void) 0 @@ -800,6 +802,12 @@ struct glyph_row /* Face of the right fringe glyph. */ unsigned right_fringe_face_id : FACE_ID_BITS; + /* Vertical offset of the left fringe bitmap. */ + signed left_fringe_offset : FRINGE_HEIGHT_BITS; + + /* Vertical offset of the right fringe bitmap. */ + signed right_fringe_offset : FRINGE_HEIGHT_BITS; + /* 1 means that we must draw the bitmaps of this row. */ unsigned redraw_fringe_bitmaps_p : 1; @@ -914,7 +922,7 @@ struct glyph_row we don't try to access rows that are out of bounds. */ #if GLYPH_DEBUG -struct glyph_row *matrix_row P_ ((struct glyph_matrix *, int)); +struct glyph_row *matrix_row (struct glyph_matrix *, int); #define MATRIX_ROW(MATRIX, ROW) matrix_row ((MATRIX), (ROW)) #else #define MATRIX_ROW(MATRIX, ROW) ((MATRIX)->rows + (ROW)) @@ -2478,7 +2486,7 @@ struct run /* Handlers for setting frame parameters. */ -typedef void (*frame_parm_handler) P_ ((struct frame *, Lisp_Object, Lisp_Object)); +typedef void (*frame_parm_handler) (struct frame *, Lisp_Object, Lisp_Object); /* Structure holding system-dependent interface functions needed @@ -2491,110 +2499,110 @@ struct redisplay_interface /* Produce glyphs/get display metrics for the display element IT is loaded with. */ - void (*produce_glyphs) P_ ((struct it *it)); + void (*produce_glyphs) (struct it *it); /* Write or insert LEN glyphs from STRING at the nominal output position. */ - void (*write_glyphs) P_ ((struct glyph *string, int len)); - void (*insert_glyphs) P_ ((struct glyph *start, int len)); + void (*write_glyphs) (struct glyph *string, int len); + void (*insert_glyphs) (struct glyph *start, int len); /* Clear from nominal output position to X. X < 0 means clear to right end of display. */ - void (*clear_end_of_line) P_ ((int x)); + void (*clear_end_of_line) (int x); /* Function to call to scroll the display as described by RUN on window W. */ - void (*scroll_run_hook) P_ ((struct window *w, struct run *run)); + void (*scroll_run_hook) (struct window *w, struct run *run); /* Function to call after a line in a display has been completely updated. Used to draw truncation marks and alike. DESIRED_ROW is the desired row which has been updated. */ - void (*after_update_window_line_hook) P_ ((struct glyph_row *desired_row)); + void (*after_update_window_line_hook) (struct glyph_row *desired_row); /* Function to call before beginning to update window W in window-based redisplay. */ - void (*update_window_begin_hook) P_ ((struct window *w)); + void (*update_window_begin_hook) (struct window *w); /* Function to call after window W has been updated in window-based redisplay. CURSOR_ON_P non-zero means switch cursor on. MOUSE_FACE_OVERWRITTEN_P non-zero means that some lines in W that contained glyphs in mouse-face were overwritten, so we have to update the mouse highlight. */ - void (*update_window_end_hook) P_ ((struct window *w, int cursor_on_p, - int mouse_face_overwritten_p)); + void (*update_window_end_hook) (struct window *w, int cursor_on_p, + int mouse_face_overwritten_p); /* Move cursor to row/column position VPOS/HPOS, pixel coordinates Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y are window-relative pixel positions. */ - void (*cursor_to) P_ ((int vpos, int hpos, int y, int x)); + void (*cursor_to) (int vpos, int hpos, int y, int x); /* Flush the display of frame F. For X, this is XFlush. */ - void (*flush_display) P_ ((struct frame *f)); + void (*flush_display) (struct frame *f); /* Flush the display of frame F if non-NULL. This is called during redisplay, and should be NULL on systems which flushes automatically before reading input. */ - void (*flush_display_optional) P_ ((struct frame *f)); + void (*flush_display_optional) (struct frame *f); /* Clear the mouse hightlight in window W, if there is any. */ - void (*clear_window_mouse_face) P_ ((struct window *w)); + void (*clear_window_mouse_face) (struct window *w); /* Set *LEFT and *RIGHT to the left and right overhang of GLYPH on frame F. */ - void (*get_glyph_overhangs) P_ ((struct glyph *glyph, struct frame *f, - int *left, int *right)); + void (*get_glyph_overhangs) (struct glyph *glyph, struct frame *f, + int *left, int *right); /* Fix the display of AREA of ROW in window W for overlapping rows. This function is called from redraw_overlapping_rows after desired rows have been made current. */ - void (*fix_overlapping_area) P_ ((struct window *w, struct glyph_row *row, - enum glyph_row_area area, int)); + void (*fix_overlapping_area) (struct window *w, struct glyph_row *row, + enum glyph_row_area area, int); #ifdef HAVE_WINDOW_SYSTEM /* Draw a fringe bitmap in window W of row ROW using parameters P. */ - void (*draw_fringe_bitmap) P_ ((struct window *w, struct glyph_row *row, - struct draw_fringe_bitmap_params *p)); + void (*draw_fringe_bitmap) (struct window *w, struct glyph_row *row, + struct draw_fringe_bitmap_params *p); /* Define and destroy fringe bitmap no. WHICH. */ - void (*define_fringe_bitmap) P_ ((int which, unsigned short *bits, - int h, int wd)); - void (*destroy_fringe_bitmap) P_ ((int which)); + void (*define_fringe_bitmap) (int which, unsigned short *bits, + int h, int wd); + void (*destroy_fringe_bitmap) (int which); /* Compute left and right overhang of glyph string S. A NULL pointer if platform does not support this. */ - void (*compute_glyph_string_overhangs) P_ ((struct glyph_string *s)); + void (*compute_glyph_string_overhangs) (struct glyph_string *s); /* Draw a glyph string S. */ - void (*draw_glyph_string) P_ ((struct glyph_string *s)); + void (*draw_glyph_string) (struct glyph_string *s); /* Define cursor CURSOR on frame F. */ - void (*define_frame_cursor) P_ ((struct frame *f, Cursor cursor)); + void (*define_frame_cursor) (struct frame *f, Cursor cursor); /* Clear the area at (X,Y,WIDTH,HEIGHT) of frame F. */ - void (*clear_frame_area) P_ ((struct frame *f, int x, int y, - int width, int height)); + void (*clear_frame_area) (struct frame *f, int x, int y, + int width, int height); /* Draw specified cursor CURSOR_TYPE of width CURSOR_WIDTH at row GLYPH_ROW on window W if ON_P is 1. If ON_P is 0, don't draw cursor. If ACTIVE_P is 1, system caret should track this cursor (when applicable). */ - void (*draw_window_cursor) P_ ((struct window *w, - struct glyph_row *glyph_row, - int x, int y, - int cursor_type, int cursor_width, - int on_p, int active_p)); + void (*draw_window_cursor) (struct window *w, + struct glyph_row *glyph_row, + int x, int y, + int cursor_type, int cursor_width, + int on_p, int active_p); /* Draw vertical border for window W from (X,Y0) to (X,Y1). */ - void (*draw_vertical_window_border) P_ ((struct window *w, - int x, int y0, int y1)); + void (*draw_vertical_window_border) (struct window *w, + int x, int y0, int y1); /* Shift display of frame F to make room for inserted glyphs. The area at pixel (X,Y) of width WIDTH and height HEIGHT is shifted right by SHIFT_BY pixels. */ - void (*shift_glyphs_for_insert) P_ ((struct frame *f, - int x, int y, int width, - int height, int shift_by)); + void (*shift_glyphs_for_insert) (struct frame *f, + int x, int y, int width, + int height, int shift_by); #endif /* HAVE_WINDOW_SYSTEM */ }; @@ -2621,14 +2629,14 @@ struct image_type /* Check that SPEC is a valid image specification for the given image type. Value is non-zero if SPEC is valid. */ - int (* valid_p) P_ ((Lisp_Object spec)); + int (* valid_p) (Lisp_Object spec); /* Load IMG which is used on frame F from information contained in IMG->spec. Value is non-zero if successful. */ - int (* load) P_ ((struct frame *f, struct image *img)); + int (* load) (struct frame *f, struct image *img); /* Free resources of image IMG which is used on frame F. */ - void (* free) P_ ((struct frame *f, struct image *img)); + void (* free) (struct frame *f, struct image *img); /* Next in list of all supported image types. */ struct image_type *next; @@ -2885,65 +2893,65 @@ extern EMACS_INT tool_bar_button_relief; /* Defined in bidi.c */ -extern void bidi_init_it P_ ((EMACS_INT, EMACS_INT, struct bidi_it *)); -extern void bidi_move_to_visually_next P_ ((struct bidi_it *)); -extern void bidi_paragraph_init P_ ((bidi_dir_t, struct bidi_it *)); -extern int bidi_mirror_char P_ ((int)); +extern void bidi_init_it (EMACS_INT, EMACS_INT, struct bidi_it *); +extern void bidi_move_to_visually_next (struct bidi_it *); +extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *); +extern int bidi_mirror_char (int); /* Defined in xdisp.c */ -struct glyph_row *row_containing_pos P_ ((struct window *, int, - struct glyph_row *, - struct glyph_row *, int)); -EMACS_INT string_buffer_position P_ ((struct window *, Lisp_Object, - EMACS_INT)); -int line_bottom_y P_ ((struct it *)); -int display_prop_intangible_p P_ ((Lisp_Object)); -void resize_echo_area_exactly P_ ((void)); -int resize_mini_window P_ ((struct window *, int)); -int try_window P_ ((Lisp_Object, struct text_pos, int)); -void window_box P_ ((struct window *, int, int *, int *, int *, int *)); -int window_box_height P_ ((struct window *)); -int window_text_bottom_y P_ ((struct window *)); -int window_box_width P_ ((struct window *, int)); -int window_box_left P_ ((struct window *, int)); -int window_box_left_offset P_ ((struct window *, int)); -int window_box_right P_ ((struct window *, int)); -int window_box_right_offset P_ ((struct window *, int)); -void window_box_edges P_ ((struct window *, int, int *, int *, int *, int *)); -int estimate_mode_line_height P_ ((struct frame *, enum face_id)); -void pixel_to_glyph_coords P_ ((struct frame *, int, int, int *, int *, - NativeRectangle *, int)); -int glyph_to_pixel_coords P_ ((struct window *, int, int, int *, int *)); -void remember_mouse_glyph P_ ((struct frame *, int, int, NativeRectangle *)); +struct glyph_row *row_containing_pos (struct window *, int, + struct glyph_row *, + struct glyph_row *, int); +EMACS_INT string_buffer_position (struct window *, Lisp_Object, + EMACS_INT); +int line_bottom_y (struct it *); +int display_prop_intangible_p (Lisp_Object); +void resize_echo_area_exactly (void); +int resize_mini_window (struct window *, int); +int try_window (Lisp_Object, struct text_pos, int); +void window_box (struct window *, int, int *, int *, int *, int *); +int window_box_height (struct window *); +int window_text_bottom_y (struct window *); +int window_box_width (struct window *, int); +int window_box_left (struct window *, int); +int window_box_left_offset (struct window *, int); +int window_box_right (struct window *, int); +int window_box_right_offset (struct window *, int); +void window_box_edges (struct window *, int, int *, int *, int *, int *); +int estimate_mode_line_height (struct frame *, enum face_id); +void pixel_to_glyph_coords (struct frame *, int, int, int *, int *, + NativeRectangle *, int); +int glyph_to_pixel_coords (struct window *, int, int, int *, int *); +void remember_mouse_glyph (struct frame *, int, int, NativeRectangle *); -void mark_window_display_accurate P_ ((Lisp_Object, int)); -void redisplay_preserve_echo_area P_ ((int)); -int set_cursor_from_row P_ ((struct window *, struct glyph_row *, - struct glyph_matrix *, int, int, int, int)); -void init_iterator P_ ((struct it *, struct window *, EMACS_INT, - EMACS_INT, struct glyph_row *, enum face_id)); -void init_iterator_to_row_start P_ ((struct it *, struct window *, - struct glyph_row *)); -int get_next_display_element P_ ((struct it *)); -void set_iterator_to_next P_ ((struct it *, int)); -void start_display P_ ((struct it *, struct window *, struct text_pos)); -void move_it_to P_ ((struct it *, int, int, int, int, int)); -void move_it_vertically P_ ((struct it *, int)); -void move_it_vertically_backward P_ ((struct it *, int)); -void move_it_by_lines P_ ((struct it *, int, int)); -void move_it_past_eol P_ ((struct it *)); +void mark_window_display_accurate (Lisp_Object, int); +void redisplay_preserve_echo_area (int); +int set_cursor_from_row (struct window *, struct glyph_row *, + struct glyph_matrix *, int, int, int, int); +void init_iterator (struct it *, struct window *, EMACS_INT, + EMACS_INT, struct glyph_row *, enum face_id); +void init_iterator_to_row_start (struct it *, struct window *, + struct glyph_row *); +int get_next_display_element (struct it *); +void set_iterator_to_next (struct it *, int); +void start_display (struct it *, struct window *, struct text_pos); +void move_it_to (struct it *, int, int, int, int, int); +void move_it_vertically (struct it *, int); +void move_it_vertically_backward (struct it *, int); +void move_it_by_lines (struct it *, int, int); +void move_it_past_eol (struct it *); void move_it_in_display_line (struct it *it, EMACS_INT to_charpos, int to_x, enum move_operation_enum op); -int in_display_vector_p P_ ((struct it *)); -int frame_mode_line_height P_ ((struct frame *)); -void highlight_trailing_whitespace P_ ((struct frame *, struct glyph_row *)); +int in_display_vector_p (struct it *); +int frame_mode_line_height (struct frame *); +void highlight_trailing_whitespace (struct frame *, struct glyph_row *); extern Lisp_Object Qtool_bar; extern Lisp_Object Vshow_trailing_whitespace; extern int mode_line_in_non_selected_windows; extern int redisplaying_p; -extern void add_to_log P_ ((char *, Lisp_Object, Lisp_Object)); +extern void add_to_log (char *, Lisp_Object, Lisp_Object); extern int help_echo_showing_p; extern int current_mode_line_height, current_header_line_height; extern Lisp_Object help_echo_string, help_echo_window; @@ -2955,67 +2963,67 @@ extern Lisp_Object Vmouse_autoselect_window; extern int unibyte_display_via_language_environment; extern EMACS_INT underline_minimum_offset; -extern void reseat_at_previous_visible_line_start P_ ((struct it *)); +extern void reseat_at_previous_visible_line_start (struct it *); -extern int calc_pixel_width_or_height P_ ((double *, struct it *, Lisp_Object, - struct font *, int, int *)); +extern int calc_pixel_width_or_height (double *, struct it *, Lisp_Object, + struct font *, int, int *); #ifdef HAVE_WINDOW_SYSTEM #if GLYPH_DEBUG -extern void dump_glyph_string P_ ((struct glyph_string *)); +extern void dump_glyph_string (struct glyph_string *); #endif -extern void x_get_glyph_overhangs P_ ((struct glyph *, struct frame *, - int *, int *)); -extern void x_produce_glyphs P_ ((struct it *)); +extern void x_get_glyph_overhangs (struct glyph *, struct frame *, + int *, int *); +extern void x_produce_glyphs (struct it *); -extern void x_write_glyphs P_ ((struct glyph *, int)); -extern void x_insert_glyphs P_ ((struct glyph *, int len)); -extern void x_clear_end_of_line P_ ((int)); +extern void x_write_glyphs (struct glyph *, int); +extern void x_insert_glyphs (struct glyph *, int len); +extern void x_clear_end_of_line (int); extern int x_stretch_cursor_p; extern struct cursor_pos output_cursor; -extern void x_fix_overlapping_area P_ ((struct window *, struct glyph_row *, - enum glyph_row_area, int)); -extern void draw_phys_cursor_glyph P_ ((struct window *, - struct glyph_row *, - enum draw_glyphs_face)); -extern void get_phys_cursor_geometry P_ ((struct window *, struct glyph_row *, - struct glyph *, int *, int *, int *)); -extern void erase_phys_cursor P_ ((struct window *)); -extern void display_and_set_cursor P_ ((struct window *, - int, int, int, int, int)); +extern void x_fix_overlapping_area (struct window *, struct glyph_row *, + enum glyph_row_area, int); +extern void draw_phys_cursor_glyph (struct window *, + struct glyph_row *, + enum draw_glyphs_face); +extern void get_phys_cursor_geometry (struct window *, struct glyph_row *, + struct glyph *, int *, int *, int *); +extern void erase_phys_cursor (struct window *); +extern void display_and_set_cursor (struct window *, + int, int, int, int, int); -extern void set_output_cursor P_ ((struct cursor_pos *)); -extern void x_cursor_to P_ ((int, int, int, int)); +extern void set_output_cursor (struct cursor_pos *); +extern void x_cursor_to (int, int, int, int); -extern void x_update_cursor P_ ((struct frame *, int)); -extern void x_clear_cursor P_ ((struct window *)); -extern void x_draw_vertical_border P_ ((struct window *w)); +extern void x_update_cursor (struct frame *, int); +extern void x_clear_cursor (struct window *); +extern void x_draw_vertical_border (struct window *w); -extern void frame_to_window_pixel_xy P_ ((struct window *, int *, int *)); -extern int get_glyph_string_clip_rects P_ ((struct glyph_string *, - NativeRectangle *, int)); -extern void get_glyph_string_clip_rect P_ ((struct glyph_string *, - NativeRectangle *nr)); -extern Lisp_Object find_hot_spot P_ ((Lisp_Object, int, int)); -extern void note_mouse_highlight P_ ((struct frame *, int, int)); -extern void x_clear_window_mouse_face P_ ((struct window *)); -extern void cancel_mouse_face P_ ((struct frame *)); +extern void frame_to_window_pixel_xy (struct window *, int *, int *); +extern int get_glyph_string_clip_rects (struct glyph_string *, + NativeRectangle *, int); +extern void get_glyph_string_clip_rect (struct glyph_string *, + NativeRectangle *nr); +extern Lisp_Object find_hot_spot (Lisp_Object, int, int); +extern void note_mouse_highlight (struct frame *, int, int); +extern void x_clear_window_mouse_face (struct window *); +extern void cancel_mouse_face (struct frame *); -extern void handle_tool_bar_click P_ ((struct frame *, - int, int, int, unsigned int)); +extern void handle_tool_bar_click (struct frame *, + int, int, int, unsigned int); /* msdos.c defines its own versions of these functions. */ -extern int clear_mouse_face P_ ((Display_Info *)); -extern void show_mouse_face P_ ((Display_Info *, enum draw_glyphs_face)); -extern int cursor_in_mouse_face_p P_ ((struct window *w)); +extern int clear_mouse_face (Display_Info *); +extern void show_mouse_face (Display_Info *, enum draw_glyphs_face); +extern int cursor_in_mouse_face_p (struct window *w); -extern void expose_frame P_ ((struct frame *, int, int, int, int)); -extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, - XRectangle *)); +extern void expose_frame (struct frame *, int, int, int, int); +extern int x_intersect_rectangles (XRectangle *, XRectangle *, + XRectangle *); #endif /* Flags passed to try_window. */ @@ -3025,107 +3033,107 @@ extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, /* Defined in fringe.c */ int lookup_fringe_bitmap (Lisp_Object); -void draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, int)); -void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *)); -int draw_window_fringes P_ ((struct window *, int)); -int update_window_fringes P_ ((struct window *, int)); -void compute_fringe_widths P_ ((struct frame *, int)); +void draw_fringe_bitmap (struct window *, struct glyph_row *, int); +void draw_row_fringe_bitmaps (struct window *, struct glyph_row *); +int draw_window_fringes (struct window *, int); +int update_window_fringes (struct window *, int); +void compute_fringe_widths (struct frame *, int); #ifdef WINDOWSNT -void w32_init_fringe P_ ((struct redisplay_interface *)); -void w32_reset_fringes P_ ((void)); +void w32_init_fringe (struct redisplay_interface *); +void w32_reset_fringes (void); #endif /* Defined in image.c */ #ifdef HAVE_WINDOW_SYSTEM -extern int x_bitmap_height P_ ((struct frame *, int)); -extern int x_bitmap_width P_ ((struct frame *, int)); -extern int x_bitmap_pixmap P_ ((struct frame *, int)); -extern void x_reference_bitmap P_ ((struct frame *, int)); -extern int x_create_bitmap_from_data P_ ((struct frame *, char *, - unsigned int, unsigned int)); -extern int x_create_bitmap_from_file P_ ((struct frame *, Lisp_Object)); +extern int x_bitmap_height (struct frame *, int); +extern int x_bitmap_width (struct frame *, int); +extern int x_bitmap_pixmap (struct frame *, int); +extern void x_reference_bitmap (struct frame *, int); +extern int x_create_bitmap_from_data (struct frame *, char *, + unsigned int, unsigned int); +extern int x_create_bitmap_from_file (struct frame *, Lisp_Object); #if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) -extern int x_create_bitmap_from_xpm_data P_ ((struct frame *f, char **bits)); +extern int x_create_bitmap_from_xpm_data (struct frame *f, char **bits); #endif #ifndef x_destroy_bitmap -extern void x_destroy_bitmap P_ ((struct frame *, int)); +extern void x_destroy_bitmap (struct frame *, int); #endif -extern void x_destroy_all_bitmaps P_ ((Display_Info *)); -extern int x_create_bitmap_mask P_ ((struct frame * , int)); -extern Lisp_Object x_find_image_file P_ ((Lisp_Object)); +extern void x_destroy_all_bitmaps (Display_Info *); +extern int x_create_bitmap_mask (struct frame * , int); +extern Lisp_Object x_find_image_file (Lisp_Object); -void x_kill_gs_process P_ ((Pixmap, struct frame *)); -struct image_cache *make_image_cache P_ ((void)); -void free_image_cache P_ ((struct frame *)); -void clear_image_caches P_ ((Lisp_Object)); -void mark_image_cache P_ ((struct image_cache *)); -int valid_image_p P_ ((Lisp_Object)); -void prepare_image_for_display P_ ((struct frame *, struct image *)); -int lookup_image P_ ((struct frame *, Lisp_Object)); +void x_kill_gs_process (Pixmap, struct frame *); +struct image_cache *make_image_cache (void); +void free_image_cache (struct frame *); +void clear_image_caches (Lisp_Object); +void mark_image_cache (struct image_cache *); +int valid_image_p (Lisp_Object); +void prepare_image_for_display (struct frame *, struct image *); +int lookup_image (struct frame *, Lisp_Object); -unsigned long image_background P_ ((struct image *, struct frame *, - XImagePtr_or_DC ximg)); -int image_background_transparent P_ ((struct image *, struct frame *, - XImagePtr_or_DC mask)); +unsigned long image_background (struct image *, struct frame *, + XImagePtr_or_DC ximg); +int image_background_transparent (struct image *, struct frame *, + XImagePtr_or_DC mask); -int image_ascent P_ ((struct image *, struct face *, struct glyph_slice *)); +int image_ascent (struct image *, struct face *, struct glyph_slice *); #endif /* Defined in sysdep.c */ -void get_tty_size P_ ((int, int *, int *)); -void request_sigio P_ ((void)); -void unrequest_sigio P_ ((void)); -int tabs_safe_p P_ ((int)); -void init_baud_rate P_ ((int)); -void init_sigio P_ ((int)); +void get_tty_size (int, int *, int *); +void request_sigio (void); +void unrequest_sigio (void); +int tabs_safe_p (int); +void init_baud_rate (int); +void init_sigio (int); /* Defined in xfaces.c */ #ifdef HAVE_X_WINDOWS -void x_free_colors P_ ((struct frame *, unsigned long *, int)); +void x_free_colors (struct frame *, unsigned long *, int); #endif -void update_face_from_frame_parameter P_ ((struct frame *, Lisp_Object, - Lisp_Object)); -Lisp_Object tty_color_name P_ ((struct frame *, int)); -void clear_face_cache P_ ((int)); -unsigned long load_color P_ ((struct frame *, struct face *, Lisp_Object, - enum lface_attribute_index)); -void unload_color P_ ((struct frame *, unsigned long)); -char *choose_face_font P_ ((struct frame *, Lisp_Object *, Lisp_Object, - int *)); -int ascii_face_of_lisp_face P_ ((struct frame *, int)); -void prepare_face_for_display P_ ((struct frame *, struct face *)); -int xstrcasecmp P_ ((const unsigned char *, const unsigned char *)); -int lookup_face P_ ((struct frame *, Lisp_Object *)); -int lookup_named_face P_ ((struct frame *, Lisp_Object, int)); -int lookup_basic_face P_ ((struct frame *, int)); -int smaller_face P_ ((struct frame *, int, int)); -int face_with_height P_ ((struct frame *, int, int)); -int lookup_derived_face P_ ((struct frame *, Lisp_Object, int, int)); -void init_frame_faces P_ ((struct frame *)); -void free_frame_faces P_ ((struct frame *)); -void recompute_basic_faces P_ ((struct frame *)); -int face_at_buffer_position P_ ((struct window *w, EMACS_INT pos, - EMACS_INT region_beg, EMACS_INT region_end, - EMACS_INT *endptr, EMACS_INT limit, - int mouse, int base_face_id)); -int face_for_overlay_string P_ ((struct window *w, EMACS_INT pos, - EMACS_INT region_beg, EMACS_INT region_end, - EMACS_INT *endptr, EMACS_INT limit, - int mouse, Lisp_Object overlay)); -int face_at_string_position P_ ((struct window *w, Lisp_Object string, - EMACS_INT pos, EMACS_INT bufpos, - EMACS_INT region_beg, EMACS_INT region_end, - EMACS_INT *endptr, enum face_id, int mouse)); -int merge_faces P_ ((struct frame *, Lisp_Object, int, int)); -int compute_char_face P_ ((struct frame *, int, Lisp_Object)); -void free_all_realized_faces P_ ((Lisp_Object)); -void free_realized_face P_ ((struct frame *, struct face *)); +void update_face_from_frame_parameter (struct frame *, Lisp_Object, + Lisp_Object); +Lisp_Object tty_color_name (struct frame *, int); +void clear_face_cache (int); +unsigned long load_color (struct frame *, struct face *, Lisp_Object, + enum lface_attribute_index); +void unload_color (struct frame *, unsigned long); +char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object, + int *); +int ascii_face_of_lisp_face (struct frame *, int); +void prepare_face_for_display (struct frame *, struct face *); +int xstrcasecmp (const unsigned char *, const unsigned char *); +int lookup_face (struct frame *, Lisp_Object *); +int lookup_named_face (struct frame *, Lisp_Object, int); +int lookup_basic_face (struct frame *, int); +int smaller_face (struct frame *, int, int); +int face_with_height (struct frame *, int, int); +int lookup_derived_face (struct frame *, Lisp_Object, int, int); +void init_frame_faces (struct frame *); +void free_frame_faces (struct frame *); +void recompute_basic_faces (struct frame *); +int face_at_buffer_position (struct window *w, EMACS_INT pos, + EMACS_INT region_beg, EMACS_INT region_end, + EMACS_INT *endptr, EMACS_INT limit, + int mouse, int base_face_id); +int face_for_overlay_string (struct window *w, EMACS_INT pos, + EMACS_INT region_beg, EMACS_INT region_end, + EMACS_INT *endptr, EMACS_INT limit, + int mouse, Lisp_Object overlay); +int face_at_string_position (struct window *w, Lisp_Object string, + EMACS_INT pos, EMACS_INT bufpos, + EMACS_INT region_beg, EMACS_INT region_end, + EMACS_INT *endptr, enum face_id, int mouse); +int merge_faces (struct frame *, Lisp_Object, int, int); +int compute_char_face (struct frame *, int, Lisp_Object); +void free_all_realized_faces (Lisp_Object); +void free_realized_face (struct frame *, struct face *); extern Lisp_Object Qforeground_color, Qbackground_color; extern Lisp_Object Qframe_set_background_mode; extern char unspecified_fg[], unspecified_bg[]; @@ -3135,24 +3143,24 @@ extern Lisp_Object Vface_remapping_alist; /* Defined in xfns.c */ #ifdef HAVE_X_WINDOWS -void gamma_correct P_ ((struct frame *, XColor *)); +void gamma_correct (struct frame *, XColor *); #endif #ifdef WINDOWSNT -void gamma_correct P_ ((struct frame *, COLORREF *)); +void gamma_correct (struct frame *, COLORREF *); #endif #ifdef HAVE_WINDOW_SYSTEM -int x_screen_planes P_ ((struct frame *)); -void x_implicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); +int x_screen_planes (struct frame *); +void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); extern Lisp_Object tip_frame; extern Window tip_window; EXFUN (Fx_show_tip, 6); EXFUN (Fx_hide_tip, 0); -extern void start_hourglass P_ ((void)); -extern void cancel_hourglass P_ ((void)); -extern int hourglass_started P_ ((void)); +extern void start_hourglass (void); +extern void cancel_hourglass (void); +extern int hourglass_started (void); extern int display_hourglass_p; extern int hourglass_shown_p; struct atimer; /* Defined in atimer.h. */ @@ -3161,8 +3169,8 @@ struct atimer; /* Defined in atimer.h. */ extern struct atimer *hourglass_atimer; /* Each GUI implements these. FIXME: move into RIF. */ -extern void show_hourglass P_ ((struct atimer *)); -extern void hide_hourglass P_ ((void)); +extern void show_hourglass (struct atimer *); +extern void hide_hourglass (void); /* Returns the background color of IMG, calculating one heuristically if necessary. If non-zero, XIMG is an existing XImage object to use for @@ -3187,116 +3195,116 @@ extern void hide_hourglass P_ ((void)); /* Defined in xmenu.c */ -int popup_activated P_ ((void)); +int popup_activated (void); /* Defined in dispnew.c */ extern int inverse_video; -extern int required_matrix_width P_ ((struct window *)); -extern int required_matrix_height P_ ((struct window *)); -extern Lisp_Object buffer_posn_from_coords P_ ((struct window *, - int *, int *, - struct display_pos *, - Lisp_Object *, - int *, int *, int *, int *)); -extern Lisp_Object mode_line_string P_ ((struct window *, enum window_part, - int *, int *, int *, - Lisp_Object *, - int *, int *, int *, int *)); -extern Lisp_Object marginal_area_string P_ ((struct window *, enum window_part, - int *, int *, int *, - Lisp_Object *, - int *, int *, int *, int *)); -extern void redraw_frame P_ ((struct frame *)); -extern void redraw_garbaged_frames P_ ((void)); -extern void cancel_line P_ ((int, struct frame *)); -extern void init_desired_glyphs P_ ((struct frame *)); -extern int scroll_frame_lines P_ ((struct frame *, int, int, int, int)); -extern int update_frame P_ ((struct frame *, int, int)); -extern int scrolling P_ ((struct frame *)); -extern void bitch_at_user P_ ((void)); -void adjust_glyphs P_ ((struct frame *)); -void free_glyphs P_ ((struct frame *)); -void free_window_matrices P_ ((struct window *)); -void check_glyph_memory P_ ((void)); -void mirrored_line_dance P_ ((struct glyph_matrix *, int, int, int *, char *)); -void clear_glyph_matrix P_ ((struct glyph_matrix *)); -void clear_current_matrices P_ ((struct frame *f)); -void clear_desired_matrices P_ ((struct frame *)); -void shift_glyph_matrix P_ ((struct window *, struct glyph_matrix *, - int, int, int)); -void rotate_matrix P_ ((struct glyph_matrix *, int, int, int)); -void increment_matrix_positions P_ ((struct glyph_matrix *, - int, int, int, int)); -void blank_row P_ ((struct window *, struct glyph_row *, int)); -void increment_row_positions P_ ((struct glyph_row *, int, int)); -void enable_glyph_matrix_rows P_ ((struct glyph_matrix *, int, int, int)); -void clear_glyph_row P_ ((struct glyph_row *)); -void prepare_desired_row P_ ((struct glyph_row *)); -int line_hash_code P_ ((struct glyph_row *)); -void set_window_update_flags P_ ((struct window *, int)); -void redraw_frame P_ ((struct frame *)); -void redraw_garbaged_frames P_ ((void)); -int scroll_cost P_ ((struct frame *, int, int, int)); -int update_frame P_ ((struct frame *, int, int)); -void update_single_window P_ ((struct window *, int)); -int scrolling P_ ((struct frame *)); -void do_pending_window_change P_ ((int)); -void change_frame_size P_ ((struct frame *, int, int, int, int, int)); -void bitch_at_user P_ ((void)); -void init_display P_ ((void)); -void syms_of_display P_ ((void)); +extern int required_matrix_width (struct window *); +extern int required_matrix_height (struct window *); +extern Lisp_Object buffer_posn_from_coords (struct window *, + int *, int *, + struct display_pos *, + Lisp_Object *, + int *, int *, int *, int *); +extern Lisp_Object mode_line_string (struct window *, enum window_part, + int *, int *, int *, + Lisp_Object *, + int *, int *, int *, int *); +extern Lisp_Object marginal_area_string (struct window *, enum window_part, + int *, int *, int *, + Lisp_Object *, + int *, int *, int *, int *); +extern void redraw_frame (struct frame *); +extern void redraw_garbaged_frames (void); +extern void cancel_line (int, struct frame *); +extern void init_desired_glyphs (struct frame *); +extern int scroll_frame_lines (struct frame *, int, int, int, int); +extern int update_frame (struct frame *, int, int); +extern int scrolling (struct frame *); +extern void bitch_at_user (void); +void adjust_glyphs (struct frame *); +void free_glyphs (struct frame *); +void free_window_matrices (struct window *); +void check_glyph_memory (void); +void mirrored_line_dance (struct glyph_matrix *, int, int, int *, char *); +void clear_glyph_matrix (struct glyph_matrix *); +void clear_current_matrices (struct frame *f); +void clear_desired_matrices (struct frame *); +void shift_glyph_matrix (struct window *, struct glyph_matrix *, + int, int, int); +void rotate_matrix (struct glyph_matrix *, int, int, int); +void increment_matrix_positions (struct glyph_matrix *, + int, int, int, int); +void blank_row (struct window *, struct glyph_row *, int); +void increment_row_positions (struct glyph_row *, int, int); +void enable_glyph_matrix_rows (struct glyph_matrix *, int, int, int); +void clear_glyph_row (struct glyph_row *); +void prepare_desired_row (struct glyph_row *); +int line_hash_code (struct glyph_row *); +void set_window_update_flags (struct window *, int); +void redraw_frame (struct frame *); +void redraw_garbaged_frames (void); +int scroll_cost (struct frame *, int, int, int); +int update_frame (struct frame *, int, int); +void update_single_window (struct window *, int); +int scrolling (struct frame *); +void do_pending_window_change (int); +void change_frame_size (struct frame *, int, int, int, int, int); +void bitch_at_user (void); +void init_display (void); +void syms_of_display (void); extern Lisp_Object Qredisplay_dont_pause; -void spec_glyph_lookup_face P_ ((struct window *, GLYPH *)); +void spec_glyph_lookup_face (struct window *, GLYPH *); /* Defined in terminal.c */ -extern void ring_bell P_ ((struct frame *)); -extern void update_begin P_ ((struct frame *)); -extern void update_end P_ ((struct frame *)); -extern void set_terminal_window P_ ((struct frame *, int)); -extern void cursor_to P_ ((struct frame *, int, int)); -extern void raw_cursor_to P_ ((struct frame *, int, int)); -extern void clear_to_end P_ ((struct frame *)); -extern void clear_frame P_ ((struct frame *)); -extern void clear_end_of_line P_ ((struct frame *, int)); -extern void write_glyphs P_ ((struct frame *, struct glyph *, int)); -extern void insert_glyphs P_ ((struct frame *, struct glyph *, int)); -extern void delete_glyphs P_ ((struct frame *, int)); -extern void ins_del_lines P_ ((struct frame *, int, int)); +extern void ring_bell (struct frame *); +extern void update_begin (struct frame *); +extern void update_end (struct frame *); +extern void set_terminal_window (struct frame *, int); +extern void cursor_to (struct frame *, int, int); +extern void raw_cursor_to (struct frame *, int, int); +extern void clear_to_end (struct frame *); +extern void clear_frame (struct frame *); +extern void clear_end_of_line (struct frame *, int); +extern void write_glyphs (struct frame *, struct glyph *, int); +extern void insert_glyphs (struct frame *, struct glyph *, int); +extern void delete_glyphs (struct frame *, int); +extern void ins_del_lines (struct frame *, int, int); -extern struct terminal *init_initial_terminal P_ ((void)); +extern struct terminal *init_initial_terminal (void); /* Defined in term.c */ -extern void tty_set_terminal_modes P_ ((struct terminal *)); -extern void tty_reset_terminal_modes P_ ((struct terminal *)); -extern void tty_turn_off_insert P_ ((struct tty_display_info *)); -extern void tty_turn_off_highlight P_ ((struct tty_display_info *)); -extern int string_cost P_ ((char *)); -extern int per_line_cost P_ ((char *)); -extern void calculate_costs P_ ((struct frame *)); -extern void produce_glyphs P_ ((struct it *)); -extern void produce_special_glyphs P_ ((struct it *, enum display_element_type)); -extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long)); +extern void tty_set_terminal_modes (struct terminal *); +extern void tty_reset_terminal_modes (struct terminal *); +extern void tty_turn_off_insert (struct tty_display_info *); +extern void tty_turn_off_highlight (struct tty_display_info *); +extern int string_cost (char *); +extern int per_line_cost (char *); +extern void calculate_costs (struct frame *); +extern void produce_glyphs (struct it *); +extern void produce_special_glyphs (struct it *, enum display_element_type); +extern int tty_capable_p (struct tty_display_info *, unsigned, unsigned long, unsigned long); extern void set_tty_color_mode (struct tty_display_info *, struct frame *); -extern struct terminal *get_tty_terminal P_ ((Lisp_Object, int)); -extern struct terminal *get_named_tty P_ ((char *)); +extern struct terminal *get_tty_terminal (Lisp_Object, int); +extern struct terminal *get_named_tty (char *); EXFUN (Ftty_type, 1); -extern void create_tty_output P_ ((struct frame *)); -extern struct terminal *init_tty P_ ((char *, char *, int)); +extern void create_tty_output (struct frame *); +extern struct terminal *init_tty (char *, char *, int); /* Defined in scroll.c */ -extern int scrolling_max_lines_saved P_ ((int, int, int *, int *, int *)); -extern int scroll_cost P_ ((struct frame *, int, int, int)); -extern void do_line_insertion_deletion_costs P_ ((struct frame *, char *, - char *, char *, char *, - char *, char *, int)); -void scrolling_1 P_ ((struct frame *, int, int, int, int *, int *, int *, - int *, int)); +extern int scrolling_max_lines_saved (int, int, int *, int *, int *); +extern int scroll_cost (struct frame *, int, int, int); +extern void do_line_insertion_deletion_costs (struct frame *, char *, + char *, char *, char *, + char *, char *, int); +void scrolling_1 (struct frame *, int, int, int, int *, int *, int *, + int *, int); /* Defined in frame.c */ @@ -3313,20 +3321,20 @@ enum resource_types RES_TYPE_BOOLEAN_NUMBER }; -extern Lisp_Object x_get_arg P_ ((Display_Info *, Lisp_Object, - Lisp_Object, char *, char *class, - enum resource_types)); -extern Lisp_Object x_frame_get_arg P_ ((struct frame *, Lisp_Object, - Lisp_Object, char *, char *, - enum resource_types)); -extern Lisp_Object x_frame_get_and_record_arg P_ (( - struct frame *, Lisp_Object, - Lisp_Object, char *, char *, - enum resource_types)); -extern Lisp_Object x_default_parameter P_ ((struct frame *, Lisp_Object, - Lisp_Object, Lisp_Object, - char *, char *, - enum resource_types)); +extern Lisp_Object x_get_arg (Display_Info *, Lisp_Object, + Lisp_Object, char *, char *class, + enum resource_types); +extern Lisp_Object x_frame_get_arg (struct frame *, Lisp_Object, + Lisp_Object, char *, char *, + enum resource_types); +extern Lisp_Object x_frame_get_and_record_arg ( + struct frame *, Lisp_Object, + Lisp_Object, char *, char *, + enum resource_types); +extern Lisp_Object x_default_parameter (struct frame *, Lisp_Object, + Lisp_Object, Lisp_Object, + char *, char *, + enum resource_types); #endif /* HAVE_WINDOW_SYSTEM */ diff --git a/src/dispnew.c b/src/dispnew.c index a8ba1995435..fe64143ec07 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -114,73 +114,73 @@ struct dim /* Function prototypes. */ -static struct glyph_matrix *save_current_matrix P_ ((struct frame *)); -static void restore_current_matrix P_ ((struct frame *, struct glyph_matrix *)); -static int showing_window_margins_p P_ ((struct window *)); -static void fake_current_matrices P_ ((Lisp_Object)); -static void redraw_overlapping_rows P_ ((struct window *, int)); -static void redraw_overlapped_rows P_ ((struct window *, int)); -static int count_blanks P_ ((struct glyph *, int)); -static int count_match P_ ((struct glyph *, struct glyph *, - struct glyph *, struct glyph *)); -static unsigned line_draw_cost P_ ((struct glyph_matrix *, int)); -static void update_frame_line P_ ((struct frame *, int)); +static struct glyph_matrix *save_current_matrix (struct frame *); +static void restore_current_matrix (struct frame *, struct glyph_matrix *); +static int showing_window_margins_p (struct window *); +static void fake_current_matrices (Lisp_Object); +static void redraw_overlapping_rows (struct window *, int); +static void redraw_overlapped_rows (struct window *, int); +static int count_blanks (struct glyph *, int); +static int count_match (struct glyph *, struct glyph *, + struct glyph *, struct glyph *); +static unsigned line_draw_cost (struct glyph_matrix *, int); +static void update_frame_line (struct frame *, int); static struct dim allocate_matrices_for_frame_redisplay - P_ ((Lisp_Object, int, int, int, int *)); -static void allocate_matrices_for_window_redisplay P_ ((struct window *)); -static int realloc_glyph_pool P_ ((struct glyph_pool *, struct dim)); -static void adjust_frame_glyphs P_ ((struct frame *)); -struct glyph_matrix *new_glyph_matrix P_ ((struct glyph_pool *)); -static void free_glyph_matrix P_ ((struct glyph_matrix *)); -static void adjust_glyph_matrix P_ ((struct window *, struct glyph_matrix *, - int, int, struct dim)); -static void change_frame_size_1 P_ ((struct frame *, int, int, int, int, int)); -static void swap_glyph_pointers P_ ((struct glyph_row *, struct glyph_row *)); + (Lisp_Object, int, int, int, int *); +static void allocate_matrices_for_window_redisplay (struct window *); +static int realloc_glyph_pool (struct glyph_pool *, struct dim); +static void adjust_frame_glyphs (struct frame *); +struct glyph_matrix *new_glyph_matrix (struct glyph_pool *); +static void free_glyph_matrix (struct glyph_matrix *); +static void adjust_glyph_matrix (struct window *, struct glyph_matrix *, + int, int, struct dim); +static void change_frame_size_1 (struct frame *, int, int, int, int, int); +static void swap_glyph_pointers (struct glyph_row *, struct glyph_row *); #if GLYPH_DEBUG -static int glyph_row_slice_p P_ ((struct glyph_row *, struct glyph_row *)); +static int glyph_row_slice_p (struct glyph_row *, struct glyph_row *); #endif -static void fill_up_frame_row_with_spaces P_ ((struct glyph_row *, int)); -static void build_frame_matrix_from_window_tree P_ ((struct glyph_matrix *, - struct window *)); -static void build_frame_matrix_from_leaf_window P_ ((struct glyph_matrix *, - struct window *)); -static struct glyph_pool *new_glyph_pool P_ ((void)); -static void free_glyph_pool P_ ((struct glyph_pool *)); -static void adjust_frame_glyphs_initially P_ ((void)); -static void adjust_frame_message_buffer P_ ((struct frame *)); -static void adjust_decode_mode_spec_buffer P_ ((struct frame *)); -static void fill_up_glyph_row_with_spaces P_ ((struct glyph_row *)); -static void build_frame_matrix P_ ((struct frame *)); -void clear_current_matrices P_ ((struct frame *)); -void scroll_glyph_matrix_range P_ ((struct glyph_matrix *, int, int, - int, int)); -static void clear_window_matrices P_ ((struct window *, int)); -static void fill_up_glyph_row_area_with_spaces P_ ((struct glyph_row *, int)); -static int scrolling_window P_ ((struct window *, int)); -static int update_window_line P_ ((struct window *, int, int *)); -static void update_marginal_area P_ ((struct window *, int, int)); -static int update_text_area P_ ((struct window *, int)); -static void make_current P_ ((struct glyph_matrix *, struct glyph_matrix *, - int)); -static void mirror_make_current P_ ((struct window *, int)); -void check_window_matrix_pointers P_ ((struct window *)); +static void fill_up_frame_row_with_spaces (struct glyph_row *, int); +static void build_frame_matrix_from_window_tree (struct glyph_matrix *, + struct window *); +static void build_frame_matrix_from_leaf_window (struct glyph_matrix *, + struct window *); +static struct glyph_pool *new_glyph_pool (void); +static void free_glyph_pool (struct glyph_pool *); +static void adjust_frame_glyphs_initially (void); +static void adjust_frame_message_buffer (struct frame *); +static void adjust_decode_mode_spec_buffer (struct frame *); +static void fill_up_glyph_row_with_spaces (struct glyph_row *); +static void build_frame_matrix (struct frame *); +void clear_current_matrices (struct frame *); +void scroll_glyph_matrix_range (struct glyph_matrix *, int, int, + int, int); +static void clear_window_matrices (struct window *, int); +static void fill_up_glyph_row_area_with_spaces (struct glyph_row *, int); +static int scrolling_window (struct window *, int); +static int update_window_line (struct window *, int, int *); +static void update_marginal_area (struct window *, int, int); +static int update_text_area (struct window *, int); +static void make_current (struct glyph_matrix *, struct glyph_matrix *, + int); +static void mirror_make_current (struct window *, int); +void check_window_matrix_pointers (struct window *); #if GLYPH_DEBUG -static void check_matrix_pointers P_ ((struct glyph_matrix *, - struct glyph_matrix *)); +static void check_matrix_pointers (struct glyph_matrix *, + struct glyph_matrix *); #endif -static void mirror_line_dance P_ ((struct window *, int, int, int *, char *)); -static int update_window_tree P_ ((struct window *, int)); -static int update_window P_ ((struct window *, int)); -static int update_frame_1 P_ ((struct frame *, int, int)); -static void set_window_cursor_after_update P_ ((struct window *)); -static int row_equal_p P_ ((struct window *, struct glyph_row *, - struct glyph_row *, int)); -static void adjust_frame_glyphs_for_window_redisplay P_ ((struct frame *)); -static void adjust_frame_glyphs_for_frame_redisplay P_ ((struct frame *)); -static void reverse_rows P_ ((struct glyph_matrix *, int, int)); -static int margin_glyphs_to_reserve P_ ((struct window *, int, Lisp_Object)); -static void sync_window_with_frame_matrix_rows P_ ((struct window *)); -struct window *frame_row_to_window P_ ((struct window *, int)); +static void mirror_line_dance (struct window *, int, int, int *, char *); +static int update_window_tree (struct window *, int); +static int update_window (struct window *, int); +static int update_frame_1 (struct frame *, int, int); +static void set_window_cursor_after_update (struct window *); +static int row_equal_p (struct window *, struct glyph_row *, + struct glyph_row *, int); +static void adjust_frame_glyphs_for_window_redisplay (struct frame *); +static void adjust_frame_glyphs_for_frame_redisplay (struct frame *); +static void reverse_rows (struct glyph_matrix *, int, int); +static int margin_glyphs_to_reserve (struct window *, int, Lisp_Object); +static void sync_window_with_frame_matrix_rows (struct window *); +struct window *frame_row_to_window (struct window *, int); /* Non-zero means don't pause redisplay for pending input. (This is @@ -325,8 +325,8 @@ int fonts_changed_p; #if GLYPH_DEBUG -static int window_to_frame_vpos P_ ((struct window *, int)); -static int window_to_frame_hpos P_ ((struct window *, int)); +static int window_to_frame_vpos (struct window *, int); +static int window_to_frame_hpos (struct window *, int); #define WINDOW_TO_FRAME_VPOS(W, VPOS) window_to_frame_vpos ((W), (VPOS)) #define WINDOW_TO_FRAME_HPOS(W, HPOS) window_to_frame_hpos ((W), (HPOS)) @@ -355,8 +355,8 @@ static int history_idx; static unsigned history_tick; -static void add_frame_display_history P_ ((struct frame *, int)); -static void add_window_display_history P_ ((struct window *, char *, int)); +static void add_frame_display_history (struct frame *, int); +static void add_window_display_history (struct window *, char *, int); /* Add to the redisplay history how window W has been displayed. MSG is a trace containing the information how W's glyph matrix @@ -413,7 +413,7 @@ add_frame_display_history (f, paused_p) DEFUN ("dump-redisplay-history", Fdump_redisplay_history, Sdump_redisplay_history, 0, 0, "", doc: /* Dump redisplay history to stderr. */) - () + (void) { int i; @@ -436,65 +436,15 @@ DEFUN ("dump-redisplay-history", Fdump_redisplay_history, #endif /* GLYPH_DEBUG == 0 */ -/* Like bcopy except never gets confused by overlap. Let this be the - first function defined in this file, or change emacs.c where the - address of this function is used. */ +#ifdef PROFILING +/* FIXME: only used to find text start for profiling. */ void -safe_bcopy (from, to, size) - const char *from; - char *to; - int size; +safe_bcopy (const char *from, char *to, int size) { - if (size <= 0 || from == to) - return; - - /* If the source and destination don't overlap, then bcopy can - handle it. If they do overlap, but the destination is lower in - memory than the source, we'll assume bcopy can handle that. */ - if (to < from || from + size <= to) - bcopy (from, to, size); - - /* Otherwise, we'll copy from the end. */ - else - { - register const char *endf = from + size; - register char *endt = to + size; - - /* If TO - FROM is large, then we should break the copy into - nonoverlapping chunks of TO - FROM bytes each. However, if - TO - FROM is small, then the bcopy function call overhead - makes this not worth it. The crossover point could be about - anywhere. Since I don't think the obvious copy loop is too - bad, I'm trying to err in its favor. */ - if (to - from < 64) - { - do - *--endt = *--endf; - while (endf != from); - } - else - { - for (;;) - { - endt -= (to - from); - endf -= (to - from); - - if (endt < to) - break; - - bcopy (endf, endt, to - from); - } - - /* If SIZE wasn't a multiple of TO - FROM, there will be a - little left over. The amount left over is (endt + (to - - from)) - to, which is endt - from. */ - bcopy (from, to, endt - from); - } - } + abort (); } - - +#endif /*********************************************************************** Glyph Matrices @@ -507,14 +457,13 @@ safe_bcopy (from, to, size) POOL, the structure is otherwise zeroed. */ struct glyph_matrix * -new_glyph_matrix (pool) - struct glyph_pool *pool; +new_glyph_matrix (struct glyph_pool *pool) { struct glyph_matrix *result; /* Allocate and clear. */ result = (struct glyph_matrix *) xmalloc (sizeof *result); - bzero (result, sizeof *result); + memset (result, 0, sizeof *result); /* Increment number of allocated matrices. This count is used to detect memory leaks. */ @@ -538,8 +487,7 @@ new_glyph_matrix (pool) matrix also frees the glyph memory in this case. */ static void -free_glyph_matrix (matrix) - struct glyph_matrix *matrix; +free_glyph_matrix (struct glyph_matrix *matrix) { if (matrix) { @@ -569,10 +517,7 @@ free_glyph_matrix (matrix) or a float. */ static int -margin_glyphs_to_reserve (w, total_glyphs, margin) - struct window *w; - int total_glyphs; - Lisp_Object margin; +margin_glyphs_to_reserve (struct window *w, int total_glyphs, Lisp_Object margin) { int n; @@ -613,11 +558,7 @@ margin_glyphs_to_reserve (w, total_glyphs, margin) leads to screen flickering. */ static void -adjust_glyph_matrix (w, matrix, x, y, dim) - struct window *w; - struct glyph_matrix *matrix; - int x, y; - struct dim dim; +adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y, struct dim dim) { int i; int new_rows; @@ -667,8 +608,8 @@ adjust_glyph_matrix (w, matrix, x, y, dim) int size = dim.height * sizeof (struct glyph_row); new_rows = dim.height - matrix->rows_allocated; matrix->rows = (struct glyph_row *) xrealloc (matrix->rows, size); - bzero (matrix->rows + matrix->rows_allocated, - new_rows * sizeof *matrix->rows); + memset (matrix->rows + matrix->rows_allocated, 0, + new_rows * sizeof *matrix->rows); matrix->rows_allocated = dim.height; } else @@ -860,9 +801,7 @@ adjust_glyph_matrix (w, matrix, x, y, dim) below). */ static void -reverse_rows (matrix, start, end) - struct glyph_matrix *matrix; - int start, end; +reverse_rows (struct glyph_matrix *matrix, int start, int end) { int i, j; @@ -891,9 +830,7 @@ reverse_rows (matrix, start, end) rotating right. */ void -rotate_matrix (matrix, first, last, by) - struct glyph_matrix *matrix; - int first, last, by; +rotate_matrix (struct glyph_matrix *matrix, int first, int last, int by) { if (by < 0) { @@ -918,9 +855,7 @@ rotate_matrix (matrix, first, last, by) DELTA_BYTES. */ void -increment_matrix_positions (matrix, start, end, delta, delta_bytes) - struct glyph_matrix *matrix; - int start, end, delta, delta_bytes; +increment_matrix_positions (struct glyph_matrix *matrix, int start, int end, int delta, int delta_bytes) { /* Check that START and END are reasonable values. */ xassert (start >= 0 && start <= matrix->nrows); @@ -937,10 +872,7 @@ increment_matrix_positions (matrix, start, end, delta, delta_bytes) ENABLED_P is non-zero, enabled_p flags in rows will be set to 1. */ void -enable_glyph_matrix_rows (matrix, start, end, enabled_p) - struct glyph_matrix *matrix; - int start, end; - int enabled_p; +enable_glyph_matrix_rows (struct glyph_matrix *matrix, int start, int end, int enabled_p) { xassert (start <= end); xassert (start >= 0 && start < matrix->nrows); @@ -962,8 +894,7 @@ enable_glyph_matrix_rows (matrix, start, end, enabled_p) currently present is the flag MATRIX->no_scrolling_p. */ void -clear_glyph_matrix (matrix) - struct glyph_matrix *matrix; +clear_glyph_matrix (struct glyph_matrix *matrix) { if (matrix) { @@ -978,10 +909,7 @@ clear_glyph_matrix (matrix) and recompute their visible height. */ void -shift_glyph_matrix (w, matrix, start, end, dy) - struct window *w; - struct glyph_matrix *matrix; - int start, end, dy; +shift_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int start, int end, int dy) { int min_y, max_y; @@ -1012,8 +940,7 @@ shift_glyph_matrix (w, matrix, start, end, dy) current matrix. */ void -clear_current_matrices (f) - register struct frame *f; +clear_current_matrices (register struct frame *f) { /* Clear frame current matrix, if we have one. */ if (f->current_matrix) @@ -1038,8 +965,7 @@ clear_current_matrices (f) /* Clear out all display lines of F for a coming redisplay. */ void -clear_desired_matrices (f) - register struct frame *f; +clear_desired_matrices (register struct frame *f) { if (f->desired_matrix) clear_glyph_matrix (f->desired_matrix); @@ -1060,9 +986,7 @@ clear_desired_matrices (f) non-zero clear desired matrices, otherwise clear current matrices. */ static void -clear_window_matrices (w, desired_p) - struct window *w; - int desired_p; +clear_window_matrices (struct window *w, int desired_p) { while (w) { @@ -1106,8 +1030,7 @@ clear_window_matrices (w, desired_p) static struct glyph_row null_row; void -clear_glyph_row (row) - struct glyph_row *row; +clear_glyph_row (struct glyph_row *row) { struct glyph *p[1 + LAST_AREA]; @@ -1133,7 +1056,7 @@ clear_glyph_row (row) returned by xmalloc. If flickering happens again, activate the code below. If the flickering is gone with that, chances are that the flickering has the same reason as here. */ - bzero (p[0], (char *) p[LAST_AREA] - (char *) p[0]); + memset (p[0], 0, (char *) p[LAST_AREA] - (char *) p[0]); #endif } @@ -1142,10 +1065,7 @@ clear_glyph_row (row) in window W starting at y-position Y. */ void -blank_row (w, row, y) - struct window *w; - struct glyph_row *row; - int y; +blank_row (struct window *w, struct glyph_row *row, int y) { int min_y, max_y; @@ -1174,9 +1094,7 @@ blank_row (w, row, y) ends. */ void -increment_row_positions (row, delta, delta_bytes) - struct glyph_row *row; - int delta, delta_bytes; +increment_row_positions (struct glyph_row *row, int delta, int delta_bytes) { int area, i; @@ -1251,8 +1169,7 @@ swap_glyphs_in_rows (a, b) /* Exchange pointers to glyph memory between glyph rows A and B. */ static INLINE void -swap_glyph_pointers (a, b) - struct glyph_row *a, *b; +swap_glyph_pointers (struct glyph_row *a, struct glyph_row *b) { int i; for (i = 0; i < LAST_AREA + 1; ++i) @@ -1268,19 +1185,18 @@ swap_glyph_pointers (a, b) that glyph pointers in the structures are left unchanged. */ INLINE void -copy_row_except_pointers (to, from) - struct glyph_row *to, *from; +copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from) { struct glyph *pointers[1 + LAST_AREA]; /* Save glyph pointers of TO. */ - bcopy (to->glyphs, pointers, sizeof to->glyphs); + memcpy (pointers, to->glyphs, sizeof to->glyphs); /* Do a structure assignment. */ *to = *from; /* Restore original pointers of TO. */ - bcopy (pointers, to->glyphs, sizeof to->glyphs); + memcpy (to->glyphs, pointers, sizeof to->glyphs); } @@ -1290,9 +1206,7 @@ copy_row_except_pointers (to, from) positions in row TO by DELTA/ DELTA_BYTES. */ void -copy_glyph_row_contents (to, from, delta, delta_bytes) - struct glyph_row *to, *from; - int delta, delta_bytes; +copy_glyph_row_contents (struct glyph_row *to, struct glyph_row *from, int delta, int delta_bytes) { int area; @@ -1303,8 +1217,8 @@ copy_glyph_row_contents (to, from, delta, delta_bytes) /* Copy glyphs from FROM to TO. */ for (area = 0; area < LAST_AREA; ++area) if (from->used[area]) - bcopy (from->glyphs[area], to->glyphs[area], - from->used[area] * sizeof (struct glyph)); + memcpy (to->glyphs[area], from->glyphs[area], + from->used[area] * sizeof (struct glyph)); /* Increment buffer positions in TO by DELTA. */ increment_row_positions (to, delta, delta_bytes); @@ -1317,8 +1231,7 @@ copy_glyph_row_contents (to, from, delta, delta_bytes) a memory leak. */ static INLINE void -assign_row (to, from) - struct glyph_row *to, *from; +assign_row (struct glyph_row *to, struct glyph_row *from) { swap_glyph_pointers (to, from); copy_row_except_pointers (to, from); @@ -1378,8 +1291,7 @@ find_glyph_row_slice (window_matrix, frame_matrix, row) call to this function really clears it. */ void -prepare_desired_row (row) - struct glyph_row *row; +prepare_desired_row (struct glyph_row *row) { if (!row->enabled_p) { @@ -1395,8 +1307,7 @@ prepare_desired_row (row) /* Return a hash code for glyph row ROW. */ int -line_hash_code (row) - struct glyph_row *row; +line_hash_code (struct glyph_row *row) { int hash = 0; @@ -1429,9 +1340,7 @@ line_hash_code (row) zero, leading and trailing spaces are ignored. */ static unsigned int -line_draw_cost (matrix, vpos) - struct glyph_matrix *matrix; - int vpos; +line_draw_cost (struct glyph_matrix *matrix, int vpos) { struct glyph_row *row = matrix->rows + vpos; struct glyph *beg = row->glyphs[TEXT_AREA]; @@ -1492,10 +1401,7 @@ line_draw_cost (matrix, vpos) flags of A and B, too. */ static INLINE int -row_equal_p (w, a, b, mouse_face_p) - struct window *w; - struct glyph_row *a, *b; - int mouse_face_p; +row_equal_p (struct window *w, struct glyph_row *a, struct glyph_row *b, int mouse_face_p) { if (a == b) return 1; @@ -1565,13 +1471,13 @@ row_equal_p (w, a, b, mouse_face_p) incremented for each pool allocated. */ static struct glyph_pool * -new_glyph_pool () +new_glyph_pool (void) { struct glyph_pool *result; /* Allocate a new glyph_pool and clear it. */ result = (struct glyph_pool *) xmalloc (sizeof *result); - bzero (result, sizeof *result); + memset (result, 0, sizeof *result); /* For memory leak and double deletion checking. */ ++glyph_pool_count; @@ -1588,8 +1494,7 @@ new_glyph_pool () was passed to free_glyph_pool. */ static void -free_glyph_pool (pool) - struct glyph_pool *pool; +free_glyph_pool (struct glyph_pool *pool) { if (pool) { @@ -1613,9 +1518,7 @@ free_glyph_pool (pool) re-adjusting window glyph matrices necessary. */ static int -realloc_glyph_pool (pool, matrix_dim) - struct glyph_pool *pool; - struct dim matrix_dim; +realloc_glyph_pool (struct glyph_pool *pool, struct dim matrix_dim) { int needed; int changed_p; @@ -1635,7 +1538,7 @@ realloc_glyph_pool (pool, matrix_dim) else { pool->glyphs = (struct glyph *) xmalloc (size); - bzero (pool->glyphs, size); + memset (pool->glyphs, 0, size); } pool->nglyphs = needed; @@ -1873,12 +1776,8 @@ check_matrix_invariants (w) #define CHANGED_LEAF_MATRIX (1 << 1) static struct dim -allocate_matrices_for_frame_redisplay (window, x, y, dim_only_p, - window_change_flags) - Lisp_Object window; - int x, y; - int dim_only_p; - int *window_change_flags; +allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y, + int dim_only_p, int *window_change_flags) { struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (window))); int x0 = x, y0 = y; @@ -1994,8 +1893,7 @@ allocate_matrices_for_frame_redisplay (window, x, y, dim_only_p, /* Return the required height of glyph matrices for window W. */ int -required_matrix_height (w) - struct window *w; +required_matrix_height (struct window *w) { #ifdef HAVE_WINDOW_SYSTEM struct frame *f = XFRAME (w->frame); @@ -2021,8 +1919,7 @@ required_matrix_height (w) /* Return the required width of glyph matrices for window W. */ int -required_matrix_width (w) - struct window *w; +required_matrix_width (struct window *w) { #ifdef HAVE_WINDOW_SYSTEM struct frame *f = XFRAME (w->frame); @@ -2050,8 +1947,7 @@ required_matrix_width (w) window whose matrices must be allocated/reallocated. */ static void -allocate_matrices_for_window_redisplay (w) - struct window *w; +allocate_matrices_for_window_redisplay (struct window *w) { while (w) { @@ -2088,8 +1984,7 @@ allocate_matrices_for_window_redisplay (w) changes, or its window configuration changes. */ void -adjust_glyphs (f) - struct frame *f; +adjust_glyphs (struct frame *f) { /* Block input so that expose events and other events that access glyph matrices are not processed while we are changing them. */ @@ -2121,7 +2016,7 @@ adjust_glyphs (f) windows to estimated values. */ static void -adjust_frame_glyphs_initially () +adjust_frame_glyphs_initially (void) { struct frame *sf = SELECTED_FRAME (); struct window *root = XWINDOW (sf->root_window); @@ -2148,8 +2043,7 @@ adjust_frame_glyphs_initially () /* Allocate/reallocate glyph matrices of a single frame F. */ static void -adjust_frame_glyphs (f) - struct frame *f; +adjust_frame_glyphs (struct frame *f) { if (FRAME_WINDOW_P (f)) adjust_frame_glyphs_for_window_redisplay (f); @@ -2167,8 +2061,7 @@ adjust_frame_glyphs (f) /* Return 1 if any window in the tree has nonzero window margins. See the hack at the end of adjust_frame_glyphs_for_frame_redisplay. */ static int -showing_window_margins_p (w) - struct window *w; +showing_window_margins_p (struct window *w) { while (w) { @@ -2196,8 +2089,7 @@ showing_window_margins_p (w) windows from the frame's current matrix. */ static void -fake_current_matrices (window) - Lisp_Object window; +fake_current_matrices (Lisp_Object window) { struct window *w; @@ -2247,18 +2139,17 @@ fake_current_matrices (window) a glyph matrix holding the contents of F's current frame matrix. */ static struct glyph_matrix * -save_current_matrix (f) - struct frame *f; +save_current_matrix (struct frame *f) { int i; struct glyph_matrix *saved; saved = (struct glyph_matrix *) xmalloc (sizeof *saved); - bzero (saved, sizeof *saved); + memset (saved, 0, sizeof *saved); saved->nrows = f->current_matrix->nrows; saved->rows = (struct glyph_row *) xmalloc (saved->nrows * sizeof *saved->rows); - bzero (saved->rows, saved->nrows * sizeof *saved->rows); + memset (saved->rows, 0, saved->nrows * sizeof *saved->rows); for (i = 0; i < saved->nrows; ++i) { @@ -2266,7 +2157,7 @@ save_current_matrix (f) struct glyph_row *to = saved->rows + i; size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph); to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes); - bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes); + memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes); to->used[TEXT_AREA] = from->used[TEXT_AREA]; } @@ -2278,9 +2169,7 @@ save_current_matrix (f) and free memory associated with SAVED. */ static void -restore_current_matrix (f, saved) - struct frame *f; - struct glyph_matrix *saved; +restore_current_matrix (struct frame *f, struct glyph_matrix *saved) { int i; @@ -2289,7 +2178,7 @@ restore_current_matrix (f, saved) struct glyph_row *from = saved->rows + i; struct glyph_row *to = f->current_matrix->rows + i; size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph); - bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes); + memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes); to->used[TEXT_AREA] = from->used[TEXT_AREA]; xfree (from->glyphs[TEXT_AREA]); } @@ -2304,8 +2193,7 @@ restore_current_matrix (f, saved) frame-based redisplay. */ static void -adjust_frame_glyphs_for_frame_redisplay (f) - struct frame *f; +adjust_frame_glyphs_for_frame_redisplay (struct frame *f) { struct dim matrix_dim; int pool_changed_p; @@ -2405,8 +2293,7 @@ adjust_frame_glyphs_for_frame_redisplay (f) window-based redisplay. */ static void -adjust_frame_glyphs_for_window_redisplay (f) - struct frame *f; +adjust_frame_glyphs_for_window_redisplay (struct frame *f) { struct window *w; @@ -2474,8 +2361,7 @@ adjust_frame_glyphs_for_window_redisplay (f) eventually without causing trouble). */ static void -adjust_frame_message_buffer (f) - struct frame *f; +adjust_frame_message_buffer (struct frame *f) { int size = FRAME_MESSAGE_BUF_SIZE (f) + 1; @@ -2493,8 +2379,7 @@ adjust_frame_message_buffer (f) /* Re-allocate buffer for decode_mode_spec on frame F. */ static void -adjust_decode_mode_spec_buffer (f) - struct frame *f; +adjust_decode_mode_spec_buffer (struct frame *f) { f->decode_mode_spec_buffer = (char *) xrealloc (f->decode_mode_spec_buffer, @@ -2513,8 +2398,7 @@ adjust_decode_mode_spec_buffer (f) the function is called when F is destroyed. */ void -free_glyphs (f) - struct frame *f; +free_glyphs (struct frame *f) { if (f && f->glyphs_initialized_p) { @@ -2575,8 +2459,7 @@ free_glyphs (f) the same tree more than once. */ void -free_window_matrices (w) - struct window *w; +free_window_matrices (struct window *w) { while (w) { @@ -2606,7 +2489,7 @@ free_window_matrices (w) explicitly and check that nothing is left allocated. */ void -check_glyph_memory () +check_glyph_memory (void) { Lisp_Object tail, frame; @@ -2690,8 +2573,7 @@ check_glyph_memory () sure not to touch them in this function. */ static void -build_frame_matrix (f) - struct frame *f; +build_frame_matrix (struct frame *f) { int i; @@ -2713,9 +2595,7 @@ build_frame_matrix (f) matrices. W is the root of a window tree. */ static void -build_frame_matrix_from_window_tree (matrix, w) - struct glyph_matrix *matrix; - struct window *w; +build_frame_matrix_from_window_tree (struct glyph_matrix *matrix, struct window *w) { while (w) { @@ -2743,9 +2623,7 @@ build_frame_matrix_from_window_tree (matrix, w) preserve_other_columns in the old redisplay. */ static void -build_frame_matrix_from_leaf_window (frame_matrix, w) - struct glyph_matrix *frame_matrix; - struct window *w; +build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct window *w) { struct glyph_matrix *window_matrix; int window_y, frame_y; @@ -2811,9 +2689,9 @@ build_frame_matrix_from_leaf_window (frame_matrix, w) if (current_row_p) { /* Copy window row to frame row. */ - bcopy (window_row->glyphs[0], - frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x, - window_matrix->matrix_w * sizeof (struct glyph)); + memcpy (frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x, + window_row->glyphs[0], + window_matrix->matrix_w * sizeof (struct glyph)); } else { @@ -2862,9 +2740,7 @@ build_frame_matrix_from_leaf_window (frame_matrix, w) for instance, vertical separators, truncation markers, etc. */ void -spec_glyph_lookup_face (w, glyph) - struct window *w; - GLYPH *glyph; +spec_glyph_lookup_face (struct window *w, GLYPH *glyph) { int lface_id = GLYPH_FACE (*glyph); /* Convert the glyph's specified face to a realized (cache) face. */ @@ -2893,8 +2769,7 @@ spec_glyph_lookup_face (w, glyph) To be called for frame-based redisplay, only. */ static void -fill_up_glyph_row_with_spaces (row) - struct glyph_row *row; +fill_up_glyph_row_with_spaces (struct glyph_row *row) { fill_up_glyph_row_area_with_spaces (row, LEFT_MARGIN_AREA); fill_up_glyph_row_area_with_spaces (row, TEXT_AREA); @@ -2906,9 +2781,7 @@ fill_up_glyph_row_with_spaces (row) frame-based redisplay only. */ static void -fill_up_glyph_row_area_with_spaces (row, area) - struct glyph_row *row; - int area; +fill_up_glyph_row_area_with_spaces (struct glyph_row *row, int area) { if (row->glyphs[area] < row->glyphs[area + 1]) { @@ -2926,9 +2799,7 @@ fill_up_glyph_row_area_with_spaces (row, area) reached. In frame matrices only one area, TEXT_AREA, is used. */ static void -fill_up_frame_row_with_spaces (row, upto) - struct glyph_row *row; - int upto; +fill_up_frame_row_with_spaces (struct glyph_row *row, int upto) { int i = row->used[TEXT_AREA]; struct glyph *glyph = row->glyphs[TEXT_AREA]; @@ -2950,8 +2821,7 @@ fill_up_frame_row_with_spaces (row, upto) working on frame matrices or not. */ static INLINE void -set_frame_matrix_frame (f) - struct frame *f; +set_frame_matrix_frame (struct frame *f) { frame_matrix_frame = f; } @@ -2966,9 +2836,7 @@ set_frame_matrix_frame (f) operations in window matrices of frame_matrix_frame. */ static INLINE void -make_current (desired_matrix, current_matrix, row) - struct glyph_matrix *desired_matrix, *current_matrix; - int row; +make_current (struct glyph_matrix *desired_matrix, struct glyph_matrix *current_matrix, int row) { struct glyph_row *current_row = MATRIX_ROW (current_matrix, row); struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, row); @@ -2995,9 +2863,7 @@ make_current (desired_matrix, current_matrix, row) matrices of leaf windows in the window tree rooted at W. */ static void -mirror_make_current (w, frame_row) - struct window *w; - int frame_row; +mirror_make_current (struct window *w, int frame_row) { while (w) { @@ -3045,12 +2911,8 @@ mirror_make_current (w, frame_row) This function is called from do_scrolling and do_direct_scrolling. */ void -mirrored_line_dance (matrix, unchanged_at_top, nlines, copy_from, - retained_p) - struct glyph_matrix *matrix; - int unchanged_at_top, nlines; - int *copy_from; - char *retained_p; +mirrored_line_dance (struct glyph_matrix *matrix, int unchanged_at_top, int nlines, + int *copy_from, char *retained_p) { /* A copy of original rows. */ struct glyph_row *old_rows; @@ -3062,7 +2924,7 @@ mirrored_line_dance (matrix, unchanged_at_top, nlines, copy_from, /* Make a copy of the original rows. */ old_rows = (struct glyph_row *) alloca (nlines * sizeof *old_rows); - bcopy (new_rows, old_rows, nlines * sizeof *old_rows); + memcpy (old_rows, new_rows, nlines * sizeof *old_rows); /* Assign new rows, maybe clear lines. */ for (i = 0; i < nlines; ++i) @@ -3090,8 +2952,7 @@ mirrored_line_dance (matrix, unchanged_at_top, nlines, copy_from, the current frame matrix. */ static void -sync_window_with_frame_matrix_rows (w) - struct window *w; +sync_window_with_frame_matrix_rows (struct window *w) { struct frame *f = XFRAME (w->frame); struct glyph_row *window_row, *window_row_end, *frame_row; @@ -3128,9 +2989,7 @@ sync_window_with_frame_matrix_rows (w) row ROW. Value is null if none is found. */ struct window * -frame_row_to_window (w, row) - struct window *w; - int row; +frame_row_to_window (struct window *w, int row) { struct window *found = NULL; @@ -3163,11 +3022,7 @@ frame_row_to_window (w, row) which is empty. */ static void -mirror_line_dance (w, unchanged_at_top, nlines, copy_from, retained_p) - struct window *w; - int unchanged_at_top, nlines; - int *copy_from; - char *retained_p; +mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy_from, char *retained_p) { while (w) { @@ -3187,7 +3042,7 @@ mirror_line_dance (w, unchanged_at_top, nlines, copy_from, retained_p) /* Make a copy of the original rows of matrix m. */ old_rows = (struct glyph_row *) alloca (m->nrows * sizeof *old_rows); - bcopy (m->rows, old_rows, m->nrows * sizeof *old_rows); + memcpy (old_rows, m->rows, m->nrows * sizeof *old_rows); for (i = 0; i < nlines; ++i) { @@ -3381,8 +3236,7 @@ window_to_frame_hpos (w, hpos) DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0, doc: /* Clear frame FRAME and output again what is supposed to appear on it. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { struct frame *f; @@ -3419,8 +3273,7 @@ DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0, function redraw-frame. */ void -redraw_frame (f) - struct frame *f; +redraw_frame (struct frame *f) { Lisp_Object frame; XSETFRAME (frame, f); @@ -3430,7 +3283,7 @@ redraw_frame (f) DEFUN ("redraw-display", Fredraw_display, Sredraw_display, 0, 0, "", doc: /* Clear and redisplay all visible frames. */) - () + (void) { Lisp_Object tail, frame; @@ -3446,7 +3299,7 @@ DEFUN ("redraw-display", Fredraw_display, Sredraw_display, 0, 0, "", visible frames marked as garbaged. */ void -redraw_garbaged_frames () +redraw_garbaged_frames (void) { Lisp_Object tail, frame; @@ -3471,10 +3324,7 @@ redraw_garbaged_frames () Value is non-zero if redisplay was stopped due to pending input. */ int -update_frame (f, force_p, inhibit_hairy_id_p) - struct frame *f; - int force_p; - int inhibit_hairy_id_p; +update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p) { /* 1 means display has been paused because of pending input. */ int paused_p; @@ -3606,9 +3456,7 @@ update_frame (f, force_p, inhibit_hairy_id_p) don't stop updating when input is pending. */ static int -update_window_tree (w, force_p) - struct window *w; - int force_p; +update_window_tree (struct window *w, int force_p) { int paused_p = 0; @@ -3632,9 +3480,7 @@ update_window_tree (w, force_p) FORCE_P is non-zero, don't stop updating if input is pending. */ void -update_single_window (w, force_p) - struct window *w; - int force_p; +update_single_window (struct window *w, int force_p) { if (w->must_be_updated_p) { @@ -3679,9 +3525,7 @@ update_single_window (w, force_p) overlapped by other rows. YB is bottom-most y-position in W. */ static void -redraw_overlapped_rows (w, yb) - struct window *w; - int yb; +redraw_overlapped_rows (struct window *w, int yb) { int i; struct frame *f = XFRAME (WINDOW_FRAME (w)); @@ -3729,9 +3573,7 @@ redraw_overlapped_rows (w, yb) others. YB is bottom-most y-position in W. */ static void -redraw_overlapping_rows (w, yb) - struct window *w; - int yb; +redraw_overlapping_rows (struct window *w, int yb) { int i, bottom_y; struct glyph_row *row; @@ -3793,8 +3635,7 @@ redraw_overlapping_rows (w, yb) which is below what's displayed in the window. */ void -check_current_matrix_flags (w) - struct window *w; +check_current_matrix_flags (struct window *w) { int last_seen_p = 0; int i, yb = window_text_bottom_y (w); @@ -3816,9 +3657,7 @@ check_current_matrix_flags (w) not stop when detecting pending input. */ static int -update_window (w, force_p) - struct window *w; - int force_p; +update_window (struct window *w, int force_p) { struct glyph_matrix *desired_matrix = w->desired_matrix; int paused_p; @@ -4010,9 +3849,7 @@ update_window (w, force_p) AREA can be either LEFT_MARGIN_AREA or RIGHT_MARGIN_AREA. */ static void -update_marginal_area (w, area, vpos) - struct window *w; - int area, vpos; +update_marginal_area (struct window *w, int area, int vpos) { struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos); struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w))); @@ -4035,9 +3872,7 @@ update_marginal_area (w, area, vpos) Value is non-zero if display has changed. */ static int -update_text_area (w, vpos) - struct window *w; - int vpos; +update_text_area (struct window *w, int vpos) { struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos); struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos); @@ -4282,9 +4117,7 @@ update_text_area (w, vpos) changed. */ static int -update_window_line (w, vpos, mouse_face_overwritten_p) - struct window *w; - int vpos, *mouse_face_overwritten_p; +update_window_line (struct window *w, int vpos, int *mouse_face_overwritten_p) { struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos); struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos); @@ -4353,8 +4186,7 @@ update_window_line (w, vpos, mouse_face_overwritten_p) be called from update_window. */ static void -set_window_cursor_after_update (w) - struct window *w; +set_window_cursor_after_update (struct window *w) { struct frame *f = XFRAME (w->frame); struct redisplay_interface *rif = FRAME_RIF (f); @@ -4438,9 +4270,7 @@ set_window_cursor_after_update (w) tree rooted at W. */ void -set_window_update_flags (w, on_p) - struct window *w; - int on_p; +set_window_update_flags (struct window *w, int on_p) { while (w) { @@ -4518,9 +4348,7 @@ static struct run **runs; of window W. */ static INLINE struct row_entry * -add_row_entry (w, row) - struct window *w; - struct glyph_row *row; +add_row_entry (struct window *w, struct glyph_row *row) { struct row_entry *entry; int i = row->hash % row_table_size; @@ -4571,9 +4399,7 @@ add_row_entry (w, row) 1 if we did scroll. */ static int -scrolling_window (w, header_line_p) - struct window *w; - int header_line_p; +scrolling_window (struct window *w, int header_line_p) { struct glyph_matrix *desired_matrix = w->desired_matrix; struct glyph_matrix *current_matrix = w->current_matrix; @@ -4681,7 +4507,7 @@ scrolling_window (w, header_line_p) row_table_size = next_almost_prime (3 * n); nbytes = row_table_size * sizeof *row_table; row_table = (struct row_entry **) xrealloc (row_table, nbytes); - bzero (row_table, nbytes); + memset (row_table, 0, nbytes); } if (n > row_entry_pool_size) @@ -4876,10 +4702,7 @@ scrolling_window (w, header_line_p) Value is non-zero if update was stopped due to pending input. */ static int -update_frame_1 (f, force_p, inhibit_id_p) - struct frame *f; - int force_p; - int inhibit_id_p; +update_frame_1 (struct frame *f, int force_p, int inhibit_id_p) { /* Frame matrices to work on. */ struct glyph_matrix *current_matrix = f->current_matrix; @@ -5089,8 +4912,7 @@ update_frame_1 (f, force_p, inhibit_id_p) /* Do line insertions/deletions on frame F for frame-based redisplay. */ int -scrolling (frame) - struct frame *frame; +scrolling (struct frame *frame) { int unchanged_at_top, unchanged_at_bottom; int window_size; @@ -5184,9 +5006,7 @@ scrolling (frame) which is LEN glyphs long. */ static int -count_blanks (r, len) - struct glyph *r; - int len; +count_blanks (struct glyph *r, int len) { int i; @@ -5203,8 +5023,7 @@ count_blanks (r, len) of STR2. Value is the number of equal glyphs equal at the start. */ static int -count_match (str1, end1, str2, end2) - struct glyph *str1, *end1, *str2, *end2; +count_match (struct glyph *str1, struct glyph *end1, struct glyph *str2, struct glyph *end2) { struct glyph *p1 = str1; struct glyph *p2 = str2; @@ -5227,9 +5046,7 @@ extern int *char_ins_del_vector; /* Perform a frame-based update on line VPOS in frame FRAME. */ static void -update_frame_line (f, vpos) - struct frame *f; - int vpos; +update_frame_line (struct frame *f, int vpos) { struct glyph *obody, *nbody, *op1, *op2, *np1, *nend; int tem; @@ -5545,13 +5362,7 @@ update_frame_line (f, vpos) Adjust *X and *Y to character positions. */ Lisp_Object -buffer_posn_from_coords (w, x, y, pos, object, dx, dy, width, height) - struct window *w; - int *x, *y; - struct display_pos *pos; - Lisp_Object *object; - int *dx, *dy; - int *width, *height; +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) { struct it it; Lisp_Object old_current_buffer = Fcurrent_buffer (); @@ -5646,14 +5457,7 @@ buffer_posn_from_coords (w, x, y, pos, object, dx, dy, width, height) *CHARPOS is set to the position in the string returned. */ Lisp_Object -mode_line_string (w, part, x, y, charpos, object, dx, dy, width, height) - struct window *w; - enum window_part part; - int *x, *y; - int *charpos; - Lisp_Object *object; - int *dx, *dy; - int *width, *height; +mode_line_string (struct window *w, enum window_part part, int *x, int *y, int *charpos, Lisp_Object *object, int *dx, int *dy, int *width, int *height) { struct glyph_row *row; struct glyph *glyph, *end; @@ -5720,14 +5524,7 @@ mode_line_string (w, part, x, y, charpos, object, dx, dy, width, height) the string returned. */ Lisp_Object -marginal_area_string (w, part, x, y, charpos, object, dx, dy, width, height) - struct window *w; - enum window_part part; - int *x, *y; - int *charpos; - Lisp_Object *object; - int *dx, *dy; - int *width, *height; +marginal_area_string (struct window *w, enum window_part part, int *x, int *y, int *charpos, Lisp_Object *object, int *dx, int *dy, int *width, int *height) { struct glyph_row *row = w->current_matrix->rows; struct glyph *glyph, *end; @@ -5816,8 +5613,8 @@ marginal_area_string (w, part, x, y, charpos, object, dx, dy, width, height) #ifdef SIGWINCH SIGTYPE -window_change_signal (signalnum) /* If we don't have an argument, */ - int signalnum; /* some compilers complain in signal calls. */ +window_change_signal (int signalnum) /* If we don't have an argument, */ + /* some compilers complain in signal calls. */ { int width, height; int old_errno = errno; @@ -5865,8 +5662,7 @@ window_change_signal (signalnum) /* If we don't have an argument, */ safe to change frame sizes while a redisplay is in progress. */ void -do_pending_window_change (safe) - int safe; +do_pending_window_change (int safe) { /* If window_change_signal should have run before, run it now. */ if (redisplaying_p && !safe) @@ -5902,9 +5698,7 @@ do_pending_window_change (safe) safe to change frame sizes while a redisplay is in progress. */ void -change_frame_size (f, newheight, newwidth, pretend, delay, safe) - register struct frame *f; - int newheight, newwidth, pretend, delay, safe; +change_frame_size (register struct frame *f, int newheight, int newwidth, int pretend, int delay, int safe) { Lisp_Object tail, frame; @@ -5923,9 +5717,7 @@ change_frame_size (f, newheight, newwidth, pretend, delay, safe) } static void -change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe) - register struct frame *f; - int newheight, newwidth, pretend, delay, safe; +change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int pretend, int delay, int safe) { int new_frame_total_cols; int count = SPECPDL_INDEX (); @@ -6054,8 +5846,7 @@ DEFUN ("open-termscript", Fopen_termscript, Sopen_termscript, 1, 1, "FOpen termscript file: ", doc: /* Start writing all terminal output to FILE as well as the terminal. FILE = nil means just close any termscript file currently open. */) - (file) - Lisp_Object file; + (Lisp_Object file) { struct tty_display_info *tty; @@ -6093,9 +5884,7 @@ Optional parameter TERMINAL specifies the tty terminal device to use. It may be a terminal object, a frame, or nil for the terminal used by the currently selected frame. In batch mode, STRING is sent to stdout when TERMINAL is nil. */) - (string, terminal) - Lisp_Object string; - Lisp_Object terminal; + (Lisp_Object string, Lisp_Object terminal) { struct terminal *t = get_terminal (terminal, 1); FILE *out; @@ -6136,8 +5925,7 @@ DEFUN ("ding", Fding, Sding, 0, 1, 0, doc: /* Beep, or flash the screen. Also, unless an argument is given, terminate any keyboard macro currently executing. */) - (arg) - Lisp_Object arg; + (Lisp_Object arg) { if (!NILP (arg)) { @@ -6153,7 +5941,7 @@ terminate any keyboard macro currently executing. */) } void -bitch_at_user () +bitch_at_user (void) { if (noninteractive) putchar (07); @@ -6176,8 +5964,7 @@ fraction of a second. Optional second arg MILLISECONDS specifies an additional wait period, in milliseconds; this may be useful if your Emacs was built without floating point support. \(Not all operating systems support waiting for a fraction of a second.) */) - (seconds, milliseconds) - Lisp_Object seconds, milliseconds; + (Lisp_Object seconds, Lisp_Object milliseconds) { int sec, usec; @@ -6230,9 +6017,7 @@ Emacs was built without floating point support. */ Lisp_Object -sit_for (timeout, reading, do_display) - Lisp_Object timeout; - int reading, do_display; +sit_for (Lisp_Object timeout, int reading, int do_display) { int sec, usec; @@ -6283,8 +6068,7 @@ DEFUN ("redisplay", Fredisplay, Sredisplay, 0, 1, 0, If optional arg FORCE is non-nil or `redisplay-dont-pause' is non-nil, perform a full redisplay even if input is available. Return t if redisplay was performed, nil otherwise. */) - (force) - Lisp_Object force; + (Lisp_Object force) { int count; @@ -6328,8 +6112,7 @@ the current state. If VARIABLE is nil, an internal variable is used. Users should not pass nil for VARIABLE. */) - (variable) - Lisp_Object variable; + (Lisp_Object variable) { Lisp_Object state, tail, frame, buf; Lisp_Object *vecp, *end; @@ -6448,7 +6231,7 @@ pass nil for VARIABLE. */) decoding routine to set up variables in the terminal package. */ void -init_display () +init_display (void) { char *terminal_type; @@ -6655,8 +6438,7 @@ DEFUN ("internal-show-cursor", Finternal_show_cursor, WINDOW nil means use the selected window. SHOW non-nil means show a cursor in WINDOW in the next redisplay. SHOW nil means don't show a cursor. */) - (window, show) - Lisp_Object window, show; + (Lisp_Object window, Lisp_Object show) { /* Don't change cursor state while redisplaying. This could confuse output routines. */ @@ -6678,8 +6460,7 @@ DEFUN ("internal-show-cursor-p", Finternal_show_cursor_p, Sinternal_show_cursor_p, 0, 1, 0, doc: /* Value is non-nil if next redisplay will display a cursor in WINDOW. WINDOW nil or omitted means report on the selected window. */) - (window) - Lisp_Object window; + (Lisp_Object window) { struct window *w; @@ -6695,7 +6476,7 @@ WINDOW nil or omitted means report on the selected window. */) DEFUN ("last-nonminibuffer-frame", Flast_nonminibuf_frame, Slast_nonminibuf_frame, 0, 0, 0, doc: /* Value is last nonminibuffer frame. */) - () + (void) { Lisp_Object frame = Qnil; @@ -6710,7 +6491,7 @@ DEFUN ("last-nonminibuffer-frame", Flast_nonminibuf_frame, ***********************************************************************/ void -syms_of_display () +syms_of_display (void) { defsubr (&Sredraw_frame); defsubr (&Sredraw_display); diff --git a/src/disptab.h b/src/disptab.h index e0f603346df..1a7f63050b6 100644 --- a/src/disptab.h +++ b/src/disptab.h @@ -32,7 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define DISP_INVIS_VECTOR(dp) ((dp)->extras[4]) #define DISP_BORDER_GLYPH(dp) ((dp)->extras[5]) -extern Lisp_Object disp_char_vector P_ ((struct Lisp_Char_Table *, int)); +extern Lisp_Object disp_char_vector (struct Lisp_Char_Table *, int); #define DISP_CHAR_VECTOR(dp, c) \ (ASCII_CHAR_P(c) \ @@ -44,10 +44,10 @@ extern Lisp_Object disp_char_vector P_ ((struct Lisp_Char_Table *, int)); : disp_char_vector ((dp), (c))) /* Defined in window.c. */ -extern struct Lisp_Char_Table *window_display_table P_ ((struct window *)); +extern struct Lisp_Char_Table *window_display_table (struct window *); /* Defined in indent.c. */ -extern struct Lisp_Char_Table *buffer_display_table P_ ((void)); +extern struct Lisp_Char_Table *buffer_display_table (void); /* Display table to use for vectors that don't specify their own. */ extern Lisp_Object Vstandard_display_table; diff --git a/src/doc.c b/src/doc.c index 9133c2e6b84..5f4fe426da0 100644 --- a/src/doc.c +++ b/src/doc.c @@ -45,10 +45,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "keymap.h" #include "buildobj.h" -#ifdef HAVE_INDEX -extern char *index P_ ((const char *, int)); -#endif - Lisp_Object Vdoc_file_name; Lisp_Object Qfunction_documentation; @@ -65,14 +61,13 @@ static char *get_doc_string_buffer; static int get_doc_string_buffer_size; static unsigned char *read_bytecode_pointer; -Lisp_Object Fsnarf_documentation P_ ((Lisp_Object)); +Lisp_Object Fsnarf_documentation (Lisp_Object); /* readchar in lread.c calls back here to fetch the next byte. If UNREADFLAG is 1, we unread a byte. */ int -read_bytecode_char (unreadflag) - int unreadflag; +read_bytecode_char (int unreadflag) { if (unreadflag) { @@ -102,9 +97,7 @@ read_bytecode_char (unreadflag) and return a cons cell. */ Lisp_Object -get_doc_string (filepos, unibyte, definition) - Lisp_Object filepos; - int unibyte, definition; +get_doc_string (Lisp_Object filepos, int unibyte, int definition) { char *from, *to; register int fd; @@ -221,9 +214,9 @@ get_doc_string (filepos, unibyte, definition) if (!nread) break; if (p == get_doc_string_buffer) - p1 = (char *) index (p + offset, '\037'); + p1 = strchr (p + offset, '\037'); else - p1 = (char *) index (p, '\037'); + p1 = strchr (p, '\037'); if (p1) { *p1 = 0; @@ -311,15 +304,13 @@ get_doc_string (filepos, unibyte, definition) of a compiled function from the .elc file. */ Lisp_Object -read_doc_string (filepos) - Lisp_Object filepos; +read_doc_string (Lisp_Object filepos) { return get_doc_string (filepos, 0, 1); } static int -reread_doc_file (file) - Lisp_Object file; +reread_doc_file (Lisp_Object file) { #if 0 Lisp_Object reply, prompt[3]; @@ -346,8 +337,7 @@ DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 2, 0, doc: /* Return the documentation string of FUNCTION. Unless a non-nil second argument RAW is given, the string is passed through `substitute-command-keys'. */) - (function, raw) - Lisp_Object function, raw; + (Lisp_Object function, Lisp_Object raw) { Lisp_Object fun; Lisp_Object funcar; @@ -481,8 +471,7 @@ Third argument RAW omitted or nil means pass the result through This differs from `get' in that it can refer to strings stored in the `etc/DOC' file; and that it evaluates documentation properties that aren't strings. */) - (symbol, prop, raw) - Lisp_Object symbol, prop, raw; + (Lisp_Object symbol, Lisp_Object prop, Lisp_Object raw) { int try_reload = 1; Lisp_Object tem; @@ -522,10 +511,8 @@ aren't strings. */) /* Scanning the DOC files and placing docstring offsets into functions. */ static void -store_function_docstring (fun, offset) - Lisp_Object fun; - /* Use EMACS_INT because we get this from pointer subtraction. */ - EMACS_INT offset; +store_function_docstring (Lisp_Object fun, EMACS_INT offset) +/* Use EMACS_INT because we get offset from pointer subtraction. */ { fun = indirect_function (fun); @@ -574,8 +561,7 @@ The function takes one argument, FILENAME, a string; it specifies the file name (without a directory) of the DOC file. That file is found in `../etc' now; later, when the dumped Emacs is run, the same file name is found in the `doc-directory'. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { int fd; char buf[1024 + 1]; @@ -652,7 +638,7 @@ the same file name is found in the `doc-directory'. */) /* p points to ^_Ffunctionname\n or ^_Vvarname\n. */ if (p != end) { - end = (char *) index (p, '\n'); + end = strchr (p, '\n'); /* 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] == '.' @@ -702,7 +688,7 @@ the same file name is found in the `doc-directory'. */) } pos += end - buf; filled -= end - buf; - bcopy (end, buf, filled); + memcpy (buf, end, filled); } emacs_close (fd); return Qnil; @@ -723,8 +709,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int Returns original STRING if no substitutions were made. Otherwise, a new string, without any text properties, is returned. */) - (string) - Lisp_Object string; + (Lisp_Object string) { unsigned char *buf; int changed = 0; @@ -781,7 +766,7 @@ a new string, without any text properties, is returned. */) if (len == 1) *bufp = *strp; else - bcopy (strp, bufp, len); + memcpy (bufp, strp, len); strp += len; bufp += len; nchars++; @@ -833,7 +818,7 @@ a new string, without any text properties, is returned. */) int offset = bufp - buf; buf = (unsigned char *) xrealloc (buf, bsize += 4); bufp = buf + offset; - bcopy ("M-x ", bufp, 4); + memcpy (bufp, "M-x ", 4); bufp += 4; nchars += 4; if (multibyte) @@ -927,7 +912,7 @@ a new string, without any text properties, is returned. */) int offset = bufp - buf; buf = (unsigned char *) xrealloc (buf, bsize += length_byte); bufp = buf + offset; - bcopy (start, bufp, length_byte); + memcpy (bufp, start, length_byte); bufp += length_byte; nchars += length; /* Check STRING again in case gc relocated it. */ @@ -944,7 +929,7 @@ a new string, without any text properties, is returned. */) if (len == 1) *bufp = *strp; else - bcopy (strp, bufp, len); + memcpy (bufp, strp, len); strp += len; bufp += len; nchars++; @@ -960,7 +945,7 @@ a new string, without any text properties, is returned. */) } void -syms_of_doc () +syms_of_doc (void) { Qfunction_documentation = intern_c_string ("function-documentation"); staticpro (&Qfunction_documentation); diff --git a/src/doprnt.c b/src/doprnt.c index cf8a9280863..1b45b21e36b 100644 --- a/src/doprnt.c +++ b/src/doprnt.c @@ -48,8 +48,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ another macro. */ #include "character.h" -static int doprnt1 (); - /* Generate output from a format-spec FORMAT, terminated at position FORMAT_END. Output goes in BUFFER, which has room for BUFSIZE chars. @@ -61,16 +59,10 @@ static int doprnt1 (); Integers are passed as C integers. */ int -doprnt (buffer, bufsize, format, format_end, nargs, args) - char *buffer; - register int bufsize; - char *format; - char *format_end; - int nargs; - char **args; +doprnt (char *buffer, register int bufsize, const char *format, + const char *format_end, va_list ap) { - int cnt = 0; /* Number of arg to gobble next */ - register char *fmt = format; /* Pointer into format string */ + const char *fmt = format; /* Pointer into format string */ register char *bufptr = buffer; /* Pointer into output buffer.. */ /* Use this for sprintf unless we need something really big. */ @@ -169,8 +161,6 @@ doprnt (buffer, bufsize, format, format_end, nargs, args) case 'd': case 'o': case 'x': - if (cnt == nargs) - error ("Not enough arguments for format string"); if (sizeof (int) == sizeof (EMACS_INT)) ; else if (sizeof (long) == sizeof (EMACS_INT)) @@ -181,7 +171,7 @@ doprnt (buffer, bufsize, format, format_end, nargs, args) string++; else abort (); - sprintf (sprintf_buffer, fmtcpy, args[cnt++]); + sprintf (sprintf_buffer, fmtcpy, va_arg(ap, char *)); /* Now copy into final output, truncating as nec. */ string = (unsigned char *) sprintf_buffer; goto doit; @@ -190,12 +180,8 @@ doprnt (buffer, bufsize, format, format_end, nargs, args) case 'e': case 'g': { - union { double d; char *half[2]; } u; - if (cnt + 1 == nargs) - error ("Not enough arguments for format string"); - u.half[0] = args[cnt++]; - u.half[1] = args[cnt++]; - sprintf (sprintf_buffer, fmtcpy, u.d); + double d = va_arg(ap, double); + sprintf (sprintf_buffer, fmtcpy, d); /* Now copy into final output, truncating as nec. */ string = (unsigned char *) sprintf_buffer; goto doit; @@ -204,11 +190,9 @@ doprnt (buffer, bufsize, format, format_end, nargs, args) case 'S': string[-1] = 's'; case 's': - if (cnt == nargs) - error ("Not enough arguments for format string"); if (fmtcpy[1] != 's') minlen = atoi (&fmtcpy[1]); - string = (unsigned char *) args[cnt++]; + string = va_arg(ap, unsigned char *); tem = strlen (string); width = strwidth (string, tem); goto doit1; @@ -237,12 +221,12 @@ doprnt (buffer, bufsize, format, format_end, nargs, args) /* Truncate the string at character boundary. */ tem = bufsize; while (!CHAR_HEAD_P (string[tem - 1])) tem--; - bcopy (string, bufptr, tem); + memcpy (bufptr, string, tem); /* We must calculate WIDTH again. */ width = strwidth (bufptr, tem); } else - bcopy (string, bufptr, tem); + memcpy (bufptr, string, tem); bufptr += tem; bufsize -= tem; if (minlen < 0) @@ -258,16 +242,21 @@ doprnt (buffer, bufsize, format, format_end, nargs, args) continue; case 'c': - if (cnt == nargs) - error ("Not enough arguments for format string"); - tem = CHAR_STRING ((int) (EMACS_INT) args[cnt], charbuf); - string = charbuf; - cnt++; - string[tem] = 0; - width = strwidth (string, tem); - if (fmtcpy[1] != 'c') - minlen = atoi (&fmtcpy[1]); - goto doit1; + { + /* Sometimes for %c we pass a char, which would widen + to int. Sometimes we pass XFASTINT() or XINT() + values, which would be EMACS_INT. Let's hope that + both are passed the same way, otherwise we'll need + to rewrite callers. */ + EMACS_INT chr = va_arg(ap, EMACS_INT); + tem = CHAR_STRING ((int) chr, charbuf); + string = charbuf; + string[tem] = 0; + width = strwidth (string, tem); + if (fmtcpy[1] != 'c') + minlen = atoi (&fmtcpy[1]); + goto doit1; + } case '%': fmt--; /* Drop thru and this % will be treated as normal */ diff --git a/src/dosfns.c b/src/dosfns.c index e8756de21a1..5be0a363da8 100644 --- a/src/dosfns.c +++ b/src/dosfns.c @@ -55,8 +55,7 @@ Return the updated REGISTER vector. INTERRUPT should be an integer in the range 0 to 255. REGISTERS should be a vector produced by `make-register' and `set-register-value'. */) - (interrupt, registers) - Lisp_Object interrupt, registers; + (Lisp_Object interrupt, Lisp_Object registers) { register int i; int no; @@ -97,8 +96,7 @@ REGISTERS should be a vector produced by `make-register' and DEFUN ("msdos-memget", Fdos_memget, Sdos_memget, 2, 2, 0, doc: /* Read DOS memory at offset ADDRESS into VECTOR. Return the updated VECTOR. */) - (address, vector) - Lisp_Object address, vector; + (Lisp_Object address, Lisp_Object vector) { register int i; int offs, len; @@ -122,8 +120,7 @@ Return the updated VECTOR. */) DEFUN ("msdos-memput", Fdos_memput, Sdos_memput, 2, 2, 0, doc: /* Write DOS memory at offset ADDRESS from VECTOR. */) - (address, vector) - Lisp_Object address, vector; + (Lisp_Object address, Lisp_Object vector) { register int i; int offs, len; @@ -153,8 +150,7 @@ DEFUN ("msdos-set-keyboard", Fmsdos_set_keyboard, Smsdos_set_keyboard, 1, 2, 0, If the optional argument ALLKEYS is non-nil, the keyboard is mapped for all keys; otherwise it is only used when the ALT key is pressed. The current keyboard layout is available in dos-keyboard-code. */) - (country_code, allkeys) - Lisp_Object country_code, allkeys; + (Lisp_Object country_code, Lisp_Object allkeys) { CHECK_NUMBER (country_code); if (!dos_set_keyboard (XINT (country_code), !NILP (allkeys))) @@ -168,7 +164,7 @@ The current keyboard layout is available in dos-keyboard-code. */) DEFUN ("msdos-mouse-p", Fmsdos_mouse_p, Smsdos_mouse_p, 0, 0, 0, doc: /* Report whether a mouse is present. */) - () + (void) { if (have_mouse) return Qt; @@ -179,7 +175,7 @@ DEFUN ("msdos-mouse-p", Fmsdos_mouse_p, Smsdos_mouse_p, 0, 0, 0, DEFUN ("msdos-mouse-init", Fmsdos_mouse_init, Smsdos_mouse_init, 0, 0, "", doc: /* Initialize and enable mouse if available. */) - () + (void) { if (have_mouse) { @@ -192,7 +188,7 @@ DEFUN ("msdos-mouse-init", Fmsdos_mouse_init, Smsdos_mouse_init, 0, 0, "", DEFUN ("msdos-mouse-enable", Fmsdos_mouse_enable, Smsdos_mouse_enable, 0, 0, "", doc: /* Enable mouse if available. */) - () + (void) { if (have_mouse) { @@ -204,7 +200,7 @@ DEFUN ("msdos-mouse-enable", Fmsdos_mouse_enable, Smsdos_mouse_enable, 0, 0, "", DEFUN ("msdos-mouse-disable", Fmsdos_mouse_disable, Smsdos_mouse_disable, 0, 0, "", doc: /* Disable mouse if available. */) - () + (void) { mouse_off (); if (have_mouse) have_mouse = -1; @@ -214,7 +210,7 @@ DEFUN ("msdos-mouse-disable", Fmsdos_mouse_disable, Smsdos_mouse_disable, 0, 0, DEFUN ("insert-startup-screen", Finsert_startup_screen, Sinsert_startup_screen, 0, 0, "", doc: /* Insert copy of screen contents prior to starting Emacs. Return nil if startup screen is not available. */) - () + (void) { char *s; int rows, cols, i, j; @@ -283,7 +279,7 @@ restore_parent_vm_title (void) #endif /* !HAVE_X_WINDOWS */ void -init_dosfns () +init_dosfns (void) { union REGS regs; _go32_dpmi_registers dpmiregs; @@ -481,9 +477,7 @@ w95_set_virtual_machine_title (const char *title_string) sets the name in the frame struct, but has no other effects. */ void -x_set_title (f, name) - struct frame *f; - Lisp_Object name; +x_set_title (struct frame *f, Lisp_Object name) { /* Don't change the title if it's already NAME. */ if (EQ (name, f->title)) @@ -511,8 +505,7 @@ Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total storage of the file system, FREE is the free storage, and AVAIL is the storage available to a non-superuser. All 3 numbers are in bytes. If the underlying system call fails, value is nil. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { struct statfs stfs; Lisp_Object encoded, value; @@ -536,7 +529,7 @@ If the underlying system call fails, value is nil. */) (There are no other processes on DOS, right?) */ Lisp_Object -list_system_processes () +list_system_processes (void) { Lisp_Object proclist = Qnil; @@ -689,7 +682,8 @@ dos_cleanup (void) /* * Define everything */ -syms_of_dosfns () +void +syms_of_dosfns (void) { defsubr (&Sint86); defsubr (&Sdos_memget); diff --git a/src/dosfns.h b/src/dosfns.h index 1759ffd8a90..820b6b30e43 100644 --- a/src/dosfns.h +++ b/src/dosfns.h @@ -38,8 +38,8 @@ extern Lisp_Object Vdos_windows_version; #ifndef HAVE_X_WINDOWS extern Lisp_Object Vdos_display_scancodes; -extern int msdos_stdcolor_idx P_ ((const char *)); -extern Lisp_Object msdos_stdcolor_name P_ ((int)); +extern int msdos_stdcolor_idx (const char *); +extern Lisp_Object msdos_stdcolor_name (int); #endif /* arch-tag: a83b8c4c-63c8-451e-9e94-bc72e3e2f8bc diff --git a/src/editfns.c b/src/editfns.c index ea279a462f2..805dba60446 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -86,38 +86,34 @@ extern char **environ; (1000 - TM_YEAR_BASE <= (tm_year) && (tm_year) <= 9999 - TM_YEAR_BASE) #endif -extern size_t emacs_strftimeu P_ ((char *, size_t, const char *, - const struct tm *, int)); +extern size_t emacs_strftimeu (char *, size_t, const char *, + const struct tm *, int); #ifdef WINDOWSNT extern Lisp_Object w32_get_internal_run_time (); #endif -static int tm_diff P_ ((struct tm *, struct tm *)); -static void find_field P_ ((Lisp_Object, Lisp_Object, Lisp_Object, int *, Lisp_Object, int *)); -static void update_buffer_properties P_ ((int, int)); -static Lisp_Object region_limit P_ ((int)); -int lisp_time_argument P_ ((Lisp_Object, time_t *, int *)); -static size_t emacs_memftimeu P_ ((char *, size_t, const char *, - size_t, const struct tm *, int)); +static int tm_diff (struct tm *, struct tm *); +static void find_field (Lisp_Object, Lisp_Object, Lisp_Object, int *, Lisp_Object, int *); +static void update_buffer_properties (int, int); +static Lisp_Object region_limit (int); +int lisp_time_argument (Lisp_Object, time_t *, int *); +static size_t emacs_memftimeu (char *, size_t, const char *, + size_t, const struct tm *, int); static void general_insert_function (void (*) (const unsigned char *, EMACS_INT), void (*) (Lisp_Object, EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, int), int, int, Lisp_Object *); -static Lisp_Object subst_char_in_region_unwind P_ ((Lisp_Object)); -static Lisp_Object subst_char_in_region_unwind_1 P_ ((Lisp_Object)); -static void transpose_markers P_ ((int, int, int, int, int, int, int, int)); - -#ifdef HAVE_INDEX -extern char *index P_ ((const char *, int)); -#endif +static Lisp_Object subst_char_in_region_unwind (Lisp_Object); +static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object); +static void transpose_markers (int, int, int, int, int, int, int, int); Lisp_Object Vbuffer_access_fontify_functions; Lisp_Object Qbuffer_access_fontify_functions; Lisp_Object Vbuffer_access_fontified_property; -Lisp_Object Fuser_full_name P_ ((Lisp_Object)); +Lisp_Object Fuser_full_name (Lisp_Object); /* Non-nil means don't stop at field boundary in text motion commands. */ @@ -141,7 +137,7 @@ Lisp_Object Qboundary; void -init_editfns () +init_editfns (void) { char *user_name; register unsigned char *p; @@ -209,8 +205,7 @@ init_editfns () DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0, doc: /* Convert arg CHAR to a string containing that character. usage: (char-to-string CHAR) */) - (character) - Lisp_Object character; + (Lisp_Object character) { int len; unsigned char str[MAX_MULTIBYTE_LENGTH]; @@ -223,8 +218,7 @@ usage: (char-to-string CHAR) */) DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0, doc: /* Convert arg BYTE to a string containing that byte. */) - (byte) - Lisp_Object byte; + (Lisp_Object byte) { unsigned char b; CHECK_NUMBER (byte); @@ -235,8 +229,7 @@ DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0, DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0, doc: /* Convert arg STRING to a character, the first character of that string. A multibyte character is handled correctly. */) - (string) - register Lisp_Object string; + (register Lisp_Object string) { register Lisp_Object val; CHECK_STRING (string); @@ -253,8 +246,7 @@ A multibyte character is handled correctly. */) } static Lisp_Object -buildmark (charpos, bytepos) - int charpos, bytepos; +buildmark (int charpos, int bytepos) { register Lisp_Object mark; mark = Fmake_marker (); @@ -265,7 +257,7 @@ buildmark (charpos, bytepos) DEFUN ("point", Fpoint, Spoint, 0, 0, 0, doc: /* Return value of point, as an integer. Beginning of buffer is position (point-min). */) - () + (void) { Lisp_Object temp; XSETFASTINT (temp, PT); @@ -274,14 +266,13 @@ Beginning of buffer is position (point-min). */) DEFUN ("point-marker", Fpoint_marker, Spoint_marker, 0, 0, 0, doc: /* Return value of point, as a marker object. */) - () + (void) { return buildmark (PT, PT_BYTE); } int -clip_to_bounds (lower, num, upper) - int lower, num, upper; +clip_to_bounds (int lower, int num, int upper) { if (num < lower) return lower; @@ -296,8 +287,7 @@ DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ", Beginning of buffer is position (point-min), end is (point-max). The return value is POSITION. */) - (position) - register Lisp_Object position; + (register Lisp_Object position) { int pos; @@ -328,8 +318,7 @@ The return value is POSITION. */) If there is no region active, signal an error. */ static Lisp_Object -region_limit (beginningp) - int beginningp; +region_limit (int beginningp) { extern Lisp_Object Vmark_even_if_inactive; /* Defined in callint.c. */ Lisp_Object m; @@ -350,14 +339,14 @@ region_limit (beginningp) DEFUN ("region-beginning", Fregion_beginning, Sregion_beginning, 0, 0, 0, doc: /* Return position of beginning of region, as an integer. */) - () + (void) { return region_limit (1); } DEFUN ("region-end", Fregion_end, Sregion_end, 0, 0, 0, doc: /* Return position of end of region, as an integer. */) - () + (void) { return region_limit (0); } @@ -366,7 +355,7 @@ DEFUN ("mark-marker", Fmark_marker, Smark_marker, 0, 0, 0, doc: /* Return this buffer's mark, as a marker object. Watch out! Moving this marker changes the mark position. If you set the marker not to point anywhere, the buffer will have no mark. */) - () + (void) { return current_buffer->mark; } @@ -377,10 +366,7 @@ If you set the marker not to point anywhere, the buffer will have no mark. */) of length LEN. */ static int -overlays_around (pos, vec, len) - int pos; - Lisp_Object *vec; - int len; +overlays_around (int pos, Lisp_Object *vec, int len) { Lisp_Object overlay, start, end; struct Lisp_Overlay *tail; @@ -436,9 +422,7 @@ overlays_around (pos, vec, len) window-specific overlays are considered only if they are associated with OBJECT. */ Lisp_Object -get_pos_property (position, prop, object) - Lisp_Object position, object; - register Lisp_Object prop; +get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object object) { CHECK_NUMBER_COERCE_MARKER (position); @@ -533,11 +517,7 @@ get_pos_property (position, prop, object) is not stored. */ static void -find_field (pos, merge_at_boundary, beg_limit, beg, end_limit, end) - Lisp_Object pos; - Lisp_Object merge_at_boundary; - Lisp_Object beg_limit, end_limit; - int *beg, *end; +find_field (Lisp_Object pos, Lisp_Object merge_at_boundary, Lisp_Object beg_limit, int *beg, Lisp_Object end_limit, int *end) { /* Fields right before and after the point. */ Lisp_Object before_field, after_field; @@ -651,8 +631,7 @@ DEFUN ("delete-field", Fdelete_field, Sdelete_field, 0, 1, 0, doc: /* Delete the field surrounding POS. A field is a region of text with the same `field' property. If POS is nil, the value of point is used for POS. */) - (pos) - Lisp_Object pos; + (Lisp_Object pos) { int beg, end; find_field (pos, Qnil, Qnil, &beg, Qnil, &end); @@ -665,8 +644,7 @@ DEFUN ("field-string", Ffield_string, Sfield_string, 0, 1, 0, doc: /* Return the contents of the field surrounding POS as a string. A field is a region of text with the same `field' property. If POS is nil, the value of point is used for POS. */) - (pos) - Lisp_Object pos; + (Lisp_Object pos) { int beg, end; find_field (pos, Qnil, Qnil, &beg, Qnil, &end); @@ -677,8 +655,7 @@ DEFUN ("field-string-no-properties", Ffield_string_no_properties, Sfield_string_ doc: /* Return the contents of the field around POS, without text properties. A field is a region of text with the same `field' property. If POS is nil, the value of point is used for POS. */) - (pos) - Lisp_Object pos; + (Lisp_Object pos) { int beg, end; find_field (pos, Qnil, Qnil, &beg, Qnil, &end); @@ -693,8 +670,7 @@ If ESCAPE-FROM-EDGE is non-nil and POS is at the beginning of its field, then the beginning of the *previous* field is returned. If LIMIT is non-nil, it is a buffer position; if the beginning of the field is before LIMIT, then LIMIT will be returned instead. */) - (pos, escape_from_edge, limit) - Lisp_Object pos, escape_from_edge, limit; + (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit) { int beg; find_field (pos, escape_from_edge, limit, &beg, Qnil, 0); @@ -709,8 +685,7 @@ If ESCAPE-FROM-EDGE is non-nil and POS is at the end of its field, then the end of the *following* field is returned. If LIMIT is non-nil, it is a buffer position; if the end of the field is after LIMIT, then LIMIT will be returned instead. */) - (pos, escape_from_edge, limit) - Lisp_Object pos, escape_from_edge, limit; + (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit) { int end; find_field (pos, escape_from_edge, Qnil, 0, limit, &end); @@ -744,9 +719,7 @@ If the optional argument INHIBIT-CAPTURE-PROPERTY is non-nil, and OLD-POS has a non-nil property of that name, then any field boundaries are ignored. Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */) - (new_pos, old_pos, escape_from_edge, only_in_line, inhibit_capture_property) - Lisp_Object new_pos, old_pos; - Lisp_Object escape_from_edge, only_in_line, inhibit_capture_property; + (Lisp_Object new_pos, Lisp_Object old_pos, Lisp_Object escape_from_edge, Lisp_Object only_in_line, Lisp_Object inhibit_capture_property) { /* If non-zero, then the original point, before re-positioning. */ int orig_point = 0; @@ -841,8 +814,7 @@ starts at point, the scan stops as soon as it starts. To ignore field boundaries bind `inhibit-field-text-motion' to t. This function does not move point. */) - (n) - Lisp_Object n; + (Lisp_Object n) { int orig, orig_byte, end; int count = SPECPDL_INDEX (); @@ -880,8 +852,7 @@ at point, the scan stops as soon as it starts. To ignore field boundaries bind `inhibit-field-text-motion' to t. This function does not move point. */) - (n) - Lisp_Object n; + (Lisp_Object n) { int end_pos; int orig = PT; @@ -900,7 +871,7 @@ This function does not move point. */) Lisp_Object -save_excursion_save () +save_excursion_save (void) { int visible = (XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer); @@ -913,8 +884,7 @@ save_excursion_save () } Lisp_Object -save_excursion_restore (info) - Lisp_Object info; +save_excursion_restore (Lisp_Object info) { Lisp_Object tem, tem1, omark, nmark; struct gcpro gcpro1, gcpro2, gcpro3; @@ -1013,8 +983,7 @@ If you only want to save the current buffer but not point nor mark, then just use `save-current-buffer', or even `with-current-buffer'. usage: (save-excursion &rest BODY) */) - (args) - Lisp_Object args; + (Lisp_Object args) { register Lisp_Object val; int count = SPECPDL_INDEX (); @@ -1029,8 +998,7 @@ DEFUN ("save-current-buffer", Fsave_current_buffer, Ssave_current_buffer, 0, UNE doc: /* Save the current buffer; execute BODY; restore the current buffer. Executes BODY just like `progn'. usage: (save-current-buffer &rest BODY) */) - (args) - Lisp_Object args; + (Lisp_Object args) { Lisp_Object val; int count = SPECPDL_INDEX (); @@ -1044,8 +1012,7 @@ usage: (save-current-buffer &rest BODY) */) DEFUN ("buffer-size", Fbufsize, Sbufsize, 0, 1, 0, doc: /* Return the number of characters in the current buffer. If BUFFER, return the number of characters in that buffer instead. */) - (buffer) - Lisp_Object buffer; + (Lisp_Object buffer) { if (NILP (buffer)) return make_number (Z - BEG); @@ -1060,7 +1027,7 @@ If BUFFER, return the number of characters in that buffer instead. */) DEFUN ("point-min", Fpoint_min, Spoint_min, 0, 0, 0, doc: /* Return the minimum permissible value of point in the current buffer. This is 1, unless narrowing (a buffer restriction) is in effect. */) - () + (void) { Lisp_Object temp; XSETFASTINT (temp, BEGV); @@ -1070,7 +1037,7 @@ This is 1, unless narrowing (a buffer restriction) is in effect. */) DEFUN ("point-min-marker", Fpoint_min_marker, Spoint_min_marker, 0, 0, 0, doc: /* Return a marker to the minimum permissible value of point in this buffer. This is the beginning, unless narrowing (a buffer restriction) is in effect. */) - () + (void) { return buildmark (BEGV, BEGV_BYTE); } @@ -1079,7 +1046,7 @@ DEFUN ("point-max", Fpoint_max, Spoint_max, 0, 0, 0, doc: /* Return the maximum permissible value of point in the current buffer. This is (1+ (buffer-size)), unless narrowing (a buffer restriction) is in effect, in which case it is less. */) - () + (void) { Lisp_Object temp; XSETFASTINT (temp, ZV); @@ -1090,7 +1057,7 @@ DEFUN ("point-max-marker", Fpoint_max_marker, Spoint_max_marker, 0, 0, 0, doc: /* Return a marker to the maximum permissible value of point in this buffer. This is (1+ (buffer-size)), unless narrowing (a buffer restriction) is in effect, in which case it is less. */) - () + (void) { return buildmark (ZV, ZV_BYTE); } @@ -1098,7 +1065,7 @@ is in effect, in which case it is less. */) DEFUN ("gap-position", Fgap_position, Sgap_position, 0, 0, 0, doc: /* Return the position of the gap, in the current buffer. See also `gap-size'. */) - () + (void) { Lisp_Object temp; XSETFASTINT (temp, GPT); @@ -1108,7 +1075,7 @@ See also `gap-size'. */) DEFUN ("gap-size", Fgap_size, Sgap_size, 0, 0, 0, doc: /* Return the size of the current buffer's gap. See also `gap-position'. */) - () + (void) { Lisp_Object temp; XSETFASTINT (temp, GAP_SIZE); @@ -1118,8 +1085,7 @@ See also `gap-position'. */) DEFUN ("position-bytes", Fposition_bytes, Sposition_bytes, 1, 1, 0, doc: /* Return the byte position for character position POSITION. If POSITION is out of range, the value is nil. */) - (position) - Lisp_Object position; + (Lisp_Object position) { CHECK_NUMBER_COERCE_MARKER (position); if (XINT (position) < BEG || XINT (position) > Z) @@ -1130,8 +1096,7 @@ If POSITION is out of range, the value is nil. */) DEFUN ("byte-to-position", Fbyte_to_position, Sbyte_to_position, 1, 1, 0, doc: /* Return the character position for byte position BYTEPOS. If BYTEPOS is out of range, the value is nil. */) - (bytepos) - Lisp_Object bytepos; + (Lisp_Object bytepos) { CHECK_NUMBER (bytepos); if (XINT (bytepos) < BEG_BYTE || XINT (bytepos) > Z_BYTE) @@ -1142,7 +1107,7 @@ If BYTEPOS is out of range, the value is nil. */) DEFUN ("following-char", Ffollowing_char, Sfollowing_char, 0, 0, 0, doc: /* Return the character following point, as a number. At the end of the buffer or accessible region, return 0. */) - () + (void) { Lisp_Object temp; if (PT >= ZV) @@ -1155,7 +1120,7 @@ At the end of the buffer or accessible region, return 0. */) DEFUN ("preceding-char", Fprevious_char, Sprevious_char, 0, 0, 0, doc: /* Return the character preceding point, as a number. At the beginning of the buffer or accessible region, return 0. */) - () + (void) { Lisp_Object temp; if (PT <= BEGV) @@ -1174,7 +1139,7 @@ At the beginning of the buffer or accessible region, return 0. */) DEFUN ("bobp", Fbobp, Sbobp, 0, 0, 0, doc: /* Return t if point is at the beginning of the buffer. If the buffer is narrowed, this means the beginning of the narrowed part. */) - () + (void) { if (PT == BEGV) return Qt; @@ -1184,7 +1149,7 @@ If the buffer is narrowed, this means the beginning of the narrowed part. */) DEFUN ("eobp", Feobp, Seobp, 0, 0, 0, doc: /* Return t if point is at the end of the buffer. If the buffer is narrowed, this means the end of the narrowed part. */) - () + (void) { if (PT == ZV) return Qt; @@ -1193,7 +1158,7 @@ If the buffer is narrowed, this means the end of the narrowed part. */) DEFUN ("bolp", Fbolp, Sbolp, 0, 0, 0, doc: /* Return t if point is at the beginning of a line. */) - () + (void) { if (PT == BEGV || FETCH_BYTE (PT_BYTE - 1) == '\n') return Qt; @@ -1203,7 +1168,7 @@ DEFUN ("bolp", Fbolp, Sbolp, 0, 0, 0, DEFUN ("eolp", Feolp, Seolp, 0, 0, 0, doc: /* Return t if point is at the end of a line. `End of a line' includes point being at the end of the buffer. */) - () + (void) { if (PT == ZV || FETCH_BYTE (PT_BYTE) == '\n') return Qt; @@ -1214,8 +1179,7 @@ DEFUN ("char-after", Fchar_after, Schar_after, 0, 1, 0, doc: /* Return character in current buffer at position POS. POS is an integer or a marker and defaults to point. If POS is out of range, the value is nil. */) - (pos) - Lisp_Object pos; + (Lisp_Object pos) { register int pos_byte; @@ -1247,8 +1211,7 @@ DEFUN ("char-before", Fchar_before, Schar_before, 0, 1, 0, doc: /* Return character in current buffer preceding position POS. POS is an integer or a marker and defaults to point. If POS is out of range, the value is nil. */) - (pos) - Lisp_Object pos; + (Lisp_Object pos) { register Lisp_Object val; register int pos_byte; @@ -1297,8 +1260,7 @@ that determines the value of this function. If optional argument UID is an integer or a float, return the login name of the user with that uid, or nil if there is no such user. */) - (uid) - Lisp_Object uid; + (Lisp_Object uid) { struct passwd *pw; uid_t id; @@ -1324,7 +1286,7 @@ DEFUN ("user-real-login-name", Fuser_real_login_name, Suser_real_login_name, doc: /* Return the name of the user's real uid, as a string. This ignores the environment variables LOGNAME and USER, so it differs from `user-login-name' when running under `su'. */) - () + (void) { /* Set up the user name info if we didn't do it before. (That can happen if Emacs is dumpable @@ -1337,7 +1299,7 @@ This ignores the environment variables LOGNAME and USER, so it differs from DEFUN ("user-uid", Fuser_uid, Suser_uid, 0, 0, 0, doc: /* Return the effective uid of Emacs. Value is an integer or a float, depending on the value. */) - () + (void) { /* Assignment to EMACS_INT stops GCC whining about limited range of data type. */ @@ -1353,7 +1315,7 @@ Value is an integer or a float, depending on the value. */) DEFUN ("user-real-uid", Fuser_real_uid, Suser_real_uid, 0, 0, 0, doc: /* Return the real uid of Emacs. Value is an integer or a float, depending on the value. */) - () + (void) { /* Assignment to EMACS_INT stops GCC whining about limited range of data type. */ @@ -1375,8 +1337,7 @@ If optional argument UID is an integer or float, return the full name of the user with that uid, or nil if there is no such user. If UID is a string, return the full name of the user with that login name, or nil if there is no such user. */) - (uid) - Lisp_Object uid; + (Lisp_Object uid) { struct passwd *pw; register unsigned char *p, *q; @@ -1404,12 +1365,12 @@ name, or nil if there is no such user. */) p = (unsigned char *) USER_FULL_NAME; /* Chop off everything after the first comma. */ - q = (unsigned char *) index (p, ','); + q = (unsigned char *) strchr (p, ','); full = make_string (p, q ? q - p : strlen (p)); #ifdef AMPERSAND_FULL_NAME p = SDATA (full); - q = (unsigned char *) index (p, '&'); + q = (unsigned char *) strchr (p, '&'); /* Substitute the login name for the &, upcasing the first character. */ if (q) { @@ -1418,7 +1379,7 @@ name, or nil if there is no such user. */) login = Fuser_login_name (make_number (pw->pw_uid)); r = (unsigned char *) alloca (strlen (p) + SCHARS (login) + 1); - bcopy (p, r, q - p); + memcpy (r, p, q - p); r[q - p] = 0; strcat (r, SDATA (login)); r[q - p] = UPCASE (r[q - p]); @@ -1432,7 +1393,7 @@ name, or nil if there is no such user. */) DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0, doc: /* Return the host name of the machine you are running on, as a string. */) - () + (void) { return Vsystem_name; } @@ -1440,7 +1401,7 @@ DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0, /* For the benefit of callers who don't want to include lisp.h */ char * -get_system_name () +get_system_name (void) { if (STRINGP (Vsystem_name)) return (char *) SDATA (Vsystem_name); @@ -1449,7 +1410,7 @@ get_system_name () } char * -get_operating_system_release() +get_operating_system_release (void) { if (STRINGP (Voperating_system_release)) return (char *) SDATA (Voperating_system_release); @@ -1459,7 +1420,7 @@ get_operating_system_release() DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0, doc: /* Return the process ID of Emacs, as an integer. */) - () + (void) { return make_number (getpid ()); } @@ -1473,7 +1434,7 @@ count. The microsecond count is zero on systems that do not provide resolution finer than a second. */) - () + (void) { EMACS_TIME t; @@ -1494,7 +1455,7 @@ count. On systems that can't determine the run time, `get-internal-run-time' does the same thing as `current-time'. The microsecond count is zero on systems that do not provide resolution finer than a second. */) - () + (void) { #ifdef HAVE_GETRUSAGE struct rusage usage; @@ -1527,10 +1488,7 @@ on systems that do not provide resolution finer than a second. */) int -lisp_time_argument (specified_time, result, usec) - Lisp_Object specified_time; - time_t *result; - int *usec; +lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec) { if (NILP (specified_time)) { @@ -1588,8 +1546,7 @@ have the form (HIGH . LOW), but this is considered obsolete. WARNING: Since the result is floating point, it may not be exact. If precise time stamps are required, use either `current-time', or (if you need time as a string) `format-time-string'. */) - (specified_time) - Lisp_Object specified_time; + (Lisp_Object specified_time) { time_t sec; int usec; @@ -1611,13 +1568,7 @@ or (if you need time as a string) `format-time-string'. */) This function behaves like emacs_strftimeu, except it allows null bytes in FORMAT. */ static size_t -emacs_memftimeu (s, maxsize, format, format_len, tp, ut) - char *s; - size_t maxsize; - const char *format; - size_t format_len; - const struct tm *tp; - int ut; +emacs_memftimeu (char *s, size_t maxsize, const char *format, size_t format_len, const struct tm *tp, int ut) { size_t total = 0; @@ -1705,8 +1656,7 @@ The modifiers are `E' and `O'. For certain characters X, %OX is like %X, but uses the locale's number symbols. For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) - (format_string, time, universal) - Lisp_Object format_string, time, universal; + (Lisp_Object format_string, Lisp_Object time, Lisp_Object universal) { time_t value; int size; @@ -1773,8 +1723,7 @@ where 0 is Sunday. DST is t if daylight saving time is in effect, otherwise nil. ZONE is an integer indicating the number of seconds east of Greenwich. (Note that Common Lisp has different meanings for DOW and ZONE.) */) - (specified_time) - Lisp_Object specified_time; + (Lisp_Object specified_time) { time_t time_spec; struct tm save_tm; @@ -1834,9 +1783,7 @@ Years before 1970 are not guaranteed to work. On some systems, year values as low as 1901 do work. usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { time_t time; struct tm tm; @@ -1922,8 +1869,7 @@ current time. The argument should have the form (HIGH LOW . IGNORED). Thus, you can use times obtained from `current-time' and from `file-attributes'. SPECIFIED-TIME can also have the form (HIGH . LOW), but this is considered obsolete. */) - (specified_time) - Lisp_Object specified_time; + (Lisp_Object specified_time) { time_t value; struct tm *tm; @@ -1950,8 +1896,7 @@ but this is considered obsolete. */) /* Yield A - B, measured in seconds. This function is copied from the GNU C Library. */ static int -tm_diff (a, b) - struct tm *a, *b; +tm_diff (struct tm *a, struct tm *b) { /* Compute intervening leap days correctly even if year is negative. Take care to avoid int overflow in leap day calculations, @@ -1986,8 +1931,7 @@ have the form (HIGH . LOW), but this is considered obsolete. Some operating systems cannot provide all this information to Emacs; in this case, `current-time-zone' returns a list containing nil for the data it can't find. */) - (specified_time) - Lisp_Object specified_time; + (Lisp_Object specified_time) { time_t value; struct tm *t; @@ -2051,8 +1995,7 @@ DEFUN ("set-time-zone-rule", Fset_time_zone_rule, Sset_time_zone_rule, 1, 1, 0, doc: /* Set the local time zone using TZ, a string specifying a time zone rule. If TZ is nil, use implementation-defined default time zone information. If TZ is t, use Universal Time. */) - (tz) - Lisp_Object tz; + (Lisp_Object tz) { char *tzstring; @@ -2098,8 +2041,7 @@ static char set_time_zone_rule_tz2[] = "TZ=GMT+1"; responsibility to free. */ void -set_time_zone_rule (tzstring) - char *tzstring; +set_time_zone_rule (const char *tzstring) { int envptrs; char **from, **to, **newenv; @@ -2221,8 +2163,7 @@ general_insert_function (void (*insert_func) } void -insert1 (arg) - Lisp_Object arg; +insert1 (Lisp_Object arg) { Finsert (1, &arg); } @@ -2250,9 +2191,7 @@ buffer; to accomplish this, apply `string-as-multibyte' to the string and insert the result. usage: (insert &rest ARGS) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { general_insert_function (insert, insert_from_string, 0, nargs, args); return Qnil; @@ -2271,9 +2210,7 @@ If the current buffer is unibyte, multibyte strings are converted to unibyte for insertion. usage: (insert-and-inherit &rest ARGS) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { general_insert_function (insert_and_inherit, insert_from_string, 1, nargs, args); @@ -2290,9 +2227,7 @@ If the current buffer is unibyte, multibyte strings are converted to unibyte for insertion. usage: (insert-before-markers &rest ARGS) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { general_insert_function (insert_before_markers, insert_from_string_before_markers, 0, @@ -2311,9 +2246,7 @@ If the current buffer is unibyte, multibyte strings are converted to unibyte for insertion. usage: (insert-before-markers-and-inherit &rest ARGS) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { general_insert_function (insert_before_markers_and_inherit, insert_from_string_before_markers, 1, @@ -2326,8 +2259,7 @@ DEFUN ("insert-char", Finsert_char, Sinsert_char, 2, 3, 0, Point, and before-insertion markers, are relocated as in the function `insert'. The optional third arg INHERIT, if non-nil, says to inherit text properties from adjoining text, if those properties are sticky. */) - (character, count, inherit) - Lisp_Object character, count, inherit; + (Lisp_Object character, Lisp_Object count, Lisp_Object inherit) { register unsigned char *string; register int strlen; @@ -2379,8 +2311,7 @@ corresponding eight-bit character is inserted. Point, and before-insertion markers, are relocated as in the function `insert'. The optional third arg INHERIT, if non-nil, says to inherit text properties from adjoining text, if those properties are sticky. */) - (byte, count, inherit) - Lisp_Object byte, count, inherit; + (Lisp_Object byte, Lisp_Object count, Lisp_Object inherit) { CHECK_NUMBER (byte); if (XINT (byte) < 0 || XINT (byte) > 255) @@ -2408,9 +2339,7 @@ from adjoining text, if those properties are sticky. */) buffer substrings. */ Lisp_Object -make_buffer_string (start, end, props) - int start, end; - int props; +make_buffer_string (int start, int end, int props) { int start_byte = CHAR_TO_BYTE (start); int end_byte = CHAR_TO_BYTE (end); @@ -2434,9 +2363,7 @@ make_buffer_string (start, end, props) buffer substrings. */ Lisp_Object -make_buffer_string_both (start, start_byte, end, end_byte, props) - int start, start_byte, end, end_byte; - int props; +make_buffer_string_both (int start, int start_byte, int end, int end_byte, int props) { Lisp_Object result, tem, tem1; @@ -2447,8 +2374,7 @@ make_buffer_string_both (start, start_byte, end, end_byte, props) result = make_uninit_multibyte_string (end - start, end_byte - start_byte); else result = make_uninit_string (end - start); - bcopy (BYTE_POS_ADDR (start_byte), SDATA (result), - end_byte - start_byte); + memcpy (SDATA (result), BYTE_POS_ADDR (start_byte), end_byte - start_byte); /* If desired, update and copy the text properties. */ if (props) @@ -2470,8 +2396,7 @@ make_buffer_string_both (start, start_byte, end, end_byte, props) in the current buffer, if necessary. */ static void -update_buffer_properties (start, end) - int start, end; +update_buffer_properties (int start, int end) { /* If this buffer has some access functions, call them, specifying the range of the buffer being accessed. */ @@ -2508,8 +2433,7 @@ The string returned is multibyte if the buffer is multibyte. This function copies the text properties of that part of the buffer into the result string; if you don't want the text properties, use `buffer-substring-no-properties' instead. */) - (start, end) - Lisp_Object start, end; + (Lisp_Object start, Lisp_Object end) { register int b, e; @@ -2525,8 +2449,7 @@ DEFUN ("buffer-substring-no-properties", Fbuffer_substring_no_properties, doc: /* Return the characters of part of the buffer, without the text properties. The two arguments START and END are character positions; they can be in either order. */) - (start, end) - Lisp_Object start, end; + (Lisp_Object start, Lisp_Object end) { register int b, e; @@ -2541,7 +2464,7 @@ DEFUN ("buffer-string", Fbuffer_string, Sbuffer_string, 0, 0, 0, doc: /* Return the contents of the current buffer as a string. If narrowing is in effect, this function returns only the visible part of the buffer. */) - () + (void) { return make_buffer_string (BEGV, ZV, 1); } @@ -2552,8 +2475,7 @@ DEFUN ("insert-buffer-substring", Finsert_buffer_substring, Sinsert_buffer_subst BUFFER may be a buffer or a buffer name. Arguments START and END are character positions specifying the substring. They default to the values of (point-min) and (point-max) in BUFFER. */) - (buffer, start, end) - Lisp_Object buffer, start, end; + (Lisp_Object buffer, Lisp_Object start, Lisp_Object end) { register int b, e, temp; register struct buffer *bp, *obuf; @@ -2606,8 +2528,7 @@ That makes six args in all, three for each substring. The value of `case-fold-search' in the current buffer determines whether case is significant or ignored. */) - (buffer1, start1, end1, buffer2, start2, end2) - Lisp_Object buffer1, start1, end1, buffer2, start2, end2; + (Lisp_Object buffer1, Lisp_Object start1, Lisp_Object end1, Lisp_Object buffer2, Lisp_Object start2, Lisp_Object end2) { register int begp1, endp1, begp2, endp2, temp; register struct buffer *bp1, *bp2; @@ -2757,15 +2678,13 @@ determines whether case is significant or ignored. */) } static Lisp_Object -subst_char_in_region_unwind (arg) - Lisp_Object arg; +subst_char_in_region_unwind (Lisp_Object arg) { return current_buffer->undo_list = arg; } static Lisp_Object -subst_char_in_region_unwind_1 (arg) - Lisp_Object arg; +subst_char_in_region_unwind_1 (Lisp_Object arg) { return current_buffer->filename = arg; } @@ -2776,8 +2695,7 @@ DEFUN ("subst-char-in-region", Fsubst_char_in_region, If optional arg NOUNDO is non-nil, don't record this change for undo and don't mark the buffer as really changed. Both characters must have the same length of multi-byte form. */) - (start, end, fromchar, tochar, noundo) - Lisp_Object start, end, fromchar, tochar, noundo; + (Lisp_Object start, Lisp_Object end, Lisp_Object fromchar, Lisp_Object tochar, Lisp_Object noundo) { register int pos, pos_byte, stop, i, len, end_byte; /* Keep track of the first change in the buffer: @@ -2953,7 +2871,7 @@ Both characters must have the same length of multi-byte form. */) } -static Lisp_Object check_translation P_ ((int, int, int, Lisp_Object)); +static Lisp_Object check_translation (int, int, int, Lisp_Object); /* Helper function for Ftranslate_region_internal. @@ -2962,9 +2880,7 @@ static Lisp_Object check_translation P_ ((int, int, int, Lisp_Object)); element is found, return it. Otherwise return Qnil. */ static Lisp_Object -check_translation (pos, pos_byte, end, val) - int pos, pos_byte, end; - Lisp_Object val; +check_translation (int pos, int pos_byte, int end, Lisp_Object val) { int buf_size = 16, buf_used = 0; int *buf = alloca (sizeof (int) * buf_size); @@ -3020,10 +2936,7 @@ From START to END, translate characters according to TABLE. TABLE is a string or a char-table; the Nth character in it is the mapping for the character with code N. It returns the number of characters changed. */) - (start, end, table) - Lisp_Object start; - Lisp_Object end; - register Lisp_Object table; + (Lisp_Object start, Lisp_Object end, register Lisp_Object table) { register unsigned char *tt; /* Trans table. */ register int nc; /* New character. */ @@ -3189,8 +3102,7 @@ DEFUN ("delete-region", Fdelete_region, Sdelete_region, 2, 2, "r", When called from a program, expects two arguments, positions (integers or markers) specifying the stretch to be deleted. */) - (start, end) - Lisp_Object start, end; + (Lisp_Object start, Lisp_Object end) { validate_region (&start, &end); del_range (XINT (start), XINT (end)); @@ -3200,8 +3112,7 @@ positions (integers or markers) specifying the stretch to be deleted. */) DEFUN ("delete-and-extract-region", Fdelete_and_extract_region, Sdelete_and_extract_region, 2, 2, 0, doc: /* Delete the text between START and END and return it. */) - (start, end) - Lisp_Object start, end; + (Lisp_Object start, Lisp_Object end) { validate_region (&start, &end); if (XINT (start) == XINT (end)) @@ -3212,7 +3123,7 @@ DEFUN ("delete-and-extract-region", Fdelete_and_extract_region, DEFUN ("widen", Fwiden, Swiden, 0, 0, "", doc: /* Remove restrictions (narrowing) from current buffer. This allows the buffer's full text to be seen and edited. */) - () + (void) { if (BEG != BEGV || Z != ZV) current_buffer->clip_changed = 1; @@ -3233,8 +3144,7 @@ See also `save-restriction'. When calling from a program, pass two arguments; positions (integers or markers) bounding the text that should remain visible. */) - (start, end) - register Lisp_Object start, end; + (register Lisp_Object start, Lisp_Object end) { CHECK_NUMBER_COERCE_MARKER (start); CHECK_NUMBER_COERCE_MARKER (end); @@ -3263,7 +3173,7 @@ or markers) bounding the text that should remain visible. */) } Lisp_Object -save_restriction_save () +save_restriction_save (void) { if (BEGV == BEG && ZV == Z) /* The common case that the buffer isn't narrowed. @@ -3287,8 +3197,7 @@ save_restriction_save () } Lisp_Object -save_restriction_restore (data) - Lisp_Object data; +save_restriction_restore (Lisp_Object data) { struct buffer *cur = NULL; struct buffer *buf = (CONSP (data) @@ -3368,8 +3277,7 @@ use `save-excursion' outermost: (save-excursion (save-restriction ...)) usage: (save-restriction &rest BODY) */) - (body) - Lisp_Object body; + (Lisp_Object body) { register Lisp_Object val; int count = SPECPDL_INDEX (); @@ -3402,9 +3310,7 @@ any existing message; this lets the minibuffer contents show. See also `current-message'. usage: (message FORMAT-STRING &rest ARGS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { if (NILP (args[0]) || (STRINGP (args[0]) @@ -3432,9 +3338,7 @@ If the first argument is nil or the empty string, clear any existing message; let the minibuffer contents show. usage: (message-box FORMAT-STRING &rest ARGS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { if (NILP (args[0])) { @@ -3472,7 +3376,7 @@ usage: (message-box FORMAT-STRING &rest ARGS) */) message_length = SBYTES (val); message_text = (char *)xrealloc (message_text, message_length); } - bcopy (SDATA (val), message_text, SBYTES (val)); + memcpy (message_text, SDATA (val), SBYTES (val)); message2 (message_text, SBYTES (val), STRING_MULTIBYTE (val)); return val; @@ -3494,9 +3398,7 @@ If the first argument is nil or the empty string, clear any existing message; let the minibuffer contents show. usage: (message-or-box FORMAT-STRING &rest ARGS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { #ifdef HAVE_MENUS if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) @@ -3508,7 +3410,7 @@ usage: (message-or-box FORMAT-STRING &rest ARGS) */) DEFUN ("current-message", Fcurrent_message, Scurrent_message, 0, 0, 0, doc: /* Return the string currently displayed in the echo area, or nil if none. */) - () + (void) { return current_message (); } @@ -3520,9 +3422,7 @@ First argument is the string to copy. Remaining arguments form a sequence of PROPERTY VALUE pairs for text properties to add to the result. usage: (propertize STRING &rest PROPERTIES) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { Lisp_Object properties, string; struct gcpro gcpro1, gcpro2; @@ -3604,9 +3504,7 @@ decimal point itself is omitted. For %s and %S, the precision specifier truncates the string to the given width. usage: (format STRING &rest OBJECTS) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { register int n; /* The number of the next arg to substitute */ register int total; /* An estimate of the final length */ @@ -3627,7 +3525,7 @@ usage: (format STRING &rest OBJECTS) */) string itself, will not be used. Element NARGS, corresponding to no argument, *will* be assigned to in the case that a `%' and `.' occur after the final format specifier. */ - int *precision = (int *) (alloca((nargs + 1) * sizeof (int))); + int *precision = (int *) (alloca ((nargs + 1) * sizeof (int))); int longest_format; Lisp_Object val; int arg_intervals = 0; @@ -3689,12 +3587,12 @@ usage: (format STRING &rest OBJECTS) */) int i; if (!info) info = (struct info *) alloca (nbytes); - bzero (info, nbytes); + memset (info, 0, nbytes); for (i = 0; i <= nargs; i++) info[i].start = -1; if (!discarded) SAFE_ALLOCA (discarded, char *, SBYTES (args[0])); - bzero (discarded, SBYTES (args[0])); + memset (discarded, 0, SBYTES (args[0])); } /* Add to TOTAL enough space to hold the converted arguments. */ @@ -3798,7 +3696,7 @@ usage: (format STRING &rest OBJECTS) */) string will finally appear (Bug#5710). */ actual_width = lisp_string_width (args[n], -1, NULL, NULL); if (precision[n] != -1) - actual_width = min(actual_width,precision[n]); + actual_width = min (actual_width, precision[n]); } /* Would get MPV otherwise, since Lisp_Int's `point' to low memory. */ else if (INTEGERP (args[n]) && *format != 's') @@ -3911,7 +3809,7 @@ usage: (format STRING &rest OBJECTS) */) discarded[format - format_start] = 1; format++; - while (index("-+0# ", *format)) + while (strchr ("-+0# ", *format)) { if (*format == '-') { @@ -4008,8 +3906,8 @@ usage: (format STRING &rest OBJECTS) */) { int this_nchars; - bcopy (this_format_start, this_format, - format - this_format_start); + memcpy (this_format, this_format_start, + format - this_format_start); this_format[format - this_format_start] = 0; if (format[-1] == 'e' || format[-1] == 'f' || format[-1] == 'g') @@ -4209,9 +4107,7 @@ usage: (format STRING &rest OBJECTS) */) } Lisp_Object -format2 (string1, arg0, arg1) - char *string1; - Lisp_Object arg0, arg1; +format2 (const char *string1, Lisp_Object arg0, Lisp_Object arg1) { Lisp_Object args[3]; args[0] = build_string (string1); @@ -4224,8 +4120,7 @@ DEFUN ("char-equal", Fchar_equal, Schar_equal, 2, 2, 0, doc: /* Return t if two characters match, optionally ignoring case. Both arguments must be characters (i.e. integers). Case is ignored if `case-fold-search' is non-nil in the current buffer. */) - (c1, c2) - register Lisp_Object c1, c2; + (register Lisp_Object c1, Lisp_Object c2) { int i1, i2; /* Check they're chars, not just integers, otherwise we could get array @@ -4274,10 +4169,9 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) It's the caller's job to ensure that START1 <= END1 <= START2 <= END2. */ static void -transpose_markers (start1, end1, start2, end2, - start1_byte, end1_byte, start2_byte, end2_byte) - register int start1, end1, start2, end2; - register int start1_byte, end1_byte, start2_byte, end2_byte; +transpose_markers (int start1, int end1, int start2, int end2, + int start1_byte, int end1_byte, + int start2_byte, int end2_byte) { register int amt1, amt1_byte, amt2, amt2_byte, diff, diff_byte, mpos; register struct Lisp_Marker *marker; @@ -4351,8 +4245,7 @@ Optional fifth arg LEAVE-MARKERS, if non-nil, means don't update any markers that happen to be located in the regions. Transposing beyond buffer boundaries is an error. */) - (startr1, endr1, startr2, endr2, leave_markers) - Lisp_Object startr1, endr1, startr2, endr2, leave_markers; + (Lisp_Object startr1, Lisp_Object endr1, Lisp_Object startr2, Lisp_Object endr2, Lisp_Object leave_markers) { register EMACS_INT start1, end1, start2, end2; EMACS_INT start1_byte, start2_byte, len1_byte, len2_byte; @@ -4488,9 +4381,9 @@ Transposing beyond buffer boundaries is an error. */) start1_addr = BYTE_POS_ADDR (start1_byte); start2_addr = BYTE_POS_ADDR (start2_byte); - bcopy (start2_addr, temp, len2_byte); - bcopy (start1_addr, start1_addr + len2_byte, len1_byte); - bcopy (temp, start1_addr, len2_byte); + memcpy (temp, start2_addr, len2_byte); + memcpy (start1_addr + len2_byte, start1_addr, len1_byte); + memcpy (start1_addr, temp, len2_byte); SAFE_FREE (); } else @@ -4501,9 +4394,9 @@ Transposing beyond buffer boundaries is an error. */) SAFE_ALLOCA (temp, unsigned char *, len1_byte); start1_addr = BYTE_POS_ADDR (start1_byte); start2_addr = BYTE_POS_ADDR (start2_byte); - bcopy (start1_addr, temp, len1_byte); - bcopy (start2_addr, start1_addr, len2_byte); - bcopy (temp, start1_addr + len2_byte, len1_byte); + memcpy (temp, start1_addr, len1_byte); + memcpy (start1_addr, start2_addr, len2_byte); + memcpy (start1_addr + len2_byte, temp, len1_byte); SAFE_FREE (); } graft_intervals_into_buffer (tmp_interval1, start1 + len2, @@ -4541,9 +4434,9 @@ Transposing beyond buffer boundaries is an error. */) SAFE_ALLOCA (temp, unsigned char *, len1_byte); start1_addr = BYTE_POS_ADDR (start1_byte); start2_addr = BYTE_POS_ADDR (start2_byte); - bcopy (start1_addr, temp, len1_byte); - bcopy (start2_addr, start1_addr, len2_byte); - bcopy (temp, start2_addr, len1_byte); + memcpy (temp, start1_addr, len1_byte); + memcpy (start1_addr, start2_addr, len2_byte); + memcpy (start2_addr, temp, len1_byte); SAFE_FREE (); graft_intervals_into_buffer (tmp_interval1, start2, @@ -4571,10 +4464,10 @@ Transposing beyond buffer boundaries is an error. */) SAFE_ALLOCA (temp, unsigned char *, len2_byte); start1_addr = BYTE_POS_ADDR (start1_byte); start2_addr = BYTE_POS_ADDR (start2_byte); - bcopy (start2_addr, temp, len2_byte); - bcopy (start1_addr, start1_addr + len_mid + len2_byte, len1_byte); - safe_bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid); - bcopy (temp, start1_addr, len2_byte); + memcpy (temp, start2_addr, len2_byte); + memcpy (start1_addr + len_mid + len2_byte, start1_addr, len1_byte); + memmove (start1_addr + len2_byte, start1_addr + len1_byte, len_mid); + memcpy (start1_addr, temp, len2_byte); SAFE_FREE (); graft_intervals_into_buffer (tmp_interval1, end2 - len1, @@ -4604,10 +4497,10 @@ Transposing beyond buffer boundaries is an error. */) SAFE_ALLOCA (temp, unsigned char *, len1_byte); start1_addr = BYTE_POS_ADDR (start1_byte); start2_addr = BYTE_POS_ADDR (start2_byte); - bcopy (start1_addr, temp, len1_byte); - bcopy (start2_addr, start1_addr, len2_byte); - bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid); - bcopy (temp, start1_addr + len2_byte + len_mid, len1_byte); + memcpy (temp, start1_addr, len1_byte); + memcpy (start1_addr, start2_addr, len2_byte); + memcpy (start1_addr + len2_byte, start1_addr + len1_byte, len_mid); + memcpy (start1_addr + len2_byte + len_mid, temp, len1_byte); SAFE_FREE (); graft_intervals_into_buffer (tmp_interval1, end2 - len1, @@ -4639,7 +4532,7 @@ Transposing beyond buffer boundaries is an error. */) void -syms_of_editfns () +syms_of_editfns (void) { environbuf = 0; initial_tz = 0; diff --git a/src/emacs.c b/src/emacs.c index 7e778e2e5fd..fbae7763877 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -90,12 +90,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; const char emacs_version[] = "24.0.50"; -extern void malloc_warning P_ ((char *)); -extern void set_time_zone_rule P_ ((char *)); -#ifdef HAVE_INDEX -extern char *index P_ ((const char *, int)); -#endif - /* Make these values available in GDB, which doesn't see macros. */ #ifdef USE_LSB_TAG @@ -157,9 +151,9 @@ int initialized; static data inside glibc's malloc. */ void *malloc_state_ptr; /* From glibc, a routine that returns a copy of the malloc internal state. */ -extern void *malloc_get_state (); +extern void *malloc_get_state (void); /* From glibc, a routine that overwrites the malloc internal state. */ -extern int malloc_set_state (); +extern int malloc_set_state (void*); /* Non-zero if the MALLOC_CHECK_ environment variable was set while dumping. Used to work around a bug in glibc's malloc. */ int malloc_using_checking; @@ -252,8 +246,8 @@ int daemon_pipe[2]; char **initial_argv; int initial_argc; -static void sort_args (); -void syms_of_emacs (); +static void sort_args (int argc, char **argv); +void syms_of_emacs (void); /* MSVC needs each string be shorter than 2048 bytes, so the usage strings below are split to not overflow this limit. */ @@ -361,7 +355,7 @@ int fatal_error_in_progress; /* If non-null, call this function from fatal_error_signal before committing suicide. */ -void (*fatal_error_signal_hook) P_ ((void)); +void (*fatal_error_signal_hook) (void); #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD /* When compiled with GTK and running under Gnome, @@ -374,8 +368,7 @@ pthread_t main_thread; /* Handle bus errors, invalid instruction, etc. */ SIGTYPE -fatal_error_signal (sig) - int sig; +fatal_error_signal (int sig) { SIGNAL_THREAD_CHECK (sig); fatal_error_code = sig; @@ -432,7 +425,7 @@ memory_warning_signal (sig) #if ! defined (DOS_NT) && ! defined (NO_ABORT) void -abort () +abort (void) { kill (getpid (), SIGABRT); /* This shouldn't be executed, but it prevents a warning. */ @@ -444,10 +437,7 @@ abort () /* Code for dealing with Lisp access to the Unix command line. */ static void -init_cmdargs (argc, argv, skip_args) - int argc; - char **argv; - int skip_args; +init_cmdargs (int argc, char **argv, int skip_args) { register int i; Lisp_Object name, dir, tem; @@ -589,7 +579,7 @@ init_cmdargs (argc, argv, skip_args) DEFUN ("invocation-name", Finvocation_name, Sinvocation_name, 0, 0, 0, doc: /* Return the program name that was used to run Emacs. Any directory names are omitted. */) - () + (void) { return Fcopy_sequence (Vinvocation_name); } @@ -597,7 +587,7 @@ Any directory names are omitted. */) DEFUN ("invocation-directory", Finvocation_directory, Sinvocation_directory, 0, 0, 0, doc: /* Return the directory name in which the Emacs executable was located. */) - () + (void) { return Fcopy_sequence (Vinvocation_directory); } @@ -616,11 +606,11 @@ static char dump_tz[] = "UtC0"; (We don't have any real constructors or destructors.) */ #ifdef __GNUC__ #ifndef GCC_CTORS_IN_LIBC -void __do_global_ctors () +void __do_global_ctors (void) {} -void __do_global_ctors_aux () +void __do_global_ctors_aux (void) {} -void __do_global_dtors () +void __do_global_dtors (void) {} /* GNU/Linux has a bug in its library; avoid an error. */ #ifndef GNU_LINUX @@ -628,7 +618,7 @@ char * __CTOR_LIST__[2] = { (char *) (-1), 0 }; #endif char * __DTOR_LIST__[2] = { (char *) (-1), 0 }; #endif /* GCC_CTORS_IN_LIBC */ -void __main () +void __main (void) {} #endif /* __GNUC__ */ #endif /* ORDINARY_LINK */ @@ -644,14 +634,7 @@ void __main () enough information to do it right. */ static int -argmatch (argv, argc, sstr, lstr, minlen, valptr, skipptr) - char **argv; - int argc; - char *sstr; - char *lstr; - int minlen; - char **valptr; - int *skipptr; +argmatch (char **argv, int argc, char *sstr, char *lstr, int minlen, char **valptr, int *skipptr) { char *p = NULL; int arglen; @@ -675,7 +658,7 @@ argmatch (argv, argc, sstr, lstr, minlen, valptr, skipptr) *skipptr += 1; return 1; } - arglen = (valptr != NULL && (p = index (arg, '=')) != NULL + arglen = (valptr != NULL && (p = strchr (arg, '=')) != NULL ? p - arg : strlen (arg)); if (lstr == 0 || arglen < minlen || strncmp (arg, lstr, arglen) != 0) return 0; @@ -709,7 +692,7 @@ argmatch (argv, argc, sstr, lstr, minlen, valptr, skipptr) possible using this special hook. */ static void -malloc_initialize_hook () +malloc_initialize_hook (void) { #ifndef USE_CRT_DLL extern char **environ; @@ -747,7 +730,7 @@ malloc_initialize_hook () } } -void (*__malloc_initialize_hook) () = malloc_initialize_hook; +void (*__malloc_initialize_hook) (void) = malloc_initialize_hook; #endif /* DOUG_LEA_MALLOC */ @@ -974,12 +957,6 @@ main (int argc, char **argv) } #endif /* MSDOS */ -#ifdef SET_EMACS_PRIORITY - if (emacs_priority) - nice (emacs_priority); - setuid (getuid ()); -#endif /* SET_EMACS_PRIORITY */ - /* Skip initial setlocale if LC_ALL is "C", as it's not needed in that case. The build procedure uses this while dumping, to ensure that the dumped Emacs does not have its system locale tables initialized, @@ -1202,7 +1179,7 @@ main (int argc, char **argv) #endif #if defined (HAVE_GTK_AND_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC) { - extern void malloc_enable_thread P_ ((void)); + extern void malloc_enable_thread (void); malloc_enable_thread (); } @@ -1663,6 +1640,9 @@ main (int argc, char **argv) #ifdef MSDOS syms_of_xmenu (); + syms_of_dosfns(); + syms_of_msdos(); + syms_of_win16select(); #endif /* MSDOS */ #ifdef HAVE_NS @@ -1677,13 +1657,9 @@ main (int argc, char **argv) syms_of_dbusbind (); #endif /* HAVE_DBUS */ -#ifdef SYMS_SYSTEM - SYMS_SYSTEM; -#endif - -#ifdef SYMS_MACHINE - SYMS_MACHINE; -#endif +#ifdef WINDOWSNT + syms_of_ntterm (); +#endif /* WINDOWSNT */ keys_of_casefiddle (); keys_of_cmds (); @@ -1772,13 +1748,14 @@ main (int argc, char **argv) extern char etext; #endif extern void safe_bcopy (); - extern void dump_opcode_frequencies (); atexit (_mcleanup); /* This uses safe_bcopy because that function comes first in the Emacs executable. It might be better to use something that gives the start of the text segment, but start_of_text is not defined on all systems now. */ + /* FIXME: Does not work on architectures with function + descriptors. */ monstartup (safe_bcopy, &etext); } else @@ -1928,9 +1905,7 @@ const struct standard_args standard_args[] = than once, eliminate all but one copy of it. */ static void -sort_args (argc, argv) - int argc; - char **argv; +sort_args (int argc, char **argv) { char **new = (char **) xmalloc (sizeof (char *) * argc); /* For each element of argv, @@ -1988,7 +1963,7 @@ sort_args (argc, argv) { match = -1; thislen = strlen (argv[from]); - equals = index (argv[from], '='); + equals = strchr (argv[from], '='); if (equals != 0) thislen = equals - argv[from]; @@ -2071,7 +2046,7 @@ sort_args (argc, argv) while (to < argc) new[to++] = 0; - bcopy (new, argv, sizeof (char *) * argc); + memcpy (argv, new, sizeof (char *) * argc); xfree (options); xfree (new); @@ -2086,8 +2061,7 @@ If ARG is a string, stuff it as keyboard input. The value of `kill-emacs-hook', if not void, is a list of functions (of no args), all of which are called before Emacs is actually killed. */) - (arg) - Lisp_Object arg; + (Lisp_Object arg) { struct gcpro gcpro1; @@ -2127,9 +2101,7 @@ all of which are called before Emacs is actually killed. */) and Fkill_emacs. */ void -shut_down_emacs (sig, no_x, stuff) - int sig, no_x; - Lisp_Object stuff; +shut_down_emacs (int sig, int no_x, Lisp_Object stuff) { /* Prevent running of hooks from now on. */ Vrun_hooks = Qnil; @@ -2158,9 +2130,7 @@ shut_down_emacs (sig, no_x, stuff) stuff_buffered_input (stuff); -#ifdef subprocesses inhibit_sentinels = 1; -#endif kill_buffer_processes (Qnil); Fdo_auto_save (Qt, Qnil); @@ -2217,8 +2187,7 @@ Take symbols from SYMFILE (presumably the file you executed to run Emacs). This is used in the file `loadup.el' when building Emacs. You must run Emacs in batch mode in order to dump it. */) - (filename, symfile) - Lisp_Object filename, symfile; + (Lisp_Object filename, Lisp_Object symfile) { extern char my_edata[]; Lisp_Object tem; @@ -2312,7 +2281,7 @@ You must run Emacs in batch mode in order to dump it. */) #if HAVE_SETLOCALE /* Recover from setlocale (LC_ALL, ""). */ void -fixup_locale () +fixup_locale (void) { /* The Emacs Lisp reader needs LC_NUMERIC to be "C", so that numbers are read and printed properly for Emacs Lisp. */ @@ -2322,10 +2291,7 @@ fixup_locale () /* Set system locale CATEGORY, with previous locale *PLOCALE, to DESIRED_LOCALE. */ static void -synchronize_locale (category, plocale, desired_locale) - int category; - Lisp_Object *plocale; - Lisp_Object desired_locale; +synchronize_locale (int category, Lisp_Object *plocale, Lisp_Object desired_locale) { if (! EQ (*plocale, desired_locale)) { @@ -2338,7 +2304,7 @@ synchronize_locale (category, plocale, desired_locale) /* Set system time locale to match Vsystem_time_locale, if possible. */ void -synchronize_system_time_locale () +synchronize_system_time_locale (void) { synchronize_locale (LC_TIME, &Vprevious_system_time_locale, Vsystem_time_locale); @@ -2347,7 +2313,7 @@ synchronize_system_time_locale () /* Set system messages locale to match Vsystem_messages_locale, if possible. */ void -synchronize_system_messages_locale () +synchronize_system_messages_locale (void) { #ifdef LC_MESSAGES synchronize_locale (LC_MESSAGES, &Vprevious_system_messages_locale, @@ -2361,17 +2327,16 @@ synchronize_system_messages_locale () #endif Lisp_Object -decode_env_path (evarname, defalt) - char *evarname, *defalt; +decode_env_path (const char *evarname, const char *defalt) { - register char *path, *p; + const char *path, *p; Lisp_Object lpath, element, tem; /* It's okay to use getenv here, because this function is only used to initialize variables when Emacs starts up, and isn't called after that. */ if (evarname != 0) - path = (char *) getenv (evarname); + path = getenv (evarname); else path = 0; if (!path) @@ -2380,18 +2345,18 @@ decode_env_path (evarname, defalt) /* Ensure values from the environment use the proper directory separator. */ if (path) { - p = alloca (strlen (path) + 1); - strcpy (p, path); - path = p; - - dostounix_filename (path); + char *path_copy = alloca (strlen (path) + 1); + strcpy (path_copy, path); + dostounix_filename (path_copy); + path = path_copy; } #endif lpath = Qnil; while (1) { - p = index (path, SEPCHAR); - if (!p) p = path + strlen (path); + p = strchr (path, SEPCHAR); + if (!p) + p = path + strlen (path); element = (p - path ? make_string (path, p - path) : build_string (".")); @@ -2424,7 +2389,7 @@ decode_env_path (evarname, defalt) DEFUN ("daemonp", Fdaemonp, Sdaemonp, 0, 0, 0, doc: /* Return non-nil if the current emacs process is a daemon. If the daemon was given a name argument, return that name. */) - () + (void) { if (IS_DAEMON) if (daemon_name) @@ -2439,7 +2404,7 @@ DEFUN ("daemon-initialized", Fdaemon_initialized, Sdaemon_initialized, 0, 0, 0, doc: /* Mark the Emacs daemon as being initialized. This finishes the daemonization process by doing the other half of detaching from the parent process and its tty file descriptors. */) - () + (void) { int nfd; @@ -2474,7 +2439,7 @@ from the parent process and its tty file descriptors. */) } void -syms_of_emacs () +syms_of_emacs (void) { Qfile_name_handler_alist = intern_c_string ("file-name-handler-alist"); staticpro (&Qfile_name_handler_alist); diff --git a/src/eval.c b/src/eval.c index a6290618753..ec031f391c8 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1,7 +1,7 @@ /* Evaluator for GNU Emacs Lisp interpreter. Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -179,21 +179,12 @@ Lisp_Object Vmacro_declaration_function; extern Lisp_Object Qrisky_local_variable; extern Lisp_Object Qfunction; -static Lisp_Object funcall_lambda P_ ((Lisp_Object, int, Lisp_Object *, - Lisp_Object)); - -static void unwind_to_catch P_ ((struct catchtag *, Lisp_Object)) NO_RETURN; - -#if __GNUC__ -/* "gcc -O3" enables automatic function inlining, which optimizes out - the arguments for the invocations of these functions, whereas they - expect these values on the stack. */ -Lisp_Object apply1 () __attribute__((noinline)); -Lisp_Object call2 () __attribute__((noinline)); -#endif +static Lisp_Object funcall_lambda (Lisp_Object, int, Lisp_Object *, + Lisp_Object); +static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN; void -init_eval_once () +init_eval_once (void) { specpdl_size = 50; specpdl = (struct specbinding *) xmalloc (specpdl_size * sizeof (struct specbinding)); @@ -206,7 +197,7 @@ init_eval_once () } void -init_eval () +init_eval (void) { specpdl_ptr = specpdl; catchlist = 0; @@ -225,8 +216,7 @@ init_eval () /* unwind-protect function used by call_debugger. */ static Lisp_Object -restore_stack_limits (data) - Lisp_Object data; +restore_stack_limits (Lisp_Object data) { max_specpdl_size = XINT (XCAR (data)); max_lisp_eval_depth = XINT (XCDR (data)); @@ -236,8 +226,7 @@ restore_stack_limits (data) /* Call the Lisp debugger, giving it argument ARG. */ Lisp_Object -call_debugger (arg) - Lisp_Object arg; +call_debugger (Lisp_Object arg) { int debug_while_redisplaying; int count = SPECPDL_INDEX (); @@ -293,8 +282,7 @@ call_debugger (arg) } void -do_debug_on_call (code) - Lisp_Object code; +do_debug_on_call (Lisp_Object code) { debug_on_next_call = 0; backtrace_list->debug_on_exit = 1; @@ -310,8 +298,7 @@ DEFUN ("or", For, Sor, 0, UNEVALLED, 0, The remaining args are not evalled at all. If all args return nil, return nil. usage: (or CONDITIONS...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { register Lisp_Object val = Qnil; struct gcpro gcpro1; @@ -335,8 +322,7 @@ DEFUN ("and", Fand, Sand, 0, UNEVALLED, 0, The remaining args are not evalled at all. If no arg yields nil, return the last arg's value. usage: (and CONDITIONS...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { register Lisp_Object val = Qt; struct gcpro gcpro1; @@ -361,8 +347,7 @@ Returns the value of THEN or the value of the last of the ELSE's. THEN must be one expression, but ELSE... can be zero or more expressions. If COND yields nil, and there are no ELSE's, the value is nil. usage: (if COND THEN ELSE...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { register Lisp_Object cond; struct gcpro gcpro1; @@ -386,8 +371,7 @@ If no clause succeeds, cond returns nil. If a clause has one element, as in (CONDITION), CONDITION's value if non-nil is returned from the cond-form. usage: (cond CLAUSES...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { register Lisp_Object clause, val; struct gcpro gcpro1; @@ -414,8 +398,7 @@ usage: (cond CLAUSES...) */) DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0, doc: /* Eval BODY forms sequentially and return value of last one. usage: (progn BODY...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { register Lisp_Object val = Qnil; struct gcpro gcpro1; @@ -437,8 +420,7 @@ DEFUN ("prog1", Fprog1, Sprog1, 1, UNEVALLED, 0, The value of FIRST is saved during the evaluation of the remaining args, whose values are discarded. usage: (prog1 FIRST BODY...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { Lisp_Object val; register Lisp_Object args_left; @@ -455,7 +437,7 @@ usage: (prog1 FIRST BODY...) */) do { if (!(argnum++)) - val = Feval (Fcar (args_left)); + val = Feval (Fcar (args_left)); else Feval (Fcar (args_left)); args_left = Fcdr (args_left); @@ -471,8 +453,7 @@ DEFUN ("prog2", Fprog2, Sprog2, 2, UNEVALLED, 0, The value of FORM2 is saved during the evaluation of the remaining args, whose values are discarded. usage: (prog2 FORM1 FORM2 BODY...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { Lisp_Object val; register Lisp_Object args_left; @@ -491,7 +472,7 @@ usage: (prog2 FORM1 FORM2 BODY...) */) do { if (!(argnum++)) - val = Feval (Fcar (args_left)); + val = Feval (Fcar (args_left)); else Feval (Fcar (args_left)); args_left = Fcdr (args_left); @@ -511,8 +492,7 @@ The second VAL is not computed until after the first SYM is set, and so on; each VAL can use the new value of variables set earlier in the `setq'. The return value of the `setq' form is the value of the last VAL. usage: (setq [SYM VAL]...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { register Lisp_Object args_left; register Lisp_Object val, sym, lex_binding; @@ -548,8 +528,7 @@ usage: (setq [SYM VAL]...) */) DEFUN ("quote", Fquote, Squote, 1, UNEVALLED, 0, doc: /* Return the argument, without evaluating it. `(quote x)' yields `x'. usage: (quote ARG) */) - (args) - Lisp_Object args; + (Lisp_Object args) { if (!NILP (Fcdr (args))) xsignal2 (Qwrong_number_of_arguments, Qquote, Flength (args)); @@ -561,8 +540,7 @@ DEFUN ("function", Ffunction, Sfunction, 1, UNEVALLED, 0, In byte compilation, `function' causes its argument to be compiled. `quote' cannot do that. usage: (function ARG) */) - (args) - Lisp_Object args; + (Lisp_Object args) { Lisp_Object quoted = XCAR (args); @@ -598,7 +576,7 @@ To test whether your function was called with `call-interactively', either (i) add an extra optional argument and give it an `interactive' spec that specifies non-nil unconditionally (such as \"p\"); or (ii) use `called-interactively-p'. */) - () + (void) { return interactive_p (1) ? Qt : Qnil; } @@ -624,8 +602,7 @@ function-modifying features. Instead of using this, it is sometimes cleaner to give your function an extra optional argument whose `interactive' spec specifies non-nil unconditionally (\"p\" is a good way to do this), or via (not (or executing-kbd-macro noninteractive)). */) - (kind) - Lisp_Object kind; + (Lisp_Object kind) { return ((INTERACTIVE || !EQ (kind, intern ("interactive"))) && interactive_p (1)) ? Qt : Qnil; @@ -639,8 +616,7 @@ way to do this), or via (not (or executing-kbd-macro noninteractive)). */) called is a built-in. */ int -interactive_p (exclude_subrs_p) - int exclude_subrs_p; +interactive_p (int exclude_subrs_p) { struct backtrace *btp; Lisp_Object fun; @@ -687,8 +663,7 @@ DEFUN ("defun", Fdefun, Sdefun, 2, UNEVALLED, 0, The definition is (lambda ARGLIST [DOCSTRING] BODY...). See also the function `interactive'. usage: (defun NAME ARGLIST [DOCSTRING] BODY...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { register Lisp_Object fn_name; register Lisp_Object defn; @@ -733,8 +708,7 @@ The elements can look like this: Set NAME's `doc-string-elt' property to ELT. usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { register Lisp_Object fn_name; register Lisp_Object defn; @@ -796,8 +770,7 @@ or of the variable at the end of the chain of aliases, if BASE-VARIABLE is itself an alias. If NEW-ALIAS is bound, and BASE-VARIABLE is not, then the value of BASE-VARIABLE is set to that of NEW-ALIAS. The return value is BASE-VARIABLE. */) - (new_alias, base_variable, docstring) - Lisp_Object new_alias, base_variable, docstring; + (Lisp_Object new_alias, Lisp_Object base_variable, Lisp_Object docstring) { struct Lisp_Symbol *sym; @@ -869,8 +842,7 @@ load a file defining variables, with this form or with `defconst' or for these variables. \(`defconst' and `defcustom' behave similarly in this respect.) usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) - (args) - Lisp_Object args; + (Lisp_Object args) { register Lisp_Object sym, tem, tail; @@ -945,8 +917,7 @@ If SYMBOL has a local binding, then this form sets the local binding's value. However, you should normally not make local bindings for variables defined with this form. usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) - (args) - Lisp_Object args; + (Lisp_Object args) { register Lisp_Object sym, tem; @@ -973,8 +944,7 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) /* Error handler used in Fuser_variable_p. */ static Lisp_Object -user_variable_p_eh (ignore) - Lisp_Object ignore; +user_variable_p_eh (Lisp_Object ignore) { return Qnil; } @@ -996,8 +966,7 @@ A variable is a user variable if \(3) it is an alias for another user variable. Return nil if VARIABLE is an alias and there is a loop in the chain of symbols. */) - (variable) - Lisp_Object variable; + (Lisp_Object variable) { Lisp_Object documentation; @@ -1007,30 +976,30 @@ chain of symbols. */) /* If indirect and there's an alias loop, don't check anything else. */ if (XSYMBOL (variable)->redirect == SYMBOL_VARALIAS && NILP (internal_condition_case_1 (lisp_indirect_variable, variable, - Qt, user_variable_p_eh))) + Qt, user_variable_p_eh))) return Qnil; while (1) { documentation = Fget (variable, Qvariable_documentation); if (INTEGERP (documentation) && XINT (documentation) < 0) - return Qt; + return Qt; if (STRINGP (documentation) - && ((unsigned char) SREF (documentation, 0) == '*')) - return Qt; + && ((unsigned char) SREF (documentation, 0) == '*')) + return Qt; /* If it is (STRING . INTEGER), a negative integer means a user variable. */ if (CONSP (documentation) - && STRINGP (XCAR (documentation)) - && INTEGERP (XCDR (documentation)) - && XINT (XCDR (documentation)) < 0) - return Qt; + && STRINGP (XCAR (documentation)) + && INTEGERP (XCDR (documentation)) + && XINT (XCDR (documentation)) < 0) + return Qt; /* Customizable? See `custom-variable-p'. */ if ((!NILP (Fget (variable, intern ("standard-value")))) - || (!NILP (Fget (variable, intern ("custom-autoload"))))) - return Qt; + || (!NILP (Fget (variable, intern ("custom-autoload"))))) + return Qt; if (!(XSYMBOL (variable)->redirect == SYMBOL_VARALIAS)) - return Qnil; + return Qnil; /* An indirect variable? Let's follow the chain. */ XSETSYMBOL (variable, SYMBOL_ALIAS (XSYMBOL (variable))); @@ -1044,8 +1013,7 @@ Each element of VARLIST is a symbol (which is bound to nil) or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM). Each VALUEFORM can refer to the symbols already bound by this VARLIST. usage: (let* VARLIST BODY...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { Lisp_Object varlist, var, val, elt, lexenv; int count = SPECPDL_INDEX (); @@ -1101,8 +1069,7 @@ Each element of VARLIST is a symbol (which is bound to nil) or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM). All the VALUEFORMs are evalled before any symbols are bound. usage: (let VARLIST BODY...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { Lisp_Object *temps, tem, lexenv; register Lisp_Object elt, varlist; @@ -1168,8 +1135,7 @@ DEFUN ("while", Fwhile, Swhile, 1, UNEVALLED, 0, The order of execution is thus TEST, BODY, TEST, BODY and so on until TEST returns nil. usage: (while TEST BODY...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { Lisp_Object test, body; struct gcpro gcpro1, gcpro2; @@ -1196,9 +1162,7 @@ in place of FORM. When a non-macro-call results, it is returned. The second optional arg ENVIRONMENT specifies an environment of macro definitions to shadow the loaded ones for use in file byte-compilation. */) - (form, environment) - Lisp_Object form; - Lisp_Object environment; + (Lisp_Object form, Lisp_Object environment) { /* With cleanups from Hallvard Furuseth. */ register Lisp_Object expander, sym, def, tem; @@ -1276,8 +1240,7 @@ Within BODY, a call to `throw' with the same TAG exits BODY and this `catch'. If no throw happens, `catch' returns the value of the last BODY form. If a throw happens, it specifies the value to return from `catch'. usage: (catch TAG BODY...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { register Lisp_Object tag; struct gcpro gcpro1; @@ -1293,10 +1256,7 @@ usage: (catch TAG BODY...) */) This is how catches are done from within C code. */ Lisp_Object -internal_catch (tag, func, arg) - Lisp_Object tag; - Lisp_Object (*func) (); - Lisp_Object arg; +internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object arg) { /* This structure is made part of the chain `catchlist'. */ struct catchtag c; @@ -1341,9 +1301,7 @@ internal_catch (tag, func, arg) This is used for correct unwinding in Fthrow and Fsignal. */ static void -unwind_to_catch (catch, value) - struct catchtag *catch; - Lisp_Object value; +unwind_to_catch (struct catchtag *catch, Lisp_Object value) { register int last_time; @@ -1361,7 +1319,7 @@ unwind_to_catch (catch, value) last_time = catchlist == catch; /* Unwind the specpdl stack, and then restore the proper set of - handlers. */ + handlers. */ unbind_to (catchlist->pdlcount, Qnil); handlerlist = catchlist->handlerlist; catchlist = catchlist->next; @@ -1372,8 +1330,8 @@ unwind_to_catch (catch, value) /* If x_catch_errors was done, turn it off now. (First we give unbind_to a chance to do that.) */ #if 0 /* This would disable x_catch_errors after x_connection_closed. - * The catch must remain in effect during that delicate - * state. --lorentey */ + The catch must remain in effect during that delicate + state. --lorentey */ x_fully_uncatch_errors (); #endif #endif @@ -1395,8 +1353,7 @@ unwind_to_catch (catch, value) DEFUN ("throw", Fthrow, Sthrow, 2, 2, 0, doc: /* Throw to the catch for TAG and return VALUE from it. Both TAG and VALUE are evalled. */) - (tag, value) - register Lisp_Object tag, value; + (register Lisp_Object tag, Lisp_Object value) { register struct catchtag *c; @@ -1416,8 +1373,7 @@ If BODYFORM completes normally, its value is returned after executing the UNWINDFORMS. If BODYFORM exits nonlocally, the UNWINDFORMS are executed anyway. usage: (unwind-protect BODYFORM UNWINDFORMS...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { Lisp_Object val; int count = SPECPDL_INDEX (); @@ -1451,14 +1407,13 @@ instead of a single condition name. Then it handles all of them. When a handler handles an error, control returns to the `condition-case' and it executes the handler's BODY... with VAR bound to (ERROR-SYMBOL . SIGNAL-DATA) from the error. -(If VAR is nil, the handler can't access that information.) +\(If VAR is nil, the handler can't access that information.) Then the value of the last BODY form is returned from the `condition-case' expression. See also the function `signal' for more info. usage: (condition-case VAR BODYFORM &rest HANDLERS) */) - (args) - Lisp_Object args; + (Lisp_Object args) { register Lisp_Object bodyform, handlers; volatile Lisp_Object var; @@ -1474,9 +1429,8 @@ usage: (condition-case VAR BODYFORM &rest HANDLERS) */) rather than passed in a list. Used by Fbyte_code. */ Lisp_Object -internal_lisp_condition_case (var, bodyform, handlers) - volatile Lisp_Object var; - Lisp_Object bodyform, handlers; +internal_lisp_condition_case (volatile Lisp_Object var, Lisp_Object bodyform, + Lisp_Object handlers) { Lisp_Object val; struct catchtag c; @@ -1508,7 +1462,7 @@ internal_lisp_condition_case (var, bodyform, handlers) if (_setjmp (c.jmp)) { if (!NILP (h.var)) - specbind (h.var, c.val); + specbind (h.var, c.val); val = Fprogn (Fcdr (h.chosen_clause)); /* Note that this just undoes the binding of h.var; whoever @@ -1543,10 +1497,8 @@ internal_lisp_condition_case (var, bodyform, handlers) but allow the debugger to run if that is enabled. */ Lisp_Object -internal_condition_case (bfun, handlers, hfun) - Lisp_Object (*bfun) (); - Lisp_Object handlers; - Lisp_Object (*hfun) (); +internal_condition_case (Lisp_Object (*bfun) (void), Lisp_Object handlers, + Lisp_Object (*hfun) (Lisp_Object)) { Lisp_Object val; struct catchtag c; @@ -1590,11 +1542,8 @@ internal_condition_case (bfun, handlers, hfun) /* Like internal_condition_case but call BFUN with ARG as its argument. */ Lisp_Object -internal_condition_case_1 (bfun, arg, handlers, hfun) - Lisp_Object (*bfun) (); - Lisp_Object arg; - Lisp_Object handlers; - Lisp_Object (*hfun) (); +internal_condition_case_1 (Lisp_Object (*bfun) (Lisp_Object), Lisp_Object arg, + Lisp_Object handlers, Lisp_Object (*hfun) (Lisp_Object)) { Lisp_Object val; struct catchtag c; @@ -1734,8 +1683,8 @@ internal_condition_case_n (Lisp_Object (*bfun) (int, Lisp_Object*), } -static Lisp_Object find_handler_clause P_ ((Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object)); +static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object); DEFUN ("signal", Fsignal, Ssignal, 2, 2, 0, doc: /* Signal an error. Args are ERROR-SYMBOL and associated DATA. @@ -1751,8 +1700,7 @@ See Info anchor `(elisp)Definition of signal' for some details on how this error message is constructed. If the signal is handled, DATA is made available to the handler. See also the function `condition-case'. */) - (error_symbol, data) - Lisp_Object error_symbol, data; + (Lisp_Object error_symbol, Lisp_Object data) { /* When memory is full, ERROR-SYMBOL is nil, and DATA is (REAL-ERROR-SYMBOL . REAL-DATA). @@ -1864,8 +1812,7 @@ See also the function `condition-case'. */) Used for anything but Qquit (which can return from Fsignal). */ void -xsignal (error_symbol, data) - Lisp_Object error_symbol, data; +xsignal (Lisp_Object error_symbol, Lisp_Object data) { Fsignal (error_symbol, data); abort (); @@ -1874,29 +1821,25 @@ xsignal (error_symbol, data) /* Like xsignal, but takes 0, 1, 2, or 3 args instead of a list. */ void -xsignal0 (error_symbol) - Lisp_Object error_symbol; +xsignal0 (Lisp_Object error_symbol) { xsignal (error_symbol, Qnil); } void -xsignal1 (error_symbol, arg) - Lisp_Object error_symbol, arg; +xsignal1 (Lisp_Object error_symbol, Lisp_Object arg) { xsignal (error_symbol, list1 (arg)); } void -xsignal2 (error_symbol, arg1, arg2) - Lisp_Object error_symbol, arg1, arg2; +xsignal2 (Lisp_Object error_symbol, Lisp_Object arg1, Lisp_Object arg2) { xsignal (error_symbol, list2 (arg1, arg2)); } void -xsignal3 (error_symbol, arg1, arg2, arg3) - Lisp_Object error_symbol, arg1, arg2, arg3; +xsignal3 (Lisp_Object error_symbol, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) { xsignal (error_symbol, list3 (arg1, arg2, arg3)); } @@ -1905,9 +1848,7 @@ xsignal3 (error_symbol, arg1, arg2, arg3) If ARG is not a genuine list, make it a one-element list. */ void -signal_error (s, arg) - char *s; - Lisp_Object arg; +signal_error (const char *s, Lisp_Object arg) { Lisp_Object tortoise, hare; @@ -1936,8 +1877,7 @@ signal_error (s, arg) a list containing one of CONDITIONS. */ static int -wants_debugger (list, conditions) - Lisp_Object list, conditions; +wants_debugger (Lisp_Object list, Lisp_Object conditions) { if (NILP (list)) return 0; @@ -1961,8 +1901,7 @@ wants_debugger (list, conditions) according to debugger-ignored-errors. */ static int -skip_debugger (conditions, data) - Lisp_Object conditions, data; +skip_debugger (Lisp_Object conditions, Lisp_Object data) { Lisp_Object tail; int first_string = 1; @@ -1999,8 +1938,7 @@ skip_debugger (conditions, data) SIG and DATA describe the signal, as in find_handler_clause. */ static int -maybe_call_debugger (conditions, sig, data) - Lisp_Object conditions, sig, data; +maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data) { Lisp_Object combined_data; @@ -2036,8 +1974,8 @@ maybe_call_debugger (conditions, sig, data) a second error here in case we're handling specpdl overflow. */ static Lisp_Object -find_handler_clause (handlers, conditions, sig, data) - Lisp_Object handlers, conditions, sig, data; +find_handler_clause (Lisp_Object handlers, Lisp_Object conditions, + Lisp_Object sig, Lisp_Object data) { register Lisp_Object h; register Lisp_Object tem; @@ -2126,13 +2064,10 @@ find_handler_clause (handlers, conditions, sig, data) return Qnil; } -/* dump an error message; called like printf */ -/* VARARGS 1 */ +/* dump an error message; called like vprintf */ void -error (m, a1, a2, a3) - char *m; - char *a1, *a2, *a3; +verror (const char *m, va_list ap) { char buf[200]; int size = 200; @@ -2142,15 +2077,12 @@ error (m, a1, a2, a3) int allocated = 0; Lisp_Object string; - args[0] = a1; - args[1] = a2; - args[2] = a3; - mlen = strlen (m); while (1) { - int used = doprnt (buffer, size, m, m + mlen, 3, args); + int used; + used = doprnt (buffer, size, m, m + mlen, ap); if (used < size) break; size *= 2; @@ -2169,6 +2101,19 @@ error (m, a1, a2, a3) xsignal1 (Qerror, string); } + + +/* dump an error message; called like printf */ + +/* VARARGS 1 */ +void +error (const char *m, ...) +{ + va_list ap; + va_start (ap, m); + verror (m, ap); + va_end (ap); +} DEFUN ("commandp", Fcommandp, Scommandp, 1, 2, 0, doc: /* Non-nil if FUNCTION makes provisions for interactive calling. @@ -2185,8 +2130,7 @@ Also, a symbol satisfies `commandp' if its function definition does so. If the optional argument FOR-CALL-INTERACTIVELY is non-nil, then strings and vectors are not accepted. */) - (function, for_call_interactively) - Lisp_Object function, for_call_interactively; + (Lisp_Object function, Lisp_Object for_call_interactively) { register Lisp_Object fun; register Lisp_Object funcar; @@ -2250,8 +2194,7 @@ Third through fifth args give info about the real definition. They default to nil. If FUNCTION is already defined other than as an autoload, this does nothing and returns nil. */) - (function, file, docstring, interactive, type) - Lisp_Object function, file, docstring, interactive, type; + (Lisp_Object function, Lisp_Object file, Lisp_Object docstring, Lisp_Object interactive, Lisp_Object type) { CHECK_SYMBOL (function); CHECK_STRING (file); @@ -2279,8 +2222,7 @@ this does nothing and returns nil. */) } Lisp_Object -un_autoload (oldqueue) - Lisp_Object oldqueue; +un_autoload (Lisp_Object oldqueue) { register Lisp_Object queue, first, second; @@ -2307,8 +2249,7 @@ un_autoload (oldqueue) FUNDEF is the autoload definition (a list). */ void -do_autoload (fundef, funname) - Lisp_Object fundef, funname; +do_autoload (Lisp_Object fundef, Lisp_Object funname) { int count = SPECPDL_INDEX (); Lisp_Object fun; @@ -2333,7 +2274,7 @@ do_autoload (fundef, funname) the function. We do this in the specific case of autoloading because autoloading is not an explicit request "load this file", but rather a request to "call this function". - + The value saved here is to be restored into Vautoload_queue. */ record_unwind_protect (un_autoload, Vautoload_queue); Vautoload_queue = Qt; @@ -2354,8 +2295,7 @@ do_autoload (fundef, funname) DEFUN ("eval", Feval, Seval, 1, 1, 0, doc: /* Evaluate FORM and return its value. */) - (form) - Lisp_Object form; + (Lisp_Object form) { Lisp_Object fun, val, original_fun, original_args; Lisp_Object funcar; @@ -2453,7 +2393,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, if (XSUBR (fun)->max_args == UNEVALLED) { backtrace.evalargs = 0; - val = (*XSUBR (fun)->function) (args_left); + val = (XSUBR (fun)->function.aUNEVALLED) (args_left); goto done; } @@ -2479,7 +2419,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, backtrace.args = vals; backtrace.nargs = XINT (numargs); - val = (*XSUBR (fun)->function) (XINT (numargs), vals); + val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals); UNGCPRO; goto done; } @@ -2503,40 +2443,40 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, switch (i) { case 0: - val = (*XSUBR (fun)->function) (); + val = (XSUBR (fun)->function.a0) (); goto done; case 1: - val = (*XSUBR (fun)->function) (argvals[0]); + val = (XSUBR (fun)->function.a1) (argvals[0]); goto done; case 2: - val = (*XSUBR (fun)->function) (argvals[0], argvals[1]); + val = (XSUBR (fun)->function.a2) (argvals[0], argvals[1]); goto done; case 3: - val = (*XSUBR (fun)->function) (argvals[0], argvals[1], - argvals[2]); + val = (XSUBR (fun)->function.a3) (argvals[0], argvals[1], + argvals[2]); goto done; case 4: - val = (*XSUBR (fun)->function) (argvals[0], argvals[1], - argvals[2], argvals[3]); + val = (XSUBR (fun)->function.a4) (argvals[0], argvals[1], + argvals[2], argvals[3]); goto done; case 5: - val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2], - argvals[3], argvals[4]); + val = (XSUBR (fun)->function.a5) (argvals[0], argvals[1], argvals[2], + argvals[3], argvals[4]); goto done; case 6: - val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2], - argvals[3], argvals[4], argvals[5]); + val = (XSUBR (fun)->function.a6) (argvals[0], argvals[1], argvals[2], + argvals[3], argvals[4], argvals[5]); goto done; case 7: - val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2], - argvals[3], argvals[4], argvals[5], - argvals[6]); + val = (XSUBR (fun)->function.a7) (argvals[0], argvals[1], argvals[2], + argvals[3], argvals[4], argvals[5], + argvals[6]); goto done; case 8: - val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2], - argvals[3], argvals[4], argvals[5], - argvals[6], argvals[7]); + val = (XSUBR (fun)->function.a8) (argvals[0], argvals[1], argvals[2], + argvals[3], argvals[4], argvals[5], + argvals[6], argvals[7]); goto done; default: @@ -2597,9 +2537,7 @@ DEFUN ("apply", Fapply, Sapply, 2, MANY, 0, Then return the value FUNCTION returns. Thus, (apply '+ 1 2 '(3 4)) returns 10. usage: (apply FUNCTION &rest ARGUMENTS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { register int i, numargs; register Lisp_Object spread_arg; @@ -2663,7 +2601,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) gcpro1.nvars = 1 + numargs; } - bcopy (args, funcall_args, nargs * sizeof (Lisp_Object)); + memcpy (funcall_args, args, nargs * sizeof (Lisp_Object)); /* Spread the last arg we got. Its first element goes in the slot that it used to occupy, hence this value of I. */ i = nargs - 1; @@ -2680,8 +2618,8 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) /* Run hook variables in various ways. */ enum run_hooks_condition {to_completion, until_success, until_failure}; -static Lisp_Object run_hook_with_args P_ ((int, Lisp_Object *, - enum run_hooks_condition)); +static Lisp_Object run_hook_with_args (int, Lisp_Object *, + enum run_hooks_condition); DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0, doc: /* Run each hook in HOOKS. @@ -2698,9 +2636,7 @@ hook; they should use `run-mode-hooks' instead. Do not use `make-local-variable' to make a hook variable buffer-local. Instead, use `add-hook' and specify t for the LOCAL argument. usage: (run-hooks &rest HOOKS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { Lisp_Object hook[1]; register int i; @@ -2729,9 +2665,7 @@ as that may change. Do not use `make-local-variable' to make a hook variable buffer-local. Instead, use `add-hook' and specify t for the LOCAL argument. usage: (run-hook-with-args HOOK &rest ARGS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { return run_hook_with_args (nargs, args, to_completion); } @@ -2751,9 +2685,7 @@ However, if they all return nil, we return nil. Do not use `make-local-variable' to make a hook variable buffer-local. Instead, use `add-hook' and specify t for the LOCAL argument. usage: (run-hook-with-args-until-success HOOK &rest ARGS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { return run_hook_with_args (nargs, args, until_success); } @@ -2772,9 +2704,7 @@ Then we return nil. However, if they all return non-nil, we return non-nil. Do not use `make-local-variable' to make a hook variable buffer-local. Instead, use `add-hook' and specify t for the LOCAL argument. usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { return run_hook_with_args (nargs, args, until_failure); } @@ -2788,10 +2718,7 @@ usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */) except that it isn't necessary to gcpro ARGS[0]. */ static Lisp_Object -run_hook_with_args (nargs, args, cond) - int nargs; - Lisp_Object *args; - enum run_hooks_condition cond; +run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond) { Lisp_Object sym, val, ret; struct gcpro gcpro1, gcpro2, gcpro3; @@ -2871,10 +2798,7 @@ run_hook_with_args (nargs, args, cond) except that it isn't necessary to gcpro ARGS[0]. */ Lisp_Object -run_hook_list_with_args (funlist, nargs, args) - Lisp_Object funlist; - int nargs; - Lisp_Object *args; +run_hook_list_with_args (Lisp_Object funlist, int nargs, Lisp_Object *args) { Lisp_Object sym; Lisp_Object val; @@ -2916,8 +2840,7 @@ run_hook_list_with_args (funlist, nargs, args) /* Run the hook HOOK, giving each function the two args ARG1 and ARG2. */ void -run_hook_with_args_2 (hook, arg1, arg2) - Lisp_Object hook, arg1, arg2; +run_hook_with_args_2 (Lisp_Object hook, Lisp_Object arg1, Lisp_Object arg2) { Lisp_Object temp[3]; temp[0] = hook; @@ -2929,8 +2852,7 @@ run_hook_with_args_2 (hook, arg1, arg2) /* Apply fn to arg */ Lisp_Object -apply1 (fn, arg) - Lisp_Object fn, arg; +apply1 (Lisp_Object fn, Lisp_Object arg) { struct gcpro gcpro1; @@ -2949,8 +2871,7 @@ apply1 (fn, arg) /* Call function fn on no arguments */ Lisp_Object -call0 (fn) - Lisp_Object fn; +call0 (Lisp_Object fn) { struct gcpro gcpro1; @@ -2961,8 +2882,7 @@ call0 (fn) /* Call function fn with 1 argument arg1 */ /* ARGSUSED */ Lisp_Object -call1 (fn, arg1) - Lisp_Object fn, arg1; +call1 (Lisp_Object fn, Lisp_Object arg1) { struct gcpro gcpro1; Lisp_Object args[2]; @@ -2977,8 +2897,7 @@ call1 (fn, arg1) /* Call function fn with 2 arguments arg1, arg2 */ /* ARGSUSED */ Lisp_Object -call2 (fn, arg1, arg2) - Lisp_Object fn, arg1, arg2; +call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) { struct gcpro gcpro1; Lisp_Object args[3]; @@ -2993,8 +2912,7 @@ call2 (fn, arg1, arg2) /* Call function fn with 3 arguments arg1, arg2, arg3 */ /* ARGSUSED */ Lisp_Object -call3 (fn, arg1, arg2, arg3) - Lisp_Object fn, arg1, arg2, arg3; +call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) { struct gcpro gcpro1; Lisp_Object args[4]; @@ -3010,8 +2928,8 @@ call3 (fn, arg1, arg2, arg3) /* Call function fn with 4 arguments arg1, arg2, arg3, arg4 */ /* ARGSUSED */ Lisp_Object -call4 (fn, arg1, arg2, arg3, arg4) - Lisp_Object fn, arg1, arg2, arg3, arg4; +call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, + Lisp_Object arg4) { struct gcpro gcpro1; Lisp_Object args[5]; @@ -3028,8 +2946,8 @@ call4 (fn, arg1, arg2, arg3, arg4) /* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5 */ /* ARGSUSED */ Lisp_Object -call5 (fn, arg1, arg2, arg3, arg4, arg5) - Lisp_Object fn, arg1, arg2, arg3, arg4, arg5; +call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, + Lisp_Object arg4, Lisp_Object arg5) { struct gcpro gcpro1; Lisp_Object args[6]; @@ -3047,8 +2965,8 @@ call5 (fn, arg1, arg2, arg3, arg4, arg5) /* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6 */ /* ARGSUSED */ Lisp_Object -call6 (fn, arg1, arg2, arg3, arg4, arg5, arg6) - Lisp_Object fn, arg1, arg2, arg3, arg4, arg5, arg6; +call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, + Lisp_Object arg4, Lisp_Object arg5, Lisp_Object arg6) { struct gcpro gcpro1; Lisp_Object args[7]; @@ -3067,8 +2985,8 @@ call6 (fn, arg1, arg2, arg3, arg4, arg5, arg6) /* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7 */ /* ARGSUSED */ Lisp_Object -call7 (fn, arg1, arg2, arg3, arg4, arg5, arg6, arg7) - Lisp_Object fn, arg1, arg2, arg3, arg4, arg5, arg6, arg7; +call7 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, + Lisp_Object arg4, Lisp_Object arg5, Lisp_Object arg6, Lisp_Object arg7) { struct gcpro gcpro1; Lisp_Object args[8]; @@ -3126,9 +3044,7 @@ DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0, Return the value that function returns. Thus, (funcall 'cons 'x 'y) returns (x . y). usage: (funcall FUNCTION &rest ARGUMENTS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { Lisp_Object fun, original_fun; Lisp_Object funcar; @@ -3191,14 +3107,14 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) if (XSUBR (fun)->max_args == MANY) { - val = (*XSUBR (fun)->function) (numargs, args + 1); + val = (XSUBR (fun)->function.aMANY) (numargs, args + 1); goto done; } if (XSUBR (fun)->max_args > numargs) { internal_args = (Lisp_Object *) alloca (XSUBR (fun)->max_args * sizeof (Lisp_Object)); - bcopy (args + 1, internal_args, numargs * sizeof (Lisp_Object)); + memcpy (internal_args, args + 1, numargs * sizeof (Lisp_Object)); for (i = numargs; i < XSUBR (fun)->max_args; i++) internal_args[i] = Qnil; } @@ -3207,44 +3123,44 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) switch (XSUBR (fun)->max_args) { case 0: - val = (*XSUBR (fun)->function) (); + val = (XSUBR (fun)->function.a0) (); goto done; case 1: - val = (*XSUBR (fun)->function) (internal_args[0]); + val = (XSUBR (fun)->function.a1) (internal_args[0]); goto done; case 2: - val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1]); + val = (XSUBR (fun)->function.a2) (internal_args[0], internal_args[1]); goto done; case 3: - val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1], - internal_args[2]); + val = (XSUBR (fun)->function.a3) (internal_args[0], internal_args[1], + internal_args[2]); goto done; case 4: - val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1], - internal_args[2], internal_args[3]); + val = (XSUBR (fun)->function.a4) (internal_args[0], internal_args[1], + internal_args[2], internal_args[3]); goto done; case 5: - val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1], - internal_args[2], internal_args[3], - internal_args[4]); + val = (XSUBR (fun)->function.a5) (internal_args[0], internal_args[1], + internal_args[2], internal_args[3], + internal_args[4]); goto done; case 6: - val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1], - internal_args[2], internal_args[3], - internal_args[4], internal_args[5]); + val = (XSUBR (fun)->function.a6) (internal_args[0], internal_args[1], + internal_args[2], internal_args[3], + internal_args[4], internal_args[5]); goto done; case 7: - val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1], - internal_args[2], internal_args[3], - internal_args[4], internal_args[5], - internal_args[6]); + val = (XSUBR (fun)->function.a7) (internal_args[0], internal_args[1], + internal_args[2], internal_args[3], + internal_args[4], internal_args[5], + internal_args[6]); goto done; case 8: - val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1], - internal_args[2], internal_args[3], - internal_args[4], internal_args[5], - internal_args[6], internal_args[7]); + val = (XSUBR (fun)->function.a8) (internal_args[0], internal_args[1], + internal_args[2], internal_args[3], + internal_args[4], internal_args[5], + internal_args[6], internal_args[7]); goto done; default: @@ -3294,10 +3210,8 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) } Lisp_Object -apply_lambda (fun, args, eval_flag, lexenv) - Lisp_Object fun, args; - int eval_flag; - Lisp_Object lexenv; +apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag, + Lisp_Object lexenv) { Lisp_Object args_left; Lisp_Object numargs; @@ -3395,11 +3309,9 @@ funcall_funvec (fun, nargs, args) FUN must be either a lambda-expression or a compiled-code object. */ static Lisp_Object -funcall_lambda (fun, nargs, arg_vector, lexenv) - Lisp_Object fun; - int nargs; - register Lisp_Object *arg_vector; - Lisp_Object lexenv; +funcall_lambda (Lisp_Object fun, int nargs, + register Lisp_Object *arg_vector, + Lisp_Object lexenv) { Lisp_Object val, syms_left, next; int count = SPECPDL_INDEX (); @@ -3516,8 +3428,7 @@ funcall_lambda (fun, nargs, arg_vector, lexenv) DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode, 1, 1, 0, doc: /* If byte-compiled OBJECT is lazy-loaded, fetch it now. */) - (object) - Lisp_Object object; + (Lisp_Object object) { Lisp_Object tem; @@ -3539,7 +3450,7 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode, } void -grow_specpdl () +grow_specpdl (void) { register int count = SPECPDL_INDEX (); if (specpdl_size >= max_specpdl_size) @@ -3572,8 +3483,7 @@ grow_specpdl () BUFFER did not yet have a buffer-local value). */ void -specbind (symbol, value) - Lisp_Object symbol, value; +specbind (Lisp_Object symbol, Lisp_Object value) { struct Lisp_Symbol *sym; @@ -3590,18 +3500,17 @@ specbind (symbol, value) case SYMBOL_VARALIAS: sym = indirect_variable (sym); XSETSYMBOL (symbol, sym); goto start; case SYMBOL_PLAINVAL: - { /* The most common case is that of a non-constant symbol with a - trivial value. Make that as fast as we can. */ - specpdl_ptr->symbol = symbol; - specpdl_ptr->old_value = SYMBOL_VAL (sym); - specpdl_ptr->func = NULL; - ++specpdl_ptr; - if (!sym->constant) - SET_SYMBOL_VAL (sym, value); - else - set_internal (symbol, value, Qnil, 1); - break; - } + /* The most common case is that of a non-constant symbol with a + trivial value. Make that as fast as we can. */ + specpdl_ptr->symbol = symbol; + specpdl_ptr->old_value = SYMBOL_VAL (sym); + specpdl_ptr->func = NULL; + ++specpdl_ptr; + if (!sym->constant) + SET_SYMBOL_VAL (sym, value); + else + set_internal (symbol, value, Qnil, 1); + break; case SYMBOL_LOCALIZED: if (SYMBOL_BLV (sym)->frame_local) error ("Frame-local vars cannot be let-bound"); @@ -3671,9 +3580,7 @@ specbind (symbol, value) } void -record_unwind_protect (function, arg) - Lisp_Object (*function) P_ ((Lisp_Object)); - Lisp_Object arg; +record_unwind_protect (Lisp_Object (*function) (Lisp_Object), Lisp_Object arg) { eassert (!handling_signal); @@ -3686,9 +3593,7 @@ record_unwind_protect (function, arg) } Lisp_Object -unbind_to (count, value) - int count; - Lisp_Object value; +unbind_to (int count, Lisp_Object value) { Lisp_Object quitf = Vquit_flag; struct gcpro gcpro1, gcpro2; @@ -3715,7 +3620,7 @@ unbind_to (count, value) bound a variable that had a buffer-local or frame-local binding. WHERE nil means that the variable had the default value when it was bound. CURRENT-BUFFER is the buffer that - was current when the variable was bound. */ + was current when the variable was bound. */ else if (CONSP (this_binding.symbol)) { Lisp_Object symbol, where; @@ -3789,8 +3694,7 @@ usage: (curry FUN &rest ARGS) */) DEFUN ("backtrace-debug", Fbacktrace_debug, Sbacktrace_debug, 2, 2, 0, doc: /* Set the debug-on-exit flag of eval frame LEVEL levels down to FLAG. The debugger is entered when that frame exits, if the flag is non-nil. */) - (level, flag) - Lisp_Object level, flag; + (Lisp_Object level, Lisp_Object flag) { register struct backtrace *backlist = backtrace_list; register int i; @@ -3811,7 +3715,7 @@ The debugger is entered when that frame exits, if the flag is non-nil. */) DEFUN ("backtrace", Fbacktrace, Sbacktrace, 0, 0, "", doc: /* Print a trace of Lisp function calls currently active. Output stream used is value of `standard-output'. */) - () + (void) { register struct backtrace *backlist = backtrace_list; register int i; @@ -3876,8 +3780,7 @@ A &rest arg is represented as the tail of the list ARG-VALUES. FUNCTION is whatever was supplied as car of evaluated list, or a lambda expression for macro calls. If NFRAMES is more than the number of frames, the value is nil. */) - (nframes) - Lisp_Object nframes; + (Lisp_Object nframes) { register struct backtrace *backlist = backtrace_list; register int i; @@ -3906,7 +3809,7 @@ If NFRAMES is more than the number of frames, the value is nil. */) void -mark_backtrace () +mark_backtrace (void) { register struct backtrace *backlist; register int i; @@ -3925,7 +3828,7 @@ mark_backtrace () } void -syms_of_eval () +syms_of_eval (void) { DEFVAR_INT ("max-specpdl-size", &max_specpdl_size, doc: /* *Limit on number of Lisp variable bindings and `unwind-protect's. diff --git a/src/fileio.c b/src/fileio.c index 8c2ee45c073..c942803e280 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -240,15 +240,13 @@ Lisp_Object Qfile_name_history; Lisp_Object Qcar_less_than_car; -static int a_write P_ ((int, Lisp_Object, int, int, - Lisp_Object *, struct coding_system *)); -static int e_write P_ ((int, Lisp_Object, int, int, struct coding_system *)); +static int a_write (int, Lisp_Object, int, int, + Lisp_Object *, struct coding_system *); +static int e_write (int, Lisp_Object, int, int, struct coding_system *); void -report_file_error (string, data) - const char *string; - Lisp_Object data; +report_file_error (const char *string, Lisp_Object data) { Lisp_Object errstring; int errorno = errno; @@ -286,8 +284,7 @@ report_file_error (string, data) } Lisp_Object -close_file_unwind (fd) - Lisp_Object fd; +close_file_unwind (Lisp_Object fd) { emacs_close (XFASTINT (fd)); return Qnil; @@ -296,8 +293,7 @@ close_file_unwind (fd) /* Restore point, having saved it as a marker. */ Lisp_Object -restore_point_unwind (location) - Lisp_Object location; +restore_point_unwind (Lisp_Object location) { Fgoto_char (location); Fset_marker (location, Qnil, Qnil); @@ -350,8 +346,7 @@ If OPERATION equals `inhibit-file-name-operation', then we ignore any handlers that are members of `inhibit-file-name-handlers', but we still do run any other handlers. This lets handlers use the standard functions without calling themselves recursively. */) - (filename, operation) - Lisp_Object filename, operation; + (Lisp_Object filename, Lisp_Object operation) { /* This function must not munge the match data. */ Lisp_Object chain, inhibited_handlers, result; @@ -407,8 +402,7 @@ DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory, Return nil if FILENAME does not include a directory. Otherwise return a directory name. Given a Unix syntax file name, returns a string ending in slash. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { #ifndef DOS_NT register const unsigned char *beg; @@ -429,7 +423,7 @@ Given a Unix syntax file name, returns a string ending in slash. */) filename = FILE_SYSTEM_CASE (filename); #ifdef DOS_NT beg = (unsigned char *) alloca (SBYTES (filename) + 1); - bcopy (SDATA (filename), beg, SBYTES (filename) + 1); + memcpy (beg, SDATA (filename), SBYTES (filename) + 1); #else beg = SDATA (filename); #endif @@ -482,8 +476,7 @@ DEFUN ("file-name-nondirectory", Ffile_name_nondirectory, For example, in a Unix-syntax file name, this is everything after the last slash, or the entire name if it contains no slash. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { register const unsigned char *beg, *p, *end; Lisp_Object handler; @@ -523,8 +516,7 @@ If FILENAME refers to a file which is not accessible from a local process, then this should return nil. The `call-process' and `start-process' functions use this function to get a current directory to run processes in. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { Lisp_Object handler; @@ -539,8 +531,7 @@ get a current directory to run processes in. */) char * -file_name_as_directory (out, in) - char *out, *in; +file_name_as_directory (char *out, char *in) { int size = strlen (in) - 1; @@ -574,8 +565,7 @@ a directory is different from its name as a file. The result can be used as the value of `default-directory' or passed as second argument to `expand-file-name'. For a Unix-syntax file name, just appends a slash. */) - (file) - Lisp_Object file; + (Lisp_Object file) { char *buf; Lisp_Object handler; @@ -604,8 +594,7 @@ For a Unix-syntax file name, just appends a slash. */) */ int -directory_file_name (src, dst) - char *src, *dst; +directory_file_name (char *src, char *dst) { long slen; @@ -634,8 +623,7 @@ This is the name of the file that holds the data for the directory DIRECTORY. This operation exists because a directory is also a file, but its name as a directory is different from its name as a file. In Unix-syntax, this function just removes the final slash. */) - (directory) - Lisp_Object directory; + (Lisp_Object directory) { char *buf; Lisp_Object handler; @@ -688,9 +676,7 @@ static unsigned make_temp_name_count, make_temp_name_count_initialized_p; generated. */ Lisp_Object -make_temp_name (prefix, base64_p) - Lisp_Object prefix; - int base64_p; +make_temp_name (Lisp_Object prefix, int base64_p) { Lisp_Object val; int len, clen; @@ -733,10 +719,10 @@ make_temp_name (prefix, base64_p) if (!STRING_MULTIBYTE (prefix)) STRING_SET_UNIBYTE (val); data = SDATA (val); - bcopy(SDATA (prefix), data, len); + memcpy (data, SDATA (prefix), len); p = data + len; - bcopy (pidbuf, p, pidlen); + memcpy (p, pidbuf, pidlen); p += pidlen; /* Here we try to minimize useless stat'ing when this function is @@ -809,8 +795,7 @@ probably use `make-temp-file' instead, except in three circumstances: * If you are creating the file in the user's home directory. * If you are creating a directory rather than an ordinary file. * If you are taking special precautions as `make-temp-file' does. */) - (prefix) - Lisp_Object prefix; + (Lisp_Object prefix) { return make_temp_name (prefix, 0); } @@ -835,8 +820,7 @@ non-intuitive results for the root directory; for instance, \(expand-file-name ".." "/") returns "/..". For this reason, use (directory-file-name (file-name-directory dirname)) to traverse a filesystem tree, not (expand-file-name ".." dirname). */) - (name, default_directory) - Lisp_Object name, default_directory; + (Lisp_Object name, Lisp_Object default_directory) { /* These point to SDATA and need to be careful with string-relocation during GC (via DECODE_FILE). */ @@ -947,7 +931,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) /* Make a local copy of nm[] to protect it from GC in DECODE_FILE below. */ nm = (unsigned char *) alloca (SBYTES (name) + 1); - bcopy (SDATA (name), nm, SBYTES (name) + 1); + memcpy (nm, SDATA (name), SBYTES (name) + 1); #ifdef DOS_NT /* Note if special escape prefix is present, but remove for now. */ @@ -1101,7 +1085,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) unsigned char *o, *p; for (p = nm; *p && (!IS_DIRECTORY_SEP (*p)); p++); o = alloca (p - nm + 1); - bcopy ((char *) nm, o, p - nm); + memcpy (o, nm, p - nm); o [p - nm] = 0; BLOCK_INPUT; @@ -1252,7 +1236,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) ) { unsigned char *temp = (unsigned char *) alloca (length); - bcopy (newdir, temp, length - 1); + memcpy (temp, newdir, length - 1); temp[length - 1] = 0; newdir = temp; } @@ -1471,11 +1455,11 @@ See also the function `substitute-in-file-name'.") /* Get past ~ to user */ unsigned char *user = nm + 1; /* Find end of name. */ - unsigned char *ptr = (unsigned char *) index (user, '/'); + unsigned char *ptr = (unsigned char *) strchr (user, '/'); int len = ptr ? ptr - user : strlen (user); /* Copy the user name into temp storage. */ o = (unsigned char *) alloca (len + 1); - bcopy ((char *) user, o, len); + memcpy (o, user, len); o[len] = 0; /* Look up the user name. */ @@ -1558,8 +1542,7 @@ See also the function `substitute-in-file-name'.") /* If /~ or // appears, discard everything through first slash. */ static int -file_name_absolute_p (filename) - const unsigned char *filename; +file_name_absolute_p (const unsigned char *filename) { return (IS_DIRECTORY_SEP (*filename) || *filename == '~' @@ -1571,8 +1554,7 @@ file_name_absolute_p (filename) } static unsigned char * -search_embedded_absfilename (nm, endp) - unsigned char *nm, *endp; +search_embedded_absfilename (unsigned char *nm, unsigned char *endp) { unsigned char *p, *s; @@ -1593,7 +1575,7 @@ search_embedded_absfilename (nm, endp) { unsigned char *o = alloca (s - p + 1); struct passwd *pw; - bcopy (p, o, s - p); + memcpy (o, p, s - p); o [s - p] = 0; /* If we have ~user and `user' exists, discard @@ -1623,8 +1605,7 @@ the entire variable name in braces. If `/~' appears, all of FILENAME through that `/' is discarded. If `//' appears, everything up to and including the first of those `/' is discarded. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { unsigned char *nm; @@ -1650,7 +1631,7 @@ those `/' is discarded. */) decode of environment variables, causing the original Lisp_String data to be relocated. */ nm = (unsigned char *) alloca (SBYTES (filename) + 1); - bcopy (SDATA (filename), nm, SBYTES (filename) + 1); + memcpy (nm, SDATA (filename), SBYTES (filename) + 1); #ifdef DOS_NT dostounix_filename (nm); @@ -1823,8 +1804,7 @@ those `/' is discarded. */) (directory-file-name (expand-file-name FOO)). */ Lisp_Object -expand_and_dir_to_file (filename, defdir) - Lisp_Object filename, defdir; +expand_and_dir_to_file (Lisp_Object filename, Lisp_Object defdir) { register Lisp_Object absname; @@ -1853,12 +1833,7 @@ expand_and_dir_to_file (filename, defdir) If QUICK is nonzero, we ask for y or n, not yes or no. */ void -barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick) - Lisp_Object absname; - unsigned char *querystring; - int interactive; - struct stat *statptr; - int quick; +barf_or_query_if_file_exists (Lisp_Object absname, unsigned char *querystring, int interactive, struct stat *statptr, int quick) { register Lisp_Object tem, encoded_filename; struct stat statbuf; @@ -1921,9 +1896,7 @@ uid and gid of FILE to NEWNAME. If PRESERVE-SELINUX-CONTEXT is non-nil and SELinux is enabled on the system, we copy the SELinux context of FILE to NEWNAME. */) - (file, newname, ok_if_already_exists, keep_time, preserve_uid_gid, preserve_selinux_context) - Lisp_Object file, newname, ok_if_already_exists, keep_time; - Lisp_Object preserve_uid_gid, preserve_selinux_context; + (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists, Lisp_Object keep_time, Lisp_Object preserve_uid_gid, Lisp_Object preserve_selinux_context) { int ifd, ofd, n; char buf[16 * 1024]; @@ -2134,8 +2107,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */) DEFUN ("make-directory-internal", Fmake_directory_internal, Smake_directory_internal, 1, 1, 0, doc: /* Create a new directory named DIRECTORY. */) - (directory) - Lisp_Object directory; + (Lisp_Object directory) { const unsigned char *dir; Lisp_Object handler; @@ -2165,8 +2137,7 @@ DEFUN ("make-directory-internal", Fmake_directory_internal, DEFUN ("delete-directory-internal", Fdelete_directory_internal, Sdelete_directory_internal, 1, 1, 0, doc: /* Delete the directory named DIRECTORY. Does not follow symlinks. */) - (directory) - Lisp_Object directory; + (Lisp_Object directory) { const unsigned char *dir; Lisp_Object handler; @@ -2196,9 +2167,7 @@ TRASH non-nil means to trash the file instead of deleting, provided When called interactively, TRASH is t if no prefix argument is given. With a prefix argument, TRASH is nil. */) - (filename, trash) - Lisp_Object filename; - Lisp_Object trash; + (Lisp_Object filename, Lisp_Object trash) { Lisp_Object handler; Lisp_Object encoded_file; @@ -2228,8 +2197,7 @@ With a prefix argument, TRASH is nil. */) } static Lisp_Object -internal_delete_file_1 (ignore) - Lisp_Object ignore; +internal_delete_file_1 (Lisp_Object ignore) { return Qt; } @@ -2255,8 +2223,7 @@ Signals a `file-already-exists' error if a file NEWNAME already exists unless optional third argument OK-IF-ALREADY-EXISTS is non-nil. A number as third arg means request confirmation if NEWNAME already exists. This is what happens in interactive use with M-x. */) - (file, newname, ok_if_already_exists) - Lisp_Object file, newname, ok_if_already_exists; + (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists) { Lisp_Object handler; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; @@ -2353,8 +2320,7 @@ Signals a `file-already-exists' error if a file NEWNAME already exists unless optional third argument OK-IF-ALREADY-EXISTS is non-nil. A number as third arg means request confirmation if NEWNAME already exists. This is what happens in interactive use with M-x. */) - (file, newname, ok_if_already_exists) - Lisp_Object file, newname, ok_if_already_exists; + (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists) { Lisp_Object handler; Lisp_Object encoded_file, encoded_newname; @@ -2409,8 +2375,7 @@ Signals a `file-already-exists' error if a file LINKNAME already exists unless optional third argument OK-IF-ALREADY-EXISTS is non-nil. A number as third arg means request confirmation if LINKNAME already exists. This happens for interactive use with M-x. */) - (filename, linkname, ok_if_already_exists) - Lisp_Object filename, linkname, ok_if_already_exists; + (Lisp_Object filename, Lisp_Object linkname, Lisp_Object ok_if_already_exists) { Lisp_Object handler; Lisp_Object encoded_filename, encoded_linkname; @@ -2485,8 +2450,7 @@ DEFUN ("file-name-absolute-p", Ffile_name_absolute_p, Sfile_name_absolute_p, 1, 1, 0, doc: /* Return t if file FILENAME specifies an absolute file name. On Unix, this is a name starting with a `/' or a `~'. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { CHECK_STRING (filename); return file_name_absolute_p (SDATA (filename)) ? Qt : Qnil; @@ -2495,8 +2459,7 @@ On Unix, this is a name starting with a `/' or a `~'. */) /* Return nonzero if file FILENAME exists and can be executed. */ static int -check_executable (filename) - char *filename; +check_executable (char *filename) { #ifdef DOS_NT int len = strlen (filename); @@ -2520,8 +2483,7 @@ check_executable (filename) /* Return nonzero if file FILENAME exists and can be written. */ static int -check_writable (filename) - char *filename; +check_writable (char *filename) { #ifdef MSDOS struct stat st; @@ -2547,8 +2509,7 @@ DEFUN ("file-exists-p", Ffile_exists_p, Sfile_exists_p, 1, 1, 0, See also `file-readable-p' and `file-attributes'. This returns nil for a symlink to a nonexistent file. Use `file-symlink-p' to test for such links. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { Lisp_Object absname; Lisp_Object handler; @@ -2571,8 +2532,7 @@ Use `file-symlink-p' to test for such links. */) DEFUN ("file-executable-p", Ffile_executable_p, Sfile_executable_p, 1, 1, 0, doc: /* Return t if FILENAME can be executed by you. For a directory, this means you can access files in that directory. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { Lisp_Object absname; Lisp_Object handler; @@ -2594,8 +2554,7 @@ For a directory, this means you can access files in that directory. */) DEFUN ("file-readable-p", Ffile_readable_p, Sfile_readable_p, 1, 1, 0, doc: /* Return t if file FILENAME exists and you can read it. See also `file-exists-p' and `file-attributes'. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { Lisp_Object absname; Lisp_Object handler; @@ -2644,8 +2603,7 @@ See also `file-exists-p' and `file-attributes'. */) on the RT/PC. */ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0, doc: /* Return t if file FILENAME can be written or created by you. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { Lisp_Object absname, dir, encoded; Lisp_Object handler; @@ -2689,8 +2647,7 @@ DEFUN ("access-file", Faccess_file, Saccess_file, 2, 2, 0, doc: /* Access file FILENAME, and get an error if that does not work. The second argument STRING is used in the error message. If there is no error, returns nil. */) - (filename, string) - Lisp_Object filename, string; + (Lisp_Object filename, Lisp_Object string) { Lisp_Object handler, encoded_filename, absname; int fd; @@ -2723,8 +2680,7 @@ Otherwise it returns nil. This function returns t when given the name of a symlink that points to a nonexistent file. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { Lisp_Object handler; @@ -2752,7 +2708,7 @@ points to a nonexistent file. */) { bufsize *= 2; buf = (char *) xrealloc (buf, bufsize); - bzero (buf, bufsize); + memset (buf, 0, bufsize); errno = 0; valsize = readlink (SDATA (filename), buf, bufsize); @@ -2773,7 +2729,7 @@ points to a nonexistent file. */) while (valsize >= bufsize); val = make_string (buf, valsize); - if (buf[0] == '/' && index (buf, ':')) + if (buf[0] == '/' && strchr (buf, ':')) val = concat2 (build_string ("/:"), val); xfree (buf); val = DECODE_FILE (val); @@ -2788,8 +2744,7 @@ DEFUN ("file-directory-p", Ffile_directory_p, Sfile_directory_p, 1, 1, 0, doc: /* Return t if FILENAME names an existing directory. Symbolic links to directories count as directories. See `file-symlink-p' to distinguish symlinks. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { register Lisp_Object absname; struct stat st; @@ -2818,8 +2773,7 @@ directory as a buffer's current directory, this predicate must return true. A directory name spec may be given instead; then the value is t if the directory so specified exists and really is a readable and searchable directory. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { Lisp_Object handler; int tem; @@ -2843,8 +2797,7 @@ DEFUN ("file-regular-p", Ffile_regular_p, Sfile_regular_p, 1, 1, 0, This is the sort of file that holds an ordinary stream of data bytes. Symbolic links to regular files count as regular files. See `file-symlink-p' to distinguish symlinks. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { register Lisp_Object absname; struct stat st; @@ -2886,8 +2839,7 @@ DEFUN ("file-selinux-context", Ffile_selinux_context, doc: /* Return SELinux context of file named FILENAME, as a list ("user", "role", "type", "range"). Return (nil, nil, nil, nil) if file does not exist, is not accessible, or SELinux is disabled */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { Lisp_Object absname; Lisp_Object values[4]; @@ -2942,8 +2894,7 @@ DEFUN ("set-file-selinux-context", Fset_file_selinux_context, doc: /* Set SELinux context of file named FILENAME to CONTEXT as a list ("user", "role", "type", "range"). Has no effect if SELinux is disabled. */) - (filename, context) - Lisp_Object filename, context; + (Lisp_Object filename, Lisp_Object context) { Lisp_Object absname, encoded_absname; Lisp_Object handler; @@ -3018,8 +2969,7 @@ is disabled. */) DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0, doc: /* Return mode bits of file named FILENAME, as an integer. Return nil, if file does not exist or is not accessible. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { Lisp_Object absname; struct stat st; @@ -3049,8 +2999,7 @@ Only the 12 low bits of MODE are used. Interactively, mode bits are read by `read-file-modes', which accepts symbolic notation, like the `chmod' command from GNU Coreutils. */) - (filename, mode) - Lisp_Object filename, mode; + (Lisp_Object filename, Lisp_Object mode) { Lisp_Object absname, encoded_absname; Lisp_Object handler; @@ -3076,8 +3025,7 @@ DEFUN ("set-default-file-modes", Fset_default_file_modes, Sset_default_file_mode doc: /* Set the file permission bits for newly created files. The argument MODE should be an integer; only the low 9 bits are used. This setting is inherited by subprocesses. */) - (mode) - Lisp_Object mode; + (Lisp_Object mode) { CHECK_NUMBER (mode); @@ -3089,7 +3037,7 @@ This setting is inherited by subprocesses. */) DEFUN ("default-file-modes", Fdefault_file_modes, Sdefault_file_modes, 0, 0, 0, doc: /* Return the default file protection for created files. The value is an integer. */) - () + (void) { int realmask; Lisp_Object value; @@ -3101,7 +3049,7 @@ The value is an integer. */) return value; } -extern int lisp_time_argument P_ ((Lisp_Object, time_t *, int *)); +extern int lisp_time_argument (Lisp_Object, time_t *, int *); DEFUN ("set-file-times", Fset_file_times, Sset_file_times, 1, 2, 0, doc: /* Set times of file FILENAME to TIME. @@ -3109,8 +3057,7 @@ Set both access and modification times. Return t on success, else nil. Use the current time if TIME is nil. TIME is in the format of `current-time'. */) - (filename, time) - Lisp_Object filename, time; + (Lisp_Object filename, Lisp_Object time) { Lisp_Object absname, encoded_absname; Lisp_Object handler; @@ -3157,7 +3104,7 @@ Use the current time if TIME is nil. TIME is in the format of #ifdef HAVE_SYNC DEFUN ("unix-sync", Funix_sync, Sunix_sync, 0, 0, "", doc: /* Tell Unix to finish all pending disk updates. */) - () + (void) { sync (); return Qnil; @@ -3169,8 +3116,7 @@ DEFUN ("file-newer-than-file-p", Ffile_newer_than_file_p, Sfile_newer_than_file_ doc: /* Return t if file FILE1 is newer than file FILE2. If FILE1 does not exist, the answer is nil; otherwise, if FILE2 does not exist, the answer is t. */) - (file1, file2) - Lisp_Object file1, file2; + (Lisp_Object file1, Lisp_Object file2) { Lisp_Object absname1, absname2; struct stat st; @@ -3235,8 +3181,7 @@ Lisp_Object Qfind_buffer_file_type; o set back the buffer multibyteness. */ static Lisp_Object -decide_coding_unwind (unwind_data) - Lisp_Object unwind_data; +decide_coding_unwind (Lisp_Object unwind_data) { Lisp_Object multibyte, undo_list, buffer; @@ -3268,12 +3213,12 @@ static EMACS_INT non_regular_nbytes; /* Read from a non-regular file. - Read non_regular_trytry bytes max from non_regular_fd. + Read non_regular_nbytes bytes max from non_regular_fd. Non_regular_inserted specifies where to put the read bytes. Value is the number of bytes read. */ static Lisp_Object -read_non_regular () +read_non_regular (Lisp_Object ignore) { EMACS_INT nbytes; @@ -3291,7 +3236,7 @@ read_non_regular () in insert-file-contents. */ static Lisp_Object -read_non_regular_quit () +read_non_regular_quit (Lisp_Object ignore) { return Qnil; } @@ -3320,8 +3265,7 @@ the number of characters that replace previous buffer contents. This function does code conversion according to the value of `coding-system-for-read' or `file-coding-system-alist', and sets the variable `last-coding-system-used' to the coding system actually used. */) - (filename, visit, beg, end, replace) - Lisp_Object filename, visit, beg, end, replace; + (Lisp_Object filename, Lisp_Object visit, Lisp_Object beg, Lisp_Object end, Lisp_Object replace) { struct stat st; register int fd; @@ -3857,7 +3801,7 @@ variable `last-coding-system-used' to the coding system actually used. */) conversion_buffer); unprocessed = coding.carryover_bytes; if (coding.carryover_bytes > 0) - bcopy (coding.carryover, read_buf, unprocessed); + memcpy (read_buf, coding.carryover, unprocessed); } UNGCPRO; emacs_close (fd); @@ -4445,11 +4389,10 @@ variable `last-coding-system-used' to the coding system actually used. */) RETURN_UNGCPRO (unbind_to (count, val)); } -static Lisp_Object build_annotations P_ ((Lisp_Object, Lisp_Object)); +static Lisp_Object build_annotations (Lisp_Object, Lisp_Object); static Lisp_Object -build_annotations_unwind (arg) - Lisp_Object arg; +build_annotations_unwind (Lisp_Object arg) { Vwrite_region_annotation_buffers = arg; return Qnil; @@ -4458,10 +4401,9 @@ build_annotations_unwind (arg) /* Decide the coding-system to encode the data with. */ static Lisp_Object -choose_write_coding_system (start, end, filename, - append, visit, lockname, coding) - Lisp_Object start, end, filename, append, visit, lockname; - struct coding_system *coding; +choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object filename, + Lisp_Object append, Lisp_Object visit, Lisp_Object lockname, + struct coding_system *coding) { Lisp_Object val; Lisp_Object eol_parent = Qnil; @@ -4602,8 +4544,7 @@ This does code conversion according to the value of This calls `write-region-annotate-functions' at the start, and `write-region-post-annotation-function' at the end. */) - (start, end, filename, append, visit, lockname, mustbenew) - Lisp_Object start, end, filename, append, visit, lockname, mustbenew; + (Lisp_Object start, Lisp_Object end, Lisp_Object filename, Lisp_Object append, Lisp_Object visit, Lisp_Object lockname, Lisp_Object mustbenew) { register int desc; int failure; @@ -4904,12 +4845,11 @@ This calls `write-region-annotate-functions' at the start, and return Qnil; } -Lisp_Object merge (); +Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object); DEFUN ("car-less-than-car", Fcar_less_than_car, Scar_less_than_car, 2, 2, 0, doc: /* Return t if (car A) is numerically less than (car B). */) - (a, b) - Lisp_Object a, b; + (Lisp_Object a, Lisp_Object b) { return Flss (Fcar (a), Fcar (b)); } @@ -4923,8 +4863,7 @@ DEFUN ("car-less-than-car", Fcar_less_than_car, Scar_less_than_car, 2, 2, 0, as save-excursion would do. */ static Lisp_Object -build_annotations (start, end) - Lisp_Object start, end; +build_annotations (Lisp_Object start, Lisp_Object end) { Lisp_Object annotations; Lisp_Object p, res; @@ -5013,13 +4952,7 @@ build_annotations (start, end) The return value is negative in case of system call failure. */ static int -a_write (desc, string, pos, nchars, annot, coding) - int desc; - Lisp_Object string; - register int nchars; - int pos; - Lisp_Object *annot; - struct coding_system *coding; +a_write (int desc, Lisp_Object string, int pos, register int nchars, Lisp_Object *annot, struct coding_system *coding) { Lisp_Object tem; int nextpos; @@ -5063,11 +4996,7 @@ a_write (desc, string, pos, nchars, annot, coding) are indexes to the string STRING. */ static int -e_write (desc, string, start, end, coding) - int desc; - Lisp_Object string; - int start, end; - struct coding_system *coding; +e_write (int desc, Lisp_Object string, int start, int end, struct coding_system *coding) { if (STRINGP (string)) { @@ -5147,8 +5076,7 @@ DEFUN ("verify-visited-file-modtime", Fverify_visited_file_modtime, doc: /* Return t if last mod time of BUF's visited file matches what BUF records. This means that the file has not been changed since it was visited or saved. See Info node `(elisp)Modification Time' for more details. */) - (buf) - Lisp_Object buf; + (Lisp_Object buf) { struct buffer *b; struct stat st; @@ -5194,7 +5122,7 @@ DEFUN ("clear-visited-file-modtime", Fclear_visited_file_modtime, Sclear_visited_file_modtime, 0, 0, 0, doc: /* Clear out records of last mod time of visited file. Next attempt to save will certainly not complain of a discrepancy. */) - () + (void) { current_buffer->modtime = 0; current_buffer->modtime_size = -1; @@ -5208,7 +5136,7 @@ The value is a list of the form (HIGH LOW), like the time values that `file-attributes' returns. If the current buffer has no recorded file modification time, this function returns 0. See Info node `(elisp)Modification Time' for more details. */) - () + (void) { if (! current_buffer->modtime) return make_number (0); @@ -5223,8 +5151,7 @@ or if the file itself has been changed for some known benign reason. An argument specifies the modification time value to use \(instead of that of the visited file), in the form of a list \(HIGH . LOW) or (HIGH LOW). */) - (time_list) - Lisp_Object time_list; + (Lisp_Object time_list) { if (!NILP (time_list)) { @@ -5259,8 +5186,7 @@ An argument specifies the modification time value to use } Lisp_Object -auto_save_error (error) - Lisp_Object error; +auto_save_error (Lisp_Object error) { Lisp_Object args[3], msg; int i, nbytes; @@ -5279,7 +5205,7 @@ auto_save_error (error) GCPRO1 (msg); nbytes = SBYTES (msg); SAFE_ALLOCA (msgbuf, char *, nbytes); - bcopy (SDATA (msg), msgbuf, nbytes); + memcpy (msgbuf, SDATA (msg), nbytes); for (i = 0; i < 3; ++i) { @@ -5296,7 +5222,7 @@ auto_save_error (error) } Lisp_Object -auto_save_1 () +auto_save_1 (void) { struct stat st; Lisp_Object modes; @@ -5322,8 +5248,8 @@ auto_save_1 () } static Lisp_Object -do_auto_save_unwind (arg) /* used as unwind-protect function */ - Lisp_Object arg; +do_auto_save_unwind (Lisp_Object arg) /* used as unwind-protect function */ + { FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer; auto_saving = 0; @@ -5337,16 +5263,15 @@ do_auto_save_unwind (arg) /* used as unwind-protect function */ } static Lisp_Object -do_auto_save_unwind_1 (value) /* used as unwind-protect function */ - Lisp_Object value; +do_auto_save_unwind_1 (Lisp_Object value) /* used as unwind-protect function */ + { minibuffer_auto_raise = XINT (value); return Qnil; } static Lisp_Object -do_auto_save_make_dir (dir) - Lisp_Object dir; +do_auto_save_make_dir (Lisp_Object dir) { Lisp_Object mode; @@ -5356,8 +5281,7 @@ do_auto_save_make_dir (dir) } static Lisp_Object -do_auto_save_eh (ignore) - Lisp_Object ignore; +do_auto_save_eh (Lisp_Object ignore) { return Qnil; } @@ -5373,8 +5297,7 @@ Normally we run the normal hook `auto-save-hook' before saving. A non-nil NO-MESSAGE argument means do not print any message if successful. A non-nil CURRENT-ONLY argument means save only current buffer. */) - (no_message, current_only) - Lisp_Object no_message, current_only; + (Lisp_Object no_message, Lisp_Object current_only) { struct buffer *old = current_buffer, *b; Lisp_Object tail, buf; @@ -5575,7 +5498,7 @@ DEFUN ("set-buffer-auto-saved", Fset_buffer_auto_saved, Sset_buffer_auto_saved, 0, 0, 0, doc: /* Mark current buffer as auto-saved with its current text. No auto-save file will be written until the buffer changes again. */) - () + (void) { /* FIXME: This should not be called in indirect buffers, since they're not autosaved. */ @@ -5588,7 +5511,7 @@ No auto-save file will be written until the buffer changes again. */) DEFUN ("clear-buffer-auto-save-failure", Fclear_buffer_auto_save_failure, Sclear_buffer_auto_save_failure, 0, 0, 0, doc: /* Clear any record of a recent auto-save failure in the current buffer. */) - () + (void) { current_buffer->auto_save_failure_time = -1; return Qnil; @@ -5600,7 +5523,7 @@ DEFUN ("recent-auto-save-p", Frecent_auto_save_p, Srecent_auto_save_p, More precisely, if it has been auto-saved since last read from or saved in the visited file. If the buffer has no visited file, then any auto-save counts as "recent". */) - () + (void) { /* FIXME: maybe we should return nil for indirect buffers since they're never autosaved. */ @@ -5614,7 +5537,7 @@ DEFUN ("next-read-file-uses-dialog-p", Fnext_read_file_uses_dialog_p, doc: /* Return t if a call to `read-file-name' will use a dialog. The return value is only relevant for a call to `read-file-name' that happens before any other event (mouse or keypress) is handled. */) - () + (void) { #if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) @@ -5627,8 +5550,7 @@ before any other event (mouse or keypress) is handled. */) } Lisp_Object -Fread_file_name (prompt, dir, default_filename, mustmatch, initial, predicate) - Lisp_Object prompt, dir, default_filename, mustmatch, initial, predicate; +Fread_file_name (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object initial, Lisp_Object predicate) { struct gcpro gcpro1, gcpro2; Lisp_Object args[7]; @@ -5646,7 +5568,7 @@ Fread_file_name (prompt, dir, default_filename, mustmatch, initial, predicate) void -syms_of_fileio () +syms_of_fileio (void) { Qoperations = intern_c_string ("operations"); Qexpand_file_name = intern_c_string ("expand-file-name"); diff --git a/src/filelock.c b/src/filelock.c index b11338c58b6..c3f1bfde292 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -34,9 +34,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_FCNTL_H #include <fcntl.h> #endif -#ifdef HAVE_STRING_H #include <string.h> -#endif #ifdef HAVE_UNISTD_H #include <unistd.h> @@ -122,11 +120,11 @@ static int boot_time_initialized; extern Lisp_Object Vshell_file_name; #ifdef BOOT_TIME -static void get_boot_time_1 P_ ((char *, int)); +static void get_boot_time_1 (char *, int); #endif static time_t -get_boot_time () +get_boot_time (void) { #if defined (BOOT_TIME) int counter; @@ -253,9 +251,7 @@ get_boot_time () Success is indicated by setting BOOT_TIME to a larger value. */ void -get_boot_time_1 (filename, newest) - char *filename; - int newest; +get_boot_time_1 (char *filename, int newest) { struct utmp ut, *utp; int desc; @@ -326,9 +322,7 @@ typedef struct fill_in_lock_file_name (lock, (file))) static void -fill_in_lock_file_name (lockfile, fn) - register char *lockfile; - register Lisp_Object fn; +fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn) { register char *p; struct stat st; @@ -364,9 +358,7 @@ fill_in_lock_file_name (lockfile, fn) Return 1 if successful, 0 if not. */ static int -lock_file_1 (lfname, force) - char *lfname; - int force; +lock_file_1 (char *lfname, int force) { register int err; time_t boot_time; @@ -408,8 +400,7 @@ lock_file_1 (lfname, force) /* Return 1 if times A and B are no more than one second apart. */ int -within_one_second (a, b) - time_t a, b; +within_one_second (time_t a, time_t b) { return (a - b >= -1 && a - b <= 1); } @@ -420,13 +411,8 @@ within_one_second (a, b) or -1 if something is wrong with the locking mechanism. */ static int -current_lock_owner (owner, lfname) - lock_info_type *owner; - char *lfname; +current_lock_owner (lock_info_type *owner, char *lfname) { -#ifndef index - extern char *rindex (), *index (); -#endif int len, ret; int local_owner = 0; char *at, *dot, *colon; @@ -468,8 +454,8 @@ current_lock_owner (owner, lfname) /* Parse USER@HOST.PID:BOOT_TIME. If can't parse, return -1. */ /* The USER is everything before the last @. */ - at = rindex (lfinfo, '@'); - dot = rindex (lfinfo, '.'); + at = strrchr (lfinfo, '@'); + dot = strrchr (lfinfo, '.'); if (!at || !dot) { xfree (lfinfo); @@ -540,9 +526,7 @@ current_lock_owner (owner, lfname) Return -1 if cannot lock for any other reason. */ static int -lock_if_free (clasher, lfname) - lock_info_type *clasher; - register char *lfname; +lock_if_free (lock_info_type *clasher, register char *lfname) { while (lock_file_1 (lfname, 0) == 0) { @@ -585,8 +569,7 @@ lock_if_free (clasher, lfname) take away the lock, or return nil meaning ignore the lock. */ void -lock_file (fn) - Lisp_Object fn; +lock_file (Lisp_Object fn) { register Lisp_Object attack, orig_fn, encoded_fn; register char *lfname, *locker; @@ -645,8 +628,7 @@ lock_file (fn) } void -unlock_file (fn) - register Lisp_Object fn; +unlock_file (register Lisp_Object fn) { register char *lfname; @@ -660,7 +642,7 @@ unlock_file (fn) } void -unlock_all_files () +unlock_all_files (void) { register Lisp_Object tail; register struct buffer *b; @@ -680,8 +662,7 @@ DEFUN ("lock-buffer", Flock_buffer, Slock_buffer, doc: /* Lock FILE, if current buffer is modified. FILE defaults to current buffer's visited file, or else nothing is done if current buffer isn't visiting a file. */) - (file) - Lisp_Object file; + (Lisp_Object file) { if (NILP (file)) file = current_buffer->file_truename; @@ -698,7 +679,7 @@ DEFUN ("unlock-buffer", Funlock_buffer, Sunlock_buffer, doc: /* Unlock the file visited in the current buffer. If the buffer is not modified, this does nothing because the file should not be locked in that case. */) - () + (void) { if (SAVE_MODIFF < MODIFF && STRINGP (current_buffer->file_truename)) @@ -709,8 +690,7 @@ should not be locked in that case. */) /* Unlock the file visited in buffer BUFFER. */ void -unlock_buffer (buffer) - struct buffer *buffer; +unlock_buffer (struct buffer *buffer) { if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer) && STRINGP (buffer->file_truename)) @@ -721,8 +701,7 @@ DEFUN ("file-locked-p", Ffile_locked_p, Sfile_locked_p, 1, 1, 0, doc: /* Return a value indicating whether FILENAME is locked. The value is nil if the FILENAME is not locked, t if it is locked by you, else a string saying which user has locked it. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { Lisp_Object ret; register char *lfname; @@ -750,14 +729,14 @@ t if it is locked by you, else a string saying which user has locked it. */) /* Initialization functions. */ void -init_filelock () +init_filelock (void) { boot_time = 0; boot_time_initialized = 0; } void -syms_of_filelock () +syms_of_filelock (void) { DEFVAR_LISP ("temporary-file-directory", &Vtemporary_file_directory, doc: /* The directory for writing temporary files. */); diff --git a/src/filemode.c b/src/filemode.c index 4a11d2a3115..3048077ff52 100644 --- a/src/filemode.c +++ b/src/filemode.c @@ -17,10 +17,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H #include <config.h> -#endif - #include <sys/types.h> #include <sys/stat.h> @@ -90,10 +87,10 @@ #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) #endif -void mode_string (); -static char ftypelet (); -static void rwx (); -static void setst (); +void mode_string (short unsigned int mode, char *str); +static char ftypelet (long int bits); +static void rwx (short unsigned int bits, char *chars); +static void setst (short unsigned int bits, char *chars); /* filemodestring - fill in string STR with an ls-style ASCII representation of the st_mode field of file stats block STATP. @@ -132,9 +129,7 @@ static void setst (); 'T' if the file is sticky but not executable. */ void -filemodestring (statp, str) - struct stat *statp; - char *str; +filemodestring (struct stat *statp, char *str) { mode_string (statp->st_mode, str); } @@ -143,9 +138,7 @@ filemodestring (statp, str) is given as an argument. */ void -mode_string (mode, str) - unsigned short mode; - char *str; +mode_string (short unsigned int mode, char *str) { str[0] = ftypelet ((long) mode); rwx ((mode & 0700) << 0, &str[1]); @@ -167,8 +160,7 @@ mode_string (mode, str) '?' for any other file type. */ static char -ftypelet (bits) - long bits; +ftypelet (long int bits) { #ifdef S_ISBLK if (S_ISBLK (bits)) @@ -207,9 +199,7 @@ ftypelet (bits) flags in CHARS accordingly. */ static void -rwx (bits, chars) - unsigned short bits; - char *chars; +rwx (short unsigned int bits, char *chars) { chars[0] = (bits & S_IRUSR) ? 'r' : '-'; chars[1] = (bits & S_IWUSR) ? 'w' : '-'; @@ -220,9 +210,7 @@ rwx (bits, chars) according to the file mode BITS. */ static void -setst (bits, chars) - unsigned short bits; - char *chars; +setst (short unsigned int bits, char *chars) { #ifdef S_ISUID if (bits & S_ISUID) diff --git a/src/floatfns.c b/src/floatfns.c index 5cd996d033c..4c1548cfd8f 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -70,7 +70,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* This declaration is omitted on some systems, like Ultrix. */ #if !defined (HPUX) && defined (HAVE_LOGB) && !defined (logb) -extern double logb (); +extern double logb (double); #endif /* not HPUX and HAVE_LOGB and no logb macro */ #if defined(DOMAIN) && defined(SING) && defined(OVERFLOW) @@ -192,8 +192,7 @@ static char *float_error_fn_name; /* Extract a Lisp number as a `double', or signal an error. */ double -extract_float (num) - Lisp_Object num; +extract_float (Lisp_Object num) { CHECK_NUMBER_OR_FLOAT (num); @@ -206,8 +205,7 @@ extract_float (num) DEFUN ("acos", Facos, Sacos, 1, 1, 0, doc: /* Return the inverse cosine of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); #ifdef FLOAT_CHECK_DOMAIN @@ -220,8 +218,7 @@ DEFUN ("acos", Facos, Sacos, 1, 1, 0, DEFUN ("asin", Fasin, Sasin, 1, 1, 0, doc: /* Return the inverse sine of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); #ifdef FLOAT_CHECK_DOMAIN @@ -238,8 +235,7 @@ If only one argument Y is given, return the inverse tangent of Y. If two arguments Y and X are given, return the inverse tangent of Y divided by X, i.e. the angle in radians between the vector (X, Y) and the x-axis. */) - (y, x) - register Lisp_Object y, x; + (register Lisp_Object y, Lisp_Object x) { double d = extract_float (y); @@ -256,8 +252,7 @@ and the x-axis. */) DEFUN ("cos", Fcos, Scos, 1, 1, 0, doc: /* Return the cosine of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); IN_FLOAT (d = cos (d), "cos", arg); @@ -266,8 +261,7 @@ DEFUN ("cos", Fcos, Scos, 1, 1, 0, DEFUN ("sin", Fsin, Ssin, 1, 1, 0, doc: /* Return the sine of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); IN_FLOAT (d = sin (d), "sin", arg); @@ -276,8 +270,7 @@ DEFUN ("sin", Fsin, Ssin, 1, 1, 0, DEFUN ("tan", Ftan, Stan, 1, 1, 0, doc: /* Return the tangent of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); double c = cos (d); @@ -292,8 +285,7 @@ DEFUN ("tan", Ftan, Stan, 1, 1, 0, #if defined HAVE_ISNAN && defined HAVE_COPYSIGN DEFUN ("isnan", Fisnan, Sisnan, 1, 1, 0, doc: /* Return non nil iff argument X is a NaN. */) - (x) - Lisp_Object x; + (Lisp_Object x) { CHECK_FLOAT (x); return isnan (XFLOAT_DATA (x)) ? Qt : Qnil; @@ -302,8 +294,7 @@ DEFUN ("isnan", Fisnan, Sisnan, 1, 1, 0, DEFUN ("copysign", Fcopysign, Scopysign, 1, 2, 0, doc: /* Copy sign of X2 to value of X1, and return the result. Cause an error if X1 or X2 is not a float. */) - (x1, x2) - Lisp_Object x1, x2; + (Lisp_Object x1, Lisp_Object x2) { double f1, f2; @@ -326,8 +317,7 @@ and an integral exponent EXP for 2, such that: The function returns the cons cell (SGNFCAND . EXP). If X is zero, both parts (SGNFCAND and EXP) are zero. */) - (x) - Lisp_Object x; + (Lisp_Object x) { double f = XFLOATINT (x); @@ -345,8 +335,7 @@ DEFUN ("ldexp", Fldexp, Sldexp, 1, 2, 0, doc: /* Construct number X from significand SGNFCAND and exponent EXP. Returns the floating point value resulting from multiplying SGNFCAND (the significand) by 2 raised to the power of EXP (the exponent). */) - (sgnfcand, exp) - Lisp_Object sgnfcand, exp; + (Lisp_Object sgnfcand, Lisp_Object exp) { CHECK_NUMBER (exp); return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exp))); @@ -357,8 +346,7 @@ Returns the floating point value resulting from multiplying SGNFCAND DEFUN ("bessel-j0", Fbessel_j0, Sbessel_j0, 1, 1, 0, doc: /* Return the bessel function j0 of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); IN_FLOAT (d = j0 (d), "bessel-j0", arg); @@ -367,8 +355,7 @@ DEFUN ("bessel-j0", Fbessel_j0, Sbessel_j0, 1, 1, 0, DEFUN ("bessel-j1", Fbessel_j1, Sbessel_j1, 1, 1, 0, doc: /* Return the bessel function j1 of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); IN_FLOAT (d = j1 (d), "bessel-j1", arg); @@ -378,8 +365,7 @@ DEFUN ("bessel-j1", Fbessel_j1, Sbessel_j1, 1, 1, 0, DEFUN ("bessel-jn", Fbessel_jn, Sbessel_jn, 2, 2, 0, doc: /* Return the order N bessel function output jn of ARG. The first arg (the order) is truncated to an integer. */) - (n, arg) - register Lisp_Object n, arg; + (register Lisp_Object n, Lisp_Object arg) { int i1 = extract_float (n); double f2 = extract_float (arg); @@ -390,8 +376,7 @@ The first arg (the order) is truncated to an integer. */) DEFUN ("bessel-y0", Fbessel_y0, Sbessel_y0, 1, 1, 0, doc: /* Return the bessel function y0 of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); IN_FLOAT (d = y0 (d), "bessel-y0", arg); @@ -400,8 +385,7 @@ DEFUN ("bessel-y0", Fbessel_y0, Sbessel_y0, 1, 1, 0, DEFUN ("bessel-y1", Fbessel_y1, Sbessel_y1, 1, 1, 0, doc: /* Return the bessel function y1 of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); IN_FLOAT (d = y1 (d), "bessel-y0", arg); @@ -411,8 +395,7 @@ DEFUN ("bessel-y1", Fbessel_y1, Sbessel_y1, 1, 1, 0, DEFUN ("bessel-yn", Fbessel_yn, Sbessel_yn, 2, 2, 0, doc: /* Return the order N bessel function output yn of ARG. The first arg (the order) is truncated to an integer. */) - (n, arg) - register Lisp_Object n, arg; + (register Lisp_Object n, Lisp_Object arg) { int i1 = extract_float (n); double f2 = extract_float (arg); @@ -427,8 +410,7 @@ The first arg (the order) is truncated to an integer. */) DEFUN ("erf", Ferf, Serf, 1, 1, 0, doc: /* Return the mathematical error function of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); IN_FLOAT (d = erf (d), "erf", arg); @@ -437,8 +419,7 @@ DEFUN ("erf", Ferf, Serf, 1, 1, 0, DEFUN ("erfc", Ferfc, Serfc, 1, 1, 0, doc: /* Return the complementary error function of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); IN_FLOAT (d = erfc (d), "erfc", arg); @@ -447,8 +428,7 @@ DEFUN ("erfc", Ferfc, Serfc, 1, 1, 0, DEFUN ("log-gamma", Flog_gamma, Slog_gamma, 1, 1, 0, doc: /* Return the log gamma of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); IN_FLOAT (d = lgamma (d), "log-gamma", arg); @@ -457,8 +437,7 @@ DEFUN ("log-gamma", Flog_gamma, Slog_gamma, 1, 1, 0, DEFUN ("cube-root", Fcube_root, Scube_root, 1, 1, 0, doc: /* Return the cube root of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); #ifdef HAVE_CBRT @@ -476,8 +455,7 @@ DEFUN ("cube-root", Fcube_root, Scube_root, 1, 1, 0, DEFUN ("exp", Fexp, Sexp, 1, 1, 0, doc: /* Return the exponential base e of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); #ifdef FLOAT_CHECK_DOMAIN @@ -493,8 +471,7 @@ DEFUN ("exp", Fexp, Sexp, 1, 1, 0, DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0, doc: /* Return the exponential ARG1 ** ARG2. */) - (arg1, arg2) - register Lisp_Object arg1, arg2; + (register Lisp_Object arg1, Lisp_Object arg2) { double f1, f2, f3; @@ -552,8 +529,7 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0, DEFUN ("log", Flog, Slog, 1, 2, 0, doc: /* Return the natural logarithm of ARG. If the optional argument BASE is given, return log ARG using that base. */) - (arg, base) - register Lisp_Object arg, base; + (register Lisp_Object arg, Lisp_Object base) { double d = extract_float (arg); @@ -581,8 +557,7 @@ If the optional argument BASE is given, return log ARG using that base. */) DEFUN ("log10", Flog10, Slog10, 1, 1, 0, doc: /* Return the logarithm base 10 of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); #ifdef FLOAT_CHECK_DOMAIN @@ -595,8 +570,7 @@ DEFUN ("log10", Flog10, Slog10, 1, 1, 0, DEFUN ("sqrt", Fsqrt, Ssqrt, 1, 1, 0, doc: /* Return the square root of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); #ifdef FLOAT_CHECK_DOMAIN @@ -611,8 +585,7 @@ DEFUN ("sqrt", Fsqrt, Ssqrt, 1, 1, 0, DEFUN ("acosh", Facosh, Sacosh, 1, 1, 0, doc: /* Return the inverse hyperbolic cosine of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); #ifdef FLOAT_CHECK_DOMAIN @@ -629,8 +602,7 @@ DEFUN ("acosh", Facosh, Sacosh, 1, 1, 0, DEFUN ("asinh", Fasinh, Sasinh, 1, 1, 0, doc: /* Return the inverse hyperbolic sine of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); #ifdef HAVE_INVERSE_HYPERBOLIC @@ -643,8 +615,7 @@ DEFUN ("asinh", Fasinh, Sasinh, 1, 1, 0, DEFUN ("atanh", Fatanh, Satanh, 1, 1, 0, doc: /* Return the inverse hyperbolic tangent of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); #ifdef FLOAT_CHECK_DOMAIN @@ -661,8 +632,7 @@ DEFUN ("atanh", Fatanh, Satanh, 1, 1, 0, DEFUN ("cosh", Fcosh, Scosh, 1, 1, 0, doc: /* Return the hyperbolic cosine of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); #ifdef FLOAT_CHECK_DOMAIN @@ -675,8 +645,7 @@ DEFUN ("cosh", Fcosh, Scosh, 1, 1, 0, DEFUN ("sinh", Fsinh, Ssinh, 1, 1, 0, doc: /* Return the hyperbolic sine of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); #ifdef FLOAT_CHECK_DOMAIN @@ -689,8 +658,7 @@ DEFUN ("sinh", Fsinh, Ssinh, 1, 1, 0, DEFUN ("tanh", Ftanh, Stanh, 1, 1, 0, doc: /* Return the hyperbolic tangent of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); IN_FLOAT (d = tanh (d), "tanh", arg); @@ -700,8 +668,7 @@ DEFUN ("tanh", Ftanh, Stanh, 1, 1, 0, DEFUN ("abs", Fabs, Sabs, 1, 1, 0, doc: /* Return the absolute value of ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { CHECK_NUMBER_OR_FLOAT (arg); @@ -715,8 +682,7 @@ DEFUN ("abs", Fabs, Sabs, 1, 1, 0, DEFUN ("float", Ffloat, Sfloat, 1, 1, 0, doc: /* Return the floating point number equal to ARG. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { CHECK_NUMBER_OR_FLOAT (arg); @@ -729,8 +695,7 @@ DEFUN ("float", Ffloat, Sfloat, 1, 1, 0, DEFUN ("logb", Flogb, Slogb, 1, 1, 0, doc: /* Returns largest integer <= the base 2 log of the magnitude of ARG. This is the same as the exponent of a float. */) - (arg) - Lisp_Object arg; + (Lisp_Object arg) { Lisp_Object val; EMACS_INT value; @@ -778,11 +743,10 @@ This is the same as the exponent of a float. */) /* the rounding functions */ static Lisp_Object -rounding_driver (arg, divisor, double_round, int_round2, name) - register Lisp_Object arg, divisor; - double (*double_round) (); - EMACS_INT (*int_round2) (); - char *name; +rounding_driver (Lisp_Object arg, Lisp_Object divisor, + double (*double_round) (double), + EMACS_INT (*int_round2) (EMACS_INT, EMACS_INT), + char *name) { CHECK_NUMBER_OR_FLOAT (arg); @@ -832,8 +796,7 @@ rounding_driver (arg, divisor, double_round, int_round2, name) integer functions. */ static EMACS_INT -ceiling2 (i1, i2) - EMACS_INT i1, i2; +ceiling2 (EMACS_INT i1, EMACS_INT i2) { return (i2 < 0 ? (i1 < 0 ? ((-1 - i1) / -i2) + 1 : - (i1 / -i2)) @@ -841,8 +804,7 @@ ceiling2 (i1, i2) } static EMACS_INT -floor2 (i1, i2) - EMACS_INT i1, i2; +floor2 (EMACS_INT i1, EMACS_INT i2) { return (i2 < 0 ? (i1 <= 0 ? -i1 / -i2 : -1 - ((i1 - 1) / -i2)) @@ -850,8 +812,7 @@ floor2 (i1, i2) } static EMACS_INT -truncate2 (i1, i2) - EMACS_INT i1, i2; +truncate2 (EMACS_INT i1, EMACS_INT i2) { return (i2 < 0 ? (i1 < 0 ? -i1 / -i2 : - (i1 / -i2)) @@ -859,8 +820,7 @@ truncate2 (i1, i2) } static EMACS_INT -round2 (i1, i2) - EMACS_INT i1, i2; +round2 (EMACS_INT i1, EMACS_INT i2) { /* The C language's division operator gives us one remainder R, but we want the remainder R1 on the other side of 0 if R1 is closer @@ -880,16 +840,14 @@ round2 (i1, i2) #define emacs_rint rint #else static double -emacs_rint (d) - double d; +emacs_rint (double d) { return floor (d + 0.5); } #endif static double -double_identity (d) - double d; +double_identity (double d) { return d; } @@ -898,8 +856,7 @@ DEFUN ("ceiling", Fceiling, Sceiling, 1, 2, 0, doc: /* Return the smallest integer no less than ARG. This rounds the value towards +inf. With optional DIVISOR, return the smallest integer no less than ARG/DIVISOR. */) - (arg, divisor) - Lisp_Object arg, divisor; + (Lisp_Object arg, Lisp_Object divisor) { return rounding_driver (arg, divisor, ceil, ceiling2, "ceiling"); } @@ -908,8 +865,7 @@ DEFUN ("floor", Ffloor, Sfloor, 1, 2, 0, doc: /* Return the largest integer no greater than ARG. This rounds the value towards -inf. With optional DIVISOR, return the largest integer no greater than ARG/DIVISOR. */) - (arg, divisor) - Lisp_Object arg, divisor; + (Lisp_Object arg, Lisp_Object divisor) { return rounding_driver (arg, divisor, floor, floor2, "floor"); } @@ -922,8 +878,7 @@ Rounding a value equidistant between two integers may choose the integer closer to zero, or it may prefer an even integer, depending on your machine. For example, \(round 2.5\) can return 3 on some systems, but 2 on others. */) - (arg, divisor) - Lisp_Object arg, divisor; + (Lisp_Object arg, Lisp_Object divisor) { return rounding_driver (arg, divisor, emacs_rint, round2, "round"); } @@ -932,8 +887,7 @@ DEFUN ("truncate", Ftruncate, Struncate, 1, 2, 0, doc: /* Truncate a floating point number to an int. Rounds ARG toward zero. With optional DIVISOR, truncate ARG/DIVISOR. */) - (arg, divisor) - Lisp_Object arg, divisor; + (Lisp_Object arg, Lisp_Object divisor) { return rounding_driver (arg, divisor, double_identity, truncate2, "truncate"); @@ -941,8 +895,7 @@ With optional DIVISOR, truncate ARG/DIVISOR. */) Lisp_Object -fmod_float (x, y) - register Lisp_Object x, y; +fmod_float (Lisp_Object x, Lisp_Object y) { double f1, f2; @@ -964,8 +917,7 @@ fmod_float (x, y) DEFUN ("fceiling", Ffceiling, Sfceiling, 1, 1, 0, doc: /* Return the smallest integer no less than ARG, as a float. \(Round toward +inf.\) */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); IN_FLOAT (d = ceil (d), "fceiling", arg); @@ -975,8 +927,7 @@ DEFUN ("fceiling", Ffceiling, Sfceiling, 1, 1, 0, DEFUN ("ffloor", Fffloor, Sffloor, 1, 1, 0, doc: /* Return the largest integer no greater than ARG, as a float. \(Round towards -inf.\) */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); IN_FLOAT (d = floor (d), "ffloor", arg); @@ -985,8 +936,7 @@ DEFUN ("ffloor", Fffloor, Sffloor, 1, 1, 0, DEFUN ("fround", Ffround, Sfround, 1, 1, 0, doc: /* Return the nearest integer to ARG, as a float. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); IN_FLOAT (d = emacs_rint (d), "fround", arg); @@ -996,8 +946,7 @@ DEFUN ("fround", Ffround, Sfround, 1, 1, 0, DEFUN ("ftruncate", Fftruncate, Sftruncate, 1, 1, 0, doc: /* Truncate a floating point number to an integral float value. Rounds the value toward zero. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { double d = extract_float (arg); if (d >= 0.0) @@ -1035,8 +984,7 @@ float_error (signo) #ifdef HAVE_MATHERR int -matherr (x) - struct exception *x; +matherr (struct exception *x) { Lisp_Object args; if (! in_float) @@ -1064,7 +1012,7 @@ matherr (x) #endif /* HAVE_MATHERR */ void -init_floatfns () +init_floatfns (void) { #ifdef FLOAT_CATCH_SIGILL signal (SIGILL, float_error); @@ -1073,7 +1021,7 @@ init_floatfns () } void -syms_of_floatfns () +syms_of_floatfns (void) { defsubr (&Sacos); defsubr (&Sasin); diff --git a/src/fns.c b/src/fns.c index 9569c214268..c02f5584a8f 100644 --- a/src/fns.c +++ b/src/fns.c @@ -74,10 +74,10 @@ Lisp_Object Qcodeset, Qdays, Qmonths, Qpaper; extern Lisp_Object Qinput_method_function; -static int internal_equal P_ ((Lisp_Object , Lisp_Object, int, int)); +static int internal_equal (Lisp_Object , Lisp_Object, int, int); -extern long get_random (); -extern void seed_random P_ ((long)); +extern long get_random (void); +extern void seed_random (long); #ifndef HAVE_UNISTD_H extern long time (); @@ -85,8 +85,7 @@ extern long time (); DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0, doc: /* Return the argument unchanged. */) - (arg) - Lisp_Object arg; + (Lisp_Object arg) { return arg; } @@ -98,8 +97,7 @@ All integers representable in Lisp are equally likely. With positive integer LIMIT, return random number in interval [0,LIMIT). With argument t, set the random number seed from the current time and pid. Other values of LIMIT are ignored. */) - (limit) - Lisp_Object limit; + (Lisp_Object limit) { EMACS_INT val; Lisp_Object lispy_val; @@ -135,8 +133,7 @@ A byte-code function object is also allowed. If the string contains multibyte characters, this is not necessarily the number of bytes in the string; it is the number of characters. To get the number of bytes, use `string-bytes'. */) - (sequence) - register Lisp_Object sequence; + (register Lisp_Object sequence) { register Lisp_Object val; register int i; @@ -186,8 +183,7 @@ DEFUN ("safe-length", Fsafe_length, Ssafe_length, 1, 1, 0, This function never gets an error. If LIST is not really a list, it returns 0. If LIST is circular, it returns a finite value which is at least the number of distinct elements. */) - (list) - Lisp_Object list; + (Lisp_Object list) { Lisp_Object tail, halftail, length; int len = 0; @@ -210,8 +206,7 @@ which is at least the number of distinct elements. */) DEFUN ("string-bytes", Fstring_bytes, Sstring_bytes, 1, 1, 0, doc: /* Return the number of bytes in STRING. If STRING is multibyte, this may be greater than the length of STRING. */) - (string) - Lisp_Object string; + (Lisp_Object string) { CHECK_STRING (string); return make_number (SBYTES (string)); @@ -221,8 +216,7 @@ DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0, doc: /* Return t if two strings have identical contents. Case is significant, but text properties are ignored. Symbols are also allowed; their print names are used instead. */) - (s1, s2) - register Lisp_Object s1, s2; + (register Lisp_Object s1, Lisp_Object s2) { if (SYMBOLP (s1)) s1 = SYMBOL_NAME (s1); @@ -233,7 +227,7 @@ Symbols are also allowed; their print names are used instead. */) if (SCHARS (s1) != SCHARS (s2) || SBYTES (s1) != SBYTES (s2) - || bcmp (SDATA (s1), SDATA (s2), SBYTES (s1))) + || memcmp (SDATA (s1), SDATA (s2), SBYTES (s1))) return Qnil; return Qt; } @@ -253,8 +247,7 @@ If string STR1 is less, the value is a negative number N; - 1 - N is the number of characters that match at the beginning. If string STR1 is greater, the value is a positive number N; N - 1 is the number of characters that match at the beginning. */) - (str1, start1, end1, str2, start2, end2, ignore_case) - Lisp_Object str1, start1, end1, start2, str2, end2, ignore_case; + (Lisp_Object str1, Lisp_Object start1, Lisp_Object end1, Lisp_Object str2, Lisp_Object start2, Lisp_Object end2, Lisp_Object ignore_case) { register int end1_char, end2_char; register int i1, i1_byte, i2, i2_byte; @@ -345,8 +338,7 @@ DEFUN ("string-lessp", Fstring_lessp, Sstring_lessp, 2, 2, 0, doc: /* Return t if first arg string is less than second in lexicographic order. Case is significant. Symbols are also allowed; their print names are used instead. */) - (s1, s2) - register Lisp_Object s1, s2; + (register Lisp_Object s1, Lisp_Object s2) { register int end; register int i1, i1_byte, i2, i2_byte; @@ -379,19 +371,12 @@ Symbols are also allowed; their print names are used instead. */) return i1 < SCHARS (s2) ? Qt : Qnil; } -#if __GNUC__ -/* "gcc -O3" enables automatic function inlining, which optimizes out - the arguments for the invocations of this function, whereas it - expects these values on the stack. */ -static Lisp_Object concat P_ ((int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special)) __attribute__((noinline)); -#else /* !__GNUC__ */ -static Lisp_Object concat P_ ((int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special)); -#endif +static Lisp_Object concat (int nargs, Lisp_Object *args, + enum Lisp_Type target_type, int last_special); /* ARGSUSED */ Lisp_Object -concat2 (s1, s2) - Lisp_Object s1, s2; +concat2 (Lisp_Object s1, Lisp_Object s2) { Lisp_Object args[2]; args[0] = s1; @@ -401,8 +386,7 @@ concat2 (s1, s2) /* ARGSUSED */ Lisp_Object -concat3 (s1, s2, s3) - Lisp_Object s1, s2, s3; +concat3 (Lisp_Object s1, Lisp_Object s2, Lisp_Object s3) { Lisp_Object args[3]; args[0] = s1; @@ -417,9 +401,7 @@ The result is a list whose elements are the elements of all the arguments. Each argument may be a list, vector or string. The last argument is not copied, just used as the tail of the new list. usage: (append &rest SEQUENCES) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { return concat (nargs, args, Lisp_Cons, 1); } @@ -429,9 +411,7 @@ DEFUN ("concat", Fconcat, Sconcat, 0, MANY, 0, The result is a string whose elements are the elements of all the arguments. Each argument may be a string or a list or vector of characters (integers). usage: (concat &rest SEQUENCES) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { return concat (nargs, args, Lisp_String, 0); } @@ -441,9 +421,7 @@ DEFUN ("vconcat", Fvconcat, Svconcat, 0, MANY, 0, The result is a vector whose elements are the elements of all the arguments. Each argument may be a list, vector or string. usage: (vconcat &rest SEQUENCES) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { return concat (nargs, args, Lisp_Vectorlike, 0); } @@ -453,8 +431,7 @@ DEFUN ("copy-sequence", Fcopy_sequence, Scopy_sequence, 1, 1, 0, doc: /* Return a copy of a list, vector, string or char-table. The elements of a list or vector are not copied; they are shared with the original. */) - (arg) - Lisp_Object arg; + (Lisp_Object arg) { if (NILP (arg)) return arg; @@ -471,8 +448,8 @@ with the original. */) / BOOL_VECTOR_BITS_PER_CHAR); val = Fmake_bool_vector (Flength (arg), Qnil); - bcopy (XBOOL_VECTOR (arg)->data, XBOOL_VECTOR (val)->data, - size_in_chars); + memcpy (XBOOL_VECTOR (val)->data, XBOOL_VECTOR (arg)->data, + size_in_chars); return val; } @@ -492,11 +469,7 @@ struct textprop_rec }; static Lisp_Object -concat (nargs, args, target_type, last_special) - int nargs; - Lisp_Object *args; - enum Lisp_Type target_type; - int last_special; +concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special) { Lisp_Object val; register Lisp_Object tail; @@ -643,8 +616,7 @@ concat (nargs, args, target_type, last_special) { int thislen_byte = SBYTES (this); - bcopy (SDATA (this), SDATA (val) + toindex_byte, - SBYTES (this)); + memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this)); if (! NULL_INTERVAL_P (STRING_INTERVALS (this))) { textprops[num_textprops].argnum = argnum; @@ -777,7 +749,7 @@ static EMACS_INT string_char_byte_cache_charpos; static EMACS_INT string_char_byte_cache_bytepos; void -clear_string_char_byte_cache () +clear_string_char_byte_cache (void) { string_char_byte_cache_string = Qnil; } @@ -785,9 +757,7 @@ clear_string_char_byte_cache () /* Return the byte index corresponding to CHAR_INDEX in STRING. */ EMACS_INT -string_char_to_byte (string, char_index) - Lisp_Object string; - EMACS_INT char_index; +string_char_to_byte (Lisp_Object string, EMACS_INT char_index) { EMACS_INT i_byte; EMACS_INT best_below, best_below_byte; @@ -847,9 +817,7 @@ string_char_to_byte (string, char_index) /* Return the character index corresponding to BYTE_INDEX in STRING. */ EMACS_INT -string_byte_to_char (string, byte_index) - Lisp_Object string; - EMACS_INT byte_index; +string_byte_to_char (Lisp_Object string, EMACS_INT byte_index) { EMACS_INT i, i_byte; EMACS_INT best_below, best_below_byte; @@ -913,8 +881,7 @@ string_byte_to_char (string, byte_index) /* Convert STRING to a multibyte string. */ Lisp_Object -string_make_multibyte (string) - Lisp_Object string; +string_make_multibyte (Lisp_Object string) { unsigned char *buf; EMACS_INT nbytes; @@ -947,8 +914,7 @@ string_make_multibyte (string) converted to eight-bit characters. */ Lisp_Object -string_to_multibyte (string) - Lisp_Object string; +string_to_multibyte (Lisp_Object string) { unsigned char *buf; EMACS_INT nbytes; @@ -965,7 +931,7 @@ string_to_multibyte (string) return make_multibyte_string (SDATA (string), nbytes, nbytes); SAFE_ALLOCA (buf, unsigned char *, nbytes); - bcopy (SDATA (string), buf, SBYTES (string)); + memcpy (buf, SDATA (string), SBYTES (string)); str_to_multibyte (buf, nbytes, SBYTES (string)); ret = make_multibyte_string (buf, SCHARS (string), nbytes); @@ -978,8 +944,7 @@ string_to_multibyte (string) /* Convert STRING to a single-byte string. */ Lisp_Object -string_make_unibyte (string) - Lisp_Object string; +string_make_unibyte (Lisp_Object string) { int nchars; unsigned char *buf; @@ -1012,8 +977,7 @@ or entirely ASCII, it is returned unchanged. In particular, when STRING is unibyte and entirely ASCII, the returned string is unibyte. \(When the characters are all ASCII, Emacs primitives will treat the string the same way whether it is unibyte or multibyte.) */) - (string) - Lisp_Object string; + (Lisp_Object string) { CHECK_STRING (string); @@ -1027,8 +991,7 @@ Multibyte character codes are converted to unibyte according to `nonascii-translation-table' or, if that is nil, `nonascii-insert-offset'. If the lookup in the translation table fails, this function takes just the low 8 bits of each character. */) - (string) - Lisp_Object string; + (Lisp_Object string) { CHECK_STRING (string); @@ -1042,8 +1005,7 @@ If STRING is unibyte, the result is STRING itself. Otherwise it is a newly created string, with no text properties. If STRING is multibyte and contains a character of charset `eight-bit', it is converted to the corresponding single byte. */) - (string) - Lisp_Object string; + (Lisp_Object string) { CHECK_STRING (string); @@ -1052,7 +1014,7 @@ If STRING is multibyte and contains a character of charset int bytes = SBYTES (string); unsigned char *str = (unsigned char *) xmalloc (bytes); - bcopy (SDATA (string), str, bytes); + memcpy (str, SDATA (string), bytes); bytes = str_as_unibyte (str, bytes); string = make_unibyte_string (str, bytes); xfree (str); @@ -1075,8 +1037,7 @@ Beware, this often doesn't really do what you think it does. It is similar to (decode-coding-string STRING 'utf-8-emacs). If you're not sure, whether to use `string-as-multibyte' or `string-to-multibyte', use `string-to-multibyte'. */) - (string) - Lisp_Object string; + (Lisp_Object string) { CHECK_STRING (string); @@ -1089,8 +1050,7 @@ If you're not sure, whether to use `string-as-multibyte' or SBYTES (string), &nchars, &nbytes); new_string = make_uninit_multibyte_string (nchars, nbytes); - bcopy (SDATA (string), SDATA (new_string), - SBYTES (string)); + memcpy (SDATA (new_string), SDATA (string), SBYTES (string)); if (nbytes != SBYTES (string)) str_as_multibyte (SDATA (new_string), nbytes, SBYTES (string), NULL); @@ -1112,8 +1072,7 @@ the corresponding multibyte character of charset `eight-bit'. This differs from `string-as-multibyte' by converting each byte of a correct utf-8 sequence to an eight-bit character, not just bytes that don't form a correct sequence. */) - (string) - Lisp_Object string; + (Lisp_Object string) { CHECK_STRING (string); @@ -1128,8 +1087,7 @@ Otherwise it is a newly created string, with no text properties, where each `eight-bit' character is converted to the corresponding byte. If STRING contains a non-ASCII, non-`eight-bit' character, an error is signaled. */) - (string) - Lisp_Object string; + (Lisp_Object string) { CHECK_STRING (string); @@ -1155,8 +1113,7 @@ but does not share the alist structure with ALIST. The objects mapped (cars and cdrs of elements of the alist) are shared, however. Elements of ALIST that are not conses are also shared. */) - (alist) - Lisp_Object alist; + (Lisp_Object alist) { register Lisp_Object tem; @@ -1186,9 +1143,7 @@ to the end of STRING. The STRING argument may also be a vector. In that case, the return value is a new vector that contains the elements between index FROM \(inclusive) and index TO (exclusive) of that vector argument. */) - (string, from, to) - Lisp_Object string; - register Lisp_Object from, to; + (Lisp_Object string, register Lisp_Object from, Lisp_Object to) { Lisp_Object res; int size; @@ -1257,9 +1212,7 @@ If FROM is nil or omitted, the substring starts at the beginning of STRING. If FROM or TO is negative, it counts from the end. With one argument, just copy STRING without its properties. */) - (string, from, to) - Lisp_Object string; - register Lisp_Object from, to; + (Lisp_Object string, register Lisp_Object from, Lisp_Object to) { int size, size_byte; int from_char, to_char; @@ -1311,9 +1264,7 @@ With one argument, just copy STRING without its properties. */) both in characters and in bytes. */ Lisp_Object -substring_both (string, from, from_byte, to, to_byte) - Lisp_Object string; - int from, from_byte, to, to_byte; +substring_both (Lisp_Object string, int from, int from_byte, int to, int to_byte) { Lisp_Object res; int size; @@ -1348,9 +1299,7 @@ substring_both (string, from, from_byte, to, to_byte) DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0, doc: /* Take cdr N times on LIST, returns the result. */) - (n, list) - Lisp_Object n; - register Lisp_Object list; + (Lisp_Object n, Lisp_Object list) { register int i, num; CHECK_NUMBER (n); @@ -1367,16 +1316,14 @@ DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0, DEFUN ("nth", Fnth, Snth, 2, 2, 0, doc: /* Return the Nth element of LIST. N counts from zero. If LIST is not that long, nil is returned. */) - (n, list) - Lisp_Object n, list; + (Lisp_Object n, Lisp_Object list) { return Fcar (Fnthcdr (n, list)); } DEFUN ("elt", Felt, Selt, 2, 2, 0, doc: /* Return element of SEQUENCE at index N. */) - (sequence, n) - register Lisp_Object sequence, n; + (register Lisp_Object sequence, Lisp_Object n) { CHECK_NUMBER (n); if (CONSP (sequence) || NILP (sequence)) @@ -1392,9 +1339,7 @@ DEFUN ("elt", Felt, Selt, 2, 2, 0, DEFUN ("member", Fmember, Smember, 2, 2, 0, doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `equal'. The value is actually the tail of LIST whose car is ELT. */) - (elt, list) - register Lisp_Object elt; - Lisp_Object list; + (register Lisp_Object elt, Lisp_Object list) { register Lisp_Object tail; for (tail = list; CONSP (tail); tail = XCDR (tail)) @@ -1412,8 +1357,7 @@ The value is actually the tail of LIST whose car is ELT. */) DEFUN ("memq", Fmemq, Smemq, 2, 2, 0, doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `eq'. The value is actually the tail of LIST whose car is ELT. */) - (elt, list) - register Lisp_Object elt, list; + (register Lisp_Object elt, Lisp_Object list) { while (1) { @@ -1439,9 +1383,7 @@ The value is actually the tail of LIST whose car is ELT. */) DEFUN ("memql", Fmemql, Smemql, 2, 2, 0, doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `eql'. The value is actually the tail of LIST whose car is ELT. */) - (elt, list) - register Lisp_Object elt; - Lisp_Object list; + (register Lisp_Object elt, Lisp_Object list) { register Lisp_Object tail; @@ -1464,8 +1406,7 @@ DEFUN ("assq", Fassq, Sassq, 2, 2, 0, doc: /* Return non-nil if KEY is `eq' to the car of an element of LIST. The value is actually the first element of LIST whose car is KEY. Elements of LIST that are not conses are ignored. */) - (key, list) - Lisp_Object key, list; + (Lisp_Object key, Lisp_Object list) { while (1) { @@ -1497,8 +1438,7 @@ Elements of LIST that are not conses are ignored. */) Use only on lists known never to be circular. */ Lisp_Object -assq_no_quit (key, list) - Lisp_Object key, list; +assq_no_quit (Lisp_Object key, Lisp_Object list) { while (CONSP (list) && (!CONSP (XCAR (list)) @@ -1511,8 +1451,7 @@ assq_no_quit (key, list) DEFUN ("assoc", Fassoc, Sassoc, 2, 2, 0, doc: /* Return non-nil if KEY is `equal' to the car of an element of LIST. The value is actually the first element of LIST whose car equals KEY. */) - (key, list) - Lisp_Object key, list; + (Lisp_Object key, Lisp_Object list) { Lisp_Object car; @@ -1549,8 +1488,7 @@ The value is actually the first element of LIST whose car equals KEY. */) Use only on lists known never to be circular. */ Lisp_Object -assoc_no_quit (key, list) - Lisp_Object key, list; +assoc_no_quit (Lisp_Object key, Lisp_Object list) { while (CONSP (list) && (!CONSP (XCAR (list)) @@ -1564,9 +1502,7 @@ assoc_no_quit (key, list) DEFUN ("rassq", Frassq, Srassq, 2, 2, 0, doc: /* Return non-nil if KEY is `eq' to the cdr of an element of LIST. The value is actually the first element of LIST whose cdr is KEY. */) - (key, list) - register Lisp_Object key; - Lisp_Object list; + (register Lisp_Object key, Lisp_Object list) { while (1) { @@ -1597,8 +1533,7 @@ The value is actually the first element of LIST whose cdr is KEY. */) DEFUN ("rassoc", Frassoc, Srassoc, 2, 2, 0, doc: /* Return non-nil if KEY is `equal' to the cdr of an element of LIST. The value is actually the first element of LIST whose cdr equals KEY. */) - (key, list) - Lisp_Object key, list; + (Lisp_Object key, Lisp_Object list) { Lisp_Object cdr; @@ -1637,9 +1572,7 @@ The modified LIST is returned. Comparison is done with `eq'. If the first member of LIST is ELT, there is no way to remove it by side effect; therefore, write `(setq foo (delq element foo))' to be sure of changing the value of `foo'. */) - (elt, list) - register Lisp_Object elt; - Lisp_Object list; + (register Lisp_Object elt, Lisp_Object list) { register Lisp_Object tail, prev; register Lisp_Object tem; @@ -1673,8 +1606,7 @@ If SEQ is not a list, or the first member of SEQ is ELT, deleting it is not a side effect; it is simply using a different sequence. Therefore, write `(setq foo (delete element foo))' to be sure of changing the value of `foo'. */) - (elt, seq) - Lisp_Object elt, seq; + (Lisp_Object elt, Lisp_Object seq) { if (VECTORP (seq)) { @@ -1789,8 +1721,7 @@ to be sure of changing the value of `foo'. */) DEFUN ("nreverse", Fnreverse, Snreverse, 1, 1, 0, doc: /* Reverse LIST by modifying cdr pointers. Return the reversed list. */) - (list) - Lisp_Object list; + (Lisp_Object list) { register Lisp_Object prev, tail, next; @@ -1812,8 +1743,7 @@ Return the reversed list. */) DEFUN ("reverse", Freverse, Sreverse, 1, 1, 0, doc: /* Reverse LIST, copying. Return the reversed list. See also the function `nreverse', which is used more often. */) - (list) - Lisp_Object list; + (Lisp_Object list) { Lisp_Object new; @@ -1826,15 +1756,14 @@ See also the function `nreverse', which is used more often. */) return new; } -Lisp_Object merge (); +Lisp_Object merge (Lisp_Object org_l1, Lisp_Object org_l2, Lisp_Object pred); DEFUN ("sort", Fsort, Ssort, 2, 2, 0, doc: /* Sort LIST, stably, comparing elements using PREDICATE. Returns the sorted list. LIST is modified by side effects. PREDICATE is called with two elements of LIST, and should return non-nil if the first element should sort before the second. */) - (list, predicate) - Lisp_Object list, predicate; + (Lisp_Object list, Lisp_Object predicate) { Lisp_Object front, back; register Lisp_Object len, tem; @@ -1860,9 +1789,7 @@ if the first element should sort before the second. */) } Lisp_Object -merge (org_l1, org_l2, pred) - Lisp_Object org_l1, org_l2; - Lisp_Object pred; +merge (Lisp_Object org_l1, Lisp_Object org_l2, Lisp_Object pred) { Lisp_Object value; register Lisp_Object tail; @@ -1928,9 +1855,7 @@ PLIST is a property list, which is a list of the form \(PROP1 VALUE1 PROP2 VALUE2...). This function returns the value corresponding to the given PROP, or nil if PROP is not one of the properties on the list. This function never signals an error. */) - (plist, prop) - Lisp_Object plist; - Lisp_Object prop; + (Lisp_Object plist, Lisp_Object prop) { Lisp_Object tail, halftail; @@ -1960,8 +1885,7 @@ properties on the list. This function never signals an error. */) DEFUN ("get", Fget, Sget, 2, 2, 0, doc: /* Return the value of SYMBOL's PROPNAME property. This is the last value stored with `(put SYMBOL PROPNAME VALUE)'. */) - (symbol, propname) - Lisp_Object symbol, propname; + (Lisp_Object symbol, Lisp_Object propname) { CHECK_SYMBOL (symbol); return Fplist_get (XSYMBOL (symbol)->plist, propname); @@ -1975,10 +1899,7 @@ If PROP is already a property on the list, its value is set to VAL, otherwise the new PROP VAL pair is added. The new plist is returned; use `(setq x (plist-put x prop val))' to be sure to use the new value. The PLIST is modified by side effects. */) - (plist, prop, val) - Lisp_Object plist; - register Lisp_Object prop; - Lisp_Object val; + (Lisp_Object plist, register Lisp_Object prop, Lisp_Object val) { register Lisp_Object tail, prev; Lisp_Object newcell; @@ -2006,8 +1927,7 @@ The PLIST is modified by side effects. */) DEFUN ("put", Fput, Sput, 3, 3, 0, doc: /* Store SYMBOL's PROPNAME property with value VALUE. It can be retrieved with `(get SYMBOL PROPNAME)'. */) - (symbol, propname, value) - Lisp_Object symbol, propname, value; + (Lisp_Object symbol, Lisp_Object propname, Lisp_Object value) { CHECK_SYMBOL (symbol); XSYMBOL (symbol)->plist @@ -2021,9 +1941,7 @@ PLIST is a property list, which is a list of the form \(PROP1 VALUE1 PROP2 VALUE2...). This function returns the value corresponding to the given PROP, or nil if PROP is not one of the properties on the list. */) - (plist, prop) - Lisp_Object plist; - Lisp_Object prop; + (Lisp_Object plist, Lisp_Object prop) { Lisp_Object tail; @@ -2050,10 +1968,7 @@ If PROP is already a property on the list, its value is set to VAL, otherwise the new PROP VAL pair is added. The new plist is returned; use `(setq x (lax-plist-put x prop val))' to be sure to use the new value. The PLIST is modified by side effects. */) - (plist, prop, val) - Lisp_Object plist; - register Lisp_Object prop; - Lisp_Object val; + (Lisp_Object plist, register Lisp_Object prop, Lisp_Object val) { register Lisp_Object tail, prev; Lisp_Object newcell; @@ -2081,8 +1996,7 @@ The PLIST is modified by side effects. */) DEFUN ("eql", Feql, Seql, 2, 2, 0, doc: /* Return t if the two args are the same Lisp object. Floating-point numbers of equal value are `eql', but they may not be `eq'. */) - (obj1, obj2) - Lisp_Object obj1, obj2; + (Lisp_Object obj1, Lisp_Object obj2) { if (FLOATP (obj1)) return internal_equal (obj1, obj2, 0, 0) ? Qt : Qnil; @@ -2098,8 +2012,7 @@ Vectors and strings are compared element by element. Numbers are compared by value, but integers cannot equal floats. (Use `=' if you want integers and floats to be able to be equal.) Symbols must match exactly. */) - (o1, o2) - register Lisp_Object o1, o2; + (register Lisp_Object o1, Lisp_Object o2) { return internal_equal (o1, o2, 0, 0) ? Qt : Qnil; } @@ -2108,8 +2021,7 @@ DEFUN ("equal-including-properties", Fequal_including_properties, Sequal_includi doc: /* Return t if two Lisp objects have similar structure and contents. This is like `equal' except that it compares the text properties of strings. (`equal' ignores text properties.) */) - (o1, o2) - register Lisp_Object o1, o2; + (register Lisp_Object o1, Lisp_Object o2) { return internal_equal (o1, o2, 0, 1) ? Qt : Qnil; } @@ -2119,9 +2031,7 @@ of strings. (`equal' ignores text properties.) */) PROPS, if non-nil, means compare string text properties too. */ static int -internal_equal (o1, o2, depth, props) - register Lisp_Object o1, o2; - int depth, props; +internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int props) { if (depth > 200) error ("Stack overflow in equal"); @@ -2193,8 +2103,8 @@ internal_equal (o1, o2, depth, props) if (XBOOL_VECTOR (o1)->size != XBOOL_VECTOR (o2)->size) return 0; - if (bcmp (XBOOL_VECTOR (o1)->data, XBOOL_VECTOR (o2)->data, - size_in_chars)) + if (memcmp (XBOOL_VECTOR (o1)->data, XBOOL_VECTOR (o2)->data, + size_in_chars)) return 0; return 1; } @@ -2229,8 +2139,7 @@ internal_equal (o1, o2, depth, props) return 0; if (SBYTES (o1) != SBYTES (o2)) return 0; - if (bcmp (SDATA (o1), SDATA (o2), - SBYTES (o1))) + if (memcmp (SDATA (o1), SDATA (o2), SBYTES (o1))) return 0; if (props && !compare_string_intervals (o1, o2)) return 0; @@ -2243,13 +2152,11 @@ internal_equal (o1, o2, depth, props) return 0; } -extern Lisp_Object Fmake_char_internal (); DEFUN ("fillarray", Ffillarray, Sfillarray, 2, 2, 0, doc: /* Store each element of ARRAY with ITEM. ARRAY is a vector, string, char-table, or bool-vector. */) - (array, item) - Lisp_Object array, item; + (Lisp_Object array, Lisp_Object item) { register int size, index, charval; if (VECTORP (array)) @@ -2323,13 +2230,12 @@ DEFUN ("clear-string", Fclear_string, Sclear_string, 1, 1, 0, doc: /* Clear the contents of STRING. This makes STRING unibyte and may change its length. */) - (string) - Lisp_Object string; + (Lisp_Object string) { int len; CHECK_STRING (string); len = SBYTES (string); - bzero (SDATA (string), len); + memset (SDATA (string), 0, len); STRING_SET_CHARS (string, len); STRING_SET_UNIBYTE (string); return Qnil; @@ -2337,8 +2243,7 @@ This makes STRING unibyte and may change its length. */) /* ARGSUSED */ Lisp_Object -nconc2 (s1, s2) - Lisp_Object s1, s2; +nconc2 (Lisp_Object s1, Lisp_Object s2) { Lisp_Object args[2]; args[0] = s1; @@ -2350,9 +2255,7 @@ DEFUN ("nconc", Fnconc, Snconc, 0, MANY, 0, doc: /* Concatenate any number of lists by altering them. Only the last argument is not altered, and need not be a list. usage: (nconc &rest LISTS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { register int argnum; register Lisp_Object tail, tem, val; @@ -2393,10 +2296,7 @@ usage: (nconc &rest LISTS) */) LENI is the length of VALS, which should also be the length of SEQ. */ static void -mapcar1 (leni, vals, fn, seq) - int leni; - Lisp_Object *vals; - Lisp_Object fn, seq; +mapcar1 (int leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq) { register Lisp_Object tail; Lisp_Object dummy; @@ -2476,8 +2376,7 @@ DEFUN ("mapconcat", Fmapconcat, Smapconcat, 3, 3, 0, In between each pair of results, stick in SEPARATOR. Thus, " " as SEPARATOR results in spaces between the values returned by FUNCTION. SEQUENCE may be a list, a vector, a bool-vector, or a string. */) - (function, sequence, separator) - Lisp_Object function, sequence, separator; + (Lisp_Object function, Lisp_Object sequence, Lisp_Object separator) { Lisp_Object len; register int leni; @@ -2517,8 +2416,7 @@ DEFUN ("mapcar", Fmapcar, Smapcar, 2, 2, 0, doc: /* Apply FUNCTION to each element of SEQUENCE, and make a list of the results. The result is a list just as long as SEQUENCE. SEQUENCE may be a list, a vector, a bool-vector, or a string. */) - (function, sequence) - Lisp_Object function, sequence; + (Lisp_Object function, Lisp_Object sequence) { register Lisp_Object len; register int leni; @@ -2545,8 +2443,7 @@ DEFUN ("mapc", Fmapc, Smapc, 2, 2, 0, doc: /* Apply FUNCTION to each element of SEQUENCE for side effects only. Unlike `mapcar', don't accumulate the results. Return SEQUENCE. SEQUENCE may be a list, a vector, a bool-vector, or a string. */) - (function, sequence) - Lisp_Object function, sequence; + (Lisp_Object function, Lisp_Object sequence) { register int leni; @@ -2572,8 +2469,7 @@ for more information. In this case, the useful bindings are `act', `skip', Under a windowing system a dialog box will be used if `last-nonmenu-event' is nil and `use-dialog-box' is non-nil. */) - (prompt) - Lisp_Object prompt; + (Lisp_Object prompt) { register Lisp_Object obj, key, def, map; register int answer; @@ -2705,8 +2601,7 @@ is nil and `use-dialog-box' is non-nil. */) Anything that calls this function must protect from GC! */ Lisp_Object -do_yes_or_no_p (prompt) - Lisp_Object prompt; +do_yes_or_no_p (Lisp_Object prompt) { return call1 (intern ("yes-or-no-p"), prompt); } @@ -2722,8 +2617,7 @@ and can edit it until it has been confirmed. Under a windowing system a dialog box will be used if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil. */) - (prompt) - Lisp_Object prompt; + (Lisp_Object prompt) { register Lisp_Object ans; Lisp_Object args[2]; @@ -2795,8 +2689,7 @@ An error is thrown if the load average can't be obtained. In some cases making it work would require Emacs being installed setuid or setgid so that it can read kernel information, and that usually isn't advisable. */) - (use_floats) - Lisp_Object use_floats; + (Lisp_Object use_floats) { double load_ave[3]; int loads = getloadavg (load_ave, 3); @@ -2827,8 +2720,7 @@ presence or absence of Emacs or environment extensions. Use `provide' to declare that a feature is available. This function looks at the value of the variable `features'. The optional argument SUBFEATURE can be used to check a specific subfeature of FEATURE. */) - (feature, subfeature) - Lisp_Object feature, subfeature; + (Lisp_Object feature, Lisp_Object subfeature) { register Lisp_Object tem; CHECK_SYMBOL (feature); @@ -2842,8 +2734,7 @@ DEFUN ("provide", Fprovide, Sprovide, 1, 2, 0, doc: /* Announce that FEATURE is a feature of the current Emacs. The optional argument SUBFEATURES should be a list of symbols listing particular subfeatures supported in this version of FEATURE. */) - (feature, subfeatures) - Lisp_Object feature, subfeatures; + (Lisp_Object feature, Lisp_Object subfeatures) { register Lisp_Object tem; CHECK_SYMBOL (feature); @@ -2873,8 +2764,7 @@ particular subfeatures supported in this version of FEATURE. */) Lisp_Object require_nesting_list; Lisp_Object -require_unwind (old_value) - Lisp_Object old_value; +require_unwind (Lisp_Object old_value) { return require_nesting_list = old_value; } @@ -2890,8 +2780,7 @@ If the optional third argument NOERROR is non-nil, then return nil if the file is not found instead of signaling an error. Normally the return value is FEATURE. The normal messages at start and end of loading FILENAME are suppressed. */) - (feature, filename, noerror) - Lisp_Object feature, filename, noerror; + (Lisp_Object feature, Lisp_Object filename, Lisp_Object noerror) { register Lisp_Object tem; struct gcpro gcpro1, gcpro2; @@ -2986,8 +2875,7 @@ PLIST is a property list, which is a list of the form Unlike `plist-get', this allows you to distinguish between a missing property and a property with the value nil. The value is actually the tail of PLIST whose car is PROP. */) - (plist, prop) - Lisp_Object plist, prop; + (Lisp_Object plist, Lisp_Object prop) { while (CONSP (plist) && !EQ (XCAR (plist), prop)) { @@ -3001,8 +2889,7 @@ The value is actually the tail of PLIST whose car is PROP. */) DEFUN ("widget-put", Fwidget_put, Swidget_put, 3, 3, 0, doc: /* In WIDGET, set PROPERTY to VALUE. The value can later be retrieved with `widget-get'. */) - (widget, property, value) - Lisp_Object widget, property, value; + (Lisp_Object widget, Lisp_Object property, Lisp_Object value) { CHECK_CONS (widget); XSETCDR (widget, Fplist_put (XCDR (widget), property, value)); @@ -3013,8 +2900,7 @@ DEFUN ("widget-get", Fwidget_get, Swidget_get, 2, 2, 0, doc: /* In WIDGET, get the value of PROPERTY. The value could either be specified when the widget was created, or later with `widget-put'. */) - (widget, property) - Lisp_Object widget, property; + (Lisp_Object widget, Lisp_Object property) { Lisp_Object tmp; @@ -3040,9 +2926,7 @@ DEFUN ("widget-apply", Fwidget_apply, Swidget_apply, 2, MANY, 0, doc: /* Apply the value of WIDGET's PROPERTY to the widget itself. ARGS are passed as extra arguments to the function. usage: (widget-apply WIDGET PROPERTY &rest ARGS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { /* This function can GC. */ Lisp_Object newargs[3]; @@ -3081,8 +2965,7 @@ If the system can't provide such information through a call to See also Info node `(libc)Locales'. The data read from the system are decoded using `locale-coding-system'. */) - (item) - Lisp_Object item; + (Lisp_Object item) { char *str = NULL; #ifdef HAVE_LANGINFO_CODESET @@ -3227,8 +3110,8 @@ static const short base64_char_to_value[128] = base64 characters. */ -static int base64_encode_1 P_ ((const char *, char *, int, int, int)); -static int base64_decode_1 P_ ((const char *, char *, int, int, int *)); +static int base64_encode_1 (const char *, char *, int, int, int); +static int base64_decode_1 (const char *, char *, int, int, int *); DEFUN ("base64-encode-region", Fbase64_encode_region, Sbase64_encode_region, 2, 3, "r", @@ -3236,8 +3119,7 @@ DEFUN ("base64-encode-region", Fbase64_encode_region, Sbase64_encode_region, Return the length of the encoded text. Optional third argument NO-LINE-BREAK means do not break long lines into shorter lines. */) - (beg, end, no_line_break) - Lisp_Object beg, end, no_line_break; + (Lisp_Object beg, Lisp_Object end, Lisp_Object no_line_break) { char *encoded; int allength, length; @@ -3296,8 +3178,7 @@ DEFUN ("base64-encode-string", Fbase64_encode_string, Sbase64_encode_string, doc: /* Base64-encode STRING and return the result. Optional second argument NO-LINE-BREAK means do not break long lines into shorter lines. */) - (string, no_line_break) - Lisp_Object string, no_line_break; + (Lisp_Object string, Lisp_Object no_line_break) { int allength, length, encoded_length; char *encoded; @@ -3336,12 +3217,7 @@ into shorter lines. */) } static int -base64_encode_1 (from, to, length, line_break, multibyte) - const char *from; - char *to; - int length; - int line_break; - int multibyte; +base64_encode_1 (const char *from, char *to, int length, int line_break, int multibyte) { int counter = 0, i = 0; char *e = to; @@ -3440,8 +3316,7 @@ DEFUN ("base64-decode-region", Fbase64_decode_region, Sbase64_decode_region, doc: /* Base64-decode the region between BEG and END. Return the length of the decoded text. If the region can't be decoded, signal an error and don't modify the buffer. */) - (beg, end) - Lisp_Object beg, end; + (Lisp_Object beg, Lisp_Object end) { int ibeg, iend, length, allength; char *decoded; @@ -3501,8 +3376,7 @@ If the region can't be decoded, signal an error and don't modify the buffer. */ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string, 1, 1, 0, doc: /* Base64-decode STRING and return the result. */) - (string) - Lisp_Object string; + (Lisp_Object string) { char *decoded; int length, decoded_length; @@ -3538,12 +3412,7 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string, characters in *NCHARS_RETURN. */ static int -base64_decode_1 (from, to, length, multibyte, nchars_return) - const char *from; - char *to; - int length; - int multibyte; - int *nchars_return; +base64_decode_1 (const char *from, char *to, int length, int multibyte, int *nchars_return) { int i = 0; char *e = to; @@ -3655,25 +3524,25 @@ Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value; /* Function prototypes. */ -static struct Lisp_Hash_Table *check_hash_table P_ ((Lisp_Object)); -static int get_key_arg P_ ((Lisp_Object, int, Lisp_Object *, char *)); -static void maybe_resize_hash_table P_ ((struct Lisp_Hash_Table *)); -static int cmpfn_eql P_ ((struct Lisp_Hash_Table *, Lisp_Object, unsigned, - Lisp_Object, unsigned)); -static int cmpfn_equal P_ ((struct Lisp_Hash_Table *, Lisp_Object, unsigned, - Lisp_Object, unsigned)); -static int cmpfn_user_defined P_ ((struct Lisp_Hash_Table *, Lisp_Object, - unsigned, Lisp_Object, unsigned)); -static unsigned hashfn_eq P_ ((struct Lisp_Hash_Table *, Lisp_Object)); -static unsigned hashfn_eql P_ ((struct Lisp_Hash_Table *, Lisp_Object)); -static unsigned hashfn_equal P_ ((struct Lisp_Hash_Table *, Lisp_Object)); -static unsigned hashfn_user_defined P_ ((struct Lisp_Hash_Table *, - Lisp_Object)); -static unsigned sxhash_string P_ ((unsigned char *, int)); -static unsigned sxhash_list P_ ((Lisp_Object, int)); -static unsigned sxhash_vector P_ ((Lisp_Object, int)); -static unsigned sxhash_bool_vector P_ ((Lisp_Object)); -static int sweep_weak_table P_ ((struct Lisp_Hash_Table *, int)); +static struct Lisp_Hash_Table *check_hash_table (Lisp_Object); +static int get_key_arg (Lisp_Object, int, Lisp_Object *, char *); +static void maybe_resize_hash_table (struct Lisp_Hash_Table *); +static int cmpfn_eql (struct Lisp_Hash_Table *, Lisp_Object, unsigned, + Lisp_Object, unsigned); +static int cmpfn_equal (struct Lisp_Hash_Table *, Lisp_Object, unsigned, + Lisp_Object, unsigned); +static int cmpfn_user_defined (struct Lisp_Hash_Table *, Lisp_Object, + unsigned, Lisp_Object, unsigned); +static unsigned hashfn_eq (struct Lisp_Hash_Table *, Lisp_Object); +static unsigned hashfn_eql (struct Lisp_Hash_Table *, Lisp_Object); +static unsigned hashfn_equal (struct Lisp_Hash_Table *, Lisp_Object); +static unsigned hashfn_user_defined (struct Lisp_Hash_Table *, + Lisp_Object); +static unsigned sxhash_string (unsigned char *, int); +static unsigned sxhash_list (Lisp_Object, int); +static unsigned sxhash_vector (Lisp_Object, int); +static unsigned sxhash_bool_vector (Lisp_Object); +static int sweep_weak_table (struct Lisp_Hash_Table *, int); @@ -3685,8 +3554,7 @@ static int sweep_weak_table P_ ((struct Lisp_Hash_Table *, int)); Lisp_Hash_Table. Otherwise, signal an error. */ static struct Lisp_Hash_Table * -check_hash_table (obj) - Lisp_Object obj; +check_hash_table (Lisp_Object obj) { CHECK_HASH_TABLE (obj); return XHASH_TABLE (obj); @@ -3697,8 +3565,7 @@ check_hash_table (obj) number. */ int -next_almost_prime (n) - int n; +next_almost_prime (int n) { if (n % 2 == 0) n += 1; @@ -3717,11 +3584,7 @@ next_almost_prime (n) a DEFUN parameter list. */ static int -get_key_arg (key, nargs, args, used) - Lisp_Object key; - int nargs; - Lisp_Object *args; - char *used; +get_key_arg (Lisp_Object key, int nargs, Lisp_Object *args, char *used) { int i; @@ -3746,10 +3609,7 @@ get_key_arg (key, nargs, args, used) vector that are not copied from VEC are set to INIT. */ Lisp_Object -larger_vector (vec, new_size, init) - Lisp_Object vec; - int new_size; - Lisp_Object init; +larger_vector (Lisp_Object vec, int new_size, Lisp_Object init) { struct Lisp_Vector *v; int i, old_size; @@ -3759,8 +3619,7 @@ larger_vector (vec, new_size, init) xassert (new_size >= old_size); v = allocate_vector (new_size); - bcopy (XVECTOR (vec)->contents, v->contents, - old_size * sizeof *v->contents); + memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents); for (i = old_size; i < new_size; ++i) v->contents[i] = init; XSETVECTOR (vec, v); @@ -3777,10 +3636,7 @@ larger_vector (vec, new_size, init) KEY2 are the same. */ static int -cmpfn_eql (h, key1, hash1, key2, hash2) - struct Lisp_Hash_Table *h; - Lisp_Object key1, key2; - unsigned hash1, hash2; +cmpfn_eql (struct Lisp_Hash_Table *h, Lisp_Object key1, unsigned int hash1, Lisp_Object key2, unsigned int hash2) { return (FLOATP (key1) && FLOATP (key2) @@ -3793,10 +3649,7 @@ cmpfn_eql (h, key1, hash1, key2, hash2) KEY2 are the same. */ static int -cmpfn_equal (h, key1, hash1, key2, hash2) - struct Lisp_Hash_Table *h; - Lisp_Object key1, key2; - unsigned hash1, hash2; +cmpfn_equal (struct Lisp_Hash_Table *h, Lisp_Object key1, unsigned int hash1, Lisp_Object key2, unsigned int hash2) { return hash1 == hash2 && !NILP (Fequal (key1, key2)); } @@ -3807,10 +3660,7 @@ cmpfn_equal (h, key1, hash1, key2, hash2) if KEY1 and KEY2 are the same. */ static int -cmpfn_user_defined (h, key1, hash1, key2, hash2) - struct Lisp_Hash_Table *h; - Lisp_Object key1, key2; - unsigned hash1, hash2; +cmpfn_user_defined (struct Lisp_Hash_Table *h, Lisp_Object key1, unsigned int hash1, Lisp_Object key2, unsigned int hash2) { if (hash1 == hash2) { @@ -3831,9 +3681,7 @@ cmpfn_user_defined (h, key1, hash1, key2, hash2) in a Lisp integer. */ static unsigned -hashfn_eq (h, key) - struct Lisp_Hash_Table *h; - Lisp_Object key; +hashfn_eq (struct Lisp_Hash_Table *h, Lisp_Object key) { unsigned hash = XUINT (key) ^ XTYPE (key); xassert ((hash & ~INTMASK) == 0); @@ -3846,9 +3694,7 @@ hashfn_eq (h, key) in a Lisp integer. */ static unsigned -hashfn_eql (h, key) - struct Lisp_Hash_Table *h; - Lisp_Object key; +hashfn_eql (struct Lisp_Hash_Table *h, Lisp_Object key) { unsigned hash; if (FLOATP (key)) @@ -3865,9 +3711,7 @@ hashfn_eql (h, key) in a Lisp integer. */ static unsigned -hashfn_equal (h, key) - struct Lisp_Hash_Table *h; - Lisp_Object key; +hashfn_equal (struct Lisp_Hash_Table *h, Lisp_Object key) { unsigned hash = sxhash (key, 0); xassert ((hash & ~INTMASK) == 0); @@ -3880,9 +3724,7 @@ hashfn_equal (h, key) guaranteed to fit in a Lisp integer. */ static unsigned -hashfn_user_defined (h, key) - struct Lisp_Hash_Table *h; - Lisp_Object key; +hashfn_user_defined (struct Lisp_Hash_Table *h, Lisp_Object key) { Lisp_Object args[2], hash; @@ -3918,10 +3760,9 @@ hashfn_user_defined (h, key) one of the symbols `key', `value', `key-or-value', or `key-and-value'. */ Lisp_Object -make_hash_table (test, size, rehash_size, rehash_threshold, weak, - user_test, user_hash) - Lisp_Object test, size, rehash_size, rehash_threshold, weak; - Lisp_Object user_test, user_hash; +make_hash_table (Lisp_Object test, Lisp_Object size, Lisp_Object rehash_size, + Lisp_Object rehash_threshold, Lisp_Object weak, + Lisp_Object user_test, Lisp_Object user_hash) { struct Lisp_Hash_Table *h; Lisp_Object table; @@ -4006,8 +3847,7 @@ make_hash_table (test, size, rehash_size, rehash_threshold, weak, only the table itself is. */ Lisp_Object -copy_hash_table (h1) - struct Lisp_Hash_Table *h1; +copy_hash_table (struct Lisp_Hash_Table *h1) { Lisp_Object table; struct Lisp_Hash_Table *h2; @@ -4015,7 +3855,7 @@ copy_hash_table (h1) h2 = allocate_hash_table (); next = h2->vec_next; - bcopy (h1, h2, sizeof *h2); + memcpy (h2, h1, sizeof *h2); h2->vec_next = next; h2->key_and_value = Fcopy_sequence (h1->key_and_value); h2->hash = Fcopy_sequence (h1->hash); @@ -4038,8 +3878,7 @@ copy_hash_table (h1) because it's already too large, throw an error. */ static INLINE void -maybe_resize_hash_table (h) - struct Lisp_Hash_Table *h; +maybe_resize_hash_table (struct Lisp_Hash_Table *h) { if (NILP (h->next_free)) { @@ -4104,10 +3943,7 @@ maybe_resize_hash_table (h) matching KEY, or -1 if not found. */ int -hash_lookup (h, key, hash) - struct Lisp_Hash_Table *h; - Lisp_Object key; - unsigned *hash; +hash_lookup (struct Lisp_Hash_Table *h, Lisp_Object key, unsigned int *hash) { unsigned hash_code; int start_of_bucket; @@ -4141,10 +3977,7 @@ hash_lookup (h, key, hash) Value is the index of the entry in H matching KEY. */ int -hash_put (h, key, value, hash) - struct Lisp_Hash_Table *h; - Lisp_Object key, value; - unsigned hash; +hash_put (struct Lisp_Hash_Table *h, Lisp_Object key, Lisp_Object value, unsigned int hash) { int start_of_bucket, i; @@ -4174,9 +4007,7 @@ hash_put (h, key, value, hash) /* Remove the entry matching KEY from hash table H, if there is one. */ static void -hash_remove_from_table (h, key) - struct Lisp_Hash_Table *h; - Lisp_Object key; +hash_remove_from_table (struct Lisp_Hash_Table *h, Lisp_Object key) { unsigned hash_code; int start_of_bucket; @@ -4224,8 +4055,7 @@ hash_remove_from_table (h, key) /* Clear hash table H. */ void -hash_clear (h) - struct Lisp_Hash_Table *h; +hash_clear (struct Lisp_Hash_Table *h) { if (h->count > 0) { @@ -4254,7 +4084,7 @@ hash_clear (h) ************************************************************************/ void -init_weak_hash_tables () +init_weak_hash_tables (void) { weak_hash_tables = NULL; } @@ -4265,9 +4095,7 @@ init_weak_hash_tables () non-zero if anything was marked. */ static int -sweep_weak_table (h, remove_entries_p) - struct Lisp_Hash_Table *h; - int remove_entries_p; +sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p) { int bucket, n, marked; @@ -4355,7 +4183,7 @@ sweep_weak_table (h, remove_entries_p) from Vweak_hash_tables. Called from gc_sweep. */ void -sweep_weak_hash_tables () +sweep_weak_hash_tables (void) { struct Lisp_Hash_Table *h, *used, *next; int marked; @@ -4423,9 +4251,7 @@ sweep_weak_hash_tables () code returned is guaranteed to fit in a Lisp integer. */ static unsigned -sxhash_string (ptr, len) - unsigned char *ptr; - int len; +sxhash_string (unsigned char *ptr, int len) { unsigned char *p = ptr; unsigned char *end = p + len; @@ -4448,9 +4274,7 @@ sxhash_string (ptr, len) list. We don't recurse deeper than SXHASH_MAX_DEPTH in it. */ static unsigned -sxhash_list (list, depth) - Lisp_Object list; - int depth; +sxhash_list (Lisp_Object list, int depth) { unsigned hash = 0; int i; @@ -4478,9 +4302,7 @@ sxhash_list (list, depth) the Lisp structure. */ static unsigned -sxhash_vector (vec, depth) - Lisp_Object vec; - int depth; +sxhash_vector (Lisp_Object vec, int depth) { unsigned hash = ASIZE (vec); int i, n; @@ -4499,8 +4321,7 @@ sxhash_vector (vec, depth) /* Return a hash for bool-vector VECTOR. */ static unsigned -sxhash_bool_vector (vec) - Lisp_Object vec; +sxhash_bool_vector (Lisp_Object vec) { unsigned hash = XBOOL_VECTOR (vec)->size; int i, n; @@ -4517,9 +4338,7 @@ sxhash_bool_vector (vec) structure. Value is an unsigned integer clipped to INTMASK. */ unsigned -sxhash (obj, depth) - Lisp_Object obj; - int depth; +sxhash (Lisp_Object obj, int depth) { unsigned hash; @@ -4590,8 +4409,7 @@ sxhash (obj, depth) DEFUN ("sxhash", Fsxhash, Ssxhash, 1, 1, 0, doc: /* Compute a hash code for OBJ and return it as integer. */) - (obj) - Lisp_Object obj; + (Lisp_Object obj) { unsigned hash = sxhash (obj, 0); return make_number (hash); @@ -4630,9 +4448,7 @@ WEAK. WEAK t is equivalent to `key-and-value'. Default value of WEAK is nil. usage: (make-hash-table &rest KEYWORD-ARGS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { Lisp_Object test, size, rehash_size, rehash_threshold, weak; Lisp_Object user_test, user_hash; @@ -4642,7 +4458,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) /* The vector `used' is used to keep track of arguments that have been consumed. */ used = (char *) alloca (nargs * sizeof *used); - bzero (used, nargs * sizeof *used); + memset (used, 0, nargs * sizeof *used); /* See if there's a `:test TEST' among the arguments. */ i = get_key_arg (QCtest, nargs, args, used); @@ -4709,8 +4525,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) DEFUN ("copy-hash-table", Fcopy_hash_table, Scopy_hash_table, 1, 1, 0, doc: /* Return a copy of hash table TABLE. */) - (table) - Lisp_Object table; + (Lisp_Object table) { return copy_hash_table (check_hash_table (table)); } @@ -4718,8 +4533,7 @@ DEFUN ("copy-hash-table", Fcopy_hash_table, Scopy_hash_table, 1, 1, 0, DEFUN ("hash-table-count", Fhash_table_count, Shash_table_count, 1, 1, 0, doc: /* Return the number of elements in TABLE. */) - (table) - Lisp_Object table; + (Lisp_Object table) { return make_number (check_hash_table (table)->count); } @@ -4728,8 +4542,7 @@ DEFUN ("hash-table-count", Fhash_table_count, Shash_table_count, 1, 1, 0, DEFUN ("hash-table-rehash-size", Fhash_table_rehash_size, Shash_table_rehash_size, 1, 1, 0, doc: /* Return the current rehash size of TABLE. */) - (table) - Lisp_Object table; + (Lisp_Object table) { return check_hash_table (table)->rehash_size; } @@ -4738,8 +4551,7 @@ DEFUN ("hash-table-rehash-size", Fhash_table_rehash_size, DEFUN ("hash-table-rehash-threshold", Fhash_table_rehash_threshold, Shash_table_rehash_threshold, 1, 1, 0, doc: /* Return the current rehash threshold of TABLE. */) - (table) - Lisp_Object table; + (Lisp_Object table) { return check_hash_table (table)->rehash_threshold; } @@ -4750,8 +4562,7 @@ DEFUN ("hash-table-size", Fhash_table_size, Shash_table_size, 1, 1, 0, The size can be used as an argument to `make-hash-table' to create a hash table than can hold as many elements of TABLE holds without need for resizing. */) - (table) - Lisp_Object table; + (Lisp_Object table) { struct Lisp_Hash_Table *h = check_hash_table (table); return make_number (HASH_TABLE_SIZE (h)); @@ -4760,8 +4571,7 @@ without need for resizing. */) DEFUN ("hash-table-test", Fhash_table_test, Shash_table_test, 1, 1, 0, doc: /* Return the test TABLE uses. */) - (table) - Lisp_Object table; + (Lisp_Object table) { return check_hash_table (table)->test; } @@ -4770,8 +4580,7 @@ DEFUN ("hash-table-test", Fhash_table_test, Shash_table_test, 1, 1, 0, DEFUN ("hash-table-weakness", Fhash_table_weakness, Shash_table_weakness, 1, 1, 0, doc: /* Return the weakness of TABLE. */) - (table) - Lisp_Object table; + (Lisp_Object table) { return check_hash_table (table)->weak; } @@ -4779,8 +4588,7 @@ DEFUN ("hash-table-weakness", Fhash_table_weakness, Shash_table_weakness, DEFUN ("hash-table-p", Fhash_table_p, Shash_table_p, 1, 1, 0, doc: /* Return t if OBJ is a Lisp hash table object. */) - (obj) - Lisp_Object obj; + (Lisp_Object obj) { return HASH_TABLE_P (obj) ? Qt : Qnil; } @@ -4788,8 +4596,7 @@ DEFUN ("hash-table-p", Fhash_table_p, Shash_table_p, 1, 1, 0, DEFUN ("clrhash", Fclrhash, Sclrhash, 1, 1, 0, doc: /* Clear hash table TABLE and return it. */) - (table) - Lisp_Object table; + (Lisp_Object table) { hash_clear (check_hash_table (table)); /* Be compatible with XEmacs. */ @@ -4800,8 +4607,7 @@ DEFUN ("clrhash", Fclrhash, Sclrhash, 1, 1, 0, DEFUN ("gethash", Fgethash, Sgethash, 2, 3, 0, doc: /* Look up KEY in TABLE and return its associated value. If KEY is not found, return DFLT which defaults to nil. */) - (key, table, dflt) - Lisp_Object key, table, dflt; + (Lisp_Object key, Lisp_Object table, Lisp_Object dflt) { struct Lisp_Hash_Table *h = check_hash_table (table); int i = hash_lookup (h, key, NULL); @@ -4813,8 +4619,7 @@ DEFUN ("puthash", Fputhash, Sputhash, 3, 3, 0, doc: /* Associate KEY with VALUE in hash table TABLE. If KEY is already present in table, replace its current value with VALUE. */) - (key, value, table) - Lisp_Object key, value, table; + (Lisp_Object key, Lisp_Object value, Lisp_Object table) { struct Lisp_Hash_Table *h = check_hash_table (table); int i; @@ -4832,8 +4637,7 @@ VALUE. */) DEFUN ("remhash", Fremhash, Sremhash, 2, 2, 0, doc: /* Remove KEY from TABLE. */) - (key, table) - Lisp_Object key, table; + (Lisp_Object key, Lisp_Object table) { struct Lisp_Hash_Table *h = check_hash_table (table); hash_remove_from_table (h, key); @@ -4844,8 +4648,7 @@ DEFUN ("remhash", Fremhash, Sremhash, 2, 2, 0, DEFUN ("maphash", Fmaphash, Smaphash, 2, 2, 0, doc: /* Call FUNCTION for all entries in hash table TABLE. FUNCTION is called with two arguments, KEY and VALUE. */) - (function, table) - Lisp_Object function, table; + (Lisp_Object function, Lisp_Object table) { struct Lisp_Hash_Table *h = check_hash_table (table); Lisp_Object args[3]; @@ -4876,8 +4679,7 @@ both arguments are the same. HASH must be a function taking one argument and return an integer that is the hash code of the argument. Hash code computation should use the whole value range of integers, including negative integers. */) - (name, test, hash) - Lisp_Object name, test, hash; + (Lisp_Object name, Lisp_Object test, Lisp_Object hash) { return Fput (name, Qhash_table_test, list2 (test, hash)); } @@ -4917,8 +4719,7 @@ command `prefer-coding-system') is used. If NOERROR is non-nil, silently assume the `raw-text' coding if the guesswork fails. Normally, an error is signaled in such case. */) - (object, start, end, coding_system, noerror) - Lisp_Object object, start, end, coding_system, noerror; + (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object noerror) { unsigned char digest[16]; unsigned char value[33]; @@ -5113,7 +4914,7 @@ guesswork fails. Normally, an error is signaled in such case. */) void -syms_of_fns () +syms_of_fns (void) { /* Hash table stuff. */ Qhash_table_p = intern_c_string ("hash-table-p"); @@ -5289,7 +5090,7 @@ this variable. */); void -init_fns () +init_fns (void) { } diff --git a/src/font.c b/src/font.c index e07dbc5dd16..cb3e9c5d326 100644 --- a/src/font.c +++ b/src/font.c @@ -175,7 +175,7 @@ static struct font_driver_list *font_driver_list; /* Creaters of font-related Lisp object. */ Lisp_Object -font_make_spec () +font_make_spec (void) { Lisp_Object font_spec; struct font_spec *spec @@ -187,7 +187,7 @@ font_make_spec () } Lisp_Object -font_make_entity () +font_make_entity (void) { Lisp_Object font_entity; struct font_entity *entity @@ -202,10 +202,7 @@ font_make_entity () not nil, copy properties from ENTITY to the font-object. If PIXELSIZE is positive, set the `size' property to PIXELSIZE. */ Lisp_Object -font_make_object (size, entity, pixelsize) - int size; - Lisp_Object entity; - int pixelsize; +font_make_object (int size, Lisp_Object entity, int pixelsize) { Lisp_Object font_object; struct font *font @@ -229,10 +226,10 @@ font_make_object (size, entity, pixelsize) -static int font_pixel_size P_ ((FRAME_PTR f, Lisp_Object)); -static Lisp_Object font_open_entity P_ ((FRAME_PTR, Lisp_Object, int)); -static Lisp_Object font_matching_entity P_ ((FRAME_PTR, Lisp_Object *, - Lisp_Object)); +static int font_pixel_size (FRAME_PTR f, Lisp_Object); +static Lisp_Object font_open_entity (FRAME_PTR, Lisp_Object, int); +static Lisp_Object font_matching_entity (FRAME_PTR, Lisp_Object *, + Lisp_Object); /* Number of registered font drivers. */ static int num_font_drivers; @@ -245,10 +242,7 @@ static int num_font_drivers; STR. */ Lisp_Object -font_intern_prop (str, len, force_symbol) - char *str; - int len; - int force_symbol; +font_intern_prop (char *str, int len, int force_symbol) { int i; Lisp_Object tem; @@ -290,9 +284,7 @@ font_intern_prop (str, len, force_symbol) /* Return a pixel size of font-spec SPEC on frame F. */ static int -font_pixel_size (f, spec) - FRAME_PTR f; - Lisp_Object spec; +font_pixel_size (FRAME_PTR f, Lisp_Object spec) { #ifdef HAVE_WINDOW_SYSTEM Lisp_Object size = AREF (spec, FONT_SIZE_INDEX); @@ -327,10 +319,7 @@ font_pixel_size (f, spec) VAL is an integer. */ int -font_style_to_value (prop, val, noerror) - enum font_property_index prop; - Lisp_Object val; - int noerror; +font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror) { Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX); int len = ASIZE (table); @@ -395,10 +384,7 @@ font_style_to_value (prop, val, noerror) } Lisp_Object -font_style_symbolic (font, prop, for_face) - Lisp_Object font; - enum font_property_index prop; - int for_face; +font_style_symbolic (Lisp_Object font, enum font_property_index prop, int for_face) { Lisp_Object val = AREF (font, prop); Lisp_Object table, elt; @@ -416,7 +402,7 @@ font_style_symbolic (font, prop, for_face) extern Lisp_Object Vface_alternative_font_family_alist; -extern Lisp_Object find_font_encoding P_ ((Lisp_Object)); +extern Lisp_Object find_font_encoding (Lisp_Object); /* Return ENCODING or a cons of ENCODING and REPERTORY of the font @@ -424,8 +410,7 @@ extern Lisp_Object find_font_encoding P_ ((Lisp_Object)); of the font. REPERTORY is a charset symbol or nil. */ Lisp_Object -find_font_encoding (fontname) - Lisp_Object fontname; +find_font_encoding (Lisp_Object fontname) { Lisp_Object tail, elt; @@ -448,9 +433,7 @@ find_font_encoding (fontname) REGISTRY is available, return 0. Otherwise return -1. */ int -font_registry_charsets (registry, encoding, repertory) - Lisp_Object registry; - struct charset **encoding, **repertory; +font_registry_charsets (Lisp_Object registry, struct charset **encoding, struct charset **repertory) { Lisp_Object val; int encoding_id, repertory_id; @@ -508,16 +491,15 @@ font_registry_charsets (registry, encoding, repertory) /* Font property value validaters. See the comment of font_property_table for the meaning of the arguments. */ -static Lisp_Object font_prop_validate P_ ((int, Lisp_Object, Lisp_Object)); -static Lisp_Object font_prop_validate_symbol P_ ((Lisp_Object, Lisp_Object)); -static Lisp_Object font_prop_validate_style P_ ((Lisp_Object, Lisp_Object)); -static Lisp_Object font_prop_validate_non_neg P_ ((Lisp_Object, Lisp_Object)); -static Lisp_Object font_prop_validate_spacing P_ ((Lisp_Object, Lisp_Object)); -static int get_font_prop_index P_ ((Lisp_Object)); +static Lisp_Object font_prop_validate (int, Lisp_Object, Lisp_Object); +static Lisp_Object font_prop_validate_symbol (Lisp_Object, Lisp_Object); +static Lisp_Object font_prop_validate_style (Lisp_Object, Lisp_Object); +static Lisp_Object font_prop_validate_non_neg (Lisp_Object, Lisp_Object); +static Lisp_Object font_prop_validate_spacing (Lisp_Object, Lisp_Object); +static int get_font_prop_index (Lisp_Object); static Lisp_Object -font_prop_validate_symbol (prop, val) - Lisp_Object prop, val; +font_prop_validate_symbol (Lisp_Object prop, Lisp_Object val) { if (STRINGP (val)) val = Fintern (val, Qnil); @@ -530,8 +512,7 @@ font_prop_validate_symbol (prop, val) static Lisp_Object -font_prop_validate_style (style, val) - Lisp_Object style, val; +font_prop_validate_style (Lisp_Object style, Lisp_Object val) { enum font_property_index prop = (EQ (style, QCweight) ? FONT_WEIGHT_INDEX : EQ (style, QCslant) ? FONT_SLANT_INDEX @@ -565,16 +546,14 @@ font_prop_validate_style (style, val) } static Lisp_Object -font_prop_validate_non_neg (prop, val) - Lisp_Object prop, val; +font_prop_validate_non_neg (Lisp_Object prop, Lisp_Object val) { return (NATNUMP (val) || (FLOATP (val) && XFLOAT_DATA (val) >= 0) ? val : Qerror); } static Lisp_Object -font_prop_validate_spacing (prop, val) - Lisp_Object prop, val; +font_prop_validate_spacing (Lisp_Object prop, Lisp_Object val) { if (NILP (val) || (NATNUMP (val) && XINT (val) <= FONT_SPACING_CHARCELL)) return val; @@ -595,8 +574,7 @@ font_prop_validate_spacing (prop, val) } static Lisp_Object -font_prop_validate_otf (prop, val) - Lisp_Object prop, val; +font_prop_validate_otf (Lisp_Object prop, Lisp_Object val) { Lisp_Object tail, tmp; int i; @@ -638,7 +616,7 @@ struct /* Function to validate PROP's value VAL, or NULL if any value is ok. The value is VAL or its regularized value if VAL is valid, and Qerror if not. */ - Lisp_Object (*validater) P_ ((Lisp_Object prop, Lisp_Object val)); + Lisp_Object (*validater) (Lisp_Object prop, Lisp_Object val); } font_property_table[] = { { &QCtype, font_prop_validate_symbol }, { &QCfoundry, font_prop_validate_symbol }, @@ -667,8 +645,7 @@ struct already known property. */ static int -get_font_prop_index (key) - Lisp_Object key; +get_font_prop_index (Lisp_Object key) { int i; @@ -683,9 +660,7 @@ get_font_prop_index (key) signal an error. The value is VAL or the regularized one. */ static Lisp_Object -font_prop_validate (idx, prop, val) - int idx; - Lisp_Object prop, val; +font_prop_validate (int idx, Lisp_Object prop, Lisp_Object val) { Lisp_Object validated; @@ -710,8 +685,7 @@ font_prop_validate (idx, prop, val) keeping the sorting order. Don't check the validity of VAL. */ Lisp_Object -font_put_extra (font, prop, val) - Lisp_Object font, prop, val; +font_put_extra (Lisp_Object font, Lisp_Object prop, Lisp_Object val) { Lisp_Object extra = AREF (font, FONT_EXTRA_INDEX); Lisp_Object slot = (NILP (extra) ? Qnil : assq_no_quit (prop, extra)); @@ -740,9 +714,9 @@ font_put_extra (font, prop, val) /* Font name parser and unparser */ -static int parse_matrix P_ ((char *)); -static int font_expand_wildcards P_ ((Lisp_Object *, int)); -static int font_parse_name P_ ((char *, Lisp_Object)); +static int parse_matrix (char *); +static int font_expand_wildcards (Lisp_Object *, int); +static int font_parse_name (char *, Lisp_Object); /* An enumerator for each field of an XLFD font name. */ enum xlfd_field_index @@ -799,8 +773,7 @@ enum xlfd_field_mask -1. */ static int -parse_matrix (p) - char *p; +parse_matrix (char *p) { double matrix[4]; char *end; @@ -822,9 +795,7 @@ parse_matrix (p) field position by its contents. */ static int -font_expand_wildcards (field, n) - Lisp_Object field[XLFD_LAST_INDEX]; - int n; +font_expand_wildcards (Lisp_Object *field, int n) { /* Copy of FIELD. */ Lisp_Object tmp[XLFD_LAST_INDEX]; @@ -1058,9 +1029,7 @@ font_check_xlfd_parse (Lisp_Object font, char *name) a fully specified XLFD. */ int -font_parse_xlfd (name, font) - char *name; - Lisp_Object font; +font_parse_xlfd (char *name, Lisp_Object font) { int len = strlen (name); int i, j, n; @@ -1242,11 +1211,7 @@ font_parse_xlfd (name, font) 0, use PIXEL_SIZE instead. */ int -font_unparse_xlfd (font, pixel_size, name, nbytes) - Lisp_Object font; - int pixel_size; - char *name; - int nbytes; +font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) { char *f[XLFD_REGISTRY_INDEX + 1]; Lisp_Object val; @@ -1389,9 +1354,7 @@ font_unparse_xlfd (font, pixel_size, name, nbytes) This function tries to guess which format it is. */ int -font_parse_fcname (name, font) - char *name; - Lisp_Object font; +font_parse_fcname (char *name, Lisp_Object font) { char *p, *q; char *size_beg = NULL, *size_end = NULL; @@ -1544,7 +1507,7 @@ font_parse_fcname (name, font) int size_found = 1; for (q = p + 1; *q && *q != ' '; q++) - if (! isdigit (*q)) + if (! isdigit (*q) && *q != '.') { size_found = 0; break; @@ -1648,11 +1611,7 @@ font_parse_fcname (name, font) FONT_SIZE_INDEX of FONT is 0, use PIXEL_SIZE instead. */ int -font_unparse_fcname (font, pixel_size, name, nbytes) - Lisp_Object font; - int pixel_size; - char *name; - int nbytes; +font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes) { Lisp_Object family, foundry; Lisp_Object tail, val; @@ -1771,11 +1730,7 @@ font_unparse_fcname (font, pixel_size, name, nbytes) size. */ int -font_unparse_gtkname (font, f, name, nbytes) - Lisp_Object font; - struct frame *f; - char *name; - int nbytes; +font_unparse_gtkname (Lisp_Object font, struct frame *f, char *name, int nbytes) { char *p; int len = 1; @@ -1858,11 +1813,9 @@ font_unparse_gtkname (font, f, name, nbytes) 0. Otherwise return -1. */ static int -font_parse_name (name, font) - char *name; - Lisp_Object font; +font_parse_name (char *name, Lisp_Object font) { - if (name[0] == '-' || index (name, '*') || index (name, '?')) + if (name[0] == '-' || strchr (name, '*') || strchr (name, '?')) return font_parse_xlfd (name, font); return font_parse_fcname (name, font); } @@ -1873,8 +1826,7 @@ font_parse_name (name, font) part. */ void -font_parse_family_registry (family, registry, font_spec) - Lisp_Object family, registry, font_spec; +font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Object font_spec) { int len; char *p0, *p1; @@ -1885,7 +1837,7 @@ font_parse_family_registry (family, registry, font_spec) CHECK_STRING (family); len = SBYTES (family); p0 = (char *) SDATA (family); - p1 = index (p0, '-'); + p1 = strchr (p0, '-'); if (p1) { if ((*p0 != '*' && p1 - p0 > 0) @@ -1904,7 +1856,7 @@ font_parse_family_registry (family, registry, font_spec) CHECK_STRING (registry); len = SBYTES (registry); p0 = (char *) SDATA (registry); - p1 = index (p0, '-'); + p1 = strchr (p0, '-'); if (! p1) { if (SDATA (registry)[len - 1] == '*') @@ -2220,17 +2172,16 @@ font_otf_Anchor (anchor) /* Font sorting */ -static unsigned font_score P_ ((Lisp_Object, Lisp_Object *)); -static int font_compare P_ ((const void *, const void *)); -static Lisp_Object font_sort_entities P_ ((Lisp_Object, Lisp_Object, - Lisp_Object, int)); +static unsigned font_score (Lisp_Object, Lisp_Object *); +static int font_compare (const void *, const void *); +static Lisp_Object font_sort_entities (Lisp_Object, Lisp_Object, + Lisp_Object, int); /* Return a rescaling ratio of FONT_ENTITY. */ extern Lisp_Object Vface_font_rescale_alist; static double -font_rescale_ratio (font_entity) - Lisp_Object font_entity; +font_rescale_ratio (Lisp_Object font_entity) { Lisp_Object tail, elt; Lisp_Object name = Qnil; @@ -2277,8 +2228,7 @@ static int sort_shift_bits[FONT_SIZE_INDEX + 1]; SPEC_PROP. */ static unsigned -font_score (entity, spec_prop) - Lisp_Object entity, *spec_prop; +font_score (Lisp_Object entity, Lisp_Object *spec_prop) { unsigned score = 0; int i; @@ -2352,8 +2302,7 @@ struct font_sort_data /* The comparison function for qsort. */ static int -font_compare (d1, d2) - const void *d1, *d2; +font_compare (const void *d1, const void *d2) { const struct font_sort_data *data1 = d1; const struct font_sort_data *data2 = d2; @@ -2381,9 +2330,7 @@ font_compare (d1, d2) such a case. */ static Lisp_Object -font_sort_entities (list, prefer, frame, best_only) - Lisp_Object list, prefer, frame; - int best_only; +font_sort_entities (Lisp_Object list, Lisp_Object prefer, Lisp_Object frame, int best_only) { Lisp_Object prefer_prop[FONT_SPEC_MAX]; int len, maxlen, i; @@ -2488,8 +2435,7 @@ font_sort_entities (list, prefer, frame, best_only) function with font_sort_order after setting up it. */ void -font_update_sort_order (order) - int *order; +font_update_sort_order (int *order) { int i, shift_bits; @@ -2509,8 +2455,7 @@ font_update_sort_order (order) } static int -font_check_otf_features (script, langsys, features, table) - Lisp_Object script, langsys, features, table; +font_check_otf_features (Lisp_Object script, Lisp_Object langsys, Lisp_Object features, Lisp_Object table) { Lisp_Object val; int negative; @@ -2584,8 +2529,7 @@ font_check_otf (Lisp_Object spec, Lisp_Object otf_capability) specification SPEC. */ int -font_match_p (spec, font) - Lisp_Object spec, font; +font_match_p (Lisp_Object spec, Lisp_Object font) { Lisp_Object prop[FONT_SPEC_MAX], *props; Lisp_Object extra, font_extra; @@ -2701,16 +2645,14 @@ font_match_p (spec, font) is a number frames sharing this cache, and FONT-CACHE-DATA is a cons (FONT-SPEC FONT-ENTITY ...). */ -static void font_prepare_cache P_ ((FRAME_PTR, struct font_driver *)); -static void font_finish_cache P_ ((FRAME_PTR, struct font_driver *)); -static Lisp_Object font_get_cache P_ ((FRAME_PTR, struct font_driver *)); -static void font_clear_cache P_ ((FRAME_PTR, Lisp_Object, - struct font_driver *)); +static void font_prepare_cache (FRAME_PTR, struct font_driver *); +static void font_finish_cache (FRAME_PTR, struct font_driver *); +static Lisp_Object font_get_cache (FRAME_PTR, struct font_driver *); +static void font_clear_cache (FRAME_PTR, Lisp_Object, + struct font_driver *); static void -font_prepare_cache (f, driver) - FRAME_PTR f; - struct font_driver *driver; +font_prepare_cache (FRAME_PTR f, struct font_driver *driver) { Lisp_Object cache, val; @@ -2732,9 +2674,7 @@ font_prepare_cache (f, driver) static void -font_finish_cache (f, driver) - FRAME_PTR f; - struct font_driver *driver; +font_finish_cache (FRAME_PTR f, struct font_driver *driver) { Lisp_Object cache, val, tmp; @@ -2755,9 +2695,7 @@ font_finish_cache (f, driver) static Lisp_Object -font_get_cache (f, driver) - FRAME_PTR f; - struct font_driver *driver; +font_get_cache (FRAME_PTR f, struct font_driver *driver) { Lisp_Object val = driver->get_cache (f); Lisp_Object type = driver->type; @@ -2773,10 +2711,7 @@ font_get_cache (f, driver) static int num_fonts; static void -font_clear_cache (f, cache, driver) - FRAME_PTR f; - Lisp_Object cache; - struct font_driver *driver; +font_clear_cache (FRAME_PTR f, Lisp_Object cache, struct font_driver *driver) { Lisp_Object tail, elt; Lisp_Object tail2, entity; @@ -2830,9 +2765,7 @@ static Lisp_Object scratch_font_spec, scratch_font_prefer; extern Lisp_Object Vface_ignored_fonts; Lisp_Object -font_delete_unmatched (vec, spec, size) - Lisp_Object vec, spec; - int size; +font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size) { Lisp_Object entity, val; enum font_property_index prop; @@ -2905,8 +2838,7 @@ font_delete_unmatched (vec, spec, size) same font-driver. */ Lisp_Object -font_list_entities (frame, spec) - Lisp_Object frame, spec; +font_list_entities (Lisp_Object frame, Lisp_Object spec) { FRAME_PTR f = XFRAME (frame); struct font_driver_list *driver_list = f->font_driver_list; @@ -2982,9 +2914,7 @@ font_list_entities (frame, spec) font-related attributes. */ static Lisp_Object -font_matching_entity (f, attrs, spec) - FRAME_PTR f; - Lisp_Object *attrs, spec; +font_matching_entity (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec) { struct font_driver_list *driver_list = f->font_driver_list; Lisp_Object ftype, size, entity; @@ -3032,10 +2962,7 @@ font_matching_entity (f, attrs, spec) opened font object. */ static Lisp_Object -font_open_entity (f, entity, pixel_size) - FRAME_PTR f; - Lisp_Object entity; - int pixel_size; +font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size) { struct font_driver_list *driver_list; Lisp_Object objlist, size, val, font_object; @@ -3078,7 +3005,6 @@ font_open_entity (f, entity, pixel_size) return Qnil; ASET (entity, FONT_OBJLIST_INDEX, Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX))); - ASET (font_object, FONT_OBJLIST_INDEX, Qnil); num_fonts++; font = XFONT_OBJECT (font_object); @@ -3111,9 +3037,7 @@ font_open_entity (f, entity, pixel_size) /* Close FONT_OBJECT that is opened on frame F. */ void -font_close_object (f, font_object) - FRAME_PTR f; - Lisp_Object font_object; +font_close_object (FRAME_PTR f, Lisp_Object font_object) { struct font *font = XFONT_OBJECT (font_object); @@ -3134,10 +3058,7 @@ font_close_object (f, font_object) FONT is a font-entity and it must be opened to check. */ int -font_has_char (f, font, c) - FRAME_PTR f; - Lisp_Object font; - int c; +font_has_char (FRAME_PTR f, Lisp_Object font, int c) { struct font *fontp; @@ -3172,9 +3093,7 @@ font_has_char (f, font, c) /* Return the glyph ID of FONT_OBJECT for character C. */ unsigned -font_encode_char (font_object, c) - Lisp_Object font_object; - int c; +font_encode_char (Lisp_Object font_object, int c) { struct font *font; @@ -3187,8 +3106,7 @@ font_encode_char (font_object, c) /* Return the name of FONT_OBJECT. */ Lisp_Object -font_get_name (font_object) - Lisp_Object font_object; +font_get_name (Lisp_Object font_object) { font_assert (FONT_OBJECT_P (font_object)); return AREF (font_object, FONT_NAME_INDEX); @@ -3198,8 +3116,7 @@ font_get_name (font_object) /* Return the specification of FONT_OBJECT. */ Lisp_Object -font_get_spec (font_object) - Lisp_Object font_object; +font_get_spec (Lisp_Object font_object) { Lisp_Object spec = font_make_spec (); int i; @@ -3216,8 +3133,7 @@ font_get_spec (font_object) could not be parsed by font_parse_name, return Qnil. */ Lisp_Object -font_spec_from_name (font_name) - Lisp_Object font_name; +font_spec_from_name (Lisp_Object font_name) { Lisp_Object spec = Ffont_spec (0, NULL); @@ -3231,9 +3147,7 @@ font_spec_from_name (font_name) void -font_clear_prop (attrs, prop) - Lisp_Object *attrs; - enum font_property_index prop; +font_clear_prop (Lisp_Object *attrs, enum font_property_index prop) { Lisp_Object font = attrs[LFACE_FONT_INDEX]; @@ -3284,9 +3198,7 @@ font_clear_prop (attrs, prop) } void -font_update_lface (f, attrs) - FRAME_PTR f; - Lisp_Object *attrs; +font_update_lface (FRAME_PTR f, Lisp_Object *attrs) { Lisp_Object spec; @@ -3333,9 +3245,7 @@ font_update_lface (f, attrs) supports C and matches best with ATTRS and PIXEL_SIZE. */ static Lisp_Object -font_select_entity (frame, entities, attrs, pixel_size, c) - Lisp_Object frame, entities, *attrs; - int pixel_size, c; +font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs, int pixel_size, int c) { Lisp_Object font_entity; Lisp_Object prefer; @@ -3380,11 +3290,7 @@ font_select_entity (frame, entities, attrs, pixel_size, c) character that the entity must support. */ Lisp_Object -font_find_for_lface (f, attrs, spec, c) - FRAME_PTR f; - Lisp_Object *attrs; - Lisp_Object spec; - int c; +font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c) { Lisp_Object work; Lisp_Object frame, entities, val; @@ -3534,11 +3440,7 @@ font_find_for_lface (f, attrs, spec, c) Lisp_Object -font_open_for_lface (f, entity, attrs, spec) - FRAME_PTR f; - Lisp_Object entity; - Lisp_Object *attrs; - Lisp_Object spec; +font_open_for_lface (FRAME_PTR f, Lisp_Object entity, Lisp_Object *attrs, Lisp_Object spec) { int size; @@ -3581,9 +3483,7 @@ font_open_for_lface (f, entity, attrs, spec) font-object. */ Lisp_Object -font_load_for_lface (f, attrs, spec) - FRAME_PTR f; - Lisp_Object *attrs, spec; +font_load_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec) { Lisp_Object entity, name; @@ -3613,9 +3513,7 @@ font_load_for_lface (f, attrs, spec) /* Make FACE on frame F ready to use the font opened for FACE. */ void -font_prepare_for_face (f, face) - FRAME_PTR f; - struct face *face; +font_prepare_for_face (FRAME_PTR f, struct face *face) { if (face->font->driver->prepare_face) face->font->driver->prepare_face (f, face); @@ -3625,9 +3523,7 @@ font_prepare_for_face (f, face) /* Make FACE on frame F stop using the font opened for FACE. */ void -font_done_for_face (f, face) - FRAME_PTR f; - struct face *face; +font_done_for_face (FRAME_PTR f, struct face *face) { if (face->font->driver->done_face) face->font->driver->done_face (f, face); @@ -3639,9 +3535,7 @@ font_done_for_face (f, face) font is found, return Qnil. */ Lisp_Object -font_open_by_spec (f, spec) - FRAME_PTR f; - Lisp_Object spec; +font_open_by_spec (FRAME_PTR f, Lisp_Object spec) { Lisp_Object attrs[LFACE_VECTOR_SIZE]; @@ -3665,9 +3559,7 @@ font_open_by_spec (f, spec) found, return Qnil. */ Lisp_Object -font_open_by_name (f, name) - FRAME_PTR f; - char *name; +font_open_by_name (FRAME_PTR f, char *name) { Lisp_Object args[2]; Lisp_Object spec, ret; @@ -3697,9 +3589,7 @@ font_open_by_name (f, name) (e.g. syms_of_xfont). */ void -register_font_driver (driver, f) - struct font_driver *driver; - FRAME_PTR f; +register_font_driver (struct font_driver *driver, FRAME_PTR f) { struct font_driver_list *root = f ? f->font_driver_list : font_driver_list; struct font_driver_list *prev, *list; @@ -3727,8 +3617,7 @@ register_font_driver (driver, f) } void -free_font_driver_list (f) - FRAME_PTR f; +free_font_driver_list (FRAME_PTR f) { struct font_driver_list *list, *next; @@ -3750,9 +3639,7 @@ free_font_driver_list (f) F. */ Lisp_Object -font_update_drivers (f, new_drivers) - FRAME_PTR f; - Lisp_Object new_drivers; +font_update_drivers (FRAME_PTR f, Lisp_Object new_drivers) { Lisp_Object active_drivers = Qnil; struct font_driver *driver; @@ -3843,10 +3730,7 @@ font_update_drivers (f, new_drivers) } int -font_put_frame_data (f, driver, data) - FRAME_PTR f; - struct font_driver *driver; - void *data; +font_put_frame_data (FRAME_PTR f, struct font_driver *driver, void *data) { struct font_data_list *list, *prev; @@ -3880,9 +3764,7 @@ font_put_frame_data (f, driver, data) void * -font_get_frame_data (f, driver) - FRAME_PTR f; - struct font_driver *driver; +font_get_frame_data (FRAME_PTR f, struct font_driver *driver) { struct font_data_list *list; @@ -3901,12 +3783,7 @@ font_get_frame_data (f, driver) STRING. */ Lisp_Object -font_at (c, pos, face, w, string) - int c; - EMACS_INT pos; - struct face *face; - struct window *w; - Lisp_Object string; +font_at (int c, EMACS_INT pos, struct face *face, struct window *w, Lisp_Object string) { FRAME_PTR f; int multibyte; @@ -3988,11 +3865,7 @@ font_at (c, pos, face, w, string) It is assured that the current buffer (or STRING) is multibyte. */ Lisp_Object -font_range (pos, limit, w, face, string) - EMACS_INT pos, *limit; - struct window *w; - struct face *face; - Lisp_Object string; +font_range (EMACS_INT pos, EMACS_INT *limit, struct window *w, struct face *face, Lisp_Object string) { EMACS_INT pos_byte, ignore; int c; @@ -4051,8 +3924,7 @@ Return nil otherwise. Optional 2nd argument EXTRA-TYPE, if non-nil, specifies to check which kind of font it is. It must be one of `font-spec', `font-entity', `font-object'. */) - (object, extra_type) - Lisp_Object object, extra_type; + (Lisp_Object object, Lisp_Object extra_type) { if (NILP (extra_type)) return (FONTP (object) ? Qt : Qnil); @@ -4130,9 +4002,7 @@ be an OpenType font, and whose GPOS table of `thai' script's default language system must contain `mark' feature. usage: (font-spec ARGS...) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { Lisp_Object spec = font_make_spec (); int i; @@ -4173,8 +4043,7 @@ usage: (font-spec ARGS...) */) DEFUN ("copy-font-spec", Fcopy_font_spec, Scopy_font_spec, 1, 1, 0, doc: /* Return a copy of FONT as a font-spec. */) - (font) - Lisp_Object font; + (Lisp_Object font) { Lisp_Object new_spec, tail, prev, extra; int i; @@ -4202,8 +4071,7 @@ DEFUN ("merge-font-spec", Fmerge_font_spec, Smerge_font_spec, 2, 2, 0, doc: /* Merge font-specs FROM and TO, and return a new font-spec. Every specified properties in FROM override the corresponding properties in TO. */) - (from, to) - Lisp_Object from, to; + (Lisp_Object from, Lisp_Object to) { Lisp_Object extra, tail; int i; @@ -4231,16 +4099,24 @@ properties in TO. */) DEFUN ("font-get", Ffont_get, Sfont_get, 2, 2, 0, doc: /* Return the value of FONT's property KEY. FONT is a font-spec, a font-entity, or a font-object. -KEY must be one of these symbols: +KEY is any symbol, but these are reserved for specific meanings: :family, :weight, :slant, :width, :foundry, :adstyle, :registry, - :size, :name, :script + :size, :name, :script, :otf See the documentation of `font-spec' for their meanings. -If FONT is a font-entity or font-object, the value of :script may be -a list of scripts that are supported by the font. */) - (font, key) - Lisp_Object font, key; +In addition, if FONT is a font-entity or a font-object, values of +:script and :otf are different from those of a font-spec as below: + +The value of :script may be a list of scripts that are supported by the font. + +The value of :otf is a cons (GSUB . GPOS) where GSUB and GPOS are lists +representing the OpenType features supported by the font by this form: + ((SCRIPT (LANGSYS FEATURE ...) ...) ...) +SCRIPT, LANGSYS, and FEATURE are all symbols representing OpenType +Layout tags. */) + (Lisp_Object font, Lisp_Object key) { int idx; + Lisp_Object val; CHECK_FONT (font); CHECK_SYMBOL (key); @@ -4250,7 +4126,20 @@ a list of scripts that are supported by the font. */) return font_style_symbolic (font, idx, 0); if (idx >= 0 && idx < FONT_EXTRA_INDEX) return AREF (font, idx); - return Fcdr (Fassq (key, AREF (font, FONT_EXTRA_INDEX))); + val = Fassq (key, AREF (font, FONT_EXTRA_INDEX)); + if (NILP (val) && EQ (key, QCotf) && FONT_OBJECT_P (font)) + { + struct font *fontp = XFONT_OBJECT (font); + + if (fontp->driver->otf_capability) + val = fontp->driver->otf_capability (fontp); + else + val = Fcons (Qnil, Qnil); + font_put_extra (font, QCotf, val); + } + else + val = Fcdr (val); + return val; } #ifdef HAVE_WINDOW_SYSTEM @@ -4268,8 +4157,7 @@ may be omitted from the list if they are not specified by FONT. The optional argument FRAME specifies the frame that the face attributes are to be displayed on. If omitted, the selected frame is used. */) - (font, frame) - Lisp_Object font, frame; + (Lisp_Object font, Lisp_Object frame) { struct frame *f; Lisp_Object plist[10]; @@ -4342,18 +4230,36 @@ are to be displayed on. If omitted, the selected frame is used. */) #endif DEFUN ("font-put", Ffont_put, Sfont_put, 3, 3, 0, - doc: /* Set one property of FONT-SPEC: give property PROP value VAL. */) - (font_spec, prop, val) - Lisp_Object font_spec, prop, val; + doc: /* Set one property of FONT: give property KEY value VAL. +FONT is a font-spec, a font-entity, or a font-object. + +If FONT is a font-spec, KEY can be any symbol. But if KEY is the one +accepted by the function `font-spec' (which see), VAL must be what +allowed in `font-spec'. + +If FONT is a font-entity or a font-object, KEY must not be the one +accepted by `font-spec'. */) + (Lisp_Object font, Lisp_Object prop, Lisp_Object val) { int idx; - CHECK_FONT_SPEC (font_spec); idx = get_font_prop_index (prop); if (idx >= 0 && idx < FONT_EXTRA_INDEX) - ASET (font_spec, idx, font_prop_validate (idx, Qnil, val)); + { + CHECK_FONT_SPEC (font); + ASET (font, idx, font_prop_validate (idx, Qnil, val)); + } else - font_put_extra (font_spec, prop, font_prop_validate (0, prop, val)); + { + if (EQ (prop, QCname) + || EQ (prop, QCscript) + || EQ (prop, QClang) + || EQ (prop, QCotf)) + CHECK_FONT_SPEC (font); + else + CHECK_FONT (font); + font_put_extra (font, prop, font_prop_validate (0, prop, val)); + } return val; } @@ -4364,8 +4270,7 @@ Optional 3rd argument NUM, if non-nil, limits the number of returned fonts. Optional 4th argument PREFER, if non-nil, is a font-spec to control the order of the returned list. Fonts are sorted by how close they are to PREFER. */) - (font_spec, frame, num, prefer) - Lisp_Object font_spec, frame, num, prefer; + (Lisp_Object font_spec, Lisp_Object frame, Lisp_Object num, Lisp_Object prefer) { Lisp_Object vec, list; int n = 0; @@ -4414,8 +4319,7 @@ how close they are to PREFER. */) DEFUN ("font-family-list", Ffont_family_list, Sfont_family_list, 0, 1, 0, doc: /* List available font families on the current frame. Optional argument FRAME, if non-nil, specifies the target frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { FRAME_PTR f; struct font_driver_list *driver_list; @@ -4444,8 +4348,7 @@ Optional argument FRAME, if non-nil, specifies the target frame. */) DEFUN ("find-font", Ffind_font, Sfind_font, 1, 2, 0, doc: /* Return a font-entity matching with FONT-SPEC on the current frame. Optional 2nd argument FRAME, if non-nil, specifies the target frame. */) - (font_spec, frame) - Lisp_Object font_spec, frame; + (Lisp_Object font_spec, Lisp_Object frame) { Lisp_Object val = Flist_fonts (font_spec, frame, make_number (1), Qnil); @@ -4460,8 +4363,7 @@ FONT is a font-spec, font-entity, or font-object. If the name is too long for XLFD (maximum 255 chars), return nil. If the 2nd optional arg FOLD-WILDCARDS is non-nil, the consecutive wildcards are folded to one. */) - (font, fold_wildcards) - Lisp_Object font, fold_wildcards; + (Lisp_Object font, Lisp_Object fold_wildcards) { char name[256]; int pixel_size = 0; @@ -4501,7 +4403,7 @@ the consecutive wildcards are folded to one. */) DEFUN ("clear-font-cache", Fclear_font_cache, Sclear_font_cache, 0, 0, 0, doc: /* Clear font cache. */) - () + (void) { Lisp_Object list, frame; @@ -4535,8 +4437,7 @@ DEFUN ("clear-font-cache", Fclear_font_cache, Sclear_font_cache, 0, 0, 0, void -font_fill_lglyph_metrics (glyph, font_object) - Lisp_Object glyph, font_object; +font_fill_lglyph_metrics (Lisp_Object glyph, Lisp_Object font_object) { struct font *font = XFONT_OBJECT (font_object); unsigned code; @@ -4563,8 +4464,7 @@ header of the glyph-string. If the shaping was successful, the value is GSTRING itself or a newly created glyph-string. Otherwise, the value is nil. */) - (gstring) - Lisp_Object gstring; + (Lisp_Object gstring) { struct font *font; Lisp_Object font_object, n, glyph; @@ -4641,8 +4541,7 @@ where VARIATION-SELECTOR is a chracter code of variation selection (#xFE00..#xFE0F or #xE0100..#xE01EF) GLYPH-ID is a glyph code of the corresponding variation glyph. */) - (font_object, character) - Lisp_Object font_object, character; + (Lisp_Object font_object, Lisp_Object character) { unsigned variations[256]; struct font *font; @@ -4710,8 +4609,7 @@ produced in GSTRING-OUT, and the value is nil. See the documentation of `font-make-gstring' for the format of glyph-string. */) - (otf_features, gstring_in, from, to, gstring_out, index) - Lisp_Object otf_features, gstring_in, from, to, gstring_out, index; + (Lisp_Object otf_features, Lisp_Object gstring_in, Lisp_Object from, Lisp_Object to, Lisp_Object gstring_out, Lisp_Object index) { Lisp_Object font_object = LGSTRING_FONT (gstring_in); Lisp_Object val; @@ -4761,8 +4659,7 @@ The value is a list of cons cells of the format (GLYPH-ID . CHARACTER), where GLYPH-ID is a glyph index of the font, and CHARACTER is a character code corresponding to the glyph or nil if there's no corresponding character. */) - (font_object, character, otf_features) - Lisp_Object font_object, character, otf_features; + (Lisp_Object font_object, Lisp_Object character, Lisp_Object otf_features) { struct font *font; Lisp_Object gstring_in, gstring_out, g; @@ -4803,10 +4700,7 @@ corresponding character. */) DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0, doc: /* Open FONT-ENTITY. */) - (font_entity, size, frame) - Lisp_Object font_entity; - Lisp_Object size; - Lisp_Object frame; + (Lisp_Object font_entity, Lisp_Object size, Lisp_Object frame) { int isize; @@ -4832,8 +4726,7 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0, DEFUN ("close-font", Fclose_font, Sclose_font, 1, 2, 0, doc: /* Close FONT-OBJECT. */) - (font_object, frame) - Lisp_Object font_object, frame; + (Lisp_Object font_object, Lisp_Object frame) { CHECK_FONT_OBJECT (font_object); if (NILP (frame)) @@ -4884,8 +4777,7 @@ representing the default langsys. FEATURE is a symbol representing OpenType feature tag. If the font is not OpenType font, CAPABILITY is nil. */) - (font_object) - Lisp_Object font_object; + (Lisp_Object font_object) { struct font *font; Lisp_Object val; @@ -4906,25 +4798,99 @@ If the font is not OpenType font, CAPABILITY is nil. */) return val; } -DEFUN ("get-font-glyphs", Fget_font_glyphs, Sget_font_glyphs, 2, 2, 0, - doc: /* Return a vector of glyphs of FONT-OBJECT for drawing STRING. -Each element is a vector [GLYPH-CODE LBEARING RBEARING WIDTH ASCENT DESCENT]. */) - (font_object, string) - Lisp_Object font_object, string; +DEFUN ("font-get-glyphs", Ffont_get_glyphs, Sfont_get_glyphs, 3, 4, 0, + doc: + /* Return a vector of FONT-OBJECT's glyphs for the specified characters. +FROM and TO are positions (integers or markers) specifying a region +of the current buffer. +If the optional fourth arg OBJECT is not nil, it is a string or a +vector containing the target characters. + +Each element is a vector containing information of a glyph in this format: + [FROM-IDX TO-IDX C CODE WIDTH LBEARING RBEARING ASCENT DESCENT ADJUSTMENT] +where + FROM is an index numbers of a character the glyph corresponds to. + TO is the same as FROM. + C is the character of the glyph. + CODE is the glyph-code of C in FONT-OBJECT. + WIDTH thru DESCENT are the metrics (in pixels) of the glyph. + ADJUSTMENT is always nil. +If FONT-OBJECT doesn't have a glyph for a character, +the corresponding element is nil. */) + (Lisp_Object font_object, Lisp_Object from, Lisp_Object to, + Lisp_Object object) { struct font *font; - int i, len; - Lisp_Object vec; + int i, len, c; + Lisp_Object *chars, vec; + USE_SAFE_ALLOCA; CHECK_FONT_GET_OBJECT (font_object, font); - CHECK_STRING (string); - len = SCHARS (string); + if (NILP (object)) + { + EMACS_INT charpos, bytepos; + + validate_region (&from, &to); + if (EQ (from, to)) + return Qnil; + len = XFASTINT (to) - XFASTINT (from); + SAFE_ALLOCA_LISP (chars, len); + charpos = XFASTINT (from); + bytepos = CHAR_TO_BYTE (charpos); + for (i = 0; charpos < XFASTINT (to); i++) + { + FETCH_CHAR_ADVANCE (c, charpos, bytepos); + chars[i] = make_number (c); + } + } + else if (STRINGP (object)) + { + const unsigned char *p; + + CHECK_NUMBER (from); + CHECK_NUMBER (to); + if (XINT (from) < 0 || XINT (from) > XINT (to) + || XINT (to) > SCHARS (object)) + args_out_of_range_3 (object, from, to); + if (EQ (from, to)) + return Qnil; + len = XFASTINT (to) - XFASTINT (from); + SAFE_ALLOCA_LISP (chars, len); + p = SDATA (object); + if (STRING_MULTIBYTE (object)) + for (i = 0; i < len; i++) + { + c = STRING_CHAR_ADVANCE (p); + chars[i] = make_number (c); + } + else + for (i = 0; i < len; i++) + chars[i] = make_number (p[i]); + } + else + { + CHECK_VECTOR (object); + CHECK_NUMBER (from); + CHECK_NUMBER (to); + if (XINT (from) < 0 || XINT (from) > XINT (to) + || XINT (to) > ASIZE (object)) + args_out_of_range_3 (object, from, to); + if (EQ (from, to)) + return Qnil; + len = XFASTINT (to) - XFASTINT (from); + for (i = 0; i < len; i++) + { + Lisp_Object elt = AREF (object, XFASTINT (from) + i); + CHECK_CHARACTER (elt); + } + chars = &(AREF (object, XFASTINT (from))); + } + vec = Fmake_vector (make_number (len), Qnil); for (i = 0; i < len; i++) { - Lisp_Object ch = Faref (string, make_number (i)); - Lisp_Object val; - int c = XINT (ch); + Lisp_Object g; + int c = XFASTINT (chars[i]); unsigned code; EMACS_INT cod; struct font_metrics metrics; @@ -4932,28 +4898,28 @@ Each element is a vector [GLYPH-CODE LBEARING RBEARING WIDTH ASCENT DESCENT]. * cod = code = font->driver->encode_char (font, c); if (code == FONT_INVALID_CODE) continue; - val = Fmake_vector (make_number (6), Qnil); - if (cod <= MOST_POSITIVE_FIXNUM) - ASET (val, 0, make_number (code)); - else - ASET (val, 0, Fcons (make_number (code >> 16), - make_number (code & 0xFFFF))); + g = Fmake_vector (make_number (LGLYPH_SIZE), Qnil); + LGLYPH_SET_FROM (g, i); + LGLYPH_SET_TO (g, i); + LGLYPH_SET_CHAR (g, c); + LGLYPH_SET_CODE (g, code); font->driver->text_extents (font, &code, 1, &metrics); - ASET (val, 1, make_number (metrics.lbearing)); - ASET (val, 2, make_number (metrics.rbearing)); - ASET (val, 3, make_number (metrics.width)); - ASET (val, 4, make_number (metrics.ascent)); - ASET (val, 5, make_number (metrics.descent)); - ASET (vec, i, val); + LGLYPH_SET_WIDTH (g, metrics.width); + LGLYPH_SET_LBEARING (g, metrics.lbearing); + LGLYPH_SET_RBEARING (g, metrics.rbearing); + LGLYPH_SET_ASCENT (g, metrics.ascent); + LGLYPH_SET_DESCENT (g, metrics.descent); + ASET (vec, i, g); } + if (! VECTORP (object)) + SAFE_FREE (); return vec; } DEFUN ("font-match-p", Ffont_match_p, Sfont_match_p, 2, 2, 0, doc: /* Return t if and only if font-spec SPEC matches with FONT. FONT is a font-spec, font-entity, or font-object. */) - (spec, font) - Lisp_Object spec, font; + (Lisp_Object spec, Lisp_Object font) { CHECK_FONT_SPEC (spec); CHECK_FONT (font); @@ -4965,8 +4931,7 @@ DEFUN ("font-at", Ffont_at, Sfont_at, 1, 3, 0, doc: /* Return a font-object for displaying a character at POSITION. Optional second arg WINDOW, if non-nil, is a window displaying the current buffer. It defaults to the currently selected window. */) - (position, window, string) - Lisp_Object position, window, string; + (Lisp_Object position, Lisp_Object window, Lisp_Object string) { struct window *w; EMACS_INT pos; @@ -4999,8 +4964,7 @@ DEFUN ("draw-string", Fdraw_string, Sdraw_string, 2, 2, 0, doc: /* Draw STRING by FONT-OBJECT on the top left corner of the current frame. The value is a number of glyphs drawn. Type C-l to recover what previously shown. */) - (font_object, string) - Lisp_Object font_object, string; + (Lisp_Object font_object, Lisp_Object string) { Lisp_Object frame = selected_frame; FRAME_PTR f = XFRAME (frame); @@ -5054,8 +5018,7 @@ where RELATIVE-COMPOSE and DEFAULT-ASCENT are the numbers controlling how to compose characters. If the named font is not yet loaded, return nil. */) - (name, frame) - Lisp_Object name, frame; + (Lisp_Object name, Lisp_Object frame) { FRAME_PTR f; struct font *font; @@ -5118,9 +5081,7 @@ If the named font is not yet loaded, return nil. */) build_style_table ((TBL), sizeof TBL / sizeof (struct table_entry)) static Lisp_Object -build_style_table (entry, nelement) - struct table_entry *entry; - int nelement; +build_style_table (const struct table_entry *entry, int nelement) { int i, j; Lisp_Object table, elt; @@ -5150,9 +5111,7 @@ static Lisp_Object Vfont_log_deferred; opening), ARG is the argument for the action, and RESULT is the result of the action. */ void -font_add_log (action, arg, result) - char *action; - Lisp_Object arg, result; +font_add_log (char *action, Lisp_Object arg, Lisp_Object result) { Lisp_Object tail, val; int i; @@ -5238,9 +5197,7 @@ font_add_log (action, arg, result) as font_add_log. */ void -font_deferred_log (action, arg, result) - char *action; - Lisp_Object arg, result; +font_deferred_log (char *action, Lisp_Object arg, Lisp_Object result) { if (EQ (Vfont_log, Qt)) return; @@ -5249,17 +5206,17 @@ font_deferred_log (action, arg, result) ASET (Vfont_log_deferred, 2, result); } -extern void syms_of_ftfont P_ (()); -extern void syms_of_xfont P_ (()); -extern void syms_of_xftfont P_ (()); -extern void syms_of_ftxfont P_ (()); -extern void syms_of_bdffont P_ (()); -extern void syms_of_w32font P_ (()); -extern void syms_of_atmfont P_ (()); -extern void syms_of_nsfont P_ (()); +extern void syms_of_ftfont (void); +extern void syms_of_xfont (void); +extern void syms_of_xftfont (void); +extern void syms_of_ftxfont (void); +extern void syms_of_bdffont (void); +extern void syms_of_w32font (void); +extern void syms_of_atmfont (void); +extern void syms_of_nsfont (void); void -syms_of_font () +syms_of_font (void) { sort_shift_bits[FONT_TYPE_INDEX] = 0; sort_shift_bits[FONT_SLANT_INDEX] = 2; @@ -5347,7 +5304,7 @@ syms_of_font () defsubr (&Sopen_font); defsubr (&Sclose_font); defsubr (&Squery_font); - defsubr (&Sget_font_glyphs); + defsubr (&Sfont_get_glyphs); defsubr (&Sfont_match_p); defsubr (&Sfont_at); #if 0 @@ -5446,7 +5403,7 @@ EMACS_FONT_LOG is set. Otherwise, it is set to t. */); } void -init_font () +init_font (void) { Vfont_log = egetenv ("EMACS_FONT_LOG") ? Qnil : Qt; } diff --git a/src/font.h b/src/font.h index 952ea269495..694f07e5f07 100644 --- a/src/font.h +++ b/src/font.h @@ -159,14 +159,19 @@ enum font_property_index /* This value is the length of font-spec vector. */ FONT_SPEC_MAX, - /* The followings are used only for a font-entity. */ + /* The followings are used only for a font-entity and a font-object. */ /* List of font-objects opened from the font-entity. */ FONT_OBJLIST_INDEX = FONT_SPEC_MAX, + /* Font-entity from which the font-object is opened. */ + FONT_ENTITY_INDEX = FONT_SPEC_MAX, + /* This value is the length of font-entity vector. */ FONT_ENTITY_MAX, + /* The followings are used only for a font-object. */ + /* XLFD name of the font (string). */ FONT_NAME_INDEX = FONT_ENTITY_MAX, @@ -507,7 +512,7 @@ struct font_driver /* Return a cache of font-entities on frame F. The cache must be a cons whose cdr part is the actual cache area. */ - Lisp_Object (*get_cache) P_ ((FRAME_PTR F)); + Lisp_Object (*get_cache) (FRAME_PTR F); /* List fonts exactly matching with FONT_SPEC on FRAME. The value is a list of font-entities. The font properties to be considered @@ -530,7 +535,7 @@ struct font_driver This and the following `match' are the only APIs that allocate font-entities. */ - Lisp_Object (*list) P_ ((Lisp_Object frame, Lisp_Object font_spec)); + Lisp_Object (*list) (Lisp_Object frame, Lisp_Object font_spec); /* Return a font-entity most closely matching with FONT_SPEC on FRAME. Which font property to consider, and how to calculate the @@ -539,92 +544,92 @@ struct font_driver The properties that the font-entity has is the same as `list' method. */ - Lisp_Object (*match) P_ ((Lisp_Object frame, Lisp_Object font_spec)); + Lisp_Object (*match) (Lisp_Object frame, Lisp_Object font_spec); /* Optional. List available families. The value is a list of family names (symbols). */ - Lisp_Object (*list_family) P_ ((Lisp_Object frame)); + Lisp_Object (*list_family) (Lisp_Object frame); /* Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value). Free FONT_EXTRA_INDEX field of FONT_ENTITY. */ - void (*free_entity) P_ ((Lisp_Object font_entity)); + void (*free_entity) (Lisp_Object font_entity); /* Open a font specified by FONT_ENTITY on frame F. If the font is scalable, open it with PIXEL_SIZE. */ - Lisp_Object (*open) P_ ((FRAME_PTR f, Lisp_Object font_entity, - int pixel_size)); + Lisp_Object (*open) (FRAME_PTR f, Lisp_Object font_entity, + int pixel_size); /* Close FONT on frame F. */ - void (*close) P_ ((FRAME_PTR f, struct font *font)); + void (*close) (FRAME_PTR f, struct font *font); /* Optional (if FACE->extra is not used). Prepare FACE for displaying characters by FONT on frame F by storing some data in FACE->extra. If successful, return 0. Otherwise, return -1. */ - int (*prepare_face) P_ ((FRAME_PTR f, struct face *face)); + int (*prepare_face) (FRAME_PTR f, struct face *face); /* Optional. Done FACE for displaying characters by FACE->font on frame F. */ - void (*done_face) P_ ((FRAME_PTR f, struct face *face)); + void (*done_face) (FRAME_PTR f, struct face *face); /* Optional. If FONT (FONT-ENTITY or FONT-OBJECT) has a glyph for character C (Unicode code point), return 1. If not, return 0. If FONT is FONT-ENTITY and it must be opened to check it, return -1. */ - int (*has_char) P_ ((Lisp_Object font, int c)); + int (*has_char) (Lisp_Object font, int c); /* Return a glyph code of FONT for characer C (Unicode code point). If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ - unsigned (*encode_char) P_ ((struct font *font, int c)); + unsigned (*encode_char) (struct font *font, int c); /* Computate the total metrics of the NGLYPHS glyphs specified by the font FONT and the sequence of glyph codes CODE, and store the result in METRICS. */ - int (*text_extents) P_ ((struct font *font, - unsigned *code, int nglyphs, - struct font_metrics *metrics)); + int (*text_extents) (struct font *font, + unsigned *code, int nglyphs, + struct font_metrics *metrics); /* Optional. Draw glyphs between FROM and TO of S->char2b at (X Y) pixel position of frame F with S->FACE and S->GC. If WITH_BACKGROUND is nonzero, fill the background in advance. It is assured that WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). */ - int (*draw) P_ ((struct glyph_string *s, int from, int to, - int x, int y, int with_background)); + int (*draw) (struct glyph_string *s, int from, int to, + int x, int y, int with_background); /* Optional. Store bitmap data for glyph-code CODE of FONT in BITMAP. It is intended that this method is callled from the other font-driver for actual drawing. */ - int (*get_bitmap) P_ ((struct font *font, unsigned code, - struct font_bitmap *bitmap, - int bits_per_pixel)); + int (*get_bitmap) (struct font *font, unsigned code, + struct font_bitmap *bitmap, + int bits_per_pixel); /* Optional. Free bitmap data in BITMAP. */ - void (*free_bitmap) P_ ((struct font *font, struct font_bitmap *bitmap)); + void (*free_bitmap) (struct font *font, struct font_bitmap *bitmap); /* Optional. Return an outline data for glyph-code CODE of FONT. The format of the outline data depends on the font-driver. */ - void *(*get_outline) P_ ((struct font *font, unsigned code)); + void *(*get_outline) (struct font *font, unsigned code); /* Optional. Free OUTLINE (that is obtained by the above method). */ - void (*free_outline) P_ ((struct font *font, void *outline)); + void (*free_outline) (struct font *font, void *outline); /* Optional. Get coordinates of the INDEXth anchor point of the glyph whose code is CODE. Store the coordinates in *X and *Y. Return 0 if the operations was successfull. Otherwise return -1. */ - int (*anchor_point) P_ ((struct font *font, unsigned code, int index, - int *x, int *y)); + int (*anchor_point) (struct font *font, unsigned code, int index, + int *x, int *y); /* Optional. Return a list describing which scripts/languages FONT supports by which GSUB/GPOS features of OpenType tables. */ - Lisp_Object (*otf_capability) P_ ((struct font *font)); + Lisp_Object (*otf_capability) (struct font *font); /* Optional. Apply FONT's OTF-FEATURES to the glyph string. @@ -641,20 +646,20 @@ struct font_driver Return the number of output codes. If none of the features are applicable to the input data, return 0. If GSTRING-OUT is too short, return -1. */ - int (*otf_drive) P_ ((struct font *font, Lisp_Object features, - Lisp_Object gstring_in, int from, int to, - Lisp_Object gstring_out, int idx, int alternate_subst)); + int (*otf_drive) (struct font *font, Lisp_Object features, + Lisp_Object gstring_in, int from, int to, + Lisp_Object gstring_out, int idx, int alternate_subst); /* Optional. Make the font driver ready for frame F. Usually this function makes some data specific to F and stores it in F by calling font_put_frame_data (). */ - int (*start_for_frame) P_ ((FRAME_PTR f)); + int (*start_for_frame) (FRAME_PTR f); /* Optional. End using the driver for frame F. Usually this function free some data stored for F. */ - int (*end_for_frame) P_ ((FRAME_PTR f)); + int (*end_for_frame) (FRAME_PTR f); /* Optional. @@ -670,14 +675,14 @@ struct font_driver a new glyph object and storing it in GSTRING. If (M) is greater than the length of GSTRING, nil should be return. In that case, this function is called again with the larger GSTRING. */ - Lisp_Object (*shape) P_ ((Lisp_Object lgstring)); + Lisp_Object (*shape) (Lisp_Object lgstring); /* Optional. If FONT is usable on frame F, return 0. Otherwise return -1. This method is used only for debugging. If this method is NULL, Emacs assumes that the font is usable on any frame. */ - int (*check) P_ ((FRAME_PTR F, struct font *font)); + int (*check) (FRAME_PTR F, struct font *font); /* Optional. @@ -685,18 +690,18 @@ struct font_driver FONT. VARIATIONS is an array of 256 elements. If the variation selector N (1..256) defines a glyph, that glyph code is stored in the (N-1)th element of VARIATIONS. */ - int (*get_variation_glyphs) P_ ((struct font *font, - int c, unsigned variations[256])); + int (*get_variation_glyphs) (struct font *font, + int c, unsigned variations[256]); - void (*filter_properties) P_ ((Lisp_Object font, Lisp_Object properties)); + void (*filter_properties) (Lisp_Object font, Lisp_Object properties); /* Optional. Return non-zero if FONT_OBJECT can be used as a (cached) font for ENTITY on frame F. */ - int (*cached_font_ok) P_ ((struct frame *f, - Lisp_Object font_object, - Lisp_Object entity)); + int (*cached_font_ok) (struct frame *f, + Lisp_Object font_object, + Lisp_Object entity); }; @@ -739,80 +744,80 @@ EXFUN (Ffont_family_list, 1); EXFUN (Fclear_font_cache, 0); EXFUN (Ffont_xlfd_name, 2); -extern Lisp_Object font_make_spec P_ ((void)); -extern Lisp_Object font_make_entity P_ ((void)); -extern Lisp_Object font_make_object P_ ((int, Lisp_Object, int)); +extern Lisp_Object font_make_spec (void); +extern Lisp_Object font_make_entity (void); +extern Lisp_Object font_make_object (int, Lisp_Object, int); -extern Lisp_Object find_font_encoding P_ ((Lisp_Object)); -extern int font_registry_charsets P_ ((Lisp_Object, struct charset **, - struct charset **)); -extern int font_style_to_value P_ ((enum font_property_index prop, - Lisp_Object name, int noerror)); -extern Lisp_Object font_style_symbolic P_ ((Lisp_Object font, - enum font_property_index prop, - int for_face)); +extern Lisp_Object find_font_encoding (Lisp_Object); +extern int font_registry_charsets (Lisp_Object, struct charset **, + struct charset **); +extern int font_style_to_value (enum font_property_index prop, + Lisp_Object name, int noerror); +extern Lisp_Object font_style_symbolic (Lisp_Object font, + enum font_property_index prop, + int for_face); -extern int font_match_p P_ ((Lisp_Object spec, Lisp_Object font)); -extern Lisp_Object font_list_entities P_ ((Lisp_Object frame, - Lisp_Object spec)); +extern int font_match_p (Lisp_Object spec, Lisp_Object font); +extern Lisp_Object font_list_entities (Lisp_Object frame, + Lisp_Object spec); -extern Lisp_Object font_get_name P_ ((Lisp_Object font_object)); -extern Lisp_Object font_spec_from_name P_ ((Lisp_Object font_name)); -extern Lisp_Object font_get_frame P_ ((Lisp_Object font_object)); -extern int font_has_char P_ ((FRAME_PTR, Lisp_Object, int)); -extern unsigned font_encode_char P_ ((Lisp_Object, int)); +extern Lisp_Object font_get_name (Lisp_Object font_object); +extern Lisp_Object font_spec_from_name (Lisp_Object font_name); +extern Lisp_Object font_get_frame (Lisp_Object font_object); +extern int font_has_char (FRAME_PTR, Lisp_Object, int); +extern unsigned font_encode_char (Lisp_Object, int); -extern void font_clear_prop P_ ((Lisp_Object *attrs, - enum font_property_index prop)); -extern void font_update_lface P_ ((FRAME_PTR f, Lisp_Object *attrs)); -extern Lisp_Object font_find_for_lface P_ ((FRAME_PTR f, Lisp_Object *lface, - Lisp_Object spec, int c)); -extern Lisp_Object font_open_for_lface P_ ((FRAME_PTR f, Lisp_Object entity, - Lisp_Object *lface, - Lisp_Object spec)); -extern Lisp_Object font_load_for_lface P_ ((FRAME_PTR f, Lisp_Object *lface, - Lisp_Object spec)); -extern void font_prepare_for_face P_ ((FRAME_PTR f, struct face *face)); -extern void font_done_for_face P_ ((FRAME_PTR f, struct face *face)); +extern void font_clear_prop (Lisp_Object *attrs, + enum font_property_index prop); +extern void font_update_lface (FRAME_PTR f, Lisp_Object *attrs); +extern Lisp_Object font_find_for_lface (FRAME_PTR f, Lisp_Object *lface, + Lisp_Object spec, int c); +extern Lisp_Object font_open_for_lface (FRAME_PTR f, Lisp_Object entity, + Lisp_Object *lface, + Lisp_Object spec); +extern Lisp_Object font_load_for_lface (FRAME_PTR f, Lisp_Object *lface, + Lisp_Object spec); +extern void font_prepare_for_face (FRAME_PTR f, struct face *face); +extern void font_done_for_face (FRAME_PTR f, struct face *face); -extern Lisp_Object font_open_by_spec P_ ((FRAME_PTR f, Lisp_Object spec)); -extern Lisp_Object font_open_by_name P_ ((FRAME_PTR f, char *name)); +extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec); +extern Lisp_Object font_open_by_name (FRAME_PTR f, char *name); extern void font_close_object (FRAME_PTR f, Lisp_Object font_object); -extern Lisp_Object font_intern_prop P_ ((char *str, int len, int force_symbol)); -extern void font_update_sort_order P_ ((int *order)); +extern Lisp_Object font_intern_prop (char *str, int len, int force_symbol); +extern void font_update_sort_order (int *order); -extern void font_parse_family_registry P_ ((Lisp_Object family, - Lisp_Object registry, - Lisp_Object spec)); -extern Lisp_Object font_spec_from_family_registry P_ ((Lisp_Object family, - Lisp_Object registry)); +extern void font_parse_family_registry (Lisp_Object family, + Lisp_Object registry, + Lisp_Object spec); +extern Lisp_Object font_spec_from_family_registry (Lisp_Object family, + Lisp_Object registry); -extern int font_parse_xlfd P_ ((char *name, Lisp_Object font)); -extern int font_unparse_xlfd P_ ((Lisp_Object font, int pixel_size, - char *name, int bytes)); -extern int font_parse_fcname P_ ((char *name, Lisp_Object font)); -extern int font_unparse_fcname P_ ((Lisp_Object font, int pixel_size, - char *name, int bytes)); -extern int font_unparse_gtkname P_ ((Lisp_Object, struct frame *, char *, int)); -extern void register_font_driver P_ ((struct font_driver *driver, FRAME_PTR f)); -extern void free_font_driver_list P_ ((FRAME_PTR f)); -extern Lisp_Object font_update_drivers P_ ((FRAME_PTR f, Lisp_Object list)); -extern Lisp_Object font_at P_ ((int c, EMACS_INT pos, struct face *face, - struct window *w, Lisp_Object object)); +extern int font_parse_xlfd (char *name, Lisp_Object font); +extern int font_unparse_xlfd (Lisp_Object font, int pixel_size, + char *name, int bytes); +extern int font_parse_fcname (char *name, Lisp_Object font); +extern int font_unparse_fcname (Lisp_Object font, int pixel_size, + char *name, int bytes); +extern int font_unparse_gtkname (Lisp_Object, struct frame *, char *, int); +extern void register_font_driver (struct font_driver *driver, FRAME_PTR f); +extern void free_font_driver_list (FRAME_PTR f); +extern Lisp_Object font_update_drivers (FRAME_PTR f, Lisp_Object list); +extern Lisp_Object font_at (int c, EMACS_INT pos, struct face *face, + struct window *w, Lisp_Object object); extern Lisp_Object font_range (EMACS_INT, EMACS_INT *, struct window *, struct face *, Lisp_Object); -extern void font_fill_lglyph_metrics P_ ((Lisp_Object, Lisp_Object)); +extern void font_fill_lglyph_metrics (Lisp_Object, Lisp_Object); -extern Lisp_Object font_put_extra P_ ((Lisp_Object font, Lisp_Object prop, - Lisp_Object val)); +extern Lisp_Object font_put_extra (Lisp_Object font, Lisp_Object prop, + Lisp_Object val); -extern int font_put_frame_data P_ ((FRAME_PTR f, - struct font_driver *driver, - void *data)); -extern void *font_get_frame_data P_ ((FRAME_PTR f, - struct font_driver *driver)); +extern int font_put_frame_data (FRAME_PTR f, + struct font_driver *driver, + void *data); +extern void *font_get_frame_data (FRAME_PTR f, + struct font_driver *driver); #ifdef HAVE_FREETYPE extern struct font_driver ftfont_driver; @@ -837,8 +842,8 @@ extern struct font_driver nsfont_driver; #endif extern Lisp_Object Vfont_log; -extern void font_add_log P_ ((char *, Lisp_Object, Lisp_Object)); -extern void font_deferred_log P_ ((char *, Lisp_Object, Lisp_Object)); +extern void font_add_log (char *, Lisp_Object, Lisp_Object); +extern void font_deferred_log (char *, Lisp_Object, Lisp_Object); #define FONT_ADD_LOG(ACTION, ARG, RESULT) \ do { \ diff --git a/src/fontset.c b/src/fontset.c index e4fd9d72780..9a27fc3e36b 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -203,23 +203,23 @@ Lisp_Object Vvertical_centering_font_regexp; Lisp_Object Votf_script_alist; /* Check if any window system is used now. */ -void (*check_window_system_func) P_ ((void)); +void (*check_window_system_func) (void); /* Prototype declarations for static functions. */ -static Lisp_Object fontset_add P_ ((Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object)); -static Lisp_Object fontset_find_font P_ ((Lisp_Object, int, struct face *, - int, int)); -static void reorder_font_vector P_ ((Lisp_Object, struct font *)); -static Lisp_Object fontset_font P_ ((Lisp_Object, int, struct face *, int)); -static Lisp_Object make_fontset P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); -static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object)); -static void accumulate_script_ranges P_ ((Lisp_Object, Lisp_Object, - Lisp_Object)); -Lisp_Object find_font_encoding P_ ((Lisp_Object)); +static Lisp_Object fontset_add (Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object); +static Lisp_Object fontset_find_font (Lisp_Object, int, struct face *, + int, int); +static void reorder_font_vector (Lisp_Object, struct font *); +static Lisp_Object fontset_font (Lisp_Object, int, struct face *, int); +static Lisp_Object make_fontset (Lisp_Object, Lisp_Object, Lisp_Object); +static Lisp_Object fontset_pattern_regexp (Lisp_Object); +static void accumulate_script_ranges (Lisp_Object, Lisp_Object, + Lisp_Object); +Lisp_Object find_font_encoding (Lisp_Object); -static void set_fontset_font P_ ((Lisp_Object, Lisp_Object)); +static void set_fontset_font (Lisp_Object, Lisp_Object); #ifdef FONTSET_DEBUG @@ -306,9 +306,7 @@ fontset_id_valid_p (id) : fontset_ref ((fontset), (c))) static Lisp_Object -fontset_ref (fontset, c) - Lisp_Object fontset; - int c; +fontset_ref (Lisp_Object fontset, int c) { Lisp_Object elt; @@ -343,8 +341,7 @@ fontset_ref (fontset, c) : fontset_add ((fontset), (range), (elt), (add))) static Lisp_Object -fontset_add (fontset, range, elt, add) - Lisp_Object fontset, range, elt, add; +fontset_add (Lisp_Object fontset, Lisp_Object range, Lisp_Object elt, Lisp_Object add) { Lisp_Object args[2]; int idx = (EQ (add, Qappend) ? 0 : 1); @@ -376,8 +373,7 @@ fontset_add (fontset, range, elt, add) } static int -fontset_compare_rfontdef (val1, val2) - const void *val1, *val2; +fontset_compare_rfontdef (const void *val1, const void *val2) { return (RFONT_DEF_SCORE (*(Lisp_Object *) val1) - RFONT_DEF_SCORE (*(Lisp_Object *) val2)); @@ -392,12 +388,10 @@ fontset_compare_rfontdef (val1, val2) If PREFERRED_FAMILY is not nil, that family has the higher priority if the encoding charsets or languages in font-specs are the same. */ -extern Lisp_Object Fassoc_string (); +extern Lisp_Object Fassoc_string (Lisp_Object, Lisp_Object, Lisp_Object); static void -reorder_font_vector (font_group, font) - Lisp_Object font_group; - struct font *font; +reorder_font_vector (Lisp_Object font_group, struct font *font) { Lisp_Object vec, font_object; int size; @@ -525,11 +519,7 @@ fontset_get_font_group (Lisp_Object fontset, int c) If FALLBACK is nonzero, search only fallback fonts. */ static Lisp_Object -fontset_find_font (fontset, c, face, id, fallback) - Lisp_Object fontset; - int c; - struct face *face; - int id, fallback; +fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fallback) { Lisp_Object vec, font_group; int i, charset_matched = 0, found_index; @@ -728,11 +718,7 @@ fontset_find_font (fontset, c, face, id, fallback) static Lisp_Object -fontset_font (fontset, c, face, id) - Lisp_Object fontset; - int c; - struct face *face; - int id; +fontset_font (Lisp_Object fontset, int c, struct face *face, int id) { Lisp_Object rfont_def, default_rfont_def; Lisp_Object base_fontset; @@ -793,8 +779,7 @@ fontset_font (fontset, c, face, id) BASE. */ static Lisp_Object -make_fontset (frame, name, base) - Lisp_Object frame, name, base; +make_fontset (Lisp_Object frame, Lisp_Object name, Lisp_Object base) { Lisp_Object fontset; int size = ASIZE (Vfontset_table); @@ -835,8 +820,7 @@ make_fontset (frame, name, base) /* Return the name of the fontset who has ID. */ Lisp_Object -fontset_name (id) - int id; +fontset_name (int id) { Lisp_Object fontset; @@ -848,8 +832,7 @@ fontset_name (id) /* Return the ASCII font name of the fontset who has ID. */ Lisp_Object -fontset_ascii (id) - int id; +fontset_ascii (int id) { Lisp_Object fontset, elt; @@ -861,9 +844,7 @@ fontset_ascii (id) } void -free_realized_fontset (f, fontset) - FRAME_PTR f; - Lisp_Object fontset; +free_realized_fontset (FRAME_PTR f, Lisp_Object fontset) { Lisp_Object tail; @@ -879,9 +860,7 @@ free_realized_fontset (f, fontset) free_realized_face. */ void -free_face_fontset (f, face) - FRAME_PTR f; - struct face *face; +free_face_fontset (FRAME_PTR f, struct face *face) { Lisp_Object fontset; @@ -915,9 +894,7 @@ free_face_fontset (f, face) when C is not an ASCII character. */ int -face_suitable_for_char_p (face, c) - struct face *face; - int c; +face_suitable_for_char_p (struct face *face, int c) { Lisp_Object fontset, rfont_def; @@ -934,11 +911,7 @@ face_suitable_for_char_p (face, c) the macro FACE_FOR_CHAR. */ int -face_for_char (f, face, c, pos, object) - FRAME_PTR f; - struct face *face; - int c, pos; - Lisp_Object object; +face_for_char (FRAME_PTR f, struct face *face, int c, int pos, Lisp_Object object) { Lisp_Object fontset, rfont_def, charset; int face_id; @@ -1006,10 +979,7 @@ face_for_char (f, face, c, pos, object) Lisp_Object -font_for_char (face, c, pos, object) - struct face *face; - int c, pos; - Lisp_Object object; +font_for_char (struct face *face, int c, int pos, Lisp_Object object) { Lisp_Object fontset, rfont_def, charset; int id; @@ -1059,10 +1029,7 @@ font_for_char (face, c, pos, object) Called from realize_x_face. */ int -make_fontset_for_ascii_face (f, base_fontset_id, face) - FRAME_PTR f; - int base_fontset_id; - struct face *face; +make_fontset_for_ascii_face (FRAME_PTR f, int base_fontset_id, struct face *face) { Lisp_Object base_fontset, fontset, frame; @@ -1096,11 +1063,10 @@ static Lisp_Object Vcached_fontset_data; expression corresponding to PATTERN. */ static Lisp_Object -fontset_pattern_regexp (pattern) - Lisp_Object pattern; +fontset_pattern_regexp (Lisp_Object pattern) { - if (!index ((char *) SDATA (pattern), '*') - && !index ((char *) SDATA (pattern), '?')) + if (!strchr ((char *) SDATA (pattern), '*') + && !strchr ((char *) SDATA (pattern), '?')) /* PATTERN does not contain any wild cards. */ return Qnil; @@ -1171,9 +1137,7 @@ fontset_pattern_regexp (pattern) */ int -fs_query_fontset (name, name_pattern) - Lisp_Object name; - int name_pattern; +fs_query_fontset (Lisp_Object name, int name_pattern) { Lisp_Object tem; int i; @@ -1222,8 +1186,7 @@ The value is nil if there is no matching fontset. PATTERN can contain `*' or `?' as a wildcard just as X font name matching algorithm allows. If REGEXPP is non-nil, PATTERN is a regular expression. */) - (pattern, regexpp) - Lisp_Object pattern, regexpp; + (Lisp_Object pattern, Lisp_Object regexpp) { Lisp_Object fontset; int id; @@ -1246,10 +1209,7 @@ If REGEXPP is non-nil, PATTERN is a regular expression. */) /* Return a list of base fontset names matching PATTERN on frame F. */ Lisp_Object -list_fontsets (f, pattern, size) - FRAME_PTR f; - Lisp_Object pattern; - int size; +list_fontsets (FRAME_PTR f, Lisp_Object pattern, int size) { Lisp_Object frame, regexp, val; int id; @@ -1285,8 +1245,7 @@ list_fontsets (f, pattern, size) /* Free all realized fontsets whose base fontset is BASE. */ static void -free_realized_fontsets (base) - Lisp_Object base; +free_realized_fontsets (Lisp_Object base) { int id; @@ -1343,8 +1302,7 @@ free_realized_fontsets (base) Set *FRAME to the actual frame. */ static Lisp_Object -check_fontset_name (name, frame) - Lisp_Object name, *frame; +check_fontset_name (Lisp_Object name, Lisp_Object *frame) { int id; @@ -1373,8 +1331,7 @@ check_fontset_name (name, frame) } static void -accumulate_script_ranges (arg, range, val) - Lisp_Object arg, range, val; +accumulate_script_ranges (Lisp_Object arg, Lisp_Object range, Lisp_Object val) { if (EQ (XCAR (arg), val)) { @@ -1399,8 +1356,7 @@ accumulate_script_ranges (arg, range, val) case. */ static void -set_fontset_font (arg, range) - Lisp_Object arg, range; +set_fontset_font (Lisp_Object arg, Lisp_Object range) { Lisp_Object fontset, font_def, add, ascii, script_range_list; int from = XINT (XCAR (range)), to = XINT (XCDR (range)); @@ -1440,7 +1396,7 @@ set_fontset_font (arg, range) } extern Lisp_Object QCfamily, QCregistry; -static void update_auto_fontset_alist P_ ((Lisp_Object, Lisp_Object)); +static void update_auto_fontset_alist (Lisp_Object, Lisp_Object); DEFUN ("set-fontset-font", Fset_fontset_font, Sset_fontset_font, 3, 5, 0, @@ -1478,8 +1434,7 @@ Optional 5th argument ADD, if non-nil, specifies how to add FONT-SPEC to the font specifications for TARGET previously set. If it is `prepend', FONT-SPEC is prepended. If it is `append', FONT-SPEC is appended. By default, FONT-SPEC overrides the previous settings. */) - (name, target, font_spec, frame, add) - Lisp_Object name, target, font_spec, frame, add; + (Lisp_Object name, Lisp_Object target, Lisp_Object font_spec, Lisp_Object frame, Lisp_Object add) { Lisp_Object fontset; Lisp_Object font_def, registry, family; @@ -1688,8 +1643,7 @@ char-table `char-script-table'. FONT-SPEC is a vector, a cons, or a string. See the documentation of `set-fontset-font' for the meaning. */) - (name, fontlist) - Lisp_Object name, fontlist; + (Lisp_Object name, Lisp_Object fontlist) { Lisp_Object fontset; int id; @@ -1762,8 +1716,7 @@ static int num_auto_fontsets; user intends to use FONT-OBJECT for Latin characters. */ int -fontset_from_font (font_object) - Lisp_Object font_object; +fontset_from_font (Lisp_Object font_object) { Lisp_Object font_name = font_get_name (font_object); Lisp_Object font_spec = Fcopy_font_spec (font_object); @@ -1819,8 +1772,7 @@ fontset_from_font (font_object) fontset_from_font. */ static void -update_auto_fontset_alist (font_object, fontset) - Lisp_Object font_object, fontset; +update_auto_fontset_alist (Lisp_Object font_object, Lisp_Object fontset) { Lisp_Object prev, tail; @@ -1866,8 +1818,7 @@ update_auto_fontset_alist (font_object, fontset) DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0, doc: /* For internal use only. */) - (position, ch) - Lisp_Object position, ch; + (Lisp_Object position, Lisp_Object ch) { EMACS_INT pos, pos_byte, dummy; int face_id; @@ -1957,8 +1908,7 @@ The char-table has one extra slot. If FONTSET is not the default fontset, the value the extra slot is a char-table containing the information about the derived fonts from the default fontset. The format is the same as above. */) - (fontset, frame) - Lisp_Object fontset, frame; + (Lisp_Object fontset, Lisp_Object frame) { FRAME_PTR f; Lisp_Object *realized[2], fontsets[2], tables[2]; @@ -2093,8 +2043,7 @@ fontset. If the 2nd optional arg ALL is non-nil, return a list of all font name patterns. */) - (name, ch, all) - Lisp_Object name, ch, all; + (Lisp_Object name, Lisp_Object ch, Lisp_Object all) { int c; Lisp_Object fontset, elt, list, repertory, val; @@ -2154,7 +2103,7 @@ patterns. */) DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0, doc: /* Return a list of all defined fontset names. */) - () + (void) { Lisp_Object fontset, list; int i; @@ -2211,7 +2160,7 @@ dump_fontset (fontset) DEFUN ("fontset-list-all", Ffontset_list_all, Sfontset_list_all, 0, 0, 0, doc: /* Return a brief summary of all fontsets for debug use. */) - () + (void) { Lisp_Object val; int i; @@ -2224,7 +2173,7 @@ DEFUN ("fontset-list-all", Ffontset_list_all, Sfontset_list_all, 0, 0, 0, #endif /* FONTSET_DEBUG */ void -syms_of_fontset () +syms_of_fontset (void) { DEFSYM (Qfontset, "fontset"); Fput (Qfontset, Qchar_table_extra_slots, make_number (9)); diff --git a/src/fontset.h b/src/fontset.h index 78bdfaaaca0..178170a04ce 100644 --- a/src/fontset.h +++ b/src/fontset.h @@ -28,22 +28,22 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define EMACS_FONTSET_H /* Check if any window system is used now. */ -extern void (*check_window_system_func) P_ ((void)); +extern void (*check_window_system_func) (void); struct face; -extern void free_face_fontset P_ ((FRAME_PTR, struct face *)); -extern Lisp_Object fontset_font_pattern P_ ((FRAME_PTR, struct face *, int)); -extern int face_suitable_for_char_p P_ ((struct face *, int)); -extern int face_for_char P_ ((FRAME_PTR, struct face *, int, - int, Lisp_Object)); -extern Lisp_Object font_for_char P_ ((struct face *, int, int, Lisp_Object)); +extern void free_face_fontset (FRAME_PTR, struct face *); +extern Lisp_Object fontset_font_pattern (FRAME_PTR, struct face *, int); +extern int face_suitable_for_char_p (struct face *, int); +extern int face_for_char (FRAME_PTR, struct face *, int, + int, Lisp_Object); +extern Lisp_Object font_for_char (struct face *, int, int, Lisp_Object); -extern int make_fontset_for_ascii_face P_ ((FRAME_PTR, int, struct face *)); -extern int fontset_from_font P_ ((Lisp_Object)); -extern int fs_query_fontset P_ ((Lisp_Object, int)); +extern int make_fontset_for_ascii_face (FRAME_PTR, int, struct face *); +extern int fontset_from_font (Lisp_Object); +extern int fs_query_fontset (Lisp_Object, int); EXFUN (Fquery_fontset, 2); -extern Lisp_Object list_fontsets P_ ((struct frame *, Lisp_Object, int)); +extern Lisp_Object list_fontsets (struct frame *, Lisp_Object, int); extern Lisp_Object Vuse_default_ascent; extern Lisp_Object Vignore_relative_composition; @@ -52,12 +52,12 @@ extern Lisp_Object Vfontset_alias_alist; extern Lisp_Object Vvertical_centering_font_regexp; extern Lisp_Object Votf_script_alist; -extern Lisp_Object fontset_name P_ ((int)); -extern Lisp_Object fontset_ascii P_ ((int)); -extern int fontset_height P_ ((int)); +extern Lisp_Object fontset_name (int); +extern Lisp_Object fontset_ascii (int); +extern int fontset_height (int); struct font; -extern int face_for_font P_ ((struct frame *, Lisp_Object, struct face *)); +extern int face_for_font (struct frame *, Lisp_Object, struct face *); #endif /* EMACS_FONTSET_H */ diff --git a/src/frame.c b/src/frame.c index 3e1b2daf556..69a640cdc96 100644 --- a/src/frame.c +++ b/src/frame.c @@ -100,6 +100,7 @@ Lisp_Object Qgeometry; /* Not used */ Lisp_Object Qheight, Qwidth; Lisp_Object Qleft, Qright; Lisp_Object Qicon_left, Qicon_top, Qicon_type, Qicon_name; +Lisp_Object Qtooltip; Lisp_Object Qinternal_border_width; Lisp_Object Qmouse_color; Lisp_Object Qminibuffer; @@ -119,6 +120,7 @@ Lisp_Object Qtitle, Qname; Lisp_Object Qexplicit_name; Lisp_Object Qunsplittable; Lisp_Object Qmenu_bar_lines, Qtool_bar_lines; +Lisp_Object Vmenu_bar_mode, Vtool_bar_mode; Lisp_Object Qleft_fringe, Qright_fringe; Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list; Lisp_Object Qtty_color_mode; @@ -141,9 +143,7 @@ static Lisp_Object Vdelete_frame_functions, Qdelete_frame_functions; int focus_follows_mouse; static void -set_menu_bar_lines_1 (window, n) - Lisp_Object window; - int n; +set_menu_bar_lines_1 (Lisp_Object window, int n) { struct window *w = XWINDOW (window); @@ -169,9 +169,7 @@ set_menu_bar_lines_1 (window, n) } void -set_menu_bar_lines (f, value, oldval) - struct frame *f; - Lisp_Object value, oldval; +set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { int nlines; int olines = FRAME_MENU_BAR_LINES (f); @@ -201,10 +199,10 @@ set_menu_bar_lines (f, value, oldval) Lisp_Object Vframe_list; extern Lisp_Object Vminibuffer_list; -extern Lisp_Object get_minibuffer (); -extern Lisp_Object Fhandle_switch_frame (); -extern Lisp_Object Fredirect_frame_focus (); -extern Lisp_Object x_get_focus_frame (); +extern Lisp_Object get_minibuffer (int); +extern Lisp_Object Fhandle_switch_frame (Lisp_Object event); +extern Lisp_Object Fredirect_frame_focus (Lisp_Object frame, Lisp_Object focus_frame); +extern Lisp_Object x_get_focus_frame (struct frame *frame); extern Lisp_Object QCname, Qfont_param; @@ -216,8 +214,7 @@ Value is t for a termcap frame (a character-only terminal), `ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display, `pc' for a direct-write MS-DOS frame. See also `frame-live-p'. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (!FRAMEP (object)) return Qnil; @@ -247,8 +244,7 @@ Value is nil if OBJECT is not a live frame. If object is a live frame, the return value indicates what sort of terminal device it is displayed on. See the documentation of `framep' for possible return values. */) - (object) - Lisp_Object object; + (Lisp_Object object) { return ((FRAMEP (object) && FRAME_LIVE_P (XFRAME (object))) @@ -262,8 +258,7 @@ The value is a symbol---for instance, 'x' for X windows. The value is nil if Emacs is using a text-only terminal. FRAME defaults to the currently selected frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { Lisp_Object type; if (NILP (frame)) @@ -281,8 +276,7 @@ FRAME defaults to the currently selected frame. */) } struct frame * -make_frame (mini_p) - int mini_p; +make_frame (int mini_p) { Lisp_Object frame; register struct frame *f; @@ -333,6 +327,8 @@ make_frame (mini_p) f->n_tool_bar_items = 0; f->left_fringe_width = f->right_fringe_width = 0; f->fringe_cols = 0; + f->menu_bar_lines = 0; + f->tool_bar_lines = 0; f->scroll_bar_actual_width = 0; f->border_width = 0; f->internal_border_width = 0; @@ -432,10 +428,7 @@ make_frame (mini_p) default (the global minibuffer). */ struct frame * -make_frame_without_minibuffer (mini_window, kb, display) - register Lisp_Object mini_window; - KBOARD *kb; - Lisp_Object display; +make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lisp_Object display) { register struct frame *f; struct gcpro gcpro1; @@ -484,7 +477,7 @@ make_frame_without_minibuffer (mini_window, kb, display) /* Make a frame containing only a minibuffer window. */ struct frame * -make_minibuffer_frame () +make_minibuffer_frame (void) { /* First make a frame containing just a root window, no minibuffer. */ @@ -561,6 +554,9 @@ make_initial_frame (void) FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; + /* The default value of menu-bar-mode is t. */ + set_menu_bar_lines (f, make_number (1), Qnil); + #ifdef CANNOT_DUMP if (!noninteractive) init_frame_faces (f); @@ -610,6 +606,7 @@ make_terminal_frame (struct terminal *terminal) FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; + FRAME_MENU_BAR_LINES(f) = NILP (Vmenu_bar_mode) ? 0 : 1; /* Set the top frame to the newly created frame. */ if (FRAMEP (FRAME_TTY (f)->top_frame) @@ -626,8 +623,7 @@ make_terminal_frame (struct terminal *terminal) /* Get a suitable value for frame parameter PARAMETER for a newly created frame, based on (1) the user-supplied frame parameter - alist SUPPLIED_PARMS, (2) CURRENT_VALUE, and finally, if all else - fails, (3) Vdefault_frame_alist. */ + alist SUPPLIED_PARMS, and (2) CURRENT_VALUE. */ static Lisp_Object get_future_frame_param (Lisp_Object parameter, @@ -641,8 +637,6 @@ get_future_frame_param (Lisp_Object parameter, result = Fassq (parameter, XFRAME (selected_frame)->param_alist); if (NILP (result) && current_value != NULL) result = build_string (current_value); - if (NILP (result)) - result = Fassq (parameter, Vdefault_frame_alist); if (!NILP (result) && !STRINGP (result)) result = XCDR (result); if (NILP (result) || !STRINGP (result)) @@ -668,8 +662,7 @@ and the `tty-type' parameter specifies the terminal type. Example: Note that changing the size of one terminal frame automatically affects all frames on the same terminal device. */) - (parms) - Lisp_Object parms; + (Lisp_Object parms) { struct frame *f; struct terminal *t = NULL; @@ -747,7 +740,6 @@ affects all frames on the same terminal device. */) adjust_glyphs (f); calculate_costs (f); XSETFRAME (frame, f); - Fmodify_frame_parameters (frame, Vdefault_frame_alist); Fmodify_frame_parameters (frame, parms); Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty_type, build_string (t->display_info.tty->type)), @@ -787,9 +779,7 @@ affects all frames on the same terminal device. */) The value of NORECORD is passed as argument to Fselect_window. */ Lisp_Object -do_switch_frame (frame, track, for_deletion, norecord) - Lisp_Object frame, norecord; - int track, for_deletion; +do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object norecord) { struct frame *sf = SELECTED_FRAME (); @@ -899,8 +889,7 @@ the window system's input focus. On a text-only terminal, the next redisplay will display FRAME. This function returns FRAME, or nil if FRAME has been deleted. */) - (frame, norecord) - Lisp_Object frame, norecord; + (Lisp_Object frame, Lisp_Object norecord) { return do_switch_frame (frame, 1, 0, norecord); } @@ -915,8 +904,7 @@ This function selects the selected window of the frame of EVENT. If EVENT is frame object, handle it as if it were a switch-frame event to that frame. */) - (event) - Lisp_Object event; + (Lisp_Object event) { /* Preserve prefix arg that the command loop just cleared. */ current_kboard->Vprefix_arg = Vcurrent_prefix_arg; @@ -926,15 +914,14 @@ to that frame. */) DEFUN ("selected-frame", Fselected_frame, Sselected_frame, 0, 0, 0, doc: /* Return the frame that is now selected. */) - () + (void) { return selected_frame; } DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0, doc: /* Return the frame object that window WINDOW is on. */) - (window) - Lisp_Object window; + (Lisp_Object window) { CHECK_LIVE_WINDOW (window); return XWINDOW (window)->frame; @@ -943,8 +930,7 @@ DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0, DEFUN ("frame-first-window", Fframe_first_window, Sframe_first_window, 0, 1, 0, doc: /* Returns the topmost, leftmost window of FRAME. If omitted, FRAME defaults to the currently selected frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { Lisp_Object w; @@ -970,7 +956,7 @@ If omitted, FRAME defaults to the currently selected frame. */) DEFUN ("active-minibuffer-window", Factive_minibuffer_window, Sactive_minibuffer_window, 0, 0, 0, doc: /* Return the currently active minibuffer window, or nil if none. */) - () + (void) { return minibuf_level ? minibuf_window : Qnil; } @@ -978,8 +964,7 @@ DEFUN ("active-minibuffer-window", Factive_minibuffer_window, DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0, doc: /* Returns the root-window of FRAME. If omitted, FRAME defaults to the currently selected frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { Lisp_Object window; @@ -998,8 +983,7 @@ DEFUN ("frame-selected-window", Fframe_selected_window, Sframe_selected_window, 0, 1, 0, doc: /* Return the selected window of FRAME. FRAME defaults to the currently selected frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { Lisp_Object window; @@ -1022,8 +1006,7 @@ selected frame, this makes WINDOW the selected window. Optional argument NORECORD non-nil means to neither change the order of recently selected windows nor the buffer list. Return WINDOW. */) - (frame, window, norecord) - Lisp_Object frame, window, norecord; + (Lisp_Object frame, Lisp_Object window, Lisp_Object norecord) { if (NILP (frame)) frame = selected_frame; @@ -1044,7 +1027,7 @@ Return WINDOW. */) DEFUN ("frame-list", Fframe_list, Sframe_list, 0, 0, 0, doc: /* Return a list of all live frames. */) - () + (void) { Lisp_Object frames; frames = Fcopy_sequence (Vframe_list); @@ -1064,9 +1047,7 @@ DEFUN ("frame-list", Fframe_list, Sframe_list, Otherwise, include all frames. */ static Lisp_Object -next_frame (frame, minibuf) - Lisp_Object frame; - Lisp_Object minibuf; +next_frame (Lisp_Object frame, Lisp_Object minibuf) { Lisp_Object tail; int passed = 0; @@ -1144,9 +1125,7 @@ next_frame (frame, minibuf) Otherwise, include all frames. */ static Lisp_Object -prev_frame (frame, minibuf) - Lisp_Object frame; - Lisp_Object minibuf; +prev_frame (Lisp_Object frame, Lisp_Object minibuf) { Lisp_Object tail; Lisp_Object prev; @@ -1229,8 +1208,7 @@ and any frame now using that window as the minibuffer. If MINIFRAME is `visible', include all visible frames. If MINIFRAME is 0, include all visible and iconified frames. Otherwise, include all frames. */) - (frame, miniframe) - Lisp_Object frame, miniframe; + (Lisp_Object frame, Lisp_Object miniframe) { if (NILP (frame)) frame = selected_frame; @@ -1250,8 +1228,7 @@ and any frame now using that window as the minibuffer. If MINIFRAME is `visible', include all visible frames. If MINIFRAME is 0, include all visible and iconified frames. Otherwise, include all frames. */) - (frame, miniframe) - Lisp_Object frame, miniframe; + (Lisp_Object frame, Lisp_Object miniframe) { if (NILP (frame)) frame = selected_frame; @@ -1264,8 +1241,7 @@ Otherwise, include all frames. */) (Exception: if F is the terminal frame, and we are using X, return 1.) */ int -other_visible_frames (f) - FRAME_PTR f; +other_visible_frames (FRAME_PTR f) { /* We know the selected frame is visible, so if F is some other frame, it can't be the sole visible one. */ @@ -1319,17 +1295,17 @@ extern Lisp_Object Qrun_hook_with_args; this. Any other value of FORCE implements the semantics described for Fdelete_frame. */ Lisp_Object -delete_frame (frame, force) +delete_frame (Lisp_Object frame, Lisp_Object force) /* If we use `register' here, gcc-4.0.2 on amd64 using -DUSE_LISP_UNION_TYPE complains further down that we're getting the address of `force'. Go figure. */ - Lisp_Object frame, force; + { struct frame *f; struct frame *sf = SELECTED_FRAME (); struct kboard *kb; - int minibuffer_selected; + int minibuffer_selected, tooltip_frame; if (EQ (frame, Qnil)) { @@ -1381,13 +1357,15 @@ delete_frame (frame, force) } } + tooltip_frame = !NILP (Fframe_parameter (frame, intern ("tooltip"))); + /* Run `delete-frame-functions' unless FORCE is `noelisp' or frame is a tooltip. FORCE is set to `noelisp' when handling a disconnect from the terminal, so we don't dare call Lisp code. */ - if (NILP (Vrun_hooks) || !NILP (Fframe_parameter (frame, intern ("tooltip")))) + if (NILP (Vrun_hooks) || tooltip_frame) ; - if (EQ (force, Qnoelisp)) + else if (EQ (force, Qnoelisp)) pending_funcalls = Fcons (list3 (Qrun_hook_with_args, Qdelete_frame_functions, frame), pending_funcalls); @@ -1633,7 +1611,8 @@ delete_frame (frame, force) } /* Cause frame titles to update--necessary if we now have just one frame. */ - update_mode_lines = 1; + if (!tooltip_frame) + update_mode_lines = 1; return Qnil; } @@ -1649,8 +1628,7 @@ but if the second optional argument FORCE is non-nil, you may do so. This function runs `delete-frame-functions' before actually deleting the frame, unless the frame is a tooltip. The functions are run with one argument, the frame to be deleted. */) - (frame, force) - Lisp_Object frame, force; + (Lisp_Object frame, Lisp_Object force) { return delete_frame (frame, !NILP (force) ? Qt : Qnil); } @@ -1669,7 +1647,7 @@ and nil for X and Y. If `mouse-position-function' is non-nil, `mouse-position' calls it, passing the normal return value to that function as an argument, and returns whatever that function returns. */) - () + (void) { FRAME_PTR f; Lisp_Object lispy_dummy; @@ -1715,7 +1693,7 @@ the vertical offset. If Emacs is running on a mouseless terminal or hasn't been programmed to read the mouse position, it returns the selected frame for FRAME and nil for X and Y. */) - () + (void) { FRAME_PTR f; Lisp_Object lispy_dummy; @@ -1752,8 +1730,7 @@ This function is a no-op for an X frame that is not visible. If you have just created a frame, you must wait for it to become visible before calling this function on it, like this. (while (not (frame-visible-p frame)) (sleep-for .5)) */) - (frame, x, y) - Lisp_Object frame, x, y; + (Lisp_Object frame, Lisp_Object x, Lisp_Object y) { CHECK_LIVE_FRAME (frame); CHECK_NUMBER (x); @@ -1794,8 +1771,7 @@ Note, this is a no-op for an X frame that is not visible. If you have just created a frame, you must wait for it to become visible before calling this function on it, like this. (while (not (frame-visible-p frame)) (sleep-for .5)) */) - (frame, x, y) - Lisp_Object frame, x, y; + (Lisp_Object frame, Lisp_Object x, Lisp_Object y) { CHECK_LIVE_FRAME (frame); CHECK_NUMBER (x); @@ -1826,14 +1802,13 @@ before calling this function on it, like this. return Qnil; } -static void make_frame_visible_1 P_ ((Lisp_Object)); +static void make_frame_visible_1 (Lisp_Object); DEFUN ("make-frame-visible", Fmake_frame_visible, Smake_frame_visible, 0, 1, "", doc: /* Make the frame FRAME visible (assuming it is an X window). If omitted, FRAME defaults to the currently selected frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { if (NILP (frame)) frame = selected_frame; @@ -1861,8 +1836,7 @@ If omitted, FRAME defaults to the currently selected frame. */) and all its descendents. */ static void -make_frame_visible_1 (window) - Lisp_Object window; +make_frame_visible_1 (Lisp_Object window) { struct window *w; @@ -1893,8 +1867,7 @@ but if the second optional argument FORCE is non-nil, you may do so. This function has no effect on text-only terminal frames. Such frames are always considered visible, whether or not they are currently being displayed in the terminal. */) - (frame, force) - Lisp_Object frame, force; + (Lisp_Object frame, Lisp_Object force) { if (NILP (frame)) frame = selected_frame; @@ -1935,8 +1908,7 @@ DEFUN ("iconify-frame", Ficonify_frame, Siconify_frame, 0, 1, "", doc: /* Make the frame FRAME into an icon. If omitted, FRAME defaults to the currently selected frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { if (NILP (frame)) frame = selected_frame; @@ -1981,8 +1953,7 @@ usually not displayed at all, even in a window system's \"taskbar\". If FRAME is a text-only terminal frame, this always returns t. Such frames are always considered visible, whether or not they are currently being displayed on the terminal. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { CHECK_LIVE_FRAME (frame); @@ -1998,7 +1969,7 @@ currently being displayed on the terminal. */) DEFUN ("visible-frame-list", Fvisible_frame_list, Svisible_frame_list, 0, 0, 0, doc: /* Return a list of all frames now \"visible\" (being updated). */) - () + (void) { Lisp_Object tail, frame; struct frame *f; @@ -2024,8 +1995,7 @@ If FRAME is invisible or iconified, make it visible. If you don't specify a frame, the selected frame is used. If Emacs is displaying on an ordinary terminal or some other device which doesn't support multiple overlapping frames, this function selects FRAME. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { struct frame *f; if (NILP (frame)) @@ -2054,8 +2024,7 @@ DEFUN ("lower-frame", Flower_frame, Slower_frame, 0, 1, "", If you don't specify a frame, the selected frame is used. If Emacs is displaying on an ordinary terminal or some other device which doesn't support multiple overlapping frames, this function does nothing. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { struct frame *f; @@ -2098,8 +2067,7 @@ differently from a frame whose focus is redirected to nil; the former is affected by `select-frame', while the latter is not. The redirection lasts until `redirect-frame-focus' is called to change it. */) - (frame, focus_frame) - Lisp_Object frame, focus_frame; + (Lisp_Object frame, Lisp_Object focus_frame) { struct frame *f; @@ -2126,8 +2094,7 @@ DEFUN ("frame-focus", Fframe_focus, Sframe_focus, 1, 1, 0, doc: /* Return the frame to which FRAME's keystrokes are currently being sent. This returns nil if FRAME's focus is not redirected. See `redirect-frame-focus'. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { CHECK_LIVE_FRAME (frame); @@ -2139,9 +2106,7 @@ See `redirect-frame-focus'. */) /* Return the value of frame parameter PROP in frame FRAME. */ Lisp_Object -get_frame_param (frame, prop) - register struct frame *frame; - Lisp_Object prop; +get_frame_param (register struct frame *frame, Lisp_Object prop) { register Lisp_Object tem; @@ -2154,8 +2119,7 @@ get_frame_param (frame, prop) /* Return the buffer-predicate of the selected frame. */ Lisp_Object -frame_buffer_predicate (frame) - Lisp_Object frame; +frame_buffer_predicate (Lisp_Object frame) { return XFRAME (frame)->buffer_predicate; } @@ -2163,8 +2127,7 @@ frame_buffer_predicate (frame) /* Return the buffer-list of the selected frame. */ Lisp_Object -frame_buffer_list (frame) - Lisp_Object frame; +frame_buffer_list (Lisp_Object frame) { return XFRAME (frame)->buffer_list; } @@ -2172,8 +2135,7 @@ frame_buffer_list (frame) /* Set the buffer-list of the selected frame. */ void -set_frame_buffer_list (frame, list) - Lisp_Object frame, list; +set_frame_buffer_list (Lisp_Object frame, Lisp_Object list) { XFRAME (frame)->buffer_list = list; } @@ -2181,8 +2143,7 @@ set_frame_buffer_list (frame, list) /* Discard BUFFER from the buffer-list and buried-buffer-list of each frame. */ void -frames_discard_buffer (buffer) - Lisp_Object buffer; +frames_discard_buffer (Lisp_Object buffer) { Lisp_Object frame, tail; @@ -2199,9 +2160,7 @@ frames_discard_buffer (buffer) If the alist already has an element for PROP, we change it. */ void -store_in_alist (alistptr, prop, val) - Lisp_Object *alistptr, val; - Lisp_Object prop; +store_in_alist (Lisp_Object *alistptr, Lisp_Object prop, Lisp_Object val) { register Lisp_Object tem; @@ -2213,9 +2172,7 @@ store_in_alist (alistptr, prop, val) } static int -frame_name_fnn_p (str, len) - char *str; - EMACS_INT len; +frame_name_fnn_p (char *str, EMACS_INT len) { if (len > 1 && str[0] == 'F') { @@ -2233,9 +2190,7 @@ frame_name_fnn_p (str, len) Modeled after x_set_name which is used for WINDOW frames. */ static void -set_term_frame_name (f, name) - struct frame *f; - Lisp_Object name; +set_term_frame_name (struct frame *f, Lisp_Object name) { f->explicit_name = ! NILP (name); @@ -2273,9 +2228,7 @@ set_term_frame_name (f, name) } void -store_frame_param (f, prop, val) - struct frame *f; - Lisp_Object prop, val; +store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) { register Lisp_Object old_alist_elt; @@ -2362,8 +2315,7 @@ DEFUN ("frame-parameters", Fframe_parameters, Sframe_parameters, 0, 1, 0, It is a list of elements of the form (PARM . VALUE), where PARM is a symbol. The meaningful PARMs depend on the kind of frame. If FRAME is omitted, return information on the currently selected frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { Lisp_Object alist; FRAME_PTR f; @@ -2460,8 +2412,7 @@ If FRAME is omitted, return information on the currently selected frame. */) DEFUN ("frame-parameter", Fframe_parameter, Sframe_parameter, 2, 2, 0, doc: /* Return FRAME's value for parameter PARAMETER. If FRAME is nil, describe the currently selected frame. */) - (frame, parameter) - Lisp_Object frame, parameter; + (Lisp_Object frame, Lisp_Object parameter) { struct frame *f; Lisp_Object value; @@ -2551,8 +2502,7 @@ as a frame-local binding for the variable FOO, if you have enabled such bindings for that variable with `make-variable-frame-local'. Note that this functionality is obsolete as of Emacs 22.2, and its use is not recommended. Explicitly check for a frame-parameter instead. */) - (frame, alist) - Lisp_Object frame, alist; + (Lisp_Object frame, Lisp_Object alist) { FRAME_PTR f; register Lisp_Object tail, prop, val; @@ -2617,8 +2567,7 @@ DEFUN ("frame-char-height", Fframe_char_height, Sframe_char_height, doc: /* Height in pixels of a line in the font in frame FRAME. If FRAME is omitted, the selected frame is used. For a terminal frame, the value is always 1. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { struct frame *f; @@ -2642,8 +2591,7 @@ DEFUN ("frame-char-width", Fframe_char_width, Sframe_char_width, If FRAME is omitted, the selected frame is used. On a graphical screen, the width is the standard width of the default font. For a terminal screen, the value is always 1. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { struct frame *f; @@ -2679,8 +2627,7 @@ and menu bar. For a text-only terminal, it includes the menu bar. In this case, the result is really in characters rather than pixels (i.e., is identical to `frame-height'). */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { struct frame *f; @@ -2702,8 +2649,7 @@ DEFUN ("frame-pixel-width", Fframe_pixel_width, doc: /* Return FRAME's width in pixels. For a terminal frame, the result really gives the width in characters. If FRAME is omitted, the selected frame is used. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { struct frame *f; @@ -2724,8 +2670,7 @@ DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 3, 0, doc: /* Specify that the frame FRAME has LINES lines. Optional third arg non-nil means that redisplay should use LINES lines but that the idea of the actual height of the frame should not be changed. */) - (frame, lines, pretend) - Lisp_Object frame, lines, pretend; + (Lisp_Object frame, Lisp_Object lines, Lisp_Object pretend) { register struct frame *f; @@ -2753,8 +2698,7 @@ DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 3, 0, doc: /* Specify that the frame FRAME has COLS columns. Optional third arg non-nil means that redisplay should use COLS columns but that the idea of the actual width of the frame should not be changed. */) - (frame, cols, pretend) - Lisp_Object frame, cols, pretend; + (Lisp_Object frame, Lisp_Object cols, Lisp_Object pretend) { register struct frame *f; CHECK_NUMBER (cols); @@ -2779,8 +2723,7 @@ but that the idea of the actual width of the frame should not be changed. */) DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0, doc: /* Sets size of FRAME to COLS by ROWS, measured in characters. */) - (frame, cols, rows) - Lisp_Object frame, cols, rows; + (Lisp_Object frame, Lisp_Object cols, Lisp_Object rows) { register struct frame *f; @@ -2812,8 +2755,7 @@ DEFUN ("set-frame-position", Fset_frame_position, This is actually the position of the upper left corner of the frame. Negative values for XOFFSET or YOFFSET are interpreted relative to the rightmost or bottommost possible position (that stays within the screen). */) - (frame, xoffset, yoffset) - Lisp_Object frame, xoffset, yoffset; + (Lisp_Object frame, Lisp_Object xoffset, Lisp_Object yoffset) { register struct frame *f; @@ -2896,12 +2838,7 @@ extern Lisp_Object Qtop; */ void -x_fullscreen_adjust (f, width, height, top_pos, left_pos) - struct frame *f; - int *width; - int *height; - int *top_pos; - int *left_pos; +x_fullscreen_adjust (struct frame *f, int *width, int *height, int *top_pos, int *left_pos) { int newwidth = FRAME_COLS (f); int newheight = FRAME_LINES (f); @@ -2944,9 +2881,7 @@ x_fullscreen_adjust (f, width, height, top_pos, left_pos) to store the new value in the parameter alist. */ void -x_set_frame_parameters (f, alist) - FRAME_PTR f; - Lisp_Object alist; +x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist) { Lisp_Object tail; @@ -3220,9 +3155,7 @@ x_set_frame_parameters (f, alist) param_alist need to be considered here. */ void -x_report_frame_params (f, alistptr) - struct frame *f; - Lisp_Object *alistptr; +x_report_frame_params (struct frame *f, Lisp_Object *alistptr) { char buf[16]; Lisp_Object tem; @@ -3291,9 +3224,7 @@ x_report_frame_params (f, alistptr) the previous value of that parameter, NEW_VALUE is the new value. */ void -x_set_fullscreen (f, new_value, old_value) - struct frame *f; - Lisp_Object new_value, old_value; +x_set_fullscreen (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { if (NILP (new_value)) f->want_fullscreen = FULLSCREEN_NONE; @@ -3315,9 +3246,7 @@ x_set_fullscreen (f, new_value, old_value) the previous value of that parameter, NEW_VALUE is the new value. */ void -x_set_line_spacing (f, new_value, old_value) - struct frame *f; - Lisp_Object new_value, old_value; +x_set_line_spacing (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { if (NILP (new_value)) f->extra_line_spacing = 0; @@ -3334,9 +3263,7 @@ x_set_line_spacing (f, new_value, old_value) the previous value of that parameter, NEW_VALUE is the new value. */ void -x_set_screen_gamma (f, new_value, old_value) - struct frame *f; - Lisp_Object new_value, old_value; +x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { Lisp_Object bgcolor; @@ -3366,9 +3293,7 @@ x_set_screen_gamma (f, new_value, old_value) void -x_set_font (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { Lisp_Object frame, font_object, font_param = Qnil; int fontset = -1; @@ -3465,9 +3390,7 @@ x_set_font (f, arg, oldval) void -x_set_font_backend (f, new_value, old_value) - struct frame *f; - Lisp_Object new_value, old_value; +x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { if (! NILP (new_value) && !CONSP (new_value)) @@ -3523,17 +3446,13 @@ x_set_font_backend (f, new_value, old_value) void -x_set_fringe_width (f, new_value, old_value) - struct frame *f; - Lisp_Object new_value, old_value; +x_set_fringe_width (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { compute_fringe_widths (f, 1); } void -x_set_border_width (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { CHECK_NUMBER (arg); @@ -3547,9 +3466,7 @@ x_set_border_width (f, arg, oldval) } void -x_set_internal_border_width (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { int old = FRAME_INTERNAL_BORDER_WIDTH (f); @@ -3577,9 +3494,7 @@ x_set_internal_border_width (f, arg, oldval) } void -x_set_visibility (f, value, oldval) - struct frame *f; - Lisp_Object value, oldval; +x_set_visibility (struct frame *f, Lisp_Object value, Lisp_Object oldval) { Lisp_Object frame; XSETFRAME (frame, f); @@ -3593,33 +3508,25 @@ x_set_visibility (f, value, oldval) } void -x_set_autoraise (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_autoraise (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { f->auto_raise = !EQ (Qnil, arg); } void -x_set_autolower (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_autolower (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { f->auto_lower = !EQ (Qnil, arg); } void -x_set_unsplittable (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_unsplittable (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { f->no_split = !NILP (arg); } void -x_set_vertical_scroll_bars (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_vertical_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { if ((EQ (arg, Qleft) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) || (EQ (arg, Qright) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) @@ -3650,9 +3557,7 @@ x_set_vertical_scroll_bars (f, arg, oldval) } void -x_set_scroll_bar_width (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { int wid = FRAME_COLUMN_WIDTH (f); @@ -3687,8 +3592,7 @@ x_set_scroll_bar_width (f, arg, oldval) /* Return non-nil if frame F wants a bitmap icon. */ Lisp_Object -x_icon_type (f) - FRAME_PTR f; +x_icon_type (FRAME_PTR f) { Lisp_Object tem; @@ -3700,9 +3604,7 @@ x_icon_type (f) } void -x_set_alpha (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { double alpha = 1.0; double newval[2]; @@ -3760,7 +3662,7 @@ x_set_alpha (f, arg, oldval) Fix it up, or set it to `emacs' if it is too hopeless. */ void -validate_x_resource_name () +validate_x_resource_name (void) { int len = 0; /* Number of valid characters in the resource name. */ @@ -3827,17 +3729,15 @@ validate_x_resource_name () } -extern char *x_get_string_resource P_ ((XrmDatabase, char *, char *)); -extern Display_Info *check_x_display_info P_ ((Lisp_Object)); +extern char *x_get_string_resource (XrmDatabase, char *, char *); +extern Display_Info *check_x_display_info (Lisp_Object); /* Get specified attribute from resource database RDB. See Fx_get_resource below for other parameters. */ static Lisp_Object -xrdb_get_resource (rdb, attribute, class, component, subclass) - XrmDatabase rdb; - Lisp_Object attribute, class, component, subclass; +xrdb_get_resource (XrmDatabase rdb, Lisp_Object attribute, Lisp_Object class, Lisp_Object component, Lisp_Object subclass) { register char *value; char *name_key; @@ -3908,8 +3808,7 @@ The optional arguments COMPONENT and SUBCLASS add to the key and the class, respectively. You must specify both of them or neither. If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE' and the class is `Emacs.CLASS.SUBCLASS'. */) - (attribute, class, component, subclass) - Lisp_Object attribute, class, component, subclass; + (Lisp_Object attribute, Lisp_Object class, Lisp_Object component, Lisp_Object subclass) { #ifdef HAVE_X_WINDOWS check_x (); @@ -3922,9 +3821,7 @@ and the class is `Emacs.CLASS.SUBCLASS'. */) /* Get an X resource, like Fx_get_resource, but for display DPYINFO. */ Lisp_Object -display_x_get_resource (dpyinfo, attribute, class, component, subclass) - Display_Info *dpyinfo; - Lisp_Object attribute, class, component, subclass; +display_x_get_resource (Display_Info *dpyinfo, Lisp_Object attribute, Lisp_Object class, Lisp_Object component, Lisp_Object subclass) { return xrdb_get_resource (dpyinfo->xrdb, attribute, class, component, subclass); @@ -3934,8 +3831,7 @@ display_x_get_resource (dpyinfo, attribute, class, component, subclass) /* Used when C code wants a resource value. */ /* Called from oldXMenu/Create.c. */ char * -x_get_resource_string (attribute, class) - char *attribute, *class; +x_get_resource_string (char *attribute, char *class) { char *name_key; char *class_key; @@ -3968,12 +3864,7 @@ x_get_resource_string (attribute, class) and don't let it get stored in any Lisp-visible variables! */ Lisp_Object -x_get_arg (dpyinfo, alist, param, attribute, class, type) - Display_Info *dpyinfo; - Lisp_Object alist, param; - char *attribute; - char *class; - enum resource_types type; +x_get_arg (Display_Info *dpyinfo, Lisp_Object alist, Lisp_Object param, char *attribute, char *class, enum resource_types type) { register Lisp_Object tem; @@ -4071,12 +3962,7 @@ x_get_arg (dpyinfo, alist, param, attribute, class, type) } Lisp_Object -x_frame_get_arg (f, alist, param, attribute, class, type) - struct frame *f; - Lisp_Object alist, param; - char *attribute; - char *class; - enum resource_types type; +x_frame_get_arg (struct frame *f, Lisp_Object alist, Lisp_Object param, char *attribute, char *class, enum resource_types type) { return x_get_arg (FRAME_X_DISPLAY_INFO (f), alist, param, attribute, class, type); @@ -4085,12 +3971,7 @@ x_frame_get_arg (f, alist, param, attribute, class, type) /* Like x_frame_get_arg, but also record the value in f->param_alist. */ Lisp_Object -x_frame_get_and_record_arg (f, alist, param, attribute, class, type) - struct frame *f; - Lisp_Object alist, param; - char *attribute; - char *class; - enum resource_types type; +x_frame_get_and_record_arg (struct frame *f, Lisp_Object alist, Lisp_Object param, char *attribute, char *class, enum resource_types type) { Lisp_Object value; @@ -4110,14 +3991,7 @@ x_frame_get_and_record_arg (f, alist, param, attribute, class, type) If that is not found either, use the value DEFLT. */ Lisp_Object -x_default_parameter (f, alist, prop, deflt, xprop, xclass, type) - struct frame *f; - Lisp_Object alist; - Lisp_Object prop; - Lisp_Object deflt; - char *xprop; - char *xclass; - enum resource_types type; +x_default_parameter (struct frame *f, Lisp_Object alist, Lisp_Object prop, Lisp_Object deflt, char *xprop, char *xclass, enum resource_types type) { Lisp_Object tem; @@ -4147,8 +4021,7 @@ For X, the value of `left' or `top' may be an integer, or a list (+ N) meaning N pixels relative to top/left corner, or a list (- N) meaning -N pixels relative to bottom/right corner. On Nextstep, this just calls `ns-parse-geometry'. */) - (string) - Lisp_Object string; + (Lisp_Object string) { #ifdef HAVE_NS call1 (Qns_parse_geometry, string); @@ -4211,10 +4084,7 @@ On Nextstep, this just calls `ns-parse-geometry'. */) #define DEFAULT_COLS 80 int -x_figure_window_size (f, parms, toolbar_p) - struct frame *f; - Lisp_Object parms; - int toolbar_p; +x_figure_window_size (struct frame *f, Lisp_Object parms, int toolbar_p) { register Lisp_Object tem0, tem1, tem2; long window_prompting = 0; @@ -4389,7 +4259,7 @@ x_figure_window_size (f, parms, toolbar_p) #endif /* HAVE_WINDOW_SYSTEM */ void -frame_make_pointer_invisible () +frame_make_pointer_invisible (void) { if (! NILP (Vmake_pointer_invisible)) { @@ -4409,7 +4279,7 @@ frame_make_pointer_invisible () } void -frame_make_pointer_visible () +frame_make_pointer_visible (void) { /* We don't check Vmake_pointer_invisible here in case the pointer was invisible when Vmake_pointer_invisible was set to nil. */ @@ -4434,7 +4304,7 @@ frame_make_pointer_visible () ***********************************************************************/ void -syms_of_frame () +syms_of_frame (void) { Qframep = intern_c_string ("framep"); staticpro (&Qframep); @@ -4460,6 +4330,8 @@ syms_of_frame () staticpro (&Qicon_left); Qicon_top = intern_c_string ("icon-top"); staticpro (&Qicon_top); + Qtooltip = intern_c_string ("tooltip"); + staticpro (&Qtooltip); Qleft = intern_c_string ("left"); staticpro (&Qleft); Qright = intern_c_string ("right"); @@ -4648,6 +4520,14 @@ recursively). */); Qdelete_frame_functions = intern_c_string ("delete-frame-functions"); staticpro (&Qdelete_frame_functions); + DEFVAR_LISP ("menu-bar-mode", &Vmenu_bar_mode, + doc: /* Non-nil if Menu-Bar mode is enabled. */); + Vmenu_bar_mode = Qt; + + DEFVAR_LISP ("tool-bar-mode", &Vtool_bar_mode, + doc: /* Non-nil if Tool-Bar mode is enabled. */); + Vtool_bar_mode = Qt; + DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame, doc: /* Minibufferless frames use this frame's minibuffer. diff --git a/src/frame.h b/src/frame.h index 887d47eff21..0abd878a31f 100644 --- a/src/frame.h +++ b/src/frame.h @@ -828,19 +828,19 @@ extern Lisp_Object Qnoelisp; extern struct frame *last_nonminibuf_frame; -extern struct frame *make_initial_frame P_ ((void)); -extern struct frame *make_terminal_frame P_ ((struct terminal *)); -extern struct frame *make_frame P_ ((int)); +extern struct frame *make_initial_frame (void); +extern struct frame *make_terminal_frame (struct terminal *); +extern struct frame *make_frame (int); #ifdef HAVE_WINDOW_SYSTEM -extern struct frame *make_minibuffer_frame P_ ((void)); -extern struct frame *make_frame_without_minibuffer P_ ((Lisp_Object, - struct kboard *, - Lisp_Object)); +extern struct frame *make_minibuffer_frame (void); +extern struct frame *make_frame_without_minibuffer (Lisp_Object, + struct kboard *, + Lisp_Object); #endif /* HAVE_WINDOW_SYSTEM */ -extern int other_visible_frames P_ ((struct frame *)); -extern void frame_make_pointer_invisible P_ ((void)); -extern void frame_make_pointer_visible P_ ((void)); -extern Lisp_Object delete_frame P_ ((Lisp_Object, Lisp_Object)); +extern int other_visible_frames (struct frame *); +extern void frame_make_pointer_invisible (void); +extern void frame_make_pointer_visible (void); +extern Lisp_Object delete_frame (Lisp_Object, Lisp_Object); extern Lisp_Object Vframe_list; extern Lisp_Object Vdefault_frame_alist; @@ -1081,11 +1081,11 @@ extern Lisp_Object Qdisplay; /* These are in xterm.c, w32term.c, etc. */ -extern void x_set_scroll_bar_default_width P_ ((struct frame *)); -extern void x_set_offset P_ ((struct frame *, int, int, int)); -extern void x_wm_set_icon_position P_ ((struct frame *, int, int)); +extern void x_set_scroll_bar_default_width (struct frame *); +extern void x_set_offset (struct frame *, int, int, int); +extern void x_wm_set_icon_position (struct frame *, int, int); -extern Lisp_Object x_new_font P_ ((struct frame *, Lisp_Object, int)); +extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int); /* These are in frame.c */ @@ -1095,38 +1095,38 @@ extern Lisp_Object Vx_resource_class; extern Lisp_Object Qface_set_after_frame_default; -extern void x_fullscreen_adjust P_ ((struct frame *f, int *, int *, - int *, int *)); +extern void x_fullscreen_adjust (struct frame *f, int *, int *, + int *, int *); -extern void x_set_frame_parameters P_ ((struct frame *, Lisp_Object)); -extern void x_report_frame_params P_ ((struct frame *, Lisp_Object *)); +extern void x_set_frame_parameters (struct frame *, Lisp_Object); +extern void x_report_frame_params (struct frame *, Lisp_Object *); -extern void x_set_fullscreen P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern void x_set_screen_gamma P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern void x_set_font P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern void x_set_font_backend P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern void x_set_fringe_width P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern void x_set_border_width P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern void x_set_internal_border_width P_ ((struct frame *, Lisp_Object, - Lisp_Object)); -extern void x_set_visibility P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern void x_set_autoraise P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern void x_set_autolower P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern void x_set_unsplittable P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern void x_set_vertical_scroll_bars P_ ((struct frame *, Lisp_Object, - Lisp_Object)); -extern void x_set_scroll_bar_width P_ ((struct frame *, Lisp_Object, - Lisp_Object)); +extern void x_set_fullscreen (struct frame *, Lisp_Object, Lisp_Object); +extern void x_set_line_spacing (struct frame *, Lisp_Object, Lisp_Object); +extern void x_set_screen_gamma (struct frame *, Lisp_Object, Lisp_Object); +extern void x_set_font (struct frame *, Lisp_Object, Lisp_Object); +extern void x_set_font_backend (struct frame *, Lisp_Object, Lisp_Object); +extern void x_set_fringe_width (struct frame *, Lisp_Object, Lisp_Object); +extern void x_set_border_width (struct frame *, Lisp_Object, Lisp_Object); +extern void x_set_internal_border_width (struct frame *, Lisp_Object, + Lisp_Object); +extern void x_set_visibility (struct frame *, Lisp_Object, Lisp_Object); +extern void x_set_autoraise (struct frame *, Lisp_Object, Lisp_Object); +extern void x_set_autolower (struct frame *, Lisp_Object, Lisp_Object); +extern void x_set_unsplittable (struct frame *, Lisp_Object, Lisp_Object); +extern void x_set_vertical_scroll_bars (struct frame *, Lisp_Object, + Lisp_Object); +extern void x_set_scroll_bar_width (struct frame *, Lisp_Object, + Lisp_Object); -extern Lisp_Object x_icon_type P_ ((struct frame *)); +extern Lisp_Object x_icon_type (struct frame *); -extern int x_figure_window_size P_ ((struct frame *, Lisp_Object, int)); +extern int x_figure_window_size (struct frame *, Lisp_Object, int); extern Lisp_Object Vframe_alpha_lower_limit; -extern void x_set_alpha P_ ((struct frame *, Lisp_Object, Lisp_Object)); +extern void x_set_alpha (struct frame *, Lisp_Object, Lisp_Object); -extern void validate_x_resource_name P_ ((void)); +extern void validate_x_resource_name (void); extern Lisp_Object display_x_get_resource (Display_Info *, Lisp_Object attribute, diff --git a/src/fringe.c b/src/fringe.c index dcb4705e2e5..bfb2c217172 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -490,8 +490,7 @@ int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS; Return 0 if not a bitmap. */ int -lookup_fringe_bitmap (bitmap) - Lisp_Object bitmap; +lookup_fringe_bitmap (Lisp_Object bitmap) { int bn; @@ -517,8 +516,7 @@ lookup_fringe_bitmap (bitmap) Return BN if not found in Vfringe_bitmaps. */ static Lisp_Object -get_fringe_bitmap_name (bn) - int bn; +get_fringe_bitmap_name (int bn) { Lisp_Object bitmaps; Lisp_Object num; @@ -550,43 +548,41 @@ get_fringe_bitmap_name (bn) */ static void -draw_fringe_bitmap_1 (w, row, left_p, overlay, which) - struct window *w; - struct glyph_row *row; - int left_p, overlay; - int which; +draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int overlay, int which) { struct frame *f = XFRAME (WINDOW_FRAME (w)); struct draw_fringe_bitmap_params p; struct fringe_bitmap *fb; int period; int face_id = DEFAULT_FACE_ID; + int offset, header_line_height; - p.cursor_p = 0; p.overlay_p = (overlay & 1) == 1; p.cursor_p = (overlay & 2) == 2; if (which != NO_FRINGE_BITMAP) { + offset = 0; } else if (left_p) { which = row->left_fringe_bitmap; face_id = row->left_fringe_face_id; + offset = row->left_fringe_offset; } else { which = row->right_fringe_bitmap; face_id = row->right_fringe_face_id; + offset = row->right_fringe_offset; } if (face_id == DEFAULT_FACE_ID) { - Lisp_Object face; - - if ((face = fringe_faces[which], NILP (face)) - || (face_id = lookup_derived_face (f, face, FRINGE_FACE_ID, 0), - face_id < 0)) + Lisp_Object face = fringe_faces[which]; + face_id = NILP (face) ? lookup_named_face (f, Qfringe, 0) + : lookup_derived_face (f, face, FRINGE_FACE_ID, 0); + if (face_id < 0) face_id = FRINGE_FACE_ID; } @@ -598,7 +594,7 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which) period = fb->period; /* Convert row to frame coordinates. */ - p.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); + p.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y) + offset; p.which = which; p.bits = fb->bits; @@ -607,9 +603,19 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which) p.h = fb->height; p.dh = (period > 0 ? (p.y % period) : 0); p.h -= p.dh; - /* Clip bitmap if too high. */ - if (p.h > row->height) - p.h = row->height; + + /* Adjust y to the offset in the row to start drawing the bitmap. */ + switch (fb->align) + { + case ALIGN_BITMAP_CENTER: + p.y += (row->height - p.h) / 2; + break; + case ALIGN_BITMAP_BOTTOM: + p.y += (row->visible_height - p.h); + break; + case ALIGN_BITMAP_TOP: + break; + } p.face = FACE_FROM_ID (f, face_id); @@ -625,6 +631,9 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which) /* Clear left fringe if no bitmap to draw or if bitmap doesn't fill the fringe. */ p.bx = -1; + header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); + p.by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, row->y)); + p.ny = row->visible_height; if (left_p) { int wd = WINDOW_LEFT_FRINGE_WIDTH (w); @@ -635,7 +644,7 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which) p.wd = wd; p.x = x - p.wd - (wd - p.wd) / 2; - if (p.wd < wd || row->height > p.h) + if (p.wd < wd || p.y > p.by || p.y + p.h < p.by + p.ny) { /* If W has a vertical border to its left, don't draw over it. */ wd -= ((!WINDOW_LEFTMOST_P (w) @@ -657,42 +666,18 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which) p.x = x + (wd - p.wd) / 2; /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill the fringe. */ - if (p.wd < wd || row->height > p.h) + if (p.wd < wd || p.y > p.by || p.y + p.h < p.by + p.ny) { p.bx = x; p.nx = wd; } } - if (p.bx >= 0) - { - int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); - - p.by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, row->y)); - p.ny = row->visible_height; - } - - /* Adjust y to the offset in the row to start drawing the bitmap. */ - switch (fb->align) - { - case ALIGN_BITMAP_CENTER: - p.y += (row->height - p.h) / 2; - break; - case ALIGN_BITMAP_BOTTOM: - p.h = fb->height; - p.y += (row->visible_height - p.h); - break; - case ALIGN_BITMAP_TOP: - break; - } - FRAME_RIF (f)->draw_fringe_bitmap (w, row, &p); } static int -get_logical_cursor_bitmap (w, cursor) - struct window *w; - Lisp_Object cursor; +get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor) { Lisp_Object cmap, bm = Qnil; @@ -715,10 +700,7 @@ get_logical_cursor_bitmap (w, cursor) } static int -get_logical_fringe_bitmap (w, bitmap, right_p, partial_p) - struct window *w; - Lisp_Object bitmap; - int right_p, partial_p; +get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, int partial_p) { Lisp_Object cmap, bm1 = Qnil, bm2 = Qnil, bm; int ln1 = 0, ln2 = 0; @@ -818,10 +800,7 @@ get_logical_fringe_bitmap (w, bitmap, right_p, partial_p) void -draw_fringe_bitmap (w, row, left_p) - struct window *w; - struct glyph_row *row; - int left_p; +draw_fringe_bitmap (struct window *w, struct glyph_row *row, int left_p) { int overlay = 0; @@ -874,9 +853,7 @@ draw_fringe_bitmap (w, row, left_p) function with input blocked. */ void -draw_row_fringe_bitmaps (w, row) - struct window *w; - struct glyph_row *row; +draw_row_fringe_bitmaps (struct window *w, struct glyph_row *row) { xassert (interrupt_input_blocked); @@ -904,14 +881,12 @@ draw_row_fringe_bitmaps (w, row) */ int -draw_window_fringes (w, no_fringe) - struct window *w; - int no_fringe; +draw_window_fringes (struct window *w, int no_fringe) { struct glyph_row *row; int yb = window_text_bottom_y (w); int nrows = w->current_matrix->nrows; - int y = 0, rn; + int y, rn; int updated = 0; if (w->pseudo_window_p) @@ -923,7 +898,7 @@ draw_window_fringes (w, no_fringe) || WINDOW_RIGHT_FRINGE_WIDTH (w) == 0)) updated++; - for (y = 0, rn = 0, row = w->current_matrix->rows; + for (y = w->vscroll, rn = 0, row = w->current_matrix->rows; y < yb && rn < nrows; y += row->height, ++row, ++rn) { @@ -944,9 +919,7 @@ draw_window_fringes (w, no_fringe) If KEEP_CURRENT_P is 0, update current_matrix too. */ int -update_window_fringes (w, keep_current_p) - struct window *w; - int keep_current_p; +update_window_fringes (struct window *w, int keep_current_p) { struct glyph_row *row, *cur = 0; int yb = window_text_bottom_y (w); @@ -959,6 +932,9 @@ update_window_fringes (w, keep_current_p) Lisp_Object ind = Qnil; #define MAX_BITMAP_CACHE (8*4) int bitmap_cache[MAX_BITMAP_CACHE]; + int top_ind_rn, bot_ind_rn; + int top_ind_min_y, bot_ind_max_y; + int top_row_ends_at_zv_p, bot_row_ends_at_zv_p; if (w->pseudo_window_p) return 0; @@ -987,11 +963,10 @@ update_window_fringes (w, keep_current_p) boundary_top = boundary_bot = Qleft; } + top_ind_rn = bot_ind_rn = -1; if (!NILP (ind)) { - int done_top = 0, done_bot = 0; - - for (y = 0, rn = 0; + for (y = w->vscroll, rn = 0; y < yb && rn < nrows; y += row->height, ++rn) { @@ -1012,31 +987,25 @@ update_window_fringes (w, keep_current_p) if (!row->mode_line_p) { - if (!done_top) + if (top_ind_rn < 0 && row->visible_height > 0) { if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer)) && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row)) row->indicate_bob_p = !NILP (boundary_top); else row->indicate_top_line_p = !NILP (arrow_top); - done_top = 1; + top_ind_rn = rn; } - if (!done_bot) + if (bot_ind_rn < 0) { if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)) && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P (w, row)) - row->indicate_eob_p = !NILP (boundary_bot), done_bot = 1; + row->indicate_eob_p = !NILP (boundary_bot), bot_ind_rn = rn; else if (y + row->height >= yb) - row->indicate_bottom_line_p = !NILP (arrow_bot), done_bot = 1; + row->indicate_bottom_line_p = !NILP (arrow_bot), bot_ind_rn = rn; } } - - if (indicate_bob_p != row->indicate_bob_p - || indicate_top_line_p != row->indicate_top_line_p - || indicate_eob_p != row->indicate_eob_p - || indicate_bottom_line_p != row->indicate_bottom_line_p) - row->redraw_fringe_bitmaps_p = 1; } } @@ -1060,12 +1029,139 @@ update_window_fringes (w, keep_current_p) get_logical_fringe_bitmap (w, which, 1, partial_p))) - for (y = 0, rn = 0; + /* Extend top-aligned top indicator (or bottom-aligned bottom + indicator) to adjacent rows if it doesn't fit in one row. */ + top_ind_min_y = bot_ind_max_y = -1; + if (top_ind_rn >= 0) + { + int bn = NO_FRINGE_BITMAP; + + row = w->desired_matrix->rows + top_ind_rn; + if (!row->enabled_p) + row = w->current_matrix->rows + top_ind_rn; + + top_row_ends_at_zv_p = row->ends_at_zv_p; + if (row->indicate_bob_p) + { + if (EQ (boundary_top, Qleft)) + bn = ((row->indicate_eob_p && EQ (boundary_bot, Qleft)) + ? LEFT_FRINGE (1, Qtop_bottom, row->ends_at_zv_p) + : LEFT_FRINGE (2, Qtop, 0)); + else + bn = ((row->indicate_eob_p && EQ (boundary_bot, Qright)) + ? RIGHT_FRINGE (1, Qtop_bottom, row->ends_at_zv_p) + : RIGHT_FRINGE (2, Qtop, 0)); + } + else if (row->indicate_top_line_p) + { + if (EQ (arrow_top, Qleft)) + bn = LEFT_FRINGE (6, Qup, 0); + else + bn = RIGHT_FRINGE (6, Qup, 0); + } + + if (bn != NO_FRINGE_BITMAP) + { + struct fringe_bitmap *fb; + + fb = fringe_bitmaps[bn]; + if (fb == NULL) + fb = &standard_bitmaps[bn < MAX_STANDARD_FRINGE_BITMAPS + ? bn : UNDEF_FRINGE_BITMAP]; + if (fb->align == ALIGN_BITMAP_TOP && fb->period == 0) + { + struct glyph_row *row1; + int top_ind_max_y; + + top_ind_min_y = WINDOW_HEADER_LINE_HEIGHT (w); + top_ind_max_y = top_ind_min_y + fb->height; + if (top_ind_max_y > yb) + top_ind_max_y = yb; + + for (y = row->y + row->height, rn = top_ind_rn + 1; + y < top_ind_max_y && rn < nrows; + y += row1->height, rn++) + { + if (bot_ind_rn >= 0 && rn >= bot_ind_rn) + break; + + row1 = w->desired_matrix->rows + rn; + if (!row1->enabled_p) + row1 = w->current_matrix->rows + rn; + + row1->indicate_bob_p = row->indicate_bob_p; + row1->indicate_top_line_p = row->indicate_top_line_p; + } + } + } + } + if (bot_ind_rn >= 0) + { + int bn = NO_FRINGE_BITMAP; + + row = w->desired_matrix->rows + bot_ind_rn; + if (!row->enabled_p) + row = w->current_matrix->rows + bot_ind_rn; + + bot_row_ends_at_zv_p = row->ends_at_zv_p; + if (row->indicate_eob_p) + { + if (EQ (boundary_bot, Qleft)) + bn = LEFT_FRINGE (3, Qbottom, row->ends_at_zv_p); + else + bn = RIGHT_FRINGE (3, Qbottom, row->ends_at_zv_p); + } + else if (row->indicate_bottom_line_p) + { + if (EQ (arrow_bot, Qleft)) + bn = LEFT_FRINGE (7, Qdown, 0); + else + bn = RIGHT_FRINGE (7, Qdown, 0); + } + + if (bn != NO_FRINGE_BITMAP) + { + struct fringe_bitmap *fb; + + fb = fringe_bitmaps[bn]; + if (fb == NULL) + fb = &standard_bitmaps[bn < MAX_STANDARD_FRINGE_BITMAPS + ? bn : UNDEF_FRINGE_BITMAP]; + if (fb->align == ALIGN_BITMAP_BOTTOM && fb->period == 0) + { + struct glyph_row *row1; + int bot_ind_min_y; + + bot_ind_max_y = row->y + row->visible_height; + bot_ind_min_y = bot_ind_max_y - fb->height; + if (bot_ind_min_y < WINDOW_HEADER_LINE_HEIGHT (w)) + bot_ind_min_y = WINDOW_HEADER_LINE_HEIGHT (w); + + for (y = row->y, rn = bot_ind_rn - 1; + y >= bot_ind_min_y && rn >= 0; + y -= row1->height, rn--) + { + if (top_ind_rn >= 0 && rn <= top_ind_rn) + break; + + row1 = w->desired_matrix->rows + rn; + if (!row1->enabled_p) + row1 = w->current_matrix->rows + rn; + + row1->indicate_eob_p = row->indicate_eob_p; + row1->indicate_bottom_line_p = row->indicate_bottom_line_p; + } + } + } + } + + for (y = w->vscroll, rn = 0; y < yb && rn < nrows; y += row->height, rn++) { int left, right; unsigned left_face_id, right_face_id; + int left_offset, right_offset; row = w->desired_matrix->rows + rn; cur = w->current_matrix->rows + rn; @@ -1073,6 +1169,7 @@ update_window_fringes (w, keep_current_p) row = cur; left_face_id = right_face_id = DEFAULT_FACE_ID; + left_offset = right_offset = 0; /* Decide which bitmap to draw in the left fringe. */ if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0) @@ -1086,20 +1183,36 @@ update_window_fringes (w, keep_current_p) || (row->reversed_p && row->truncated_on_right_p)) left = LEFT_FRINGE(0, Qtruncation, 0); else if (row->indicate_bob_p && EQ (boundary_top, Qleft)) - left = ((row->indicate_eob_p && EQ (boundary_bot, Qleft)) - ? LEFT_FRINGE (1, Qtop_bottom, row->ends_at_zv_p) - : LEFT_FRINGE (2, Qtop, 0)); + { + left = ((row->indicate_eob_p && EQ (boundary_bot, Qleft)) + ? LEFT_FRINGE (1, Qtop_bottom, top_row_ends_at_zv_p) + : LEFT_FRINGE (2, Qtop, 0)); + if (top_ind_min_y >= 0) + left_offset = top_ind_min_y - row->y; + } else if (row->indicate_eob_p && EQ (boundary_bot, Qleft)) - left = LEFT_FRINGE (3, Qbottom, row->ends_at_zv_p); + { + left = LEFT_FRINGE (3, Qbottom, bot_row_ends_at_zv_p); + if (bot_ind_max_y >= 0) + left_offset = bot_ind_max_y - (row->y + row->visible_height); + } else if ((!row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row)) || (row->reversed_p && row->continued_p)) left = LEFT_FRINGE (4, Qcontinuation, 0); else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft)) left = LEFT_FRINGE (5, Qempty_line, 0); else if (row->indicate_top_line_p && EQ (arrow_top, Qleft)) - left = LEFT_FRINGE (6, Qup, 0); + { + left = LEFT_FRINGE (6, Qup, 0); + if (top_ind_min_y >= 0) + left_offset = top_ind_min_y - row->y; + } else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qleft)) - left = LEFT_FRINGE (7, Qdown, 0); + { + left = LEFT_FRINGE (7, Qdown, 0); + if (bot_ind_max_y >= 0) + left_offset = bot_ind_max_y - (row->y + row->visible_height); + } else left = NO_FRINGE_BITMAP; @@ -1115,18 +1228,34 @@ update_window_fringes (w, keep_current_p) || (row->reversed_p && row->truncated_on_left_p)) right = RIGHT_FRINGE (0, Qtruncation, 0); else if (row->indicate_bob_p && EQ (boundary_top, Qright)) - right = ((row->indicate_eob_p && EQ (boundary_bot, Qright)) - ? RIGHT_FRINGE (1, Qtop_bottom, row->ends_at_zv_p) - : RIGHT_FRINGE (2, Qtop, 0)); + { + right = ((row->indicate_eob_p && EQ (boundary_bot, Qright)) + ? RIGHT_FRINGE (1, Qtop_bottom, top_row_ends_at_zv_p) + : RIGHT_FRINGE (2, Qtop, 0)); + if (top_ind_min_y >= 0) + right_offset = top_ind_min_y - row->y; + } else if (row->indicate_eob_p && EQ (boundary_bot, Qright)) - right = RIGHT_FRINGE (3, Qbottom, row->ends_at_zv_p); + { + right = RIGHT_FRINGE (3, Qbottom, bot_row_ends_at_zv_p); + if (bot_ind_max_y >= 0) + right_offset = bot_ind_max_y - (row->y + row->visible_height); + } else if ((!row->reversed_p && row->continued_p) || (row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row))) right = RIGHT_FRINGE (4, Qcontinuation, 0); else if (row->indicate_top_line_p && EQ (arrow_top, Qright)) - right = RIGHT_FRINGE (6, Qup, 0); + { + right = RIGHT_FRINGE (6, Qup, 0); + if (top_ind_min_y >= 0) + right_offset = top_ind_min_y - row->y; + } else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qright)) - right = RIGHT_FRINGE (7, Qdown, 0); + { + right = RIGHT_FRINGE (7, Qdown, 0); + if (bot_ind_max_y >= 0) + right_offset = bot_ind_max_y - (row->y + row->visible_height); + } else if (row->indicate_empty_line_p && EQ (empty_pos, Qright)) right = RIGHT_FRINGE (5, Qempty_line, 0); else @@ -1139,6 +1268,8 @@ update_window_fringes (w, keep_current_p) || right != cur->right_fringe_bitmap || left_face_id != cur->left_fringe_face_id || right_face_id != cur->right_fringe_face_id + || left_offset != cur->left_fringe_offset + || right_offset != cur->right_fringe_offset || cur->redraw_fringe_bitmaps_p) { redraw_p = row->redraw_fringe_bitmaps_p = 1; @@ -1149,6 +1280,8 @@ update_window_fringes (w, keep_current_p) cur->right_fringe_bitmap = right; cur->left_fringe_face_id = left_face_id; cur->right_fringe_face_id = right_face_id; + cur->left_fringe_offset = left_offset; + cur->right_fringe_offset = right_offset; } } @@ -1165,9 +1298,8 @@ update_window_fringes (w, keep_current_p) row->right_fringe_bitmap = right; row->left_fringe_face_id = left_face_id; row->right_fringe_face_id = right_face_id; - - if (rn > 0 && row->redraw_fringe_bitmaps_p) - row[-1].redraw_fringe_bitmaps_p = cur[-1].redraw_fringe_bitmaps_p = 1; + row->left_fringe_offset = left_offset; + row->right_fringe_offset = right_offset; } return redraw_p && !keep_current_p; @@ -1188,9 +1320,7 @@ update_window_fringes (w, keep_current_p) */ void -compute_fringe_widths (f, redraw) - struct frame *f; - int redraw; +compute_fringe_widths (struct frame *f, int redraw) { int o_left = FRAME_LEFT_FRINGE_WIDTH (f); int o_right = FRAME_RIGHT_FRINGE_WIDTH (f); @@ -1272,8 +1402,7 @@ compute_fringe_widths (f, redraw) /* Free resources used by a user-defined bitmap. */ void -destroy_fringe_bitmap (n) - int n; +destroy_fringe_bitmap (int n) { struct fringe_bitmap **fbp; @@ -1300,8 +1429,7 @@ DEFUN ("destroy-fringe-bitmap", Fdestroy_fringe_bitmap, Sdestroy_fringe_bitmap, 1, 1, 0, doc: /* Destroy fringe bitmap BITMAP. If BITMAP overrides a standard fringe bitmap, the original bitmap is restored. */) - (bitmap) - Lisp_Object bitmap; + (Lisp_Object bitmap) { int n; @@ -1342,10 +1470,7 @@ static const unsigned char swap_nibble[16] = { #endif /* HAVE_X_WINDOWS */ void -init_fringe_bitmap (which, fb, once_p) - int which; - struct fringe_bitmap *fb; - int once_p; +init_fringe_bitmap (int which, struct fringe_bitmap *fb, int once_p) { if (once_p || fb->dynamic) { @@ -1415,8 +1540,7 @@ is used; the default is to center the bitmap. Fifth arg may also be a list (ALIGN PERIODIC) where PERIODIC non-nil specifies that the bitmap should be repeated. If BITMAP already exists, the existing definition is replaced. */) - (bitmap, bits, height, width, align) - Lisp_Object bitmap, bits, height, width, align; + (Lisp_Object bitmap, Lisp_Object bits, Lisp_Object height, Lisp_Object width, Lisp_Object align) { int n, h, i, j; unsigned short *b; @@ -1520,7 +1644,7 @@ If BITMAP already exists, the existing definition is replaced. */) xfb = (struct fringe_bitmap *) xmalloc (sizeof fb + fb.height * BYTES_PER_BITMAP_ROW); fb.bits = b = (unsigned short *) (xfb + 1); - bzero (b, fb.height); + memset (b, 0, fb.height); j = 0; while (j < fb.height) @@ -1547,8 +1671,7 @@ DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, Sset_fringe_bitmap_fac 1, 2, 0, doc: /* Set face for fringe bitmap BITMAP to FACE. If FACE is nil, reset face to default fringe face. */) - (bitmap, face) - Lisp_Object bitmap, face; + (Lisp_Object bitmap, Lisp_Object face) { int n; int face_id; @@ -1580,8 +1703,7 @@ is the symbol for the bitmap in the left fringe (or nil if no bitmap), RIGHT is similar for the right fringe, and OV is non-nil if there is an overlay arrow in the left fringe. Return nil if POS is not visible in WINDOW. */) - (pos, window) - Lisp_Object pos, window; + (Lisp_Object pos, Lisp_Object window) { struct window *w; struct glyph_row *row; @@ -1620,7 +1742,7 @@ Return nil if POS is not visible in WINDOW. */) ***********************************************************************/ void -syms_of_fringe () +syms_of_fringe (void) { Qtruncation = intern_c_string ("truncation"); staticpro (&Qtruncation); @@ -1657,7 +1779,7 @@ If nil, also continue lines which are exactly as wide as the window. */); /* Garbage collection hook */ void -mark_fringe_data () +mark_fringe_data (void) { int i; @@ -1669,7 +1791,7 @@ mark_fringe_data () /* Initialize this module when Emacs starts. */ void -init_fringe_once () +init_fringe_once (void) { int bt; @@ -1678,7 +1800,7 @@ init_fringe_once () } void -init_fringe () +init_fringe (void) { int i; @@ -1714,7 +1836,7 @@ w32_init_fringe (struct redisplay_interface *rif) } void -w32_reset_fringes () +w32_reset_fringes (void) { /* Destroy row bitmaps. */ int bt; diff --git a/src/ftfont.c b/src/ftfont.c index 9699dc58009..1fdf4c265ce 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -80,16 +80,16 @@ enum ftfont_cache_for FTFONT_CACHE_FOR_ENTITY }; -static Lisp_Object ftfont_pattern_entity P_ ((FcPattern *, Lisp_Object)); +static Lisp_Object ftfont_pattern_entity (FcPattern *, Lisp_Object); -static Lisp_Object ftfont_resolve_generic_family P_ ((Lisp_Object, - FcPattern *)); -static Lisp_Object ftfont_lookup_cache P_ ((Lisp_Object, - enum ftfont_cache_for)); +static Lisp_Object ftfont_resolve_generic_family (Lisp_Object, + FcPattern *); +static Lisp_Object ftfont_lookup_cache (Lisp_Object, + enum ftfont_cache_for); -static void ftfont_filter_properties P_ ((Lisp_Object font, Lisp_Object alist)); +static void ftfont_filter_properties (Lisp_Object font, Lisp_Object alist); -Lisp_Object ftfont_font_format P_ ((FcPattern *, Lisp_Object)); +Lisp_Object ftfont_font_format (FcPattern *, Lisp_Object); #define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM)) @@ -188,9 +188,7 @@ get_adstyle_property (FcPattern *p) } static Lisp_Object -ftfont_pattern_entity (p, extra) - FcPattern *p; - Lisp_Object extra; +ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) { Lisp_Object key, cache, entity; char *file, *str; @@ -289,9 +287,7 @@ ftfont_pattern_entity (p, extra) static Lisp_Object ftfont_generic_family_list; static Lisp_Object -ftfont_resolve_generic_family (family, pattern) - Lisp_Object family; - FcPattern *pattern; +ftfont_resolve_generic_family (Lisp_Object family, FcPattern *pattern) { Lisp_Object slot; FcPattern *match; @@ -348,9 +344,7 @@ struct ftfont_cache_data }; static Lisp_Object -ftfont_lookup_cache (key, cache_for) - Lisp_Object key; - enum ftfont_cache_for cache_for; +ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for) { Lisp_Object cache, val, entity; struct ftfont_cache_data *cache_data; @@ -450,8 +444,7 @@ ftfont_lookup_cache (key, cache_for) } FcCharSet * -ftfont_get_fc_charset (entity) - Lisp_Object entity; +ftfont_get_fc_charset (Lisp_Object entity) { Lisp_Object val, cache; struct ftfont_cache_data *cache_data; @@ -464,8 +457,7 @@ ftfont_get_fc_charset (entity) #ifdef HAVE_LIBOTF static OTF * -ftfont_get_otf (ftfont_info) - struct ftfont_info *ftfont_info; +ftfont_get_otf (struct ftfont_info *ftfont_info) { OTF *otf; @@ -486,26 +478,26 @@ ftfont_get_otf (ftfont_info) } #endif /* HAVE_LIBOTF */ -static Lisp_Object ftfont_get_cache P_ ((FRAME_PTR)); -static Lisp_Object ftfont_list P_ ((Lisp_Object, Lisp_Object)); -static Lisp_Object ftfont_match P_ ((Lisp_Object, Lisp_Object)); -static Lisp_Object ftfont_list_family P_ ((Lisp_Object)); -static Lisp_Object ftfont_open P_ ((FRAME_PTR, Lisp_Object, int)); -static void ftfont_close P_ ((FRAME_PTR, struct font *)); -static int ftfont_has_char P_ ((Lisp_Object, int)); -static unsigned ftfont_encode_char P_ ((struct font *, int)); -static int ftfont_text_extents P_ ((struct font *, unsigned *, int, - struct font_metrics *)); -static int ftfont_get_bitmap P_ ((struct font *, unsigned, - struct font_bitmap *, int)); -static int ftfont_anchor_point P_ ((struct font *, unsigned, int, - int *, int *)); -static Lisp_Object ftfont_otf_capability P_ ((struct font *)); -static Lisp_Object ftfont_shape P_ ((Lisp_Object)); +static Lisp_Object ftfont_get_cache (FRAME_PTR); +static Lisp_Object ftfont_list (Lisp_Object, Lisp_Object); +static Lisp_Object ftfont_match (Lisp_Object, Lisp_Object); +static Lisp_Object ftfont_list_family (Lisp_Object); +static Lisp_Object ftfont_open (FRAME_PTR, Lisp_Object, int); +static void ftfont_close (FRAME_PTR, struct font *); +static int ftfont_has_char (Lisp_Object, int); +static unsigned ftfont_encode_char (struct font *, int); +static int ftfont_text_extents (struct font *, unsigned *, int, + struct font_metrics *); +static int ftfont_get_bitmap (struct font *, unsigned, + struct font_bitmap *, int); +static int ftfont_anchor_point (struct font *, unsigned, int, + int *, int *); +static Lisp_Object ftfont_otf_capability (struct font *); +static Lisp_Object ftfont_shape (Lisp_Object); #ifdef HAVE_OTF_GET_VARIATION_GLYPHS -static int ftfont_variation_glyphs P_ ((struct font *, int c, - unsigned variations[256])); +static int ftfont_variation_glyphs (struct font *, int c, + unsigned variations[256]); #endif /* HAVE_OTF_GET_VARIATION_GLYPHS */ struct font_driver ftfont_driver = @@ -559,15 +551,13 @@ struct font_driver ftfont_driver = extern Lisp_Object QCname; static Lisp_Object -ftfont_get_cache (f) - FRAME_PTR f; +ftfont_get_cache (FRAME_PTR f) { return freetype_font_cache; } static int -ftfont_get_charset (registry) - Lisp_Object registry; +ftfont_get_charset (Lisp_Object registry) { char *str = (char *) SDATA (SYMBOL_NAME (registry)); char *re = alloca (SBYTES (SYMBOL_NAME (registry)) * 2 + 1); @@ -705,16 +695,12 @@ ftfont_get_open_type_spec (Lisp_Object otf_spec) return spec; } -static FcPattern *ftfont_spec_pattern P_ ((Lisp_Object, char *, - struct OpenTypeSpec **, - char **langname)); +static FcPattern *ftfont_spec_pattern (Lisp_Object, char *, + struct OpenTypeSpec **, + char **langname); static FcPattern * -ftfont_spec_pattern (spec, otlayout, otspec, langname) - Lisp_Object spec; - char *otlayout; - struct OpenTypeSpec **otspec; - char **langname; +ftfont_spec_pattern (Lisp_Object spec, char *otlayout, struct OpenTypeSpec **otspec, char **langname) { Lisp_Object tmp, extra; FcPattern *pattern = NULL; @@ -871,8 +857,7 @@ ftfont_spec_pattern (spec, otlayout, otspec, langname) } static Lisp_Object -ftfont_list (frame, spec) - Lisp_Object frame, spec; +ftfont_list (Lisp_Object frame, Lisp_Object spec) { Lisp_Object val = Qnil, family, adstyle; int i; @@ -1069,8 +1054,7 @@ ftfont_list (frame, spec) } static Lisp_Object -ftfont_match (frame, spec) - Lisp_Object frame, spec; +ftfont_match (Lisp_Object frame, Lisp_Object spec) { Lisp_Object entity = Qnil; FcPattern *pattern, *match = NULL; @@ -1120,8 +1104,7 @@ ftfont_match (frame, spec) } static Lisp_Object -ftfont_list_family (frame) - Lisp_Object frame; +ftfont_list_family (Lisp_Object frame) { Lisp_Object list = Qnil; FcPattern *pattern = NULL; @@ -1164,10 +1147,7 @@ ftfont_list_family (frame) static Lisp_Object -ftfont_open (f, entity, pixel_size) - FRAME_PTR f; - Lisp_Object entity; - int pixel_size; +ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) { struct ftfont_info *ftfont_info; struct font *font; @@ -1262,7 +1242,7 @@ ftfont_open (f, entity, pixel_size) spacing = XINT (AREF (entity, FONT_SPACING_INDEX)); else spacing = FC_PROPORTIONAL; - if (spacing != FC_PROPORTIONAL) + if (spacing != FC_PROPORTIONAL && spacing != FC_DUAL) font->min_width = font->average_width = font->space_width = (scalable ? ft_face->max_advance_width * size / upEM : ft_face->size->metrics.max_advance >> 6); @@ -1307,9 +1287,7 @@ ftfont_open (f, entity, pixel_size) } static void -ftfont_close (f, font) - FRAME_PTR f; - struct font *font; +ftfont_close (FRAME_PTR f, struct font *font) { struct ftfont_info *ftfont_info = (struct ftfont_info *) font; Lisp_Object val, cache; @@ -1335,9 +1313,7 @@ ftfont_close (f, font) } static int -ftfont_has_char (font, c) - Lisp_Object font; - int c; +ftfont_has_char (Lisp_Object font, int c) { struct charset *cs = NULL; @@ -1367,9 +1343,7 @@ ftfont_has_char (font, c) } static unsigned -ftfont_encode_char (font, c) - struct font *font; - int c; +ftfont_encode_char (struct font *font, int c) { struct ftfont_info *ftfont_info = (struct ftfont_info *) font; FT_Face ft_face = ftfont_info->ft_size->face; @@ -1380,11 +1354,7 @@ ftfont_encode_char (font, c) } static int -ftfont_text_extents (font, code, nglyphs, metrics) - struct font *font; - unsigned *code; - int nglyphs; - struct font_metrics *metrics; +ftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct font_metrics *metrics) { struct ftfont_info *ftfont_info = (struct ftfont_info *) font; FT_Face ft_face = ftfont_info->ft_size->face; @@ -1394,7 +1364,7 @@ ftfont_text_extents (font, code, nglyphs, metrics) if (ftfont_info->ft_size != ft_face->size) FT_Activate_Size (ftfont_info->ft_size); if (metrics) - bzero (metrics, sizeof (struct font_metrics)); + memset (metrics, 0, sizeof (struct font_metrics)); for (i = 0, first = 1; i < nglyphs; i++) { if (FT_Load_Glyph (ft_face, code[i], FT_LOAD_DEFAULT) == 0) @@ -1439,11 +1409,7 @@ ftfont_text_extents (font, code, nglyphs, metrics) } static int -ftfont_get_bitmap (font, code, bitmap, bits_per_pixel) - struct font *font; - unsigned code; - struct font_bitmap *bitmap; - int bits_per_pixel; +ftfont_get_bitmap (struct font *font, unsigned int code, struct font_bitmap *bitmap, int bits_per_pixel) { struct ftfont_info *ftfont_info = (struct ftfont_info *) font; FT_Face ft_face = ftfont_info->ft_size->face; @@ -1487,11 +1453,7 @@ ftfont_get_bitmap (font, code, bitmap, bits_per_pixel) } static int -ftfont_anchor_point (font, code, index, x, y) - struct font *font; - unsigned code; - int index; - int *x, *y; +ftfont_anchor_point (struct font *font, unsigned int code, int index, int *x, int *y) { struct ftfont_info *ftfont_info = (struct ftfont_info *) font; FT_Face ft_face = ftfont_info->ft_size->face; @@ -1512,8 +1474,7 @@ ftfont_anchor_point (font, code, index, x, y) #ifdef HAVE_LIBOTF static Lisp_Object -ftfont_otf_features (gsub_gpos) - OTF_GSUB_GPOS *gsub_gpos; +ftfont_otf_features (OTF_GSUB_GPOS *gsub_gpos) { Lisp_Object scripts, langsyses, features, sym; int i, j, k, l; @@ -1557,8 +1518,7 @@ ftfont_otf_features (gsub_gpos) static Lisp_Object -ftfont_otf_capability (font) - struct font *font; +ftfont_otf_capability (struct font *font) { struct ftfont_info *ftfont_info = (struct ftfont_info *) font; OTF *otf = ftfont_get_otf (ftfont_info); @@ -1596,10 +1556,8 @@ struct MFLTFontFT }; static int -ftfont_get_glyph_id (font, gstring, from, to) - MFLTFont *font; - MFLTGlyphString *gstring; - int from, to; +ftfont_get_glyph_id (MFLTFont *font, MFLTGlyphString *gstring, + int from, int to) { struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font; FT_Face ft_face = flt_font_ft->ft_face; @@ -1623,10 +1581,8 @@ ftfont_get_glyph_id (font, gstring, from, to) #define ROUND(x) (((x)+32) & -64) static int -ftfont_get_metrics (font, gstring, from, to) - MFLTFont *font; - MFLTGlyphString *gstring; - int from, to; +ftfont_get_metrics (MFLTFont *font, MFLTGlyphString *gstring, + int from, int to) { struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font; FT_Face ft_face = flt_font_ft->ft_face; @@ -2123,13 +2079,9 @@ ftfont_try_otf (MFLTFont *font, MFLTOtfSpec *spec, #else /* not M17N_FLT_USE_NEW_FEATURE */ static int -ftfont_drive_otf (font, spec, in, from, to, out, adjustment) - MFLTFont *font; - MFLTOtfSpec *spec; - MFLTGlyphString *in; - int from, to; - MFLTGlyphString *out; - MFLTGlyphAdjustment *adjustment; +ftfont_drive_otf (MFLTFont *font, MFLTOtfSpec *spec, MFLTGlyphString *in, + int from, int to, + MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment) { struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font; FT_Face ft_face = flt_font_ft->ft_face; @@ -2384,12 +2336,8 @@ static int m17n_flt_initialized; extern Lisp_Object QCfamily; static Lisp_Object -ftfont_shape_by_flt (lgstring, font, ft_face, otf, matrix) - Lisp_Object lgstring; - struct font *font; - FT_Face ft_face; - OTF *otf; - FT_Matrix *matrix; +ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, + FT_Face ft_face, OTF *otf, FT_Matrix *matrix) { EMACS_UINT len = LGSTRING_GLYPH_LEN (lgstring); EMACS_UINT i; @@ -2555,8 +2503,7 @@ ftfont_shape_by_flt (lgstring, font, ft_face, otf, matrix) } Lisp_Object -ftfont_shape (lgstring) - Lisp_Object lgstring; +ftfont_shape (Lisp_Object lgstring) { struct font *font; struct ftfont_info *ftfont_info; @@ -2576,10 +2523,7 @@ ftfont_shape (lgstring) #ifdef HAVE_OTF_GET_VARIATION_GLYPHS static int -ftfont_variation_glyphs (font, c, variations) - struct font *font; - int c; - unsigned variations[256]; +ftfont_variation_glyphs (struct font *font, int c, unsigned variations[256]) { struct ftfont_info *ftfont_info = (struct ftfont_info *) font; OTF *otf = ftfont_get_otf (ftfont_info); @@ -2677,9 +2621,7 @@ static const char *ftfont_non_booleans [] = { }; static void -ftfont_filter_properties (font, alist) - Lisp_Object font; - Lisp_Object alist; +ftfont_filter_properties (Lisp_Object font, Lisp_Object alist) { Lisp_Object it; int i; @@ -2721,7 +2663,7 @@ ftfont_filter_properties (font, alist) void -syms_of_ftfont () +syms_of_ftfont (void) { DEFSYM (Qfreetype, "freetype"); DEFSYM (Qmonospace, "monospace"); diff --git a/src/ftxfont.c b/src/ftxfont.c index 847522a2f9c..0a9137617b8 100644 --- a/src/ftxfont.c +++ b/src/ftxfont.c @@ -39,12 +39,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ static Lisp_Object Qftx; /* Prototypes for helper function. */ -static GC *ftxfont_get_gcs P_ ((FRAME_PTR, unsigned long, unsigned long)); -static int ftxfont_draw_bitmap P_ ((FRAME_PTR, GC, GC *, struct font *, - unsigned, int, int, XPoint *, int, int *, - int)); -static void ftxfont_draw_backgrond P_ ((FRAME_PTR, struct font *, GC, - int, int, int)); +static GC *ftxfont_get_gcs (FRAME_PTR, unsigned long, unsigned long); +static int ftxfont_draw_bitmap (FRAME_PTR, GC, GC *, struct font *, + unsigned, int, int, XPoint *, int, int *, + int); +static void ftxfont_draw_backgrond (FRAME_PTR, struct font *, GC, + int, int, int); struct ftxfont_frame_data { @@ -61,9 +61,7 @@ struct ftxfont_frame_data /* Return an array of 6 GCs for antialiasing. */ static GC * -ftxfont_get_gcs (f, foreground, background) - FRAME_PTR f; - unsigned long foreground, background; +ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int background) { XColor color; XGCValues xgcv; @@ -140,15 +138,7 @@ ftxfont_get_gcs (f, foreground, background) } static int -ftxfont_draw_bitmap (f, gc_fore, gcs, font, code, x, y, p, size, n, flush) - FRAME_PTR f; - GC gc_fore, *gcs; - struct font *font; - unsigned code; - int x, y; - XPoint *p; - int size, *n; - int flush; +ftxfont_draw_bitmap (FRAME_PTR f, GC gc_fore, GC *gcs, struct font *font, unsigned int code, int x, int y, XPoint *p, int size, int *n, int flush) { struct font_bitmap bitmap; unsigned char *b; @@ -224,11 +214,7 @@ ftxfont_draw_bitmap (f, gc_fore, gcs, font, code, x, y, p, size, n, flush) } static void -ftxfont_draw_backgrond (f, font, gc, x, y, width) - FRAME_PTR f; - struct font *font; - GC gc; - int x, y, width; +ftxfont_draw_backgrond (FRAME_PTR f, struct font *font, GC gc, int x, int y, int width) { XGCValues xgcv; @@ -241,18 +227,16 @@ ftxfont_draw_backgrond (f, font, gc, x, y, width) } /* Prototypes for font-driver methods. */ -static Lisp_Object ftxfont_list P_ ((Lisp_Object, Lisp_Object)); -static Lisp_Object ftxfont_match P_ ((Lisp_Object, Lisp_Object)); -static Lisp_Object ftxfont_open P_ ((FRAME_PTR, Lisp_Object, int)); -static void ftxfont_close P_ ((FRAME_PTR, struct font *)); -static int ftxfont_draw P_ ((struct glyph_string *, int, int, int, int, int)); +static Lisp_Object ftxfont_list (Lisp_Object, Lisp_Object); +static Lisp_Object ftxfont_match (Lisp_Object, Lisp_Object); +static Lisp_Object ftxfont_open (FRAME_PTR, Lisp_Object, int); +static void ftxfont_close (FRAME_PTR, struct font *); +static int ftxfont_draw (struct glyph_string *, int, int, int, int, int); struct font_driver ftxfont_driver; static Lisp_Object -ftxfont_list (frame, spec) - Lisp_Object frame; - Lisp_Object spec; +ftxfont_list (Lisp_Object frame, Lisp_Object spec) { Lisp_Object list = ftfont_driver.list (frame, spec), tail; @@ -262,9 +246,7 @@ ftxfont_list (frame, spec) } static Lisp_Object -ftxfont_match (frame, spec) - Lisp_Object frame; - Lisp_Object spec; +ftxfont_match (Lisp_Object frame, Lisp_Object spec) { Lisp_Object entity = ftfont_driver.match (frame, spec); @@ -274,10 +256,7 @@ ftxfont_match (frame, spec) } static Lisp_Object -ftxfont_open (f, entity, pixel_size) - FRAME_PTR f; - Lisp_Object entity; - int pixel_size; +ftxfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) { Lisp_Object font_object; struct font *font; @@ -291,17 +270,13 @@ ftxfont_open (f, entity, pixel_size) } static void -ftxfont_close (f, font) - FRAME_PTR f; - struct font *font; +ftxfont_close (FRAME_PTR f, struct font *font) { ftfont_driver.close (f, font); } static int -ftxfont_draw (s, from, to, x, y, with_background) - struct glyph_string *s; - int from, to, x, y, with_background; +ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background) { FRAME_PTR f = s->f; struct face *face = s->face; @@ -372,8 +347,7 @@ ftxfont_draw (s, from, to, x, y, with_background) } static int -ftxfont_end_for_frame (f) - FRAME_PTR f; +ftxfont_end_for_frame (FRAME_PTR f) { struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver); @@ -396,7 +370,7 @@ ftxfont_end_for_frame (f) void -syms_of_ftxfont () +syms_of_ftxfont (void) { DEFSYM (Qftx, "ftx"); diff --git a/src/getloadavg.c b/src/getloadavg.c index a174fc07a01..779a0ef804c 100644 --- a/src/getloadavg.c +++ b/src/getloadavg.c @@ -713,7 +713,7 @@ getloadavg (loadavg, nelem) for (i = 0; i < conf.config_maxclass; ++i) { struct class_stats stats; - bzero ((char *) &stats, sizeof stats); + memset (&stats, 0, sizeof stats); desc.sd_type = CPUTYPE_CLASS; desc.sd_objid = i; diff --git a/src/gmalloc.c b/src/gmalloc.c index a3f533bd5e8..8314798b171 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c @@ -1969,12 +1969,12 @@ Fifth Floor, Boston, MA 02110-1301, USA. #endif /* Old hook values. */ -static void (*old_free_hook) __P ((__ptr_t ptr)); -static __ptr_t (*old_malloc_hook) __P ((__malloc_size_t size)); -static __ptr_t (*old_realloc_hook) __P ((__ptr_t ptr, __malloc_size_t size)); +static void (*old_free_hook) (__ptr_t ptr); +static __ptr_t (*old_malloc_hook) (__malloc_size_t size); +static __ptr_t (*old_realloc_hook) (__ptr_t ptr, __malloc_size_t size); /* Function to call when something awful happens. */ -static void (*abortfunc) __P ((enum mcheck_status)); +static void (*abortfunc) (enum mcheck_status); /* Arbitrary magical numbers. */ #define MAGICWORD 0xfedabeeb @@ -1992,7 +1992,7 @@ struct hdr #if defined(_LIBC) || defined(STDC_HEADERS) || defined(USG) #define flood memset #else -static void flood __P ((__ptr_t, int, __malloc_size_t)); +static void flood (__ptr_t, int, __malloc_size_t); static void flood (ptr, val, size) __ptr_t ptr; @@ -2005,7 +2005,7 @@ flood (ptr, val, size) } #endif -static enum mcheck_status checkhdr __P ((const struct hdr *)); +static enum mcheck_status checkhdr (const struct hdr *); static enum mcheck_status checkhdr (hdr) const struct hdr *hdr; @@ -2031,7 +2031,7 @@ checkhdr (hdr) return status; } -static void freehook __P ((__ptr_t)); +static void freehook (__ptr_t); static void freehook (ptr) __ptr_t ptr; @@ -2053,7 +2053,7 @@ freehook (ptr) __free_hook = freehook; } -static __ptr_t mallochook __P ((__malloc_size_t)); +static __ptr_t mallochook (__malloc_size_t); static __ptr_t mallochook (size) __malloc_size_t size; @@ -2073,7 +2073,7 @@ mallochook (size) return (__ptr_t) (hdr + 1); } -static __ptr_t reallochook __P ((__ptr_t, __malloc_size_t)); +static __ptr_t reallochook (__ptr_t, __malloc_size_t); static __ptr_t reallochook (ptr, size) __ptr_t ptr; @@ -2146,7 +2146,7 @@ static int mcheck_used = 0; int mcheck (func) - void (*func) __P ((enum mcheck_status)); + void (*func) (enum mcheck_status); { abortfunc = (func != NULL) ? func : &mabort; diff --git a/src/gtkutil.c b/src/gtkutil.c index c8800817b68..b1bb2e32324 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -47,13 +47,34 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Avoid "differ in sign" warnings */ #define SSDATA(x) ((char *) SDATA (x)) +#ifndef HAVE_GTK_WIDGET_SET_HAS_WINDOW +#define gtk_widget_set_has_window(w, b) \ + (gtk_fixed_set_has_window (GTK_FIXED (w), b)) +#endif +#ifndef HAVE_GTK_DIALOG_GET_ACTION_AREA +#define gtk_dialog_get_action_area(w) ((w)->action_area) +#define gtk_dialog_get_content_area(w) ((w)->vbox) +#endif +#ifndef HAVE_GTK_WIDGET_GET_SENSITIVE +#define gtk_widget_get_sensitive(w) (GTK_WIDGET_SENSITIVE (w)) +#endif +#ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE +#define gtk_adjustment_set_page_size(w, s) ((w)->page_size = (s)) +#define gtk_adjustment_set_page_increment(w, s) ((w)->page_increment = (s)) +#define gtk_adjustment_get_step_increment(w) ((w)->step_increment) +#define gtk_adjustment_set_step_increment(w, s) ((w)->step_increment = (s)) +#endif +#if GTK_MAJOR_VERSION > 2 || GTK_MINOR_VERSION > 11 +#define remove_submenu(w) gtk_menu_item_set_submenu ((w), NULL) +#else +#define remove_submenu(w) gtk_menu_item_remove_submenu ((w)) +#endif + /*********************************************************************** Display handling functions ***********************************************************************/ -#ifdef HAVE_GTK_MULTIDISPLAY - /* Keep track of the default display, or NULL if there is none. Emacs may close all its displays. */ @@ -64,9 +85,7 @@ static GdkDisplay *gdpy_def; W can be a GtkMenu or a GtkWindow widget. */ static void -xg_set_screen (w, f) - GtkWidget *w; - FRAME_PTR f; +xg_set_screen (GtkWidget *w, FRAME_PTR f) { if (FRAME_X_DISPLAY (f) != GDK_DISPLAY ()) { @@ -81,20 +100,6 @@ xg_set_screen (w, f) } -#else /* not HAVE_GTK_MULTIDISPLAY */ - -/* Make some defines so we can use the GTK 2.2 functions when - compiling with GTK 2.0. */ - -#define xg_set_screen(w, f) -#define gdk_xid_table_lookup_for_display(dpy, w) gdk_xid_table_lookup (w) -#define gdk_pixmap_foreign_new_for_display(dpy, p) gdk_pixmap_foreign_new (p) -#define gdk_cursor_new_for_display(dpy, c) gdk_cursor_new (c) -#define gdk_x11_lookup_xdisplay(dpy) 0 -#define GdkDisplay void - -#endif /* not HAVE_GTK_MULTIDISPLAY */ - /* Open a display named by DISPLAY_NAME. The display is returned in *DPY. *DPY is set to NULL if the display can't be opened. @@ -102,12 +107,9 @@ xg_set_screen (w, f) be opened, and less than zero if the GTK version doesn't support multipe displays. */ -int -xg_display_open (display_name, dpy) - char *display_name; - Display **dpy; +void +xg_display_open (char *display_name, Display **dpy) { -#ifdef HAVE_GTK_MULTIDISPLAY GdkDisplay *gdpy; gdpy = gdk_display_open (display_name); @@ -119,12 +121,6 @@ xg_display_open (display_name, dpy) } *dpy = gdpy ? GDK_DISPLAY_XDISPLAY (gdpy) : NULL; - return gdpy != NULL; - -#else /* not HAVE_GTK_MULTIDISPLAY */ - - return -1; -#endif /* not HAVE_GTK_MULTIDISPLAY */ } @@ -133,7 +129,6 @@ xg_display_open (display_name, dpy) void xg_display_close (Display *dpy) { -#ifdef HAVE_GTK_MULTIDISPLAY GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (dpy); /* If this is the default display, try to change it before closing. @@ -165,7 +160,6 @@ xg_display_close (Display *dpy) /* This seems to be fixed in GTK 2.10. */ gdk_display_close (gdpy); #endif -#endif /* HAVE_GTK_MULTIDISPLAY */ } @@ -182,7 +176,7 @@ static int malloc_cpt; Return a pointer to the allocated structure. */ widget_value * -malloc_widget_value () +malloc_widget_value (void) { widget_value *wv; if (widget_value_free_list) @@ -204,8 +198,7 @@ malloc_widget_value () by malloc_widget_value, and no substructures. */ void -free_widget_value (wv) - widget_value *wv; +free_widget_value (widget_value *wv) { if (wv->free_list) abort (); @@ -229,8 +222,7 @@ free_widget_value (wv) scroll bars on display DPY. */ GdkCursor * -xg_create_default_cursor (dpy) - Display *dpy; +xg_create_default_cursor (Display *dpy) { GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (dpy); return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR); @@ -239,10 +231,9 @@ xg_create_default_cursor (dpy) /* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */ static GdkPixbuf * -xg_get_pixbuf_from_pix_and_mask (gpix, gmask, cmap) - GdkPixmap *gpix; - GdkPixmap *gmask; - GdkColormap *cmap; +xg_get_pixbuf_from_pix_and_mask (GdkPixmap *gpix, + GdkPixmap *gmask, + GdkColormap *cmap) { int width, height; GdkPixbuf *icon_buf, *tmp_buf; @@ -293,8 +284,7 @@ xg_get_pixbuf_from_pix_and_mask (gpix, gmask, cmap) } static Lisp_Object -file_for_image (image) - Lisp_Object image; +file_for_image (Lisp_Object image) { Lisp_Object specified_file = Qnil; Lisp_Object tail; @@ -321,11 +311,10 @@ file_for_image (image) If OLD_WIDGET is not NULL, that widget is modified. */ static GtkWidget * -xg_get_image_for_pixmap (f, img, widget, old_widget) - FRAME_PTR f; - struct image *img; - GtkWidget *widget; - GtkImage *old_widget; +xg_get_image_for_pixmap (FRAME_PTR f, + struct image *img, + GtkWidget *widget, + GtkImage *old_widget) { GdkPixmap *gpix; GdkPixmap *gmask; @@ -393,13 +382,12 @@ xg_get_image_for_pixmap (f, img, widget, old_widget) and it is those widgets that are visible. */ static void -xg_set_cursor (w, cursor) - GtkWidget *w; - GdkCursor *cursor; +xg_set_cursor (GtkWidget *w, GdkCursor *cursor) { - GList *children = gdk_window_peek_children (w->window); + GdkWindow *window = gtk_widget_get_window(w); + GList *children = gdk_window_peek_children (window); - gdk_window_set_cursor (w->window, cursor); + gdk_window_set_cursor (window, cursor); /* The scroll bar widget has more than one GDK window (had to look at the source to figure this out), and there is no way to set cursor @@ -447,8 +435,7 @@ xg_list_remove (xg_list_node *list, xg_list_node *node) with g_free. */ static char * -get_utf8_string (str) - char *str; +get_utf8_string (char *str) { char *utf8_str = str; @@ -527,8 +514,7 @@ get_utf8_string (str) F is the frame we shall set geometry for. */ static void -xg_set_geometry (f) - FRAME_PTR f; +xg_set_geometry (FRAME_PTR f) { if (f->size_hint_flags & (USPosition | PPosition)) { @@ -559,8 +545,7 @@ xg_set_geometry (f) and use a GtkFixed widget, this doesn't happen automatically. */ static void -xg_clear_under_internal_border (f) - FRAME_PTR f; +xg_clear_under_internal_border (FRAME_PTR f) { if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0) { @@ -598,16 +583,15 @@ xg_clear_under_internal_border (f) PIXELWIDTH, PIXELHEIGHT is the new size in pixels. */ void -xg_frame_resized (f, pixelwidth, pixelheight) - FRAME_PTR f; - int pixelwidth, pixelheight; +xg_frame_resized (FRAME_PTR f, int pixelwidth, int pixelheight) { int rows, columns; if (pixelwidth == -1 && pixelheight == -1) { - if (FRAME_GTK_WIDGET (f) && GTK_WIDGET_MAPPED (FRAME_GTK_WIDGET (f))) - gdk_window_get_geometry (FRAME_GTK_WIDGET (f)->window, 0, 0, + if (FRAME_GTK_WIDGET (f) && gtk_widget_get_mapped (FRAME_GTK_WIDGET (f))) + gdk_window_get_geometry (gtk_widget_get_window (FRAME_GTK_WIDGET (f)), + 0, 0, &pixelwidth, &pixelheight, 0); else return; } @@ -635,10 +619,7 @@ xg_frame_resized (f, pixelwidth, pixelheight) COLUMNS/ROWS is the size the edit area shall have after the resize. */ void -xg_frame_set_char_size (f, cols, rows) - FRAME_PTR f; - int cols; - int rows; +xg_frame_set_char_size (FRAME_PTR f, int cols, int rows) { int pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows) + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); @@ -700,8 +681,7 @@ xg_frame_set_char_size (f, cols, rows) The policy is to keep the number of editable lines. */ static void -xg_height_changed (f) - FRAME_PTR f; +xg_height_changed (FRAME_PTR f) { gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), FRAME_PIXEL_WIDTH (f), FRAME_TOTAL_PIXEL_HEIGHT (f)); @@ -716,9 +696,7 @@ xg_height_changed (f) Return 0 if no widget match WDESC. */ GtkWidget * -xg_win_to_widget (dpy, wdesc) - Display *dpy; - Window wdesc; +xg_win_to_widget (Display *dpy, Window wdesc) { gpointer gdkwin; GtkWidget *gwdesc = 0; @@ -742,10 +720,7 @@ xg_win_to_widget (dpy, wdesc) W is the widget that color will be used for. Used to find colormap. */ static void -xg_pix_to_gcolor (w, pixel, c) - GtkWidget *w; - unsigned long pixel; - GdkColor *c; +xg_pix_to_gcolor (GtkWidget *w, long unsigned int pixel, GdkColor *c) { GdkColormap *map = gtk_widget_get_colormap (w); gdk_colormap_query_color (map, pixel, c); @@ -755,8 +730,7 @@ xg_pix_to_gcolor (w, pixel, c) Return 0 if creation failed, non-zero otherwise. */ int -xg_create_frame_widgets (f) - FRAME_PTR f; +xg_create_frame_widgets (FRAME_PTR f) { GtkWidget *wtop; GtkWidget *wvbox; @@ -802,7 +776,7 @@ xg_create_frame_widgets (f) FRAME_GTK_WIDGET (f) = wfixed; f->output_data.x->vbox_widget = wvbox; - gtk_fixed_set_has_window (GTK_FIXED (wfixed), TRUE); + gtk_widget_set_has_window (wfixed, TRUE); gtk_container_add (GTK_CONTAINER (wtop), wvbox); gtk_box_pack_end (GTK_BOX (wvbox), wfixed, TRUE, TRUE, 0); @@ -882,10 +856,7 @@ xg_create_frame_widgets (f) flag (this is useful when FLAGS is 0). */ void -x_wm_set_size_hint (f, flags, user_position) - FRAME_PTR f; - long flags; - int user_position; +x_wm_set_size_hint (FRAME_PTR f, long int flags, int user_position) { /* Must use GTK routines here, otherwise GTK resets the size hints to its own defaults. */ @@ -981,9 +952,7 @@ x_wm_set_size_hint (f, flags, user_position) BG is the pixel value to change to. */ void -xg_set_background_color (f, bg) - FRAME_PTR f; - unsigned long bg; +xg_set_background_color (FRAME_PTR f, long unsigned int bg) { if (FRAME_GTK_WIDGET (f)) { @@ -1001,10 +970,7 @@ xg_set_background_color (f, bg) functions so GTK does not overwrite the icon. */ void -xg_set_frame_icon (f, icon_pixmap, icon_mask) - FRAME_PTR f; - Pixmap icon_pixmap; - Pixmap icon_mask; +xg_set_frame_icon (FRAME_PTR f, Pixmap icon_pixmap, Pixmap icon_mask) { GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); GdkPixmap *gpix = gdk_pixmap_foreign_new_for_display (gdpy, icon_pixmap); @@ -1064,10 +1030,7 @@ get_dialog_title (char key) Returns TRUE to end propagation of event. */ static gboolean -dialog_delete_callback (w, event, user_data) - GtkWidget *w; - GdkEvent *event; - gpointer user_data; +dialog_delete_callback (GtkWidget *w, GdkEvent *event, gpointer user_data) { gtk_widget_unmap (w); return TRUE; @@ -1081,10 +1044,9 @@ dialog_delete_callback (w, event, user_data) Returns the GTK dialog widget. */ static GtkWidget * -create_dialog (wv, select_cb, deactivate_cb) - widget_value *wv; - GCallback select_cb; - GCallback deactivate_cb; +create_dialog (widget_value *wv, + GCallback select_cb, + GCallback deactivate_cb) { char *title = get_dialog_title (wv->name[0]); int total_buttons = wv->name[1] - '0'; @@ -1093,8 +1055,9 @@ create_dialog (wv, select_cb, deactivate_cb) int button_nr = 0; int button_spacing = 10; GtkWidget *wdialog = gtk_dialog_new (); + GtkDialog *wd = GTK_DIALOG (wdialog); + GtkBox *cur_box = GTK_BOX (gtk_dialog_get_action_area (wd)); widget_value *item; - GtkBox *cur_box; GtkWidget *wvbox; GtkWidget *whbox_up; GtkWidget *whbox_down; @@ -1109,7 +1072,6 @@ create_dialog (wv, select_cb, deactivate_cb) gtk_window_set_title (GTK_WINDOW (wdialog), title); gtk_widget_set_name (wdialog, "emacs-dialog"); - cur_box = GTK_BOX (GTK_DIALOG (wdialog)->action_area); if (make_two_rows) { @@ -1141,21 +1103,18 @@ create_dialog (wv, select_cb, deactivate_cb) if (item->name && strcmp (item->name, "message") == 0) { + GtkBox *wvbox = GTK_BOX (gtk_dialog_get_content_area (wd)); /* This is the text part of the dialog. */ w = gtk_label_new (utf8_label); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (wdialog)->vbox), - gtk_label_new (""), - FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (wdialog)->vbox), w, - TRUE, TRUE, 0); + gtk_box_pack_start (wvbox, gtk_label_new (""), FALSE, FALSE, 0); + gtk_box_pack_start (wvbox, w, TRUE, TRUE, 0); gtk_misc_set_alignment (GTK_MISC (w), 0.1, 0.5); /* Try to make dialog look better. Must realize first so the widget can calculate the size it needs. */ gtk_widget_realize (w); gtk_widget_size_request (w, &req); - gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (wdialog)->vbox), - req.height); + gtk_box_set_spacing (wvbox, req.height); if (item->value && strlen (item->value) > 0) button_spacing = 2*req.width/strlen (item->value); } @@ -1202,12 +1161,9 @@ struct xg_dialog_data USER_DATA is what we passed in to g_signal_connect. */ static void -xg_dialog_response_cb (w, - response, - user_data) - GtkDialog *w; - gint response; - gpointer user_data; +xg_dialog_response_cb (GtkDialog *w, + gint response, + gpointer user_data) { struct xg_dialog_data *dd = (struct xg_dialog_data *)user_data; dd->response = response; @@ -1218,8 +1174,7 @@ xg_dialog_response_cb (w, /* Destroy the dialog. This makes it pop down. */ static Lisp_Object -pop_down_dialog (arg) - Lisp_Object arg; +pop_down_dialog (Lisp_Object arg) { struct Lisp_Save_Value *p = XSAVE_VALUE (arg); struct xg_dialog_data *dd = (struct xg_dialog_data *) p->pointer; @@ -1240,8 +1195,7 @@ pop_down_dialog (arg) We pass in DATA as gpointer* so we can use this as a callback. */ static gboolean -xg_maybe_add_timer (data) - gpointer data; +xg_maybe_add_timer (gpointer data) { struct xg_dialog_data *dd = (struct xg_dialog_data *) data; EMACS_TIME next_time = timer_check (1); @@ -1265,10 +1219,7 @@ xg_maybe_add_timer (data) The dialog W is not destroyed when this function returns. */ static int -xg_dialog_run (f, w) - FRAME_PTR f; - GtkWidget *w; - +xg_dialog_run (FRAME_PTR f, GtkWidget *w) { int count = SPECPDL_INDEX (); struct xg_dialog_data dd; @@ -1311,33 +1262,24 @@ xg_dialog_run (f, w) Return zero if not. */ int -xg_uses_old_file_dialog () +xg_uses_old_file_dialog (void) { -#ifdef HAVE_GTK_FILE_BOTH +#ifdef HAVE_GTK_FILE_SELECTION_NEW extern int x_gtk_use_old_file_dialog; return x_gtk_use_old_file_dialog; -#else /* ! HAVE_GTK_FILE_BOTH */ - -#ifdef HAVE_GTK_FILE_SELECTION_NEW - return 1; #else return 0; #endif - -#endif /* ! HAVE_GTK_FILE_BOTH */ } -typedef char * (*xg_get_file_func) P_ ((GtkWidget *)); - -#ifdef HAVE_GTK_FILE_CHOOSER_DIALOG_NEW +typedef char * (*xg_get_file_func) (GtkWidget *); /* Return the selected file for file chooser dialog W. The returned string must be free:d. */ static char * -xg_get_file_name_from_chooser (w) - GtkWidget *w; +xg_get_file_name_from_chooser (GtkWidget *w) { return gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w)); } @@ -1346,9 +1288,7 @@ xg_get_file_name_from_chooser (w) WIDGET is the toggle widget, DATA is the file chooser dialog. */ static void -xg_toggle_visibility_cb (widget, data) - GtkWidget *widget; - gpointer data; +xg_toggle_visibility_cb (GtkWidget *widget, gpointer data) { GtkFileChooser *dialog = GTK_FILE_CHOOSER (data); gboolean visible; @@ -1364,10 +1304,7 @@ xg_toggle_visibility_cb (widget, data) changes that property by right clicking in the file list. */ static void -xg_toggle_notify_cb (gobject, arg1, user_data) - GObject *gobject; - GParamSpec *arg1; - gpointer user_data; +xg_toggle_notify_cb (GObject *gobject, GParamSpec *arg1, gpointer user_data) { extern int x_gtk_show_hidden_files; @@ -1405,13 +1342,11 @@ xg_toggle_notify_cb (gobject, arg1, user_data) Returns the created widget. */ static GtkWidget * -xg_get_file_with_chooser (f, prompt, default_filename, - mustmatch_p, only_dir_p, func) - FRAME_PTR f; - char *prompt; - char *default_filename; - int mustmatch_p, only_dir_p; - xg_get_file_func *func; +xg_get_file_with_chooser (FRAME_PTR f, + char *prompt, + char *default_filename, + int mustmatch_p, int only_dir_p, + xg_get_file_func *func) { char message[1024]; @@ -1507,7 +1442,6 @@ xg_get_file_with_chooser (f, prompt, default_filename, *func = xg_get_file_name_from_chooser; return filewin; } -#endif /* HAVE_GTK_FILE_CHOOSER_DIALOG_NEW */ #ifdef HAVE_GTK_FILE_SELECTION_NEW @@ -1515,8 +1449,7 @@ xg_get_file_with_chooser (f, prompt, default_filename, The returned string must be free:d. */ static char * -xg_get_file_name_from_selector (w) - GtkWidget *w; +xg_get_file_name_from_selector (GtkWidget *w) { GtkFileSelection *filesel = GTK_FILE_SELECTION (w); return xstrdup ((char*) gtk_file_selection_get_filename (filesel)); @@ -1533,13 +1466,11 @@ xg_get_file_name_from_selector (w) Returns the created widget. */ static GtkWidget * -xg_get_file_with_selection (f, prompt, default_filename, - mustmatch_p, only_dir_p, func) - FRAME_PTR f; - char *prompt; - char *default_filename; - int mustmatch_p, only_dir_p; - xg_get_file_func *func; +xg_get_file_with_selection (FRAME_PTR f, + char *prompt, + char *default_filename, + int mustmatch_p, int only_dir_p, + xg_get_file_func *func) { GtkWidget *filewin; GtkFileSelection *filesel; @@ -1577,11 +1508,11 @@ xg_get_file_with_selection (f, prompt, default_filename, The returned string must be freed by the caller. */ char * -xg_get_file_name (f, prompt, default_filename, mustmatch_p, only_dir_p) - FRAME_PTR f; - char *prompt; - char *default_filename; - int mustmatch_p, only_dir_p; +xg_get_file_name (FRAME_PTR f, + char *prompt, + char *default_filename, + int mustmatch_p, + int only_dir_p) { GtkWidget *w = 0; char *fn = 0; @@ -1595,7 +1526,7 @@ xg_get_file_name (f, prompt, default_filename, mustmatch_p, only_dir_p) sigblock (sigmask (__SIGRTMIN)); #endif /* HAVE_GTK_AND_PTHREAD */ -#ifdef HAVE_GTK_FILE_BOTH +#ifdef HAVE_GTK_FILE_SELECTION_NEW if (xg_uses_old_file_dialog ()) w = xg_get_file_with_selection (f, prompt, default_filename, @@ -1604,18 +1535,10 @@ xg_get_file_name (f, prompt, default_filename, mustmatch_p, only_dir_p) w = xg_get_file_with_chooser (f, prompt, default_filename, mustmatch_p, only_dir_p, &func); -#else /* not HAVE_GTK_FILE_BOTH */ - -#ifdef HAVE_GTK_FILE_SELECTION_NEW - w = xg_get_file_with_selection (f, prompt, default_filename, - mustmatch_p, only_dir_p, &func); -#endif -#ifdef HAVE_GTK_FILE_CHOOSER_DIALOG_NEW +#else /* not HAVE_GTK_FILE_SELECTION_NEW */ w = xg_get_file_with_chooser (f, prompt, default_filename, mustmatch_p, only_dir_p, &func); -#endif - -#endif /* HAVE_GTK_FILE_BOTH */ +#endif /* not HAVE_GTK_FILE_SELECTION_NEW */ gtk_widget_set_name (w, "emacs-filedialog"); @@ -1643,9 +1566,7 @@ xg_get_file_name (f, prompt, default_filename, mustmatch_p, only_dir_p) DEFAULT_NAME, if non-zero, is the default font name. */ char * -xg_get_font_name (f, default_name) - FRAME_PTR f; - char *default_name; +xg_get_font_name (FRAME_PTR f, char *default_name) { GtkWidget *w; char *fontname = NULL; @@ -1710,10 +1631,7 @@ static xg_list_node xg_menu_item_cb_list; allocated xg_menu_cb_data if CL_DATA is NULL. */ static xg_menu_cb_data * -make_cl_data (cl_data, f, highlight_cb) - xg_menu_cb_data *cl_data; - FRAME_PTR f; - GCallback highlight_cb; +make_cl_data (xg_menu_cb_data *cl_data, FRAME_PTR f, GCallback highlight_cb) { if (! cl_data) { @@ -1744,10 +1662,9 @@ make_cl_data (cl_data, f, highlight_cb) creating the menu bar. */ static void -update_cl_data (cl_data, f, highlight_cb) - xg_menu_cb_data *cl_data; - FRAME_PTR f; - GCallback highlight_cb; +update_cl_data (xg_menu_cb_data *cl_data, + FRAME_PTR f, + GCallback highlight_cb) { if (cl_data) { @@ -1762,8 +1679,7 @@ update_cl_data (cl_data, f, highlight_cb) If reference count is zero, free CL_DATA. */ static void -unref_cl_data (cl_data) - xg_menu_cb_data *cl_data; +unref_cl_data (xg_menu_cb_data *cl_data) { if (cl_data && cl_data->ref_count > 0) { @@ -1779,7 +1695,7 @@ unref_cl_data (cl_data) /* Function that marks all lisp data during GC. */ void -xg_mark_data () +xg_mark_data (void) { xg_list_node *iter; @@ -1801,9 +1717,7 @@ xg_mark_data () CLIENT_DATA points to the xg_menu_item_cb_data associated with the W. */ static void -menuitem_destroy_callback (w, client_data) - GtkWidget *w; - gpointer client_data; +menuitem_destroy_callback (GtkWidget *w, gpointer client_data) { if (client_data) { @@ -1821,10 +1735,9 @@ menuitem_destroy_callback (w, client_data) Returns FALSE to tell GTK to keep processing this event. */ static gboolean -menuitem_highlight_callback (w, event, client_data) - GtkWidget *w; - GdkEventCrossing *event; - gpointer client_data; +menuitem_highlight_callback (GtkWidget *w, + GdkEventCrossing *event, + gpointer client_data) { GdkEvent ev; GtkWidget *subwidget; @@ -1852,9 +1765,7 @@ menuitem_highlight_callback (w, event, client_data) CLIENT_DATA points to the xg_menu_cb_data associated with W. */ static void -menu_destroy_callback (w, client_data) - GtkWidget *w; - gpointer client_data; +menu_destroy_callback (GtkWidget *w, gpointer client_data) { unref_cl_data ((xg_menu_cb_data*) client_data); } @@ -1865,9 +1776,7 @@ menu_destroy_callback (w, client_data) Returns the GtkHBox. */ static GtkWidget * -make_widget_for_menu_item (utf8_label, utf8_key) - char *utf8_label; - char *utf8_key; +make_widget_for_menu_item (char *utf8_label, char *utf8_key) { GtkWidget *wlbl; GtkWidget *wkey; @@ -1905,11 +1814,10 @@ make_widget_for_menu_item (utf8_label, utf8_key) but the MacOS X version doesn't either, so I guess that is OK. */ static GtkWidget * -make_menu_item (utf8_label, utf8_key, item, group) - char *utf8_label; - char *utf8_key; - widget_value *item; - GSList **group; +make_menu_item (char *utf8_label, + char *utf8_key, + widget_value *item, + GSList **group) { GtkWidget *w; GtkWidget *wtoadd = 0; @@ -2004,7 +1912,7 @@ static int xg_detached_menus; /* Returns non-zero if there are detached menus. */ int -xg_have_tear_offs () +xg_have_tear_offs (void) { return xg_detached_menus > 0; } @@ -2015,9 +1923,7 @@ xg_have_tear_offs () CLIENT_DATA is not used. */ static void -tearoff_remove (widget, client_data) - GtkWidget *widget; - gpointer client_data; +tearoff_remove (GtkWidget *widget, gpointer client_data) { if (xg_detached_menus > 0) --xg_detached_menus; } @@ -2028,9 +1934,7 @@ tearoff_remove (widget, client_data) CLIENT_DATA is not used. */ static void -tearoff_activate (widget, client_data) - GtkWidget *widget; - gpointer client_data; +tearoff_activate (GtkWidget *widget, gpointer client_data) { GtkWidget *menu = gtk_widget_get_parent (widget); if (gtk_menu_get_tearoff_state (GTK_MENU (menu))) @@ -2058,13 +1962,12 @@ tearoff_activate (widget, client_data) Returns the created GtkWidget. */ static GtkWidget * -xg_create_one_menuitem (item, f, select_cb, highlight_cb, cl_data, group) - widget_value *item; - FRAME_PTR f; - GCallback select_cb; - GCallback highlight_cb; - xg_menu_cb_data *cl_data; - GSList **group; +xg_create_one_menuitem (widget_value *item, + FRAME_PTR f, + GCallback select_cb, + GCallback highlight_cb, + xg_menu_cb_data *cl_data, + GSList **group) { char *utf8_label; char *utf8_key; @@ -2107,10 +2010,6 @@ xg_create_one_menuitem (item, f, select_cb, highlight_cb, cl_data, group) return w; } -static GtkWidget *create_menus P_ ((widget_value *, FRAME_PTR, GCallback, - GCallback, GCallback, int, int, int, - GtkWidget *, xg_menu_cb_data *, char *)); - /* Create a full menu tree specified by DATA. F is the frame the created menu belongs to. SELECT_CB is the callback to use when a menu item is selected. @@ -2134,19 +2033,17 @@ static GtkWidget *create_menus P_ ((widget_value *, FRAME_PTR, GCallback, This function calls itself to create submenus. */ static GtkWidget * -create_menus (data, f, select_cb, deactivate_cb, highlight_cb, - pop_up_p, menu_bar_p, add_tearoff_p, topmenu, cl_data, name) - widget_value *data; - FRAME_PTR f; - GCallback select_cb; - GCallback deactivate_cb; - GCallback highlight_cb; - int pop_up_p; - int menu_bar_p; - int add_tearoff_p; - GtkWidget *topmenu; - xg_menu_cb_data *cl_data; - char *name; +create_menus (widget_value *data, + FRAME_PTR f, + GCallback select_cb, + GCallback deactivate_cb, + GCallback highlight_cb, + int pop_up_p, + int menu_bar_p, + int add_tearoff_p, + GtkWidget *topmenu, + xg_menu_cb_data *cl_data, + char *name) { widget_value *item; GtkWidget *wmenu = topmenu; @@ -2278,15 +2175,9 @@ create_menus (data, f, select_cb, deactivate_cb, highlight_cb, Returns the widget created. */ GtkWidget * -xg_create_widget (type, name, f, val, - select_cb, deactivate_cb, highlight_cb) - char *type; - char *name; - FRAME_PTR f; - widget_value *val; - GCallback select_cb; - GCallback deactivate_cb; - GCallback highlight_cb; +xg_create_widget (char *type, char *name, FRAME_PTR f, widget_value *val, + GCallback select_cb, GCallback deactivate_cb, + GCallback highlight_cb) { GtkWidget *w = 0; int menu_bar_p = strcmp (type, "menubar") == 0; @@ -2337,8 +2228,7 @@ xg_create_widget (type, name, f, val, /* Return the label for menu item WITEM. */ static const char * -xg_get_menu_item_label (witem) - GtkMenuItem *witem; +xg_get_menu_item_label (GtkMenuItem *witem) { GtkLabel *wlabel = GTK_LABEL (gtk_bin_get_child (GTK_BIN (witem))); return gtk_label_get_label (wlabel); @@ -2347,9 +2237,7 @@ xg_get_menu_item_label (witem) /* Return non-zero if the menu item WITEM has the text LABEL. */ static int -xg_item_label_same_p (witem, label) - GtkMenuItem *witem; - char *label; +xg_item_label_same_p (GtkMenuItem *witem, char *label) { int is_same = 0; char *utf8_label = get_utf8_string (label); @@ -2368,8 +2256,7 @@ xg_item_label_same_p (witem, label) /* Destroy widgets in LIST. */ static void -xg_destroy_widgets (list) - GList *list; +xg_destroy_widgets (GList *list) { GList *iter; @@ -2395,18 +2282,16 @@ xg_destroy_widgets (list) This function calls itself to walk through the menu bar names. */ static void -xg_update_menubar (menubar, f, list, iter, pos, val, - select_cb, deactivate_cb, highlight_cb, cl_data) - GtkWidget *menubar; - FRAME_PTR f; - GList **list; - GList *iter; - int pos; - widget_value *val; - GCallback select_cb; - GCallback deactivate_cb; - GCallback highlight_cb; - xg_menu_cb_data *cl_data; +xg_update_menubar (GtkWidget *menubar, + FRAME_PTR f, + GList **list, + GList *iter, + int pos, + widget_value *val, + GCallback select_cb, + GCallback deactivate_cb, + GCallback highlight_cb, + xg_menu_cb_data *cl_data) { if (! iter && ! val) return; @@ -2473,7 +2358,7 @@ xg_update_menubar (menubar, f, list, iter, pos, val, New: A C Remove B. */ - gtk_widget_ref (GTK_WIDGET (witem)); + g_object_ref (G_OBJECT (witem)); gtk_container_remove (GTK_CONTAINER (menubar), GTK_WIDGET (witem)); gtk_widget_destroy (GTK_WIDGET (witem)); @@ -2522,7 +2407,7 @@ xg_update_menubar (menubar, f, list, iter, pos, val, Insert X. */ int nr = pos; - GList *group = 0; + GSList *group = 0; GtkWidget *w = xg_create_one_menuitem (val, f, select_cb, @@ -2555,11 +2440,11 @@ xg_update_menubar (menubar, f, list, iter, pos, val, New: A C B Move C before B */ - gtk_widget_ref (GTK_WIDGET (witem2)); + g_object_ref (G_OBJECT (witem2)); gtk_container_remove (GTK_CONTAINER (menubar), GTK_WIDGET (witem2)); gtk_menu_shell_insert (GTK_MENU_SHELL (menubar), GTK_WIDGET (witem2), pos); - gtk_widget_unref (GTK_WIDGET (witem2)); + g_object_unref (G_OBJECT (witem2)); g_list_free (*list); *list = iter = gtk_container_get_children (GTK_CONTAINER (menubar)); @@ -2581,12 +2466,11 @@ xg_update_menubar (menubar, f, list, iter, pos, val, CL_DATA is the data to set in the widget for menu invocation. */ static void -xg_update_menu_item (val, w, select_cb, highlight_cb, cl_data) - widget_value *val; - GtkWidget *w; - GCallback select_cb; - GCallback highlight_cb; - xg_menu_cb_data *cl_data; +xg_update_menu_item (widget_value *val, + GtkWidget *w, + GCallback select_cb, + GCallback highlight_cb, + xg_menu_cb_data *cl_data) { GtkWidget *wchild; GtkLabel *wlbl = 0; @@ -2613,9 +2497,10 @@ xg_update_menu_item (val, w, select_cb, highlight_cb, cl_data) if (! utf8_key) { /* Remove the key and keep just the label. */ - gtk_widget_ref (GTK_WIDGET (wlbl)); + g_object_ref (G_OBJECT (wlbl)); gtk_container_remove (GTK_CONTAINER (w), wchild); gtk_container_add (GTK_CONTAINER (w), GTK_WIDGET (wlbl)); + g_object_unref (G_OBJECT (wlbl)); wkey = 0; } @@ -2652,9 +2537,9 @@ xg_update_menu_item (val, w, select_cb, highlight_cb, cl_data) if (utf8_key && utf8_key != val->key) g_free (utf8_key); if (utf8_label && utf8_label != val->name) g_free (utf8_label); - if (! val->enabled && GTK_WIDGET_SENSITIVE (w)) + if (! val->enabled && gtk_widget_get_sensitive (w)) gtk_widget_set_sensitive (w, FALSE); - else if (val->enabled && ! GTK_WIDGET_SENSITIVE (w)) + else if (val->enabled && ! gtk_widget_get_sensitive (w)) gtk_widget_set_sensitive (w, TRUE); cb_data = (xg_menu_item_cb_data*) g_object_get_data (G_OBJECT (w), @@ -2685,9 +2570,7 @@ xg_update_menu_item (val, w, select_cb, highlight_cb, cl_data) /* Update the toggle menu item W so it corresponds to VAL. */ static void -xg_update_toggle_item (val, w) - widget_value *val; - GtkWidget *w; +xg_update_toggle_item (widget_value *val, GtkWidget *w) { gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (w), val->selected); } @@ -2695,9 +2578,7 @@ xg_update_toggle_item (val, w) /* Update the radio menu item W so it corresponds to VAL. */ static void -xg_update_radio_item (val, w) - widget_value *val; - GtkWidget *w; +xg_update_radio_item (widget_value *val, GtkWidget *w) { gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (w), val->selected); } @@ -2715,15 +2596,13 @@ xg_update_radio_item (val, w) was NULL. */ static GtkWidget * -xg_update_submenu (submenu, f, val, - select_cb, deactivate_cb, highlight_cb, cl_data) - GtkWidget *submenu; - FRAME_PTR f; - widget_value *val; - GCallback select_cb; - GCallback deactivate_cb; - GCallback highlight_cb; - xg_menu_cb_data *cl_data; +xg_update_submenu (GtkWidget *submenu, + FRAME_PTR f, + widget_value *val, + GCallback select_cb, + GCallback deactivate_cb, + GCallback highlight_cb, + xg_menu_cb_data *cl_data) { GtkWidget *newsub = submenu; GList *list = 0; @@ -2793,8 +2672,8 @@ xg_update_submenu (submenu, f, val, if (sub && ! cur->contents) { /* Not a submenu anymore. */ - gtk_widget_ref (sub); - gtk_menu_item_remove_submenu (witem); + g_object_ref (G_OBJECT (sub)); + remove_submenu (witem); gtk_widget_destroy (sub); } else if (cur->contents) @@ -2858,15 +2737,10 @@ xg_update_submenu (submenu, f, val, HIGHLIGHT_CB is the callback to call when entering/leaving menu items. */ void -xg_modify_menubar_widgets (menubar, f, val, deep_p, - select_cb, deactivate_cb, highlight_cb) - GtkWidget *menubar; - FRAME_PTR f; - widget_value *val; - int deep_p; - GCallback select_cb; - GCallback deactivate_cb; - GCallback highlight_cb; +xg_modify_menubar_widgets (GtkWidget *menubar, FRAME_PTR f, widget_value *val, + int deep_p, + GCallback select_cb, GCallback deactivate_cb, + GCallback highlight_cb) { xg_menu_cb_data *cl_data; GList *list = gtk_container_get_children (GTK_CONTAINER (menubar)); @@ -2895,7 +2769,7 @@ xg_modify_menubar_widgets (menubar, f, val, deep_p, GList *iter; GtkWidget *sub = 0; GtkWidget *newsub; - GtkMenuItem *witem; + GtkMenuItem *witem = 0; /* Find sub menu that corresponds to val and update it. */ for (iter = list ; iter; iter = g_list_next (iter)) @@ -2918,7 +2792,7 @@ xg_modify_menubar_widgets (menubar, f, val, deep_p, /* sub may still be NULL. If we just updated non deep and added a new menu bar item, it has no sub menu yet. So we set the newly created sub menu under witem. */ - if (newsub != sub) + if (newsub != sub && witem != 0) { xg_set_screen (newsub, f); gtk_menu_item_set_submenu (witem, newsub); @@ -2934,13 +2808,12 @@ xg_modify_menubar_widgets (menubar, f, val, deep_p, changed. Value is non-zero if widgets were updated. */ int -xg_update_frame_menubar (f) - FRAME_PTR f; +xg_update_frame_menubar (FRAME_PTR f) { struct x_output *x = f->output_data.x; GtkRequisition req; - if (!x->menubar_widget || GTK_WIDGET_MAPPED (x->menubar_widget)) + if (!x->menubar_widget || gtk_widget_get_mapped (x->menubar_widget)) return 0; if (x->menubar_widget && gtk_widget_get_parent (x->menubar_widget)) @@ -2965,8 +2838,7 @@ xg_update_frame_menubar (f) This is used when deleting a frame, and when turning off the menu bar. */ void -free_frame_menubar (f) - FRAME_PTR f; +free_frame_menubar (FRAME_PTR f) { struct x_output *x = f->output_data.x; @@ -2984,6 +2856,55 @@ free_frame_menubar (f) } } +int +xg_event_is_for_menubar (FRAME_PTR f, XEvent *event) +{ + struct x_output *x = f->output_data.x; + GList *iter; + GdkRectangle rec; + GList *list; + GdkDisplay *gdpy; + GdkWindow *gw; + GdkEvent gevent; + GtkWidget *gwdesc; + + if (! x->menubar_widget) return 0; + + if (! (event->xbutton.x >= 0 + && event->xbutton.x < FRAME_PIXEL_WIDTH (f) + && event->xbutton.y >= 0 + && event->xbutton.y < f->output_data.x->menubar_height + && event->xbutton.same_screen)) + return 0; + + gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); + gw = gdk_xid_table_lookup_for_display (gdpy, event->xbutton.window); + if (! gw) return 0; + gevent.any.window = gw; + gwdesc = gtk_get_event_widget (&gevent); + if (! gwdesc) return 0; + if (! GTK_IS_MENU_BAR (gwdesc) + && ! GTK_IS_MENU_ITEM (gwdesc) + && ! gtk_widget_is_ancestor (x->menubar_widget, gwdesc)) + return 0; + + list = gtk_container_get_children (GTK_CONTAINER (x->menubar_widget)); + if (! list) return 0; + rec.x = event->xbutton.x; + rec.y = event->xbutton.y; + rec.width = 1; + rec.height = 1; + + for (iter = list ; iter; iter = g_list_next (iter)) + { + GtkWidget *w = GTK_WIDGET (iter->data); + if (gtk_widget_get_mapped (w) && gtk_widget_intersect (w, &rec, NULL)) + break; + } + g_list_free (list); + return iter == 0 ? 0 : 1; +} + /*********************************************************************** @@ -3014,8 +2935,7 @@ static struct /* Store the widget pointer W in id_to_widget and return the integer index. */ static int -xg_store_widget_in_map (w) - GtkWidget *w; +xg_store_widget_in_map (GtkWidget *w) { int i; @@ -3053,8 +2973,7 @@ xg_store_widget_in_map (w) Called when scroll bar is destroyed. */ static void -xg_remove_widget_from_map (idx) - int idx; +xg_remove_widget_from_map (int idx) { if (idx < id_to_widget.max_size && id_to_widget.widgets[idx] != 0) { @@ -3066,8 +2985,7 @@ xg_remove_widget_from_map (idx) /* Get the widget pointer at IDX from id_to_widget. */ static GtkWidget * -xg_get_widget_from_map (idx) - int idx; +xg_get_widget_from_map (int idx) { if (idx < id_to_widget.max_size && id_to_widget.widgets[idx] != 0) return id_to_widget.widgets[idx]; @@ -3079,9 +2997,7 @@ xg_get_widget_from_map (idx) Return -1 if WID not in id_to_widget. */ int -xg_get_scroll_id_for_window (dpy, wid) - Display *dpy; - Window wid; +xg_get_scroll_id_for_window (Display *dpy, Window wid) { int idx; GtkWidget *w; @@ -3103,9 +3019,7 @@ xg_get_scroll_id_for_window (dpy, wid) We free pointer to last scroll bar values here and remove the index. */ static void -xg_gtk_scroll_destroy (widget, data) - GtkWidget *widget; - gpointer data; +xg_gtk_scroll_destroy (GtkWidget *widget, gpointer data) { int id = (int) (EMACS_INT) data; /* The EMACS_INT cast avoids a warning. */ xg_remove_widget_from_map (id); @@ -3120,11 +3034,11 @@ xg_gtk_scroll_destroy (widget, data) to set resources for the widget. */ void -xg_create_scroll_bar (f, bar, scroll_callback, end_callback, scroll_bar_name) - FRAME_PTR f; - struct scroll_bar *bar; - GCallback scroll_callback, end_callback; - char *scroll_bar_name; +xg_create_scroll_bar (FRAME_PTR f, + struct scroll_bar *bar, + GCallback scroll_callback, + GCallback end_callback, + char *scroll_bar_name) { GtkWidget *wscroll; GtkWidget *webox; @@ -3174,23 +3088,10 @@ xg_create_scroll_bar (f, bar, scroll_callback, end_callback, scroll_bar_name) bar->x_window = scroll_id; } -/* Make the scroll bar represented by SCROLLBAR_ID visible. */ - -void -xg_show_scroll_bar (scrollbar_id) - int scrollbar_id; -{ - GtkWidget *w = xg_get_widget_from_map (scrollbar_id); - if (w) - gtk_widget_show_all (gtk_widget_get_parent (w)); -} - /* Remove the scroll bar represented by SCROLLBAR_ID from the frame F. */ void -xg_remove_scroll_bar (f, scrollbar_id) - FRAME_PTR f; - int scrollbar_id; +xg_remove_scroll_bar (FRAME_PTR f, int scrollbar_id) { GtkWidget *w = xg_get_widget_from_map (scrollbar_id); if (w) @@ -3208,13 +3109,12 @@ xg_remove_scroll_bar (f, scrollbar_id) WIDTH, HEIGHT is the size in pixels the bar shall have. */ void -xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height) - FRAME_PTR f; - int scrollbar_id; - int top; - int left; - int width; - int height; +xg_update_scrollbar_pos (FRAME_PTR f, + int scrollbar_id, + int top, + int left, + int width, + int height) { GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id); @@ -3223,30 +3123,35 @@ xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height) { GtkWidget *wfixed = f->output_data.x->edit_widget; GtkWidget *wparent = gtk_widget_get_parent (wscroll); - GtkFixed *wf = GTK_FIXED (wfixed); + gint msl; /* Clear out old position. */ - GList *iter; int oldx = -1, oldy = -1, oldw, oldh; - for (iter = wf->children; iter; iter = iter->next) - if (((GtkFixedChild *)iter->data)->widget == wparent) - { - GtkFixedChild *ch = (GtkFixedChild *)iter->data; - if (ch->x != left || ch->y != top) - { - oldx = ch->x; - oldy = ch->y; - gtk_widget_get_size_request (wscroll, &oldw, &oldh); - } - break; - } + if (gtk_widget_get_parent (wparent) == wfixed) + { + gtk_container_child_get (GTK_CONTAINER (wfixed), wparent, + "x", &oldx, "y", &oldy, NULL); + gtk_widget_get_size_request (wscroll, &oldw, &oldh); + } /* Move and resize to new values. */ gtk_fixed_move (GTK_FIXED (wfixed), wparent, left, top); - gtk_widget_set_size_request (wscroll, width, height); + gtk_widget_style_get (wscroll, "min-slider-length", &msl, NULL); + if (msl > height) + { + /* No room. Hide scroll bar as some themes output a warning if + the height is less than the min size. */ + gtk_widget_hide (wparent); + gtk_widget_hide (wscroll); + } + else + { + gtk_widget_show_all (wparent); + gtk_widget_set_size_request (wscroll, width, height); + } gtk_widget_queue_draw (wfixed); gdk_window_process_all_updates (); - if (oldx != -1) + if (oldx != -1 && oldw > 0 && oldh > 0) { /* Clear under old scroll bar position. This must be done after the gtk_widget_queue_draw and gdk_window_process_all_updates @@ -3270,9 +3175,10 @@ xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height) displaying PORTION out of a whole WHOLE, and our position POSITION. */ void -xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) - struct scroll_bar *bar; - int portion, position, whole; +xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, + int portion, + int position, + int whole) { GtkWidget *wscroll = xg_get_widget_from_map (bar->x_window); @@ -3316,13 +3222,13 @@ xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) /* Assume all lines are of equal size. */ new_step = size / max (1, FRAME_LINES (f)); - if ((int) adj->page_size != size - || (int) adj->step_increment != new_step) + if ((int) gtk_adjustment_get_page_size (adj) != size + || (int) gtk_adjustment_get_step_increment (adj) != new_step) { - adj->page_size = size; - adj->step_increment = new_step; + gtk_adjustment_set_page_size (adj, size); + gtk_adjustment_set_step_increment (adj, new_step); /* Assume a page increment is about 95% of the page size */ - adj->page_increment = (int) (0.95*adj->page_size); + gtk_adjustment_set_page_increment (adj,(int) (0.95*size)); changed = 1; } @@ -3354,9 +3260,7 @@ xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) Return non-zero if the event is for a scroll bar, zero otherwise. */ int -xg_event_is_for_scrollbar (f, event) - FRAME_PTR f; - XEvent *event; +xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event) { int retval = 0; @@ -3365,7 +3269,7 @@ xg_event_is_for_scrollbar (f, event) /* Check if press occurred outside the edit widget. */ GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); retval = gdk_display_get_window_at_pointer (gdpy, NULL, NULL) - != f->output_data.x->edit_widget->window; + != gtk_widget_get_window (f->output_data.x->edit_widget); } else if (f && ((event->type == ButtonRelease && event->xbutton.button < 4) @@ -3411,10 +3315,9 @@ xg_event_is_for_scrollbar (f, event) tool bar. 0 is the first button. */ static gboolean -xg_tool_bar_button_cb (widget, event, user_data) - GtkWidget *widget; - GdkEventButton *event; - gpointer user_data; +xg_tool_bar_button_cb (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data) { /* Casts to avoid warnings when gpointer is 64 bits and int is 32 bits */ gpointer ptr = (gpointer) (EMACS_INT) event->state; @@ -3429,9 +3332,7 @@ xg_tool_bar_button_cb (widget, event, user_data) tool bar. 0 is the first button. */ static void -xg_tool_bar_callback (w, client_data) - GtkWidget *w; - gpointer client_data; +xg_tool_bar_callback (GtkWidget *w, gpointer client_data) { /* The EMACS_INT cast avoids a warning. */ int idx = (int) (EMACS_INT) client_data; @@ -3480,9 +3381,7 @@ xg_tool_bar_callback (w, client_data) tool bar. 0 is the first button. */ static void -xg_tool_bar_proxy_callback (w, client_data) - GtkWidget *w; - gpointer client_data; +xg_tool_bar_proxy_callback (GtkWidget *w, gpointer client_data) { GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w), XG_TOOL_BAR_PROXY_BUTTON)); @@ -3491,18 +3390,17 @@ xg_tool_bar_proxy_callback (w, client_data) static gboolean -xg_tool_bar_help_callback P_ ((GtkWidget *w, - GdkEventCrossing *event, - gpointer client_data)); +xg_tool_bar_help_callback (GtkWidget *w, + GdkEventCrossing *event, + gpointer client_data); /* This callback is called when a help is to be shown for an item in the detached tool bar when the detached tool bar it is not expanded. */ static gboolean -xg_tool_bar_proxy_help_callback (w, event, client_data) - GtkWidget *w; - GdkEventCrossing *event; - gpointer client_data; +xg_tool_bar_proxy_help_callback (GtkWidget *w, + GdkEventCrossing *event, + gpointer client_data) { GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w), XG_TOOL_BAR_PROXY_BUTTON)); @@ -3510,6 +3408,17 @@ xg_tool_bar_proxy_help_callback (w, event, client_data) return xg_tool_bar_help_callback (wbutton, event, client_data); } +static GtkWidget * +xg_get_tool_bar_widgets (GtkWidget *vb, GtkWidget **wimage) +{ + GList *clist = gtk_container_get_children (GTK_CONTAINER (vb)); + GtkWidget *c1 = (GtkWidget *) clist->data; + GtkWidget *c2 = (GtkWidget *) clist->next->data; + *wimage = GTK_IS_IMAGE (c1) ? c1 : c2; + g_list_free (clist); + return GTK_IS_LABEL (c1) ? c1 : c2; +} + /* This callback is called when a tool item should create a proxy item, such as for the overflow menu. Also called when the tool bar is detached. @@ -3517,24 +3426,19 @@ xg_tool_bar_proxy_help_callback (w, event, client_data) blank. */ static gboolean -xg_tool_bar_menu_proxy (toolitem, user_data) - GtkToolItem *toolitem; - gpointer user_data; +xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data) { GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (toolitem)); GtkButton *wbutton = GTK_BUTTON (gtk_bin_get_child (GTK_BIN (weventbox))); - GtkBox *vb = GTK_BOX (gtk_bin_get_child (GTK_BIN (wbutton))); - GtkBoxChild *c1 = (GtkBoxChild *) vb->children->data; - GtkBoxChild *c2 = (GtkBoxChild *) vb->children->next->data; - GtkImage *wimage = GTK_IS_IMAGE (c1->widget) - ? GTK_IMAGE (c1->widget) : GTK_IMAGE (c2->widget); - GtkLabel *wlbl = GTK_IS_LABEL (c1->widget) - ? GTK_LABEL (c1->widget) : GTK_LABEL (c2->widget); + GtkWidget *vb = gtk_bin_get_child (GTK_BIN (wbutton)); + GtkWidget *c1; + GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1)); + GtkImage *wimage = GTK_IMAGE (c1); GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label (gtk_label_get_text (wlbl)); - GtkWidget *wmenuimage; + if (gtk_button_get_use_stock (wbutton)) wmenuimage = gtk_image_new_from_stock (gtk_button_get_label (wbutton), GTK_ICON_SIZE_MENU); @@ -3605,7 +3509,8 @@ xg_tool_bar_menu_proxy (toolitem, user_data) g_object_set_data (G_OBJECT (wmenuitem), XG_TOOL_BAR_PROXY_BUTTON, (gpointer) wbutton); gtk_tool_item_set_proxy_menu_item (toolitem, "Emacs toolbar item", wmenuitem); - gtk_widget_set_sensitive (wmenuitem, GTK_WIDGET_SENSITIVE (wbutton)); + gtk_widget_set_sensitive (wmenuitem, + gtk_widget_get_sensitive (GTK_WIDGET (wbutton))); /* Use enter/leave notify to show help. We use the events rather than the GtkButton specific signals "enter" and @@ -3631,10 +3536,9 @@ xg_tool_bar_menu_proxy (toolitem, user_data) CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ static void -xg_tool_bar_detach_callback (wbox, w, client_data) - GtkHandleBox *wbox; - GtkWidget *w; - gpointer client_data; +xg_tool_bar_detach_callback (GtkHandleBox *wbox, + GtkWidget *w, + gpointer client_data) { FRAME_PTR f = (FRAME_PTR) client_data; extern int x_gtk_whole_detached_tool_bar; @@ -3662,10 +3566,9 @@ xg_tool_bar_detach_callback (wbox, w, client_data) CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ static void -xg_tool_bar_attach_callback (wbox, w, client_data) - GtkHandleBox *wbox; - GtkWidget *w; - gpointer client_data; +xg_tool_bar_attach_callback (GtkHandleBox *wbox, + GtkWidget *w, + gpointer client_data) { FRAME_PTR f = (FRAME_PTR) client_data; g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL); @@ -3692,10 +3595,9 @@ xg_tool_bar_attach_callback (wbox, w, client_data) Returns FALSE to tell GTK to keep processing this event. */ static gboolean -xg_tool_bar_help_callback (w, event, client_data) - GtkWidget *w; - GdkEventCrossing *event; - gpointer client_data; +xg_tool_bar_help_callback (GtkWidget *w, + GdkEventCrossing *event, + gpointer client_data) { /* The EMACS_INT cast avoids a warning. */ int idx = (int) (EMACS_INT) client_data; @@ -3734,10 +3636,9 @@ xg_tool_bar_help_callback (w, event, client_data) Returns FALSE to tell GTK to keep processing this event. */ static gboolean -xg_tool_bar_item_expose_callback (w, event, client_data) - GtkWidget *w; - GdkEventExpose *event; - gpointer client_data; +xg_tool_bar_item_expose_callback (GtkWidget *w, + GdkEventExpose *event, + gpointer client_data) { gint width, height; @@ -3758,8 +3659,7 @@ xg_tool_bar_item_expose_callback (w, event, client_data) /* Attach a tool bar to frame F. */ static void -xg_pack_tool_bar (f) - FRAME_PTR f; +xg_pack_tool_bar (FRAME_PTR f) { struct x_output *x = f->output_data.x; int vbox_pos = x->menubar_widget ? 1 : 0; @@ -3784,10 +3684,16 @@ xg_pack_tool_bar (f) } /* Create a tool bar for frame F. */ +#ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION +#define toolbar_set_orientation(w, o) \ + gtk_orientable_set_orientation (GTK_ORIENTABLE (w), o) +#else +#define toolbar_set_orientation(w, o) \ + gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o) +#endif static void -xg_create_tool_bar (f) - FRAME_PTR f; +xg_create_tool_bar (FRAME_PTR f) { struct x_output *x = f->output_data.x; @@ -3797,7 +3703,7 @@ xg_create_tool_bar (f) gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar"); gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS); - gtk_toolbar_set_orientation (GTK_TOOLBAR (x->toolbar_widget), + toolbar_set_orientation (x->toolbar_widget, GTK_ORIENTATION_HORIZONTAL); } @@ -3808,10 +3714,7 @@ xg_create_tool_bar (f) Returns IMAGE if RTL is not found. */ static Lisp_Object -find_rtl_image (f, image, rtl) - FRAME_PTR f; - Lisp_Object image; - Lisp_Object rtl; +find_rtl_image (FRAME_PTR f, Lisp_Object image, Lisp_Object rtl) { int i; Lisp_Object file, rtl_name; @@ -3852,9 +3755,9 @@ xg_make_tool_item (FRAME_PTR f, GtkWidget *weventbox = gtk_event_box_new (); if (wimage) - gtk_box_pack_start_defaults (GTK_BOX (vb), wimage); + gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0); - gtk_box_pack_start_defaults (GTK_BOX (vb), gtk_label_new (label)); + gtk_box_pack_start (GTK_BOX (vb), gtk_label_new (label), TRUE, TRUE, 0); gtk_button_set_focus_on_click (GTK_BUTTON (wb), FALSE); gtk_button_set_relief (GTK_BUTTON (wb), GTK_RELIEF_NONE); gtk_container_add (GTK_CONTAINER (wb), vb); @@ -3924,13 +3827,9 @@ xg_show_toolbar_item (GtkToolItem *ti) GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti)); GtkWidget *wbutton = gtk_bin_get_child (GTK_BIN (weventbox)); - GtkBox *vb = GTK_BOX (gtk_bin_get_child (GTK_BIN (wbutton))); - GtkBoxChild *c1 = (GtkBoxChild *) vb->children->data; - GtkBoxChild *c2 = (GtkBoxChild *) vb->children->next->data; - GtkWidget *wimage = GTK_IS_IMAGE (c1->widget) - ? c1->widget : c2->widget; - GtkWidget *wlbl = GTK_IS_LABEL (c1->widget) - ? c1->widget : c2->widget; + GtkWidget *vb = gtk_bin_get_child (GTK_BIN (wbutton)); + GtkWidget *wimage; + GtkWidget *wlbl = xg_get_tool_bar_widgets (vb, &wimage); GtkWidget *new_box = NULL; if (GTK_IS_VBOX (vb) && horiz) @@ -3939,17 +3838,17 @@ xg_show_toolbar_item (GtkToolItem *ti) new_box = gtk_vbox_new (FALSE, 0); if (new_box) { - gtk_widget_ref (wimage); - gtk_widget_ref (wlbl); + g_object_ref (G_OBJECT (wimage)); + g_object_ref (G_OBJECT (wlbl)); gtk_container_remove (GTK_CONTAINER (vb), wimage); gtk_container_remove (GTK_CONTAINER (vb), wlbl); gtk_widget_destroy (GTK_WIDGET (vb)); - gtk_box_pack_start_defaults (GTK_BOX (new_box), wimage); - gtk_box_pack_start_defaults (GTK_BOX (new_box), wlbl); + gtk_box_pack_start (GTK_BOX (new_box), wimage, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (new_box), wlbl, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (wbutton), new_box); - gtk_widget_unref (wimage); - gtk_widget_unref (wlbl); - vb = GTK_BOX (new_box); + g_object_unref (G_OBJECT (wimage)); + g_object_unref (G_OBJECT (wlbl)); + vb = new_box; } if (show_label) gtk_widget_show (wlbl); @@ -3968,8 +3867,7 @@ xg_show_toolbar_item (GtkToolItem *ti) extern Lisp_Object Qx_gtk_map_stock; void -update_frame_tool_bar (f) - FRAME_PTR f; +update_frame_tool_bar (FRAME_PTR f) { int i; GtkRequisition old_req, new_req; @@ -4033,7 +3931,6 @@ update_frame_tool_bar (f) GtkWidget *wbutton = NULL; GtkWidget *weventbox; Lisp_Object specified_file; - Lisp_Object lbl = PROP (TOOL_BAR_ITEM_LABEL); char *label = SSDATA (PROP (TOOL_BAR_ITEM_LABEL)); ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i); @@ -4165,13 +4062,9 @@ update_frame_tool_bar (f) } else { - GtkBox *vb = GTK_BOX (gtk_bin_get_child (GTK_BIN (wbutton))); - GtkBoxChild *c1 = (GtkBoxChild *) vb->children->data; - GtkBoxChild *c2 = (GtkBoxChild *) vb->children->next->data; - GtkWidget *wimage = GTK_IS_IMAGE (c1->widget) - ? c1->widget : c2->widget; - GtkWidget *wlbl = GTK_IS_LABEL (c1->widget) - ? c1->widget : c2->widget; + GtkWidget *vb = gtk_bin_get_child (GTK_BIN (wbutton)); + GtkWidget *wimage; + GtkWidget *wlbl = xg_get_tool_bar_widgets (vb, &wimage); Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA); @@ -4208,7 +4101,8 @@ update_frame_tool_bar (f) } else if (img && old_img != img->pixmap) { - (void) xg_get_image_for_pixmap (f, img, x->widget, wimage); + (void) xg_get_image_for_pixmap (f, img, x->widget, + GTK_IMAGE (wimage)); g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA, (gpointer)img->pixmap); @@ -4254,8 +4148,7 @@ update_frame_tool_bar (f) Remove the tool bar. */ void -free_frame_tool_bar (f) - FRAME_PTR f; +free_frame_tool_bar (FRAME_PTR f) { struct x_output *x = f->output_data.x; @@ -4286,7 +4179,7 @@ free_frame_tool_bar (f) Initializing ***********************************************************************/ void -xg_initialize () +xg_initialize (void) { GtkBindingSet *binding_set; diff --git a/src/gtkutil.h b/src/gtkutil.h index 602228f97be..14693650de5 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h @@ -38,7 +38,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Key for data that menu items hold. */ #define XG_ITEM_DATA "emacs_menuitem" - /* Button types in menus. */ enum button_type { @@ -119,94 +118,95 @@ typedef struct _widget_value struct _widget_value *free_list; } widget_value; -#ifdef HAVE_GTK_FILE_BOTH +#ifdef HAVE_GTK_FILE_SELECTION_NEW extern int use_old_gtk_file_dialog; #endif -extern widget_value *malloc_widget_value P_ ((void)); -extern void free_widget_value P_ ((widget_value *)); +extern widget_value *malloc_widget_value (void); +extern void free_widget_value (widget_value *); -extern int xg_uses_old_file_dialog P_ ((void)); +extern int xg_uses_old_file_dialog (void); -extern char *xg_get_file_name P_ ((FRAME_PTR f, - char *prompt, - char *default_filename, - int mustmatch_p, - int only_dir_p)); +extern char *xg_get_file_name (FRAME_PTR f, + char *prompt, + char *default_filename, + int mustmatch_p, + int only_dir_p); -extern char *xg_get_font_name P_ ((FRAME_PTR f, char *)); +extern char *xg_get_font_name (FRAME_PTR f, char *); -extern GtkWidget *xg_create_widget P_ ((char *type, - char *name, - FRAME_PTR f, - widget_value *val, - GCallback select_cb, - GCallback deactivate_cb, - GCallback hightlight_cb)); +extern GtkWidget *xg_create_widget (char *type, + char *name, + FRAME_PTR f, + widget_value *val, + GCallback select_cb, + GCallback deactivate_cb, + GCallback hightlight_cb); -extern void xg_modify_menubar_widgets P_ ((GtkWidget *menubar, - FRAME_PTR f, - widget_value *val, - int deep_p, - GCallback select_cb, - GCallback deactivate_cb, - GCallback hightlight_cb)); +extern void xg_modify_menubar_widgets (GtkWidget *menubar, + FRAME_PTR f, + widget_value *val, + int deep_p, + GCallback select_cb, + GCallback deactivate_cb, + GCallback hightlight_cb); -extern int xg_update_frame_menubar P_ ((FRAME_PTR f)); +extern int xg_update_frame_menubar (FRAME_PTR f); -extern int xg_have_tear_offs P_ ((void)); +extern int xg_event_is_for_menubar (FRAME_PTR f, XEvent *event); -extern int xg_get_scroll_id_for_window P_ ((Display *dpy, Window wid)); +extern int xg_have_tear_offs (void); -extern void xg_create_scroll_bar P_ ((FRAME_PTR f, - struct scroll_bar *bar, - GCallback scroll_callback, - GCallback end_callback, - char *scroll_bar_name)); -extern void xg_show_scroll_bar P_ ((int scrollbar_id)); -extern void xg_remove_scroll_bar P_ ((FRAME_PTR f, int scrollbar_id)); +extern int xg_get_scroll_id_for_window (Display *dpy, Window wid); -extern void xg_update_scrollbar_pos P_ ((FRAME_PTR f, - int scrollbar_id, - int top, - int left, - int width, - int height)); +extern void xg_create_scroll_bar (FRAME_PTR f, + struct scroll_bar *bar, + GCallback scroll_callback, + GCallback end_callback, + char *scroll_bar_name); +extern void xg_remove_scroll_bar (FRAME_PTR f, int scrollbar_id); -extern void xg_set_toolkit_scroll_bar_thumb P_ ((struct scroll_bar *bar, - int portion, - int position, - int whole)); -extern int xg_event_is_for_scrollbar P_ ((FRAME_PTR f, XEvent *event)); +extern void xg_update_scrollbar_pos (FRAME_PTR f, + int scrollbar_id, + int top, + int left, + int width, + int height); -extern void update_frame_tool_bar P_ ((FRAME_PTR f)); -extern void free_frame_tool_bar P_ ((FRAME_PTR f)); +extern void xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, + int portion, + int position, + int whole); +extern int xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event); -extern void xg_frame_resized P_ ((FRAME_PTR f, - int pixelwidth, - int pixelheight)); -extern void xg_frame_set_char_size P_ ((FRAME_PTR f, int cols, int rows)); -extern GtkWidget * xg_win_to_widget P_ ((Display *dpy, Window wdesc)); +extern void update_frame_tool_bar (FRAME_PTR f); +extern void free_frame_tool_bar (FRAME_PTR f); -extern int xg_display_open P_ ((char *display_name, Display **dpy)); -extern void xg_display_close P_ ((Display *dpy)); -extern GdkCursor * xg_create_default_cursor P_ ((Display *dpy)); +extern void xg_frame_resized (FRAME_PTR f, + int pixelwidth, + int pixelheight); +extern void xg_frame_set_char_size (FRAME_PTR f, int cols, int rows); +extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc); -extern int xg_create_frame_widgets P_ ((FRAME_PTR f)); -extern void x_wm_set_size_hint P_ ((FRAME_PTR f, - long flags, - int user_position)); -extern void xg_set_background_color P_ ((FRAME_PTR f, unsigned long bg)); +extern void xg_display_open (char *display_name, Display **dpy); +extern void xg_display_close (Display *dpy); +extern GdkCursor * xg_create_default_cursor (Display *dpy); -extern void xg_set_frame_icon P_ ((FRAME_PTR f, - Pixmap icon_pixmap, - Pixmap icon_mask)); +extern int xg_create_frame_widgets (FRAME_PTR f); +extern void x_wm_set_size_hint (FRAME_PTR f, + long flags, + int user_position); +extern void xg_set_background_color (FRAME_PTR f, unsigned long bg); + +extern void xg_set_frame_icon (FRAME_PTR f, + Pixmap icon_pixmap, + Pixmap icon_mask); /* Mark all callback data that are Lisp_object:s during GC. */ -extern void xg_mark_data P_ ((void)); +extern void xg_mark_data (void); /* Initialize GTK specific parts. */ -extern void xg_initialize P_ ((void)); +extern void xg_initialize (void); /* Setting scrollbar values invokes the callback. Use this variable to indicate that the callback should do nothing. */ diff --git a/src/image.c b/src/image.c index 67c228cbc7f..2ea70e221cf 100644 --- a/src/image.c +++ b/src/image.c @@ -127,16 +127,16 @@ typedef struct ns_bitmap_record Bitmap_Record; Lisp_Object Vx_bitmap_file_path; -static void x_disable_image P_ ((struct frame *, struct image *)); -static void x_edge_detection P_ ((struct frame *, struct image *, Lisp_Object, - Lisp_Object)); +static void x_disable_image (struct frame *, struct image *); +static void x_edge_detection (struct frame *, struct image *, Lisp_Object, + Lisp_Object); -static void init_color_table P_ ((void)); -static unsigned long lookup_rgb_color P_ ((struct frame *f, int r, int g, int b)); +static void init_color_table (void); +static unsigned long lookup_rgb_color (struct frame *f, int r, int g, int b); #ifdef COLOR_TABLE_SUPPORT -static void free_color_table P_ ((void)); -static unsigned long *colors_in_color_table P_ ((int *n)); -static unsigned long lookup_pixel_color P_ ((struct frame *f, unsigned long p)); +static void free_color_table (void); +static unsigned long *colors_in_color_table (int *n); +static unsigned long lookup_pixel_color (struct frame *f, unsigned long p); #endif /* Code to deal with bitmaps. Bitmaps are referenced by their bitmap @@ -157,7 +157,7 @@ XGetImage (Display *display, Pixmap pixmap, int x, int y, unsigned long plane_mask, int format) { /* TODO: not sure what this function is supposed to do.. */ - ns_retain_object(pixmap); + ns_retain_object (pixmap); return pixmap; } @@ -165,7 +165,7 @@ XGetImage (Display *display, Pixmap pixmap, int x, int y, unsigned long XGetPixel (XImagePtr ximage, int x, int y) { - return ns_get_pixel(ximage, x, y); + return ns_get_pixel (ximage, x, y); } /* use with imgs created by ns_image_for_XPM; alpha set to 1; @@ -173,7 +173,7 @@ XGetPixel (XImagePtr ximage, int x, int y) void XPutPixel (XImagePtr ximage, int x, int y, unsigned long pixel) { - ns_put_pixel(ximage, x, y, pixel); + ns_put_pixel (ximage, x, y, pixel); } #endif /* HAVE_NS */ @@ -181,26 +181,20 @@ XPutPixel (XImagePtr ximage, int x, int y, unsigned long pixel) /* Functions to access the contents of a bitmap, given an id. */ int -x_bitmap_height (f, id) - FRAME_PTR f; - int id; +x_bitmap_height (FRAME_PTR f, int id) { return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].height; } int -x_bitmap_width (f, id) - FRAME_PTR f; - int id; +x_bitmap_width (FRAME_PTR f, int id) { return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].width; } #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) int -x_bitmap_pixmap (f, id) - FRAME_PTR f; - int id; +x_bitmap_pixmap (FRAME_PTR f, int id) { return (int) FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; } @@ -208,9 +202,7 @@ x_bitmap_pixmap (f, id) #ifdef HAVE_X_WINDOWS int -x_bitmap_mask (f, id) - FRAME_PTR f; - int id; +x_bitmap_mask (FRAME_PTR f, int id) { return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].mask; } @@ -219,8 +211,7 @@ x_bitmap_mask (f, id) /* Allocate a new bitmap record. Returns index of new record. */ static int -x_allocate_bitmap_record (f) - FRAME_PTR f; +x_allocate_bitmap_record (FRAME_PTR f) { Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); int i; @@ -251,9 +242,7 @@ x_allocate_bitmap_record (f) /* Add one reference to the reference count of the bitmap with id ID. */ void -x_reference_bitmap (f, id) - FRAME_PTR f; - int id; +x_reference_bitmap (FRAME_PTR f, int id) { ++FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].refcount; } @@ -261,10 +250,7 @@ x_reference_bitmap (f, id) /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */ int -x_create_bitmap_from_data (f, bits, width, height) - struct frame *f; - char *bits; - unsigned int width, height; +x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsigned int height) { Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); int id; @@ -288,7 +274,7 @@ x_create_bitmap_from_data (f, bits, width, height) #endif /* HAVE_NTGUI */ #ifdef HAVE_NS - void *bitmap = ns_image_from_XBM(bits, width, height); + void *bitmap = ns_image_from_XBM (bits, width, height); if (!bitmap) return -1; #endif @@ -323,9 +309,7 @@ x_create_bitmap_from_data (f, bits, width, height) /* Create bitmap from file FILE for frame F. */ int -x_create_bitmap_from_file (f, file) - struct frame *f; - Lisp_Object file; +x_create_bitmap_from_file (struct frame *f, Lisp_Object file) { Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); @@ -335,7 +319,7 @@ x_create_bitmap_from_file (f, file) #ifdef HAVE_NS int id; - void *bitmap = ns_image_from_file(file); + void *bitmap = ns_image_from_file (file); if (!bitmap) return -1; @@ -346,8 +330,8 @@ x_create_bitmap_from_file (f, file) dpyinfo->bitmaps[id - 1].refcount = 1; dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (SBYTES (file) + 1); dpyinfo->bitmaps[id - 1].depth = 1; - dpyinfo->bitmaps[id - 1].height = ns_image_width(bitmap); - dpyinfo->bitmaps[id - 1].width = ns_image_height(bitmap); + dpyinfo->bitmaps[id - 1].height = ns_image_width (bitmap); + dpyinfo->bitmaps[id - 1].width = ns_image_height (bitmap); strcpy (dpyinfo->bitmaps[id - 1].file, SDATA (file)); return id; #endif @@ -402,9 +386,7 @@ x_create_bitmap_from_file (f, file) /* Free bitmap B. */ static void -free_bitmap_record (dpyinfo, bm) - Display_Info *dpyinfo; - Bitmap_Record *bm; +free_bitmap_record (Display_Info *dpyinfo, Bitmap_Record *bm) { #ifdef HAVE_X_WINDOWS XFreePixmap (dpyinfo->display, bm->pixmap); @@ -417,7 +399,7 @@ free_bitmap_record (dpyinfo, bm) #endif /* HAVE_NTGUI */ #ifdef HAVE_NS - ns_release_object(bm->img); + ns_release_object (bm->img); #endif if (bm->file) @@ -430,9 +412,7 @@ free_bitmap_record (dpyinfo, bm) /* Remove reference to bitmap with id number ID. */ void -x_destroy_bitmap (f, id) - FRAME_PTR f; - int id; +x_destroy_bitmap (FRAME_PTR f, int id) { Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); @@ -452,8 +432,7 @@ x_destroy_bitmap (f, id) /* Free all the bitmaps for the display specified by DPYINFO. */ void -x_destroy_all_bitmaps (dpyinfo) - Display_Info *dpyinfo; +x_destroy_all_bitmaps (Display_Info *dpyinfo) { int i; Bitmap_Record *bm = dpyinfo->bitmaps; @@ -471,25 +450,23 @@ x_destroy_all_bitmaps (dpyinfo) /* Useful functions defined in the section `Image type independent image structures' below. */ -static unsigned long four_corners_best P_ ((XImagePtr ximg, - int *corners, - unsigned long width, - unsigned long height)); +static unsigned long four_corners_best (XImagePtr ximg, + int *corners, + unsigned long width, + unsigned long height); -static int x_create_x_image_and_pixmap P_ ((struct frame *f, int width, int height, - int depth, XImagePtr *ximg, - Pixmap *pixmap)); +static int x_create_x_image_and_pixmap (struct frame *f, int width, int height, + int depth, XImagePtr *ximg, + Pixmap *pixmap); -static void x_destroy_x_image P_ ((XImagePtr ximg)); +static void x_destroy_x_image (XImagePtr ximg); /* Create a mask of a bitmap. Note is this not a perfect mask. It's nicer with some borders in this context */ int -x_create_bitmap_mask (f, id) - struct frame *f; - int id; +x_create_bitmap_mask (struct frame *f, int id) { Pixmap pixmap, mask; XImagePtr ximg, mask_img; @@ -619,13 +596,13 @@ Lisp_Object Vimage_cache_eviction_delay; /* Function prototypes. */ -static Lisp_Object define_image_type P_ ((struct image_type *type, int loaded)); -static struct image_type *lookup_image_type P_ ((Lisp_Object symbol)); -static void image_error P_ ((char *format, Lisp_Object, Lisp_Object)); -static void x_laplace P_ ((struct frame *, struct image *)); -static void x_emboss P_ ((struct frame *, struct image *)); -static int x_build_heuristic_mask P_ ((struct frame *, struct image *, - Lisp_Object)); +static Lisp_Object define_image_type (struct image_type *type, int loaded); +static struct image_type *lookup_image_type (Lisp_Object symbol); +static void image_error (char *format, Lisp_Object, Lisp_Object); +static void x_laplace (struct frame *, struct image *); +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) \ do { Vimage_type_cache = Fcons (Fcons (type, status), Vimage_type_cache); } while (0) @@ -637,9 +614,7 @@ static int x_build_heuristic_mask P_ ((struct frame *, struct image *, image_types and caches the loading status of TYPE. */ static Lisp_Object -define_image_type (type, loaded) - struct image_type *type; - int loaded; +define_image_type (struct image_type *type, int loaded) { Lisp_Object success; @@ -650,7 +625,7 @@ define_image_type (type, loaded) /* Make a copy of TYPE to avoid a bus error in a dumped Emacs. The initialized data segment is read-only. */ struct image_type *p = (struct image_type *) xmalloc (sizeof *p); - bcopy (type, p, sizeof *p); + memcpy (p, type, sizeof *p); p->next = image_types; image_types = p; success = Qt; @@ -665,8 +640,7 @@ define_image_type (type, loaded) structure. Value is null if SYMBOL is not a known image type. */ static INLINE struct image_type * -lookup_image_type (symbol) - Lisp_Object symbol; +lookup_image_type (Lisp_Object symbol) { struct image_type *type; @@ -690,8 +664,7 @@ lookup_image_type (symbol) image type. */ int -valid_image_p (object) - Lisp_Object object; +valid_image_p (Lisp_Object object) { int valid_p = 0; @@ -726,9 +699,7 @@ valid_image_p (object) therefore simply displays a message. */ static void -image_error (format, arg1, arg2) - char *format; - Lisp_Object arg1, arg2; +image_error (char *format, Lisp_Object arg1, Lisp_Object arg2) { add_to_log (format, arg1, arg2); } @@ -776,9 +747,9 @@ struct image_keyword }; -static int parse_image_spec P_ ((Lisp_Object, struct image_keyword *, - int, Lisp_Object)); -static Lisp_Object image_spec_value P_ ((Lisp_Object, Lisp_Object, int *)); +static int parse_image_spec (Lisp_Object, struct image_keyword *, + int, Lisp_Object); +static Lisp_Object image_spec_value (Lisp_Object, Lisp_Object, int *); /* Parse image spec SPEC according to KEYWORDS. A valid image spec @@ -788,11 +759,8 @@ static Lisp_Object image_spec_value P_ ((Lisp_Object, Lisp_Object, int *)); allowed keyword/value pairs. Value is non-zero if SPEC is valid. */ static int -parse_image_spec (spec, keywords, nkeywords, type) - Lisp_Object spec; - struct image_keyword *keywords; - int nkeywords; - Lisp_Object type; +parse_image_spec (Lisp_Object spec, struct image_keyword *keywords, + int nkeywords, Lisp_Object type) { int i; Lisp_Object plist; @@ -928,9 +896,7 @@ parse_image_spec (spec, keywords, nkeywords, type) to 1 if KEY was found in SPEC, set it to 0 otherwise. */ static Lisp_Object -image_spec_value (spec, key, found) - Lisp_Object spec, key; - int *found; +image_spec_value (Lisp_Object spec, Lisp_Object key, int *found) { Lisp_Object tail; @@ -960,8 +926,7 @@ 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; + (Lisp_Object spec, Lisp_Object pixels, Lisp_Object frame) { Lisp_Object size; @@ -991,8 +956,7 @@ 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. */) - (spec, frame) - Lisp_Object spec, frame; + (Lisp_Object spec, Lisp_Object frame) { Lisp_Object mask; @@ -1015,8 +979,7 @@ 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. */) - (spec, frame) - Lisp_Object spec, frame; + (Lisp_Object spec, Lisp_Object frame) { Lisp_Object ext; @@ -1037,9 +1000,9 @@ 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)); -static int check_image_size P_ ((struct frame *f, int width, int height)); +static struct image *make_image (Lisp_Object spec, unsigned hash); +static void free_image (struct frame *f, struct image *img); +static int check_image_size (struct frame *f, int width, int height); #define MAX_IMAGE_SIZE 6.0 Lisp_Object Vmax_image_size; @@ -1048,15 +1011,13 @@ Lisp_Object Vmax_image_size; SPEC. SPEC has a hash value of HASH. */ static struct image * -make_image (spec, hash) - Lisp_Object spec; - unsigned hash; +make_image (Lisp_Object spec, unsigned int hash) { struct image *img = (struct image *) xmalloc (sizeof *img); Lisp_Object file = image_spec_value (spec, QCfile, NULL); xassert (valid_image_p (spec)); - bzero (img, sizeof *img); + memset (img, 0, sizeof *img); img->dependencies = NILP (file) ? Qnil : list1 (file); img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL)); xassert (img->type != NULL); @@ -1072,9 +1033,7 @@ make_image (spec, hash) /* Free image IMG which was used on frame F, including its resources. */ static void -free_image (f, img) - struct frame *f; - struct image *img; +free_image (struct frame *f, struct image *img) { if (img) { @@ -1094,6 +1053,10 @@ free_image (f, img) /* Free resources, then free IMG. */ img->type->free (f, img); xfree (img); + + /* As display glyphs may still be referring to the image ID, we + must garbage the frame (Bug#6426). */ + SET_FRAME_GARBAGED (f); } } @@ -1101,10 +1064,7 @@ free_image (f, img) otherwise, return 0. */ int -check_image_size (f, width, height) - struct frame *f; - int width; - int height; +check_image_size (struct frame *f, int width, int height) { int w, h; @@ -1135,9 +1095,7 @@ check_image_size (f, width, height) drawing an image. */ void -prepare_image_for_display (f, img) - struct frame *f; - struct image *img; +prepare_image_for_display (struct frame *f, struct image *img) { EMACS_TIME t; @@ -1157,10 +1115,7 @@ prepare_image_for_display (f, img) drawn in face FACE. */ int -image_ascent (img, face, slice) - struct image *img; - struct face *face; - struct glyph_slice *slice; +image_ascent (struct image *img, struct face *face, struct glyph_slice *slice) { int height; int ascent; @@ -1206,10 +1161,8 @@ image_ascent (img, face, slice) On W32, XIMG is assumed to a device context with the bitmap selected. */ static RGB_PIXEL_COLOR -four_corners_best (ximg, corners, width, height) - XImagePtr_or_DC ximg; - int *corners; - unsigned long width, height; +four_corners_best (XImagePtr_or_DC ximg, int *corners, + unsigned long width, unsigned long height) { RGB_PIXEL_COLOR corner_pixels[4], best; int i, best_count; @@ -1259,10 +1212,10 @@ four_corners_best (ximg, corners, width, height) #elif defined (HAVE_NS) #define Destroy_Image(ximg, dummy) \ - ns_release_object(ximg) + ns_release_object (ximg) #define Free_Pixmap(display, pixmap) \ - ns_release_object(pixmap) + ns_release_object (pixmap) #else @@ -1281,10 +1234,7 @@ four_corners_best (ximg, corners, width, height) use for the heuristic. */ RGB_PIXEL_COLOR -image_background (img, f, ximg) - struct image *img; - struct frame *f; - XImagePtr_or_DC ximg; +image_background (struct image *img, struct frame *f, XImagePtr_or_DC ximg) { if (! img->background_valid) /* IMG doesn't have a background yet, try to guess a reasonable value. */ @@ -1323,10 +1273,7 @@ image_background (img, f, ximg) existing XImage object to use for the heuristic. */ int -image_background_transparent (img, f, mask) - struct image *img; - struct frame *f; - XImagePtr_or_DC mask; +image_background_transparent (struct image *img, struct frame *f, XImagePtr_or_DC mask) { if (! img->background_transparent_valid) /* IMG doesn't have a background yet, try to guess a reasonable value. */ @@ -1371,13 +1318,13 @@ 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)); -static void x_clear_image P_ ((struct frame *f, struct image *img)); -static unsigned long x_alloc_image_color P_ ((struct frame *f, - struct image *img, - Lisp_Object color_name, - unsigned long dflt)); +static void x_clear_image_1 (struct frame *, struct image *, int, + int, int); +static void x_clear_image (struct frame *f, struct image *img); +static unsigned long x_alloc_image_color (struct frame *f, + struct image *img, + Lisp_Object color_name, + unsigned long dflt); /* Clear X resources of image IMG on frame F. PIXMAP_P non-zero means @@ -1386,10 +1333,8 @@ static unsigned long x_alloc_image_color P_ ((struct frame *f, the image, if any. */ static void -x_clear_image_1 (f, img, pixmap_p, mask_p, colors_p) - struct frame *f; - struct image *img; - int pixmap_p, mask_p, colors_p; +x_clear_image_1 (struct frame *f, struct image *img, int pixmap_p, int mask_p, + int colors_p) { if (pixmap_p && img->pixmap) { @@ -1422,9 +1367,7 @@ x_clear_image_1 (f, img, pixmap_p, mask_p, colors_p) /* Free X resources of image IMG which is used on frame F. */ static void -x_clear_image (f, img) - struct frame *f; - struct image *img; +x_clear_image (struct frame *f, struct image *img) { BLOCK_INPUT; x_clear_image_1 (f, img, 1, 1, 1); @@ -1438,11 +1381,8 @@ x_clear_image (f, img) color. */ static unsigned long -x_alloc_image_color (f, img, color_name, dflt) - struct frame *f; - struct image *img; - Lisp_Object color_name; - unsigned long dflt; +x_alloc_image_color (struct frame *f, struct image *img, Lisp_Object color_name, + unsigned long dflt) { XColor color; unsigned long result; @@ -1472,25 +1412,25 @@ 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)); -static void postprocess_image P_ ((struct frame *, struct image *)); +static struct image *search_image_cache (struct frame *, Lisp_Object, unsigned); +static void cache_image (struct frame *f, struct image *img); +static void postprocess_image (struct frame *, struct image *); /* Return a new, initialized image cache that is allocated from the heap. Call free_image_cache to free an image cache. */ struct image_cache * -make_image_cache () +make_image_cache (void) { struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c); int size; - bzero (c, sizeof *c); + memset (c, 0, sizeof *c); c->size = 50; c->images = (struct image **) xmalloc (c->size * sizeof *c->images); size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; c->buckets = (struct image **) xmalloc (size); - bzero (c->buckets, size); + memset (c->buckets, 0, size); return c; } @@ -1498,10 +1438,7 @@ make_image_cache () /* Find an image matching SPEC in the cache, and return it. If no image is found, return NULL. */ static struct image * -search_image_cache (f, spec, hash) - struct frame *f; - Lisp_Object spec; - unsigned hash; +search_image_cache (struct frame *f, Lisp_Object spec, unsigned int hash) { struct image *img; struct image_cache *c = FRAME_IMAGE_CACHE (f); @@ -1534,9 +1471,7 @@ search_image_cache (f, spec, hash) /* Search frame F for an image with spec SPEC, and free it. */ static void -uncache_image (f, spec) - struct frame *f; - Lisp_Object spec; +uncache_image (struct frame *f, Lisp_Object spec) { struct image *img = search_image_cache (f, spec, sxhash (spec, 0)); if (img) @@ -1548,8 +1483,7 @@ uncache_image (f, spec) caches. */ void -free_image_cache (f) - struct frame *f; +free_image_cache (struct frame *f) { struct image_cache *c = FRAME_IMAGE_CACHE (f); if (c) @@ -1677,8 +1611,7 @@ 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; + (Lisp_Object filter) { if (!(EQ (filter, Qnil) || FRAMEP (filter))) clear_image_caches (filter); @@ -1698,8 +1631,7 @@ current contents of that file. FRAME nil or omitted means use the selected frame. FRAME t means refresh the image on all frames. */) - (spec, frame) - Lisp_Object spec, frame; + (Lisp_Object spec, Lisp_Object frame) { if (!valid_image_p (spec)) error ("Invalid image specification"); @@ -1725,9 +1657,7 @@ FRAME t means refresh the image on all frames. */) by the image's specification, */ static void -postprocess_image (f, img) - struct frame *f; - struct image *img; +postprocess_image (struct frame *f, struct image *img) { /* Manipulation of the image's mask. */ if (img->pixmap) @@ -1800,9 +1730,7 @@ postprocess_image (f, img) SPEC must be a valid Lisp image specification (see valid_image_p). */ int -lookup_image (f, spec) - struct frame *f; - Lisp_Object spec; +lookup_image (struct frame *f, Lisp_Object spec) { struct image_cache *c; struct image *img; @@ -1922,9 +1850,7 @@ lookup_image (f, spec) /* Cache image IMG in the image cache of frame F. */ static void -cache_image (f, img) - struct frame *f; - struct image *img; +cache_image (struct frame *f, struct image *img) { struct image_cache *c = FRAME_IMAGE_CACHE (f); int i; @@ -1964,8 +1890,7 @@ cache_image (f, img) /* Mark Lisp objects in image IMG. */ static void -mark_image (img) - struct image *img; +mark_image (struct image *img) { mark_object (img->spec); mark_object (img->dependencies); @@ -2033,10 +1958,10 @@ w32_delayed_load (Lisp_Object libraries, Lisp_Object type) #endif /* HAVE_NTGUI */ -static int x_create_x_image_and_pixmap P_ ((struct frame *, int, int, int, - XImagePtr *, Pixmap *)); -static void x_destroy_x_image P_ ((XImagePtr)); -static void x_put_x_image P_ ((struct frame *, XImagePtr, Pixmap, int, int)); +static int x_create_x_image_and_pixmap (struct frame *, int, int, int, + XImagePtr *, Pixmap *); +static void x_destroy_x_image (XImagePtr); +static void x_put_x_image (struct frame *, XImagePtr, Pixmap, int, int); /* Create an XImage and a pixmap of size WIDTH x HEIGHT for use on @@ -2049,11 +1974,8 @@ static void x_put_x_image P_ ((struct frame *, XImagePtr, Pixmap, int, int)); should indicate the bit depth of the image. */ static int -x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap) - struct frame *f; - int width, height, depth; - XImagePtr *ximg; - Pixmap *pixmap; +x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth, + XImagePtr *ximg, Pixmap *pixmap) { #ifdef HAVE_X_WINDOWS Display *display = FRAME_X_DISPLAY (f); @@ -2125,8 +2047,8 @@ x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap) return 0; } - header = &((*ximg)->info.bmiHeader); - bzero (&((*ximg)->info), sizeof (BITMAPINFO)); + header = &(*ximg)->info.bmiHeader; + memset (&(*ximg)->info, 0, sizeof (BITMAPINFO)); header->biSize = sizeof (*header); header->biWidth = width; header->biHeight = -height; /* negative indicates a top-down bitmap. */ @@ -2176,7 +2098,7 @@ x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap) #endif /* HAVE_NTGUI */ #ifdef HAVE_NS - *pixmap = ns_image_for_XPM(width, height, depth); + *pixmap = ns_image_for_XPM (width, height, depth); if (*pixmap == 0) { *ximg = NULL; @@ -2192,8 +2114,7 @@ x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap) /* Destroy XImage XIMG. Free XIMG->data. */ static void -x_destroy_x_image (ximg) - XImagePtr ximg; +x_destroy_x_image (XImagePtr ximg) { xassert (interrupt_input_blocked); if (ximg) @@ -2209,7 +2130,7 @@ x_destroy_x_image (ximg) xfree (ximg); #endif /* HAVE_NTGUI */ #ifdef HAVE_NS - ns_release_object(ximg); + ns_release_object (ximg); #endif /* HAVE_NS */ } } @@ -2219,11 +2140,7 @@ x_destroy_x_image (ximg) are width and height of both the image and pixmap. */ static void -x_put_x_image (f, ximg, pixmap, width, height) - struct frame *f; - XImagePtr ximg; - Pixmap pixmap; - int width, height; +x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, int width, int height) { #ifdef HAVE_X_WINDOWS GC gc; @@ -2244,7 +2161,7 @@ x_put_x_image (f, ximg, pixmap, width, height) #ifdef HAVE_NS xassert (ximg == pixmap); - ns_retain_object(ximg); + ns_retain_object (ximg); #endif } @@ -2253,7 +2170,7 @@ x_put_x_image (f, ximg, pixmap, width, height) File Handling ***********************************************************************/ -static unsigned char *slurp_file P_ ((char *, int *)); +static unsigned char *slurp_file (char *, int *); /* Find image file FILE. Look in data-directory/images, then @@ -2261,8 +2178,7 @@ static unsigned char *slurp_file P_ ((char *, int *)); found, or nil if not found. */ Lisp_Object -x_find_image_file (file) - Lisp_Object file; +x_find_image_file (Lisp_Object file) { Lisp_Object file_found, search_path; struct gcpro gcpro1, gcpro2; @@ -2297,9 +2213,7 @@ x_find_image_file (file) occurred. *SIZE is set to the size of the file. */ static unsigned char * -slurp_file (file, size) - char *file; - int *size; +slurp_file (char *file, int *size) { FILE *fp = NULL; unsigned char *buf = NULL; @@ -2333,15 +2247,15 @@ 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)); -static int xbm_load_image P_ ((struct frame *f, struct image *img, - unsigned char *, unsigned char *)); -static int xbm_image_p P_ ((Lisp_Object object)); -static int xbm_read_bitmap_data P_ ((struct frame *f, - unsigned char *, unsigned char *, - int *, int *, unsigned char **, int)); -static int xbm_file_p P_ ((Lisp_Object)); +static int xbm_scan (unsigned char **, unsigned char *, char *, int *); +static int xbm_load (struct frame *f, struct image *img); +static int xbm_load_image (struct frame *f, struct image *img, + unsigned char *, unsigned char *); +static int xbm_image_p (Lisp_Object object); +static int xbm_read_bitmap_data (struct frame *f, + unsigned char *, unsigned char *, + int *, int *, unsigned char **, int); +static int xbm_file_p (Lisp_Object); /* Indices of image specification fields in xbm_format, below. */ @@ -2434,12 +2348,11 @@ enum xbm_token displayed is used. */ static int -xbm_image_p (object) - Lisp_Object object; +xbm_image_p (Lisp_Object object) { struct image_keyword kw[XBM_LAST]; - bcopy (xbm_format, kw, sizeof kw); + memcpy (kw, xbm_format, sizeof kw); if (!parse_image_spec (object, kw, XBM_LAST, Qxbm)) return 0; @@ -2528,10 +2441,7 @@ xbm_image_p (object) scanning a number, store its value in *IVAL. */ static int -xbm_scan (s, end, sval, ival) - unsigned char **s, *end; - char *sval; - int *ival; +xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival) { unsigned int c; @@ -2632,7 +2542,7 @@ w32_create_pixmap_from_bitmap_data (int width, int height, char *data) w1 = (width + 7) / 8; /* nb of 8bits elt in X bitmap */ w2 = ((width + 15) / 16) * 2; /* nb of 16bits elt in W32 bitmap */ bits = (unsigned char *) alloca (height * w2); - bzero (bits, height * w2); + memset (bits, 0, height * w2); for (i = 0; i < height; i++) { p = bits + i*w2; @@ -2650,10 +2560,8 @@ w32_create_pixmap_from_bitmap_data (int width, int height, char *data) } static void -convert_mono_to_color_image (f, img, foreground, background) - struct frame *f; - struct image *img; - COLORREF foreground, background; +convert_mono_to_color_image (struct frame *f, struct image *img, + COLORREF foreground, COLORREF background) { HDC hdc, old_img_dc, new_img_dc; HGDIOBJ old_prev, new_prev; @@ -2695,12 +2603,9 @@ convert_mono_to_color_image (f, img, foreground, background) static void -Create_Pixmap_From_Bitmap_Data (f, img, data, fg, bg, non_default_colors) - struct frame *f; - struct image *img; - char *data; - RGB_PIXEL_COLOR fg, bg; - int non_default_colors; +Create_Pixmap_From_Bitmap_Data (struct frame *f, struct image *img, char *data, + RGB_PIXEL_COLOR fg, RGB_PIXEL_COLOR bg, + int non_default_colors) { #ifdef HAVE_NTGUI img->pixmap @@ -2711,7 +2616,7 @@ Create_Pixmap_From_Bitmap_Data (f, img, data, fg, bg, non_default_colors) convert_mono_to_color_image (f, img, fg, bg); #elif defined (HAVE_NS) - img->pixmap = ns_image_from_XBM(data, img->width, img->height); + img->pixmap = ns_image_from_XBM (data, img->width, img->height); #else img->pixmap @@ -2736,12 +2641,9 @@ Create_Pixmap_From_Bitmap_Data (f, img, data, fg, bg, non_default_colors) invalid (the bitmap remains unread). */ static int -xbm_read_bitmap_data (f, contents, end, width, height, data, inhibit_image_error) - struct frame *f; - unsigned char *contents, *end; - int *width, *height; - unsigned char **data; - int inhibit_image_error; +xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *end, + int *width, int *height, unsigned char **data, + int inhibit_image_error) { unsigned char *s = contents; char buffer[BUFSIZ]; @@ -2890,10 +2792,8 @@ xbm_read_bitmap_data (f, contents, end, width, height, data, inhibit_image_error successful. */ static int -xbm_load_image (f, img, contents, end) - struct frame *f; - struct image *img; - unsigned char *contents, *end; +xbm_load_image (struct frame *f, struct image *img, unsigned char *contents, + unsigned char *end) { int rc; unsigned char *data; @@ -2949,8 +2849,7 @@ xbm_load_image (f, img, contents, end) /* Value is non-zero if DATA looks like an in-memory XBM file. */ static int -xbm_file_p (data) - Lisp_Object data; +xbm_file_p (Lisp_Object data) { int w, h; return (STRINGP (data) @@ -2964,9 +2863,7 @@ xbm_file_p (data) non-zero if successful. */ static int -xbm_load (f, img) - struct frame *f; - struct image *img; +xbm_load (struct frame *f, struct image *img) { int success_p = 0; Lisp_Object file_name; @@ -3018,7 +2915,7 @@ xbm_load (f, img) in_memory_file_p = xbm_file_p (data); /* Parse the image specification. */ - bcopy (xbm_format, fmt, sizeof fmt); + memcpy (fmt, xbm_format, sizeof fmt); parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm); xassert (parsed_p); @@ -3064,9 +2961,9 @@ xbm_load (f, img) { Lisp_Object line = XVECTOR (data)->contents[i]; if (STRINGP (line)) - bcopy (SDATA (line), p, nbytes); + memcpy (p, SDATA (line), nbytes); else - bcopy (XBOOL_VECTOR (line)->data, p, nbytes); + memcpy (p, XBOOL_VECTOR (line)->data, nbytes); } } else if (STRINGP (data)) @@ -3082,7 +2979,7 @@ xbm_load (f, img) invertedBits = bits; nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR * img->height; - bits = (char *) alloca(nbytes); + bits = (char *) alloca (nbytes); for (i = 0; i < nbytes; i++) bits[i] = XBM_BIT_SHUFFLE (invertedBits[i]); } @@ -3114,9 +3011,9 @@ xbm_load (f, img) #if defined (HAVE_XPM) || defined (HAVE_NS) -static int xpm_image_p P_ ((Lisp_Object object)); -static int xpm_load P_ ((struct frame *f, struct image *img)); -static int xpm_valid_color_symbols_p P_ ((Lisp_Object)); +static int xpm_image_p (Lisp_Object object); +static int xpm_load (struct frame *f, struct image *img); +static int xpm_valid_color_symbols_p (Lisp_Object); #endif /* HAVE_XPM || HAVE_NS */ @@ -3207,12 +3104,12 @@ static struct image_type xpm_type = #ifdef ALLOC_XPM_COLORS -static void xpm_init_color_cache P_ ((struct frame *, XpmAttributes *)); -static void xpm_free_color_cache P_ ((void)); -static int xpm_lookup_color P_ ((struct frame *, char *, XColor *)); -static int xpm_color_bucket P_ ((char *)); -static struct xpm_cached_color *xpm_cache_color P_ ((struct frame *, char *, - XColor *, int)); +static void xpm_init_color_cache (struct frame *, XpmAttributes *); +static void xpm_free_color_cache (void); +static int xpm_lookup_color (struct frame *, char *, XColor *); +static int xpm_color_bucket (char *); +static struct xpm_cached_color *xpm_cache_color (struct frame *, char *, + XColor *, int); /* An entry in a hash table used to cache color definitions of named colors. This cache is necessary to speed up XPM image loading in @@ -3240,9 +3137,7 @@ struct xpm_cached_color **xpm_color_cache; /* Initialize the color cache. */ static void -xpm_init_color_cache (f, attrs) - struct frame *f; - XpmAttributes *attrs; +xpm_init_color_cache (struct frame *f, XpmAttributes *attrs) { size_t nbytes = XPM_COLOR_CACHE_BUCKETS * sizeof *xpm_color_cache; xpm_color_cache = (struct xpm_cached_color **) xmalloc (nbytes); @@ -3268,7 +3163,7 @@ xpm_init_color_cache (f, attrs) /* Free the color cache. */ static void -xpm_free_color_cache () +xpm_free_color_cache (void) { struct xpm_cached_color *p, *next; int i; @@ -3289,8 +3184,7 @@ xpm_free_color_cache () cache. */ static int -xpm_color_bucket (color_name) - char *color_name; +xpm_color_bucket (char *color_name) { unsigned h = 0; char *s; @@ -3306,11 +3200,7 @@ xpm_color_bucket (color_name) entry added. */ static struct xpm_cached_color * -xpm_cache_color (f, color_name, color, bucket) - struct frame *f; - char *color_name; - XColor *color; - int bucket; +xpm_cache_color (struct frame *f, char *color_name, XColor *color, int bucket) { size_t nbytes; struct xpm_cached_color *p; @@ -3333,10 +3223,7 @@ xpm_cache_color (f, color_name, color, bucket) allocation failed. */ static int -xpm_lookup_color (f, color_name, color) - struct frame *f; - char *color_name; - XColor *color; +xpm_lookup_color (struct frame *f, char *color_name, XColor *color) { struct xpm_cached_color *p; int h = xpm_color_bucket (color_name); @@ -3358,7 +3245,7 @@ xpm_lookup_color (f, color_name, color) with transparency, and it's useful. */ else if (strcmp ("opaque", color_name) == 0) { - bzero (color, sizeof (XColor)); /* Is this necessary/correct? */ + memset (color, 0, sizeof (XColor)); /* Is this necessary/correct? */ color->pixel = FRAME_FOREGROUND_PIXEL (f); p = xpm_cache_color (f, color_name, color, h); } @@ -3373,12 +3260,8 @@ xpm_lookup_color (f, color_name, color) if successful. */ static int -xpm_alloc_color (dpy, cmap, color_name, color, closure) - Display *dpy; - Colormap cmap; - char *color_name; - XColor *color; - void *closure; +xpm_alloc_color (Display *dpy, Colormap cmap, char *color_name, XColor *color, + void *closure) { return xpm_lookup_color ((struct frame *) closure, color_name, color); } @@ -3389,12 +3272,7 @@ xpm_alloc_color (dpy, cmap, color_name, color, closure) non-zero if successful. */ static int -xpm_free_colors (dpy, cmap, pixels, npixels, closure) - Display *dpy; - Colormap cmap; - Pixel *pixels; - int npixels; - void *closure; +xpm_free_colors (Display *dpy, Colormap cmap, Pixel *pixels, int npixels, void *closure) { return 1; } @@ -3434,8 +3312,7 @@ init_xpm_functions (Lisp_Object libraries) cdr are strings. */ static int -xpm_valid_color_symbols_p (color_symbols) - Lisp_Object color_symbols; +xpm_valid_color_symbols_p (Lisp_Object color_symbols) { while (CONSP (color_symbols)) { @@ -3454,11 +3331,10 @@ xpm_valid_color_symbols_p (color_symbols) /* Value is non-zero if OBJECT is a valid XPM image specification. */ static int -xpm_image_p (object) - Lisp_Object object; +xpm_image_p (Lisp_Object object) { struct image_keyword fmt[XPM_LAST]; - bcopy (xpm_format, fmt, sizeof fmt); + memcpy (fmt, xpm_format, sizeof fmt); return (parse_image_spec (object, fmt, XPM_LAST, Qxpm) /* Either `:file' or `:data' must be present. */ && fmt[XPM_FILE].count + fmt[XPM_DATA].count == 1 @@ -3472,16 +3348,14 @@ xpm_image_p (object) #if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) int -x_create_bitmap_from_xpm_data (f, bits) - struct frame *f; - char **bits; +x_create_bitmap_from_xpm_data (struct frame *f, char **bits) { Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); int id, rc; XpmAttributes attrs; Pixmap bitmap, mask; - bzero (&attrs, sizeof attrs); + memset (&attrs, 0, sizeof attrs); attrs.visual = FRAME_X_VISUAL (f); attrs.colormap = FRAME_X_COLORMAP (f); @@ -3517,9 +3391,7 @@ x_create_bitmap_from_xpm_data (f, bits) #ifdef HAVE_XPM static int -xpm_load (f, img) - struct frame *f; - struct image *img; +xpm_load (struct frame *f, struct image *img) { int rc; XpmAttributes attrs; @@ -3531,7 +3403,7 @@ xpm_load (f, img) /* Configure the XPM lib. Use the visual of frame F. Allocate close colors. Return colors allocated. */ - bzero (&attrs, sizeof attrs); + memset (&attrs, 0, sizeof attrs); #ifndef HAVE_NTGUI attrs.visual = FRAME_X_VISUAL (f); @@ -3578,7 +3450,7 @@ xpm_load (f, img) /* Allocate an XpmColorSymbol array. */ size = attrs.numsymbols * sizeof *xpm_syms; xpm_syms = (XpmColorSymbol *) alloca (size); - bzero (xpm_syms, size); + memset (xpm_syms, 0, size); attrs.colorsymbols = xpm_syms; /* Fill the color symbol array. */ @@ -3752,25 +3624,25 @@ xpm_load (f, img) /* XPM support functions for NS where libxpm is not available. Only XPM version 3 (without any extensions) is supported. */ -static int xpm_scan P_ ((const unsigned char **, const unsigned char *, - const unsigned char **, int *)); +static int xpm_scan (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))); -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)); + (void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object), + Lisp_Object (**) (Lisp_Object, const unsigned char *, int)); +static void xpm_put_color_table_v (Lisp_Object, const unsigned char *, + int, Lisp_Object); +static Lisp_Object xpm_get_color_table_v (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))); -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, - const unsigned char *, int)); -static int xpm_str_to_color_key P_ ((const char *)); -static int xpm_load_image P_ ((struct frame *, struct image *, - const unsigned char *, const unsigned char *)); + (void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object), + Lisp_Object (**) (Lisp_Object, const unsigned char *, int)); +static void xpm_put_color_table_h (Lisp_Object, const unsigned char *, + int, Lisp_Object); +static Lisp_Object xpm_get_color_table_h (Lisp_Object, + const unsigned char *, int); +static int xpm_str_to_color_key (const char *); +static int xpm_load_image (struct frame *, struct image *, + const unsigned char *, const unsigned char *); /* Tokens returned from xpm_scan. */ @@ -3984,7 +3856,7 @@ xpm_load_image (f, img, contents, end) if (!(end - s >= 9 && memcmp (s, "/* XPM */", 9) == 0)) goto failure; s += 9; - match(); + match (); expect_ident ("static"); expect_ident ("char"); expect ('*'); @@ -4134,8 +4006,8 @@ xpm_load_image (f, img, contents, end) (!EQ (color_val, Qt) ? PIX_MASK_DRAW : (have_mask = 1, PIX_MASK_RETAIN))); #else - if (EQ(color_val, Qt)) - ns_set_alpha(ximg, x, y, 0); + if (EQ (color_val, Qt)) + ns_set_alpha (ximg, x, y, 0); #endif } if (y + 1 < height) @@ -4273,11 +4145,11 @@ int ct_colors_allocated; /* Initialize the color table. */ static void -init_color_table () +init_color_table (void) { int size = CT_SIZE * sizeof (*ct_table); ct_table = (struct ct_color **) xmalloc (size); - bzero (ct_table, size); + memset (ct_table, 0, size); ct_colors_allocated = 0; } @@ -4285,7 +4157,7 @@ init_color_table () /* Free memory associated with the color table. */ static void -free_color_table () +free_color_table (void) { int i; struct ct_color *p, *next; @@ -4308,9 +4180,7 @@ free_color_table () G, B, and make an entry in the color table. */ static unsigned long -lookup_rgb_color (f, r, g, b) - struct frame *f; - int r, g, b; +lookup_rgb_color (struct frame *f, int r, int g, int b) { unsigned hash = CT_HASH_RGB (r, g, b); int i = hash % CT_SIZE; @@ -4405,9 +4275,7 @@ lookup_rgb_color (f, r, g, b) table. If not already present, allocate it. Value is PIXEL. */ static unsigned long -lookup_pixel_color (f, pixel) - struct frame *f; - unsigned long pixel; +lookup_pixel_color (struct frame *f, unsigned long pixel) { int i = pixel % CT_SIZE; struct ct_color *p; @@ -4459,8 +4327,7 @@ lookup_pixel_color (f, pixel) allocated via xmalloc. Set *N to the number of colors. */ static unsigned long * -colors_in_color_table (n) - int *n; +colors_in_color_table (int *n) { int i, j; struct ct_color *p; @@ -4488,9 +4355,7 @@ colors_in_color_table (n) #else /* COLOR_TABLE_SUPPORT */ static unsigned long -lookup_rgb_color (f, r, g, b) - struct frame *f; - int r, g, b; +lookup_rgb_color (struct frame *f, int r, int g, int b) { unsigned long pixel; @@ -4505,7 +4370,7 @@ lookup_rgb_color (f, r, g, b) } static void -init_color_table () +init_color_table (void) { } #endif /* COLOR_TABLE_SUPPORT */ @@ -4515,9 +4380,9 @@ 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 *)); -static void x_detect_edges P_ ((struct frame *, struct image *, int[9], int)); +static XColor *x_to_xcolors (struct frame *, struct image *, int); +static void x_from_xcolors (struct frame *, struct image *, XColor *); +static void x_detect_edges (struct frame *, struct image *, int[9], int); #ifdef HAVE_NTGUI static void XPutPixel (XImagePtr , int, int, COLORREF); @@ -4558,10 +4423,7 @@ static int laplace_matrix[9] = { allocated with xmalloc; it must be freed by the caller. */ static XColor * -x_to_xcolors (f, img, rgb_p) - struct frame *f; - struct image *img; - int rgb_p; +x_to_xcolors (struct frame *f, struct image *img, int rgb_p) { int x, y; XColor *colors, *p; @@ -4626,10 +4488,7 @@ x_to_xcolors (f, img, rgb_p) stored in ximg->data. */ static void -XPutPixel (ximg, x, y, color) - XImagePtr ximg; - int x, y; - COLORREF color; +XPutPixel (XImagePtr ximg, int x, int y, COLORREF color) { int width = ximg->info.bmiHeader.biWidth; int height = ximg->info.bmiHeader.biHeight; @@ -4674,10 +4533,7 @@ XPutPixel (ximg, x, y, color) COLORS will be freed; an existing IMG->pixmap will be freed, too. */ static void -x_from_xcolors (f, img, colors) - struct frame *f; - struct image *img; - XColor *colors; +x_from_xcolors (struct frame *f, struct image *img, XColor *colors) { int x, y; XImagePtr oimg = NULL; @@ -4719,10 +4575,7 @@ x_from_xcolors (f, img, colors) outgoing image. */ static void -x_detect_edges (f, img, matrix, color_adjust) - struct frame *f; - struct image *img; - int matrix[9], color_adjust; +x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjust) { XColor *colors = x_to_xcolors (f, img, 1); XColor *new, *p; @@ -4788,9 +4641,7 @@ x_detect_edges (f, img, matrix, color_adjust) on frame F. */ static void -x_emboss (f, img) - struct frame *f; - struct image *img; +x_emboss (struct frame *f, struct image *img) { x_detect_edges (f, img, emboss_matrix, 0xffff / 2); } @@ -4801,9 +4652,7 @@ x_emboss (f, img) to draw disabled buttons, for example. */ static void -x_laplace (f, img) - struct frame *f; - struct image *img; +x_laplace (struct frame *f, struct image *img) { x_detect_edges (f, img, laplace_matrix, 45000); } @@ -4821,10 +4670,8 @@ x_laplace (f, img) number. */ static void -x_edge_detection (f, img, matrix, color_adjust) - struct frame *f; - struct image *img; - Lisp_Object matrix, color_adjust; +x_edge_detection (struct frame *f, struct image *img, Lisp_Object matrix, + Lisp_Object color_adjust) { int i = 0; int trans[9]; @@ -4853,9 +4700,7 @@ x_edge_detection (f, img, matrix, color_adjust) /* Transform image IMG on frame F so that it looks disabled. */ static void -x_disable_image (f, img) - struct frame *f; - struct image *img; +x_disable_image (struct frame *f, struct image *img) { Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); #ifdef HAVE_NTGUI @@ -4957,10 +4802,7 @@ x_disable_image (f, img) heuristically. Value is non-zero if successful. */ static int -x_build_heuristic_mask (f, img, how) - struct frame *f; - struct image *img; - Lisp_Object how; +x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how) { XImagePtr_or_DC ximg; #ifndef HAVE_NTGUI @@ -4998,7 +4840,7 @@ x_build_heuristic_mask (f, img, how) /* Create the bit array serving as mask. */ row_width = (img->width + 7) / 8; mask_img = xmalloc (row_width * img->height); - bzero (mask_img, row_width * img->height); + memset (mask_img, 0, row_width * img->height); /* Create a memory device context for IMG->pixmap. */ frame_dc = get_frame_dc (f); @@ -5047,7 +4889,7 @@ x_build_heuristic_mask (f, img, how) ? PIX_MASK_DRAW : PIX_MASK_RETAIN)); #else if (XGetPixel (ximg, x, y) == bg) - ns_set_alpha(ximg, x, y, 0); + 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. */ @@ -5087,9 +4929,9 @@ 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)); -static int pbm_scan_number P_ ((unsigned char **, unsigned char *)); +static int pbm_image_p (Lisp_Object object); +static int pbm_load (struct frame *f, struct image *img); +static int pbm_scan_number (unsigned char **, unsigned char *); /* The symbol `pbm' identifying images of this type. */ @@ -5146,12 +4988,11 @@ static struct image_type pbm_type = /* Return non-zero if OBJECT is a valid PBM image specification. */ static int -pbm_image_p (object) - Lisp_Object object; +pbm_image_p (Lisp_Object object) { struct image_keyword fmt[PBM_LAST]; - bcopy (pbm_format, fmt, sizeof fmt); + memcpy (fmt, pbm_format, sizeof fmt); if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm)) return 0; @@ -5166,8 +5007,7 @@ pbm_image_p (object) end of input. */ static int -pbm_scan_number (s, end) - unsigned char **s, *end; +pbm_scan_number (unsigned char **s, unsigned char *end) { int c = 0, val = -1; @@ -5242,9 +5082,7 @@ pbm_read_file (file, size) /* Load PBM image IMG for use on frame F. */ static int -pbm_load (f, img) - struct frame *f; - struct image *img; +pbm_load (struct frame *f, struct image *img) { int raw_p, x, y; int width, height, max_color_idx = 0; @@ -5366,7 +5204,7 @@ pbm_load (f, img) unsigned long bg = FRAME_BACKGROUND_PIXEL (f); /* Parse the image specification. */ - bcopy (pbm_format, fmt, sizeof fmt); + memcpy (fmt, pbm_format, sizeof fmt); parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm); /* Get foreground and background colors, maybe allocate colors. */ @@ -5511,8 +5349,8 @@ pbm_load (f, img) /* Function prototypes. */ -static int png_image_p P_ ((Lisp_Object object)); -static int png_load P_ ((struct frame *f, struct image *img)); +static int png_image_p (Lisp_Object object); +static int png_load (struct frame *f, struct image *img); /* The symbol `png' identifying images of this type. */ @@ -5566,11 +5404,10 @@ static struct image_type png_type = /* Return non-zero if OBJECT is a valid PNG image specification. */ static int -png_image_p (object) - Lisp_Object object; +png_image_p (Lisp_Object object) { struct image_keyword fmt[PNG_LAST]; - bcopy (png_format, fmt, sizeof fmt); + memcpy (fmt, png_format, sizeof fmt); if (!parse_image_spec (object, fmt, PNG_LAST, Qpng)) return 0; @@ -5671,9 +5508,7 @@ init_png_functions (Lisp_Object libraries) is initialized. */ static void -my_png_error (png_ptr, msg) - png_struct *png_ptr; - char *msg; +my_png_error (png_struct *png_ptr, const char *msg) { xassert (png_ptr != NULL); image_error ("PNG error: %s", build_string (msg), Qnil); @@ -5682,9 +5517,7 @@ my_png_error (png_ptr, msg) static void -my_png_warning (png_ptr, msg) - png_struct *png_ptr; - char *msg; +my_png_warning (png_struct *png_ptr, const char *msg) { xassert (png_ptr != NULL); image_error ("PNG warning: %s", build_string (msg), Qnil); @@ -5705,10 +5538,7 @@ struct png_memory_storage bytes from the input to DATA. */ static void -png_read_from_memory (png_ptr, data, length) - png_structp png_ptr; - png_bytep data; - png_size_t length; +png_read_from_memory (png_structp png_ptr, png_bytep data, png_size_t length) { struct png_memory_storage *tbr = (struct png_memory_storage *) fn_png_get_io_ptr (png_ptr); @@ -5716,7 +5546,7 @@ png_read_from_memory (png_ptr, data, length) if (length > tbr->len - tbr->index) fn_png_error (png_ptr, "Read error"); - bcopy (tbr->bytes + tbr->index, data, length); + memcpy (data, tbr->bytes + tbr->index, length); tbr->index = tbr->index + length; } @@ -5726,10 +5556,7 @@ png_read_from_memory (png_ptr, data, length) bytes from the input to DATA. */ static void -png_read_from_file (png_ptr, data, length) - png_structp png_ptr; - png_bytep data; - png_size_t length; +png_read_from_file (png_structp png_ptr, png_bytep data, png_size_t length) { FILE *fp = (FILE *) fn_png_get_io_ptr (png_ptr); @@ -5742,9 +5569,7 @@ png_read_from_file (png_ptr, data, length) successful. */ static int -png_load (f, img) - struct frame *f; - struct image *img; +png_load (struct frame *f, struct image *img) { Lisp_Object file, specified_file; Lisp_Object specified_data; @@ -5923,7 +5748,7 @@ png_load (f, img) { png_color_16 user_bg; - bzero (&user_bg, sizeof user_bg); + memset (&user_bg, 0, sizeof user_bg); user_bg.red = color.red >> shift; user_bg.green = color.green >> shift; user_bg.blue = color.blue >> shift; @@ -5943,7 +5768,7 @@ png_load (f, img) color.pixel = FRAME_BACKGROUND_PIXEL (f); x_query_color (f, &color); - bzero (&frame_background, sizeof frame_background); + memset (&frame_background, 0, sizeof frame_background); frame_background.red = color.red >> shift; frame_background.green = color.green >> shift; frame_background.blue = color.blue >> shift; @@ -6113,8 +5938,8 @@ png_load (struct frame *f, struct image *img) #if defined (HAVE_JPEG) || defined (HAVE_NS) -static int jpeg_image_p P_ ((Lisp_Object object)); -static int jpeg_load P_ ((struct frame *f, struct image *img)); +static int jpeg_image_p (Lisp_Object object); +static int jpeg_load (struct frame *f, struct image *img); /* The symbol `jpeg' identifying images of this type. */ @@ -6168,12 +5993,11 @@ static struct image_type jpeg_type = /* Return non-zero if OBJECT is a valid JPEG image specification. */ static int -jpeg_image_p (object) - Lisp_Object object; +jpeg_image_p (Lisp_Object object) { struct image_keyword fmt[JPEG_LAST]; - bcopy (jpeg_format, fmt, sizeof fmt); + memcpy (fmt, jpeg_format, sizeof fmt); if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg)) return 0; @@ -6240,9 +6064,7 @@ init_jpeg_functions (Lisp_Object libraries) /* Wrapper since we can't directly assign the function pointer to another function pointer that was declared more completely easily. */ static boolean -jpeg_resync_to_restart_wrapper (cinfo, desired) - j_decompress_ptr cinfo; - int desired; +jpeg_resync_to_restart_wrapper (j_decompress_ptr cinfo, int desired) { return fn_jpeg_resync_to_restart (cinfo, desired); } @@ -6268,8 +6090,7 @@ struct my_jpeg_error_mgr static void -my_error_exit (cinfo) - j_common_ptr cinfo; +my_error_exit (j_common_ptr cinfo) { struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err; longjmp (mgr->setjmp_buffer, 1); @@ -6281,8 +6102,7 @@ my_error_exit (cinfo) libjpeg.doc from the JPEG lib distribution. */ static void -our_common_init_source (cinfo) - j_decompress_ptr cinfo; +our_common_init_source (j_decompress_ptr cinfo) { } @@ -6291,8 +6111,7 @@ our_common_init_source (cinfo) jpeg_finish_decompress() after all data has been processed. */ static void -our_common_term_source (cinfo) - j_decompress_ptr cinfo; +our_common_term_source (j_decompress_ptr cinfo) { } @@ -6304,8 +6123,7 @@ our_common_term_source (cinfo) static JOCTET our_memory_buffer[2]; static boolean -our_memory_fill_input_buffer (cinfo) - j_decompress_ptr cinfo; +our_memory_fill_input_buffer (j_decompress_ptr cinfo) { /* Insert a fake EOI marker. */ struct jpeg_source_mgr *src = cinfo->src; @@ -6323,9 +6141,7 @@ our_memory_fill_input_buffer (cinfo) is the JPEG data source manager. */ static void -our_memory_skip_input_data (cinfo, num_bytes) - j_decompress_ptr cinfo; - long num_bytes; +our_memory_skip_input_data (j_decompress_ptr cinfo, long int num_bytes) { struct jpeg_source_mgr *src = (struct jpeg_source_mgr *) cinfo->src; @@ -6345,10 +6161,7 @@ our_memory_skip_input_data (cinfo, num_bytes) reading the image. */ static void -jpeg_memory_src (cinfo, data, len) - j_decompress_ptr cinfo; - JOCTET *data; - unsigned int len; +jpeg_memory_src (j_decompress_ptr cinfo, JOCTET *data, unsigned int len) { struct jpeg_source_mgr *src; @@ -6391,8 +6204,7 @@ struct jpeg_stdio_mgr whenever more data is needed. The data is read from a FILE *. */ static boolean -our_stdio_fill_input_buffer (cinfo) - j_decompress_ptr cinfo; +our_stdio_fill_input_buffer (j_decompress_ptr cinfo) { struct jpeg_stdio_mgr *src; @@ -6423,9 +6235,7 @@ our_stdio_fill_input_buffer (cinfo) is the JPEG data source manager. */ static void -our_stdio_skip_input_data (cinfo, num_bytes) - j_decompress_ptr cinfo; - long num_bytes; +our_stdio_skip_input_data (j_decompress_ptr cinfo, long int num_bytes) { struct jpeg_stdio_mgr *src; src = (struct jpeg_stdio_mgr *) cinfo->src; @@ -6455,9 +6265,7 @@ our_stdio_skip_input_data (cinfo, num_bytes) reading the image. */ static void -jpeg_file_src (cinfo, fp) - j_decompress_ptr cinfo; - FILE *fp; +jpeg_file_src (j_decompress_ptr cinfo, FILE *fp) { struct jpeg_stdio_mgr *src; @@ -6491,9 +6299,7 @@ jpeg_file_src (cinfo, fp) from the JPEG lib. */ static int -jpeg_load (f, img) - struct frame *f; - struct image *img; +jpeg_load (struct frame *f, struct image *img) { struct jpeg_decompress_struct cinfo; struct my_jpeg_error_mgr mgr; @@ -6669,9 +6475,9 @@ jpeg_load (f, img) static int jpeg_load (struct frame *f, struct image *img) { - return ns_load_image(f, img, - image_spec_value (img->spec, QCfile, NULL), - image_spec_value (img->spec, QCdata, NULL)); + return ns_load_image (f, img, + image_spec_value (img->spec, QCfile, NULL), + image_spec_value (img->spec, QCdata, NULL)); } #endif /* HAVE_NS */ @@ -6685,8 +6491,8 @@ jpeg_load (struct frame *f, struct image *img) #if defined (HAVE_TIFF) || defined (HAVE_NS) -static int tiff_image_p P_ ((Lisp_Object object)); -static int tiff_load P_ ((struct frame *f, struct image *img)); +static int tiff_image_p (Lisp_Object object); +static int tiff_load (struct frame *f, struct image *img); /* The symbol `tiff' identifying images of this type. */ @@ -6742,11 +6548,10 @@ static struct image_type tiff_type = /* Return non-zero if OBJECT is a valid TIFF image specification. */ static int -tiff_image_p (object) - Lisp_Object object; +tiff_image_p (Lisp_Object object) { struct image_keyword fmt[TIFF_LAST]; - bcopy (tiff_format, fmt, sizeof fmt); + memcpy (fmt, tiff_format, sizeof fmt); if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff)) return 0; @@ -6823,34 +6628,25 @@ typedef struct tiff_memory_source; static size_t -tiff_read_from_memory (data, buf, size) - thandle_t data; - tdata_t buf; - tsize_t size; +tiff_read_from_memory (thandle_t data, tdata_t buf, tsize_t size) { tiff_memory_source *src = (tiff_memory_source *) data; if (size > src->len - src->index) return (size_t) -1; - bcopy (src->bytes + src->index, buf, size); + memcpy (buf, src->bytes + src->index, size); src->index += size; return size; } static size_t -tiff_write_from_memory (data, buf, size) - thandle_t data; - tdata_t buf; - tsize_t size; +tiff_write_from_memory (thandle_t data, tdata_t buf, tsize_t size) { return (size_t) -1; } static toff_t -tiff_seek_in_memory (data, off, whence) - thandle_t data; - toff_t off; - int whence; +tiff_seek_in_memory (thandle_t data, toff_t off, int whence) { tiff_memory_source *src = (tiff_memory_source *) data; int idx; @@ -6881,44 +6677,34 @@ tiff_seek_in_memory (data, off, whence) } static int -tiff_close_memory (data) - thandle_t data; +tiff_close_memory (thandle_t data) { /* NOOP */ return 0; } static int -tiff_mmap_memory (data, pbase, psize) - thandle_t data; - tdata_t *pbase; - toff_t *psize; +tiff_mmap_memory (thandle_t data, tdata_t *pbase, toff_t *psize) { /* It is already _IN_ memory. */ return 0; } static void -tiff_unmap_memory (data, base, size) - thandle_t data; - tdata_t base; - toff_t size; +tiff_unmap_memory (thandle_t data, tdata_t base, toff_t size) { /* We don't need to do this. */ } static toff_t -tiff_size_of_memory (data) - thandle_t data; +tiff_size_of_memory (thandle_t data) { return ((tiff_memory_source *) data)->len; } static void -tiff_error_handler (title, format, ap) - const char *title, *format; - va_list ap; +tiff_error_handler (const char *title, const char *format, va_list ap) { char buf[512]; int len; @@ -6930,9 +6716,7 @@ tiff_error_handler (title, format, ap) static void -tiff_warning_handler (title, format, ap) - const char *title, *format; - va_list ap; +tiff_warning_handler (const char *title, const char *format, va_list ap) { char buf[512]; int len; @@ -6947,9 +6731,7 @@ tiff_warning_handler (title, format, ap) successful. */ static int -tiff_load (f, img) - struct frame *f; - struct image *img; +tiff_load (struct frame *f, struct image *img) { Lisp_Object file, specified_file; Lisp_Object specified_data; @@ -7120,9 +6902,9 @@ tiff_load (f, img) static int tiff_load (struct frame *f, struct image *img) { - return ns_load_image(f, img, - image_spec_value (img->spec, QCfile, NULL), - image_spec_value (img->spec, QCdata, NULL)); + return ns_load_image (f, img, + image_spec_value (img->spec, QCfile, NULL), + image_spec_value (img->spec, QCdata, NULL)); } #endif /* HAVE_NS */ @@ -7136,9 +6918,9 @@ tiff_load (struct frame *f, struct image *img) #if defined (HAVE_GIF) || defined (HAVE_NS) -static int gif_image_p P_ ((Lisp_Object object)); -static int gif_load P_ ((struct frame *f, struct image *img)); -static void gif_clear_image P_ ((struct frame *f, struct image *img)); +static int gif_image_p (Lisp_Object object); +static int gif_load (struct frame *f, struct image *img); +static void gif_clear_image (struct frame *f, struct image *img); /* The symbol `gif' identifying images of this type. */ @@ -7194,9 +6976,7 @@ static struct image_type gif_type = /* Free X resources of GIF image IMG which is used on frame F. */ static void -gif_clear_image (f, img) - struct frame *f; - struct image *img; +gif_clear_image (struct frame *f, struct image *img) { /* IMG->data.ptr_val may contain metadata with extension data. */ img->data.lisp_val = Qnil; @@ -7206,11 +6986,10 @@ gif_clear_image (f, img) /* Return non-zero if OBJECT is a valid GIF image specification. */ static int -gif_image_p (object) - Lisp_Object object; +gif_image_p (Lisp_Object object) { struct image_keyword fmt[GIF_LAST]; - bcopy (gif_format, fmt, sizeof fmt); + memcpy (fmt, gif_format, sizeof fmt); if (!parse_image_spec (object, fmt, GIF_LAST, Qgif)) return 0; @@ -7290,17 +7069,14 @@ gif_memory_source; static gif_memory_source *current_gif_memory_src; static int -gif_read_from_memory (file, buf, len) - GifFileType *file; - GifByteType *buf; - int len; +gif_read_from_memory (GifFileType *file, GifByteType *buf, int len) { gif_memory_source *src = current_gif_memory_src; if (len > src->len - src->index) return -1; - bcopy (src->bytes + src->index, buf, len); + memcpy (buf, src->bytes + src->index, len); src->index += len; return len; } @@ -7313,9 +7089,7 @@ static const int interlace_start[] = {0, 4, 2, 1}; static const int interlace_increment[] = {8, 8, 4, 2}; static int -gif_load (f, img) - struct frame *f; - struct image *img; +gif_load (struct frame *f, struct image *img) { Lisp_Object file, specified_file; Lisp_Object specified_data; @@ -7438,7 +7212,7 @@ gif_load (f, img) if (!gif_color_map) gif_color_map = gif->SColorMap; init_color_table (); - bzero (pixel_colors, sizeof pixel_colors); + memset (pixel_colors, 0, sizeof pixel_colors); if (gif_color_map) for (i = 0; i < gif_color_map->ColorCount; ++i) @@ -7558,9 +7332,9 @@ gif_load (f, img) static int gif_load (struct frame *f, struct image *img) { - return ns_load_image(f, img, - image_spec_value (img->spec, QCfile, NULL), - image_spec_value (img->spec, QCdata, NULL)); + return ns_load_image (f, img, + image_spec_value (img->spec, QCfile, NULL), + image_spec_value (img->spec, QCdata, NULL)); } #endif /* HAVE_NS */ @@ -7576,11 +7350,11 @@ gif_load (struct frame *f, struct image *img) /* Function prototypes. */ -static int svg_image_p P_ ((Lisp_Object object)); -static int svg_load P_ ((struct frame *f, struct image *img)); +static int svg_image_p (Lisp_Object object); +static int svg_load (struct frame *f, struct image *img); -static int svg_load_image P_ ((struct frame *, struct image *, - unsigned char *, unsigned int)); +static int svg_load_image (struct frame *, struct image *, + unsigned char *, unsigned int); /* The symbol `svg' identifying images of this type. */ @@ -7645,11 +7419,10 @@ static struct image_type svg_type = identify the SVG format. */ static int -svg_image_p (object) - Lisp_Object object; +svg_image_p (Lisp_Object object) { struct image_keyword fmt[SVG_LAST]; - bcopy (svg_format, fmt, sizeof fmt); + memcpy (fmt, svg_format, sizeof fmt); if (!parse_image_spec (object, fmt, SVG_LAST, Qsvg)) return 0; @@ -7748,9 +7521,7 @@ init_svg_functions (Lisp_Object libraries) the prototype thus needs to be compatible with that structure. */ static int -svg_load (f, img) - struct frame *f; - struct image *img; +svg_load (struct frame *f, struct image *img) { int success_p = 0; Lisp_Object file_name; @@ -7807,15 +7578,10 @@ svg_load (f, img) Returns non-zero when successful. */ static int -svg_load_image (f, img, contents, size) - /* Pointer to emacs frame structure. */ - struct frame *f; - /* Pointer to emacs image structure. */ - struct image *img; - /* String containing the SVG XML data to be parsed. */ - unsigned char *contents; - /* Size of data in bytes. */ - unsigned int size; +svg_load_image (struct frame *f, /* Pointer to emacs frame structure. */ + struct image *img, /* Pointer to emacs image structure. */ + unsigned char *contents, /* String containing the SVG XML data to be parsed. */ + unsigned int size) /* Size of data in bytes. */ { RsvgHandle *rsvg_handle; RsvgDimensionData dimension_data; @@ -7890,7 +7656,7 @@ svg_load_image (f, img, contents, size) background.pixel = FRAME_BACKGROUND_PIXEL (f); x_query_color (f, &background); #else - ns_query_color(FRAME_BACKGROUND_COLOR (f), &background, 1); + ns_query_color (FRAME_BACKGROUND_COLOR (f), &background, 1); #endif } @@ -7982,9 +7748,9 @@ Lisp_Object Qpostscript; #ifdef HAVE_GHOSTSCRIPT -static int gs_image_p P_ ((Lisp_Object object)); -static int gs_load P_ ((struct frame *f, struct image *img)); -static void gs_clear_image P_ ((struct frame *f, struct image *img)); +static int gs_image_p (Lisp_Object object); +static int gs_load (struct frame *f, struct image *img); +static void gs_clear_image (struct frame *f, struct image *img); /* Keyword symbols. */ @@ -8045,9 +7811,7 @@ static struct image_type gs_type = /* Free X resources of Ghostscript image IMG which is used on frame F. */ static void -gs_clear_image (f, img) - struct frame *f; - struct image *img; +gs_clear_image (struct frame *f, struct image *img) { /* IMG->data.ptr_val may contain a recorded colormap. */ xfree (img->data.ptr_val); @@ -8059,14 +7823,13 @@ gs_clear_image (f, img) specification. */ static int -gs_image_p (object) - Lisp_Object object; +gs_image_p (Lisp_Object object) { struct image_keyword fmt[GS_LAST]; Lisp_Object tem; int i; - bcopy (gs_format, fmt, sizeof fmt); + memcpy (fmt, gs_format, sizeof fmt); if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript)) return 0; @@ -8100,9 +7863,7 @@ gs_image_p (object) if successful. */ static int -gs_load (f, img) - struct frame *f; - struct image *img; +gs_load (struct frame *f, struct image *img) { char buffer[100]; Lisp_Object window_and_pixmap_id = Qnil, loader, pt_height, pt_width; @@ -8180,9 +7941,7 @@ gs_load (f, img) telling Emacs that Ghostscript has finished drawing. */ void -x_kill_gs_process (pixmap, f) - Pixmap pixmap; - struct frame *f; +x_kill_gs_process (Pixmap pixmap, struct frame *f) { struct image_cache *c = FRAME_IMAGE_CACHE (f); int class, i; @@ -8280,16 +8039,14 @@ x_kill_gs_process (pixmap, f) DEFUN ("imagep", Fimagep, Simagep, 1, 1, 0, doc: /* Value is non-nil if SPEC is a valid image specification. */) - (spec) - Lisp_Object spec; + (Lisp_Object spec) { return valid_image_p (spec) ? Qt : Qnil; } DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "") - (spec) - Lisp_Object spec; + (Lisp_Object spec) { int id = -1; @@ -8324,8 +8081,7 @@ 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; + (Lisp_Object type, Lisp_Object libraries) { Lisp_Object tested; @@ -8375,7 +8131,7 @@ of `image-library-alist', which see). */) } void -syms_of_image () +syms_of_image (void) { extern Lisp_Object Qrisky_local_variable; /* Syms_of_xdisp has already run. */ @@ -8560,7 +8316,7 @@ The function `clear-image-cache' disregards this variable. */); } void -init_image () +init_image (void) { } diff --git a/src/indent.c b/src/indent.c index b64eae1c429..0f71c6d82d7 100644 --- a/src/indent.c +++ b/src/indent.c @@ -61,8 +61,8 @@ EMACS_INT last_known_column_point; static int last_known_column_modified; -static double current_column_1 P_ ((void)); -static double position_indentation P_ ((int)); +static double current_column_1 (void); +static double position_indentation (int); /* Cache of beginning of line found by the last call of current_column. */ @@ -72,7 +72,7 @@ static EMACS_INT current_column_bol_cache; /* Get the display table to use for the current buffer. */ struct Lisp_Char_Table * -buffer_display_table () +buffer_display_table (void) { Lisp_Object thisbuf; @@ -89,9 +89,7 @@ buffer_display_table () /* Return the width of character C under display table DP. */ static int -character_width (c, dp) - int c; - struct Lisp_Char_Table *dp; +character_width (int c, struct Lisp_Char_Table *dp) { Lisp_Object elt; @@ -125,9 +123,7 @@ character_width (c, dp) invalidate the buffer's width_run_cache. */ int -disptab_matches_widthtab (disptab, widthtab) - struct Lisp_Char_Table *disptab; - struct Lisp_Vector *widthtab; +disptab_matches_widthtab (struct Lisp_Char_Table *disptab, struct Lisp_Vector *widthtab) { int i; @@ -145,9 +141,7 @@ disptab_matches_widthtab (disptab, widthtab) /* Recompute BUF's width table, using the display table DISPTAB. */ void -recompute_width_table (buf, disptab) - struct buffer *buf; - struct Lisp_Char_Table *disptab; +recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab) { int i; struct Lisp_Vector *widthtab; @@ -166,7 +160,7 @@ recompute_width_table (buf, disptab) state of current_buffer's cache_long_line_scans variable. */ static void -width_run_cache_on_off () +width_run_cache_on_off (void) { if (NILP (current_buffer->cache_long_line_scans) /* And, for the moment, this feature doesn't work on multibyte @@ -217,11 +211,7 @@ width_run_cache_on_off () will equal the return value. */ EMACS_INT -skip_invisible (pos, next_boundary_p, to, window) - EMACS_INT pos; - EMACS_INT *next_boundary_p; - EMACS_INT to; - Lisp_Object window; +skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p, EMACS_INT to, Lisp_Object window) { Lisp_Object prop, position, overlay_limit, proplimit; Lisp_Object buffer, tmp; @@ -322,7 +312,7 @@ Whether the line is visible (if `selective-display' is t) has no effect; however, ^M is treated as end of line when `selective-display' is t. Text that has an invisible property is considered as having width 0, unless `buffer-invisibility-spec' specifies that it is replaced by an ellipsis. */) - () + (void) { Lisp_Object temp; XSETFASTINT (temp, (int) current_column ()); /* iftc */ @@ -332,13 +322,13 @@ Text that has an invisible property is considered as having width 0, unless /* Cancel any recorded value of the horizontal position. */ void -invalidate_current_column () +invalidate_current_column (void) { last_known_column_point = 0; } double -current_column () +current_column (void) { register int col; register unsigned char *ptr, *stop; @@ -556,7 +546,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) w = ! NILP (window) ? XWINDOW (window) : NULL; if (tab_width <= 0 || tab_width > 1000) tab_width = 8; - bzero (&cmp_it, sizeof cmp_it); + memset (&cmp_it, 0, sizeof cmp_it); cmp_it.id = -1; composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, Qnil); @@ -723,7 +713,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) due to text properties or overlays. */ static double -current_column_1 () +current_column_1 (void) { EMACS_INT col = MOST_POSITIVE_FIXNUM; EMACS_INT opoint = PT; @@ -822,8 +812,7 @@ Optional second argument MINIMUM says always do at least MINIMUM spaces even if that goes past COLUMN; by default, MINIMUM is zero. The return value is COLUMN. */) - (column, minimum) - Lisp_Object column, minimum; + (Lisp_Object column, Lisp_Object minimum) { int mincol; register int fromcol; @@ -867,14 +856,14 @@ The return value is COLUMN. */) } -static double position_indentation P_ ((int)); +static double position_indentation (int); DEFUN ("current-indentation", Fcurrent_indentation, Scurrent_indentation, 0, 0, 0, doc: /* Return the indentation of the current line. This is the horizontal position of the character following any initial whitespace. */) - () + (void) { Lisp_Object val; int opoint = PT, opoint_byte = PT_BYTE; @@ -887,8 +876,7 @@ following any initial whitespace. */) } static double -position_indentation (pos_byte) - register int pos_byte; +position_indentation (register int pos_byte) { register EMACS_INT column = 0; register EMACS_INT tab_width = XINT (current_buffer->tab_width); @@ -977,9 +965,7 @@ position_indentation (pos_byte) preceding line. */ int -indented_beyond_p (pos, pos_byte, column) - int pos, pos_byte; - double column; +indented_beyond_p (int pos, int pos_byte, double column) { double val; int opoint = PT, opoint_byte = PT_BYTE; @@ -1011,8 +997,7 @@ In addition, if FORCE is t, and the line is too short to reach COLUMN, add spaces/tabs to get there. The return value is the current column. */) - (column, force) - Lisp_Object column, force; + (Lisp_Object column, Lisp_Object force) { EMACS_INT pos; EMACS_INT col, prev_col; @@ -1137,12 +1122,7 @@ struct position val_compute_motion; the scroll bars if they are turned on. */ struct position * -compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width, hscroll, tab_offset, win) - EMACS_INT from, fromvpos, fromhpos, to, tovpos, tohpos; - int did_motion; - EMACS_INT width; - EMACS_INT hscroll, tab_offset; - struct window *win; +compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_motion, EMACS_INT to, EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width, EMACS_INT hscroll, EMACS_INT tab_offset, struct window *win) { register EMACS_INT hpos = fromhpos; register EMACS_INT vpos = fromvpos; @@ -1232,7 +1212,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width, pos_byte = prev_pos_byte = CHAR_TO_BYTE (from); contin_hpos = 0; prev_tab_offset = tab_offset; - bzero (&cmp_it, sizeof cmp_it); + memset (&cmp_it, 0, sizeof cmp_it); cmp_it.id = -1; composition_compute_stop_pos (&cmp_it, pos, pos_byte, to, Qnil); @@ -1775,9 +1755,7 @@ of a certain window, pass the window's starting location as FROM and the window's upper-left coordinates as FROMPOS. Pass the buffer's (point-max) as TO, to limit the scan to the end of the visible section of the buffer, and pass LINE and COL as TOPOS. */) - (from, frompos, to, topos, width, offsets, window) - Lisp_Object from, frompos, to, topos; - Lisp_Object width, offsets, window; + (Lisp_Object from, Lisp_Object frompos, Lisp_Object to, Lisp_Object topos, Lisp_Object width, Lisp_Object offsets, Lisp_Object window) { struct window *w; Lisp_Object bufpos, hpos, vpos, prevhpos; @@ -1856,9 +1834,7 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */) struct position val_vmotion; struct position * -vmotion (from, vtarget, w) - register EMACS_INT from, vtarget; - struct window *w; +vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w) { EMACS_INT hscroll = XINT (w->hscroll); struct position pos; @@ -2021,8 +1997,7 @@ regardless of which buffer is displayed in WINDOW. This is consistent with other cursor motion functions and makes it possible to use `vertical-motion' in any buffer, whether or not it is currently displayed in some window. */) - (lines, window) - Lisp_Object lines, window; + (Lisp_Object lines, Lisp_Object window) { struct it it; struct text_pos pt; @@ -2183,7 +2158,7 @@ whether or not it is currently displayed in some window. */) /* File's initialization. */ void -syms_of_indent () +syms_of_indent (void) { DEFVAR_BOOL ("indent-tabs-mode", &indent_tabs_mode, doc: /* *Indentation can insert tabs if this is non-nil. */); diff --git a/src/indent.h b/src/indent.h index 4d9dbf2d7ff..394d7216b4f 100644 --- a/src/indent.h +++ b/src/indent.h @@ -49,16 +49,16 @@ struct position EMACS_INT tab_offset; }; -struct position *compute_motion P_ ((EMACS_INT from, EMACS_INT fromvpos, - EMACS_INT fromhpos, int did_motion, - EMACS_INT to, EMACS_INT tovpos, - EMACS_INT tohpos, - EMACS_INT width, EMACS_INT hscroll, - EMACS_INT tab_offset, struct window *)); -struct position *vmotion P_ ((EMACS_INT from, EMACS_INT vtarget, - struct window *)); -EMACS_INT skip_invisible P_ ((EMACS_INT pos, EMACS_INT *next_boundary_p, - EMACS_INT to, Lisp_Object window)); +struct position *compute_motion (EMACS_INT from, EMACS_INT fromvpos, + EMACS_INT fromhpos, int did_motion, + EMACS_INT to, EMACS_INT tovpos, + EMACS_INT tohpos, + EMACS_INT width, EMACS_INT hscroll, + EMACS_INT tab_offset, struct window *); +struct position *vmotion (EMACS_INT from, EMACS_INT vtarget, + struct window *); +EMACS_INT skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p, + EMACS_INT to, Lisp_Object window); /* Value of point when current_column was called */ extern EMACS_INT last_known_column_point; @@ -68,12 +68,12 @@ extern EMACS_INT last_known_column_point; /* Return true if the display table DISPTAB specifies the same widths for characters as WIDTHTAB. We use this to decide when to invalidate the buffer's column_cache. */ -int disptab_matches_widthtab P_ ((struct Lisp_Char_Table *disptab, - struct Lisp_Vector *widthtab)); +int disptab_matches_widthtab (struct Lisp_Char_Table *disptab, + struct Lisp_Vector *widthtab); /* Recompute BUF's width table, using the display table DISPTAB. */ -void recompute_width_table P_ ((struct buffer *buf, - struct Lisp_Char_Table *disptab)); +void recompute_width_table (struct buffer *buf, + struct Lisp_Char_Table *disptab); /* arch-tag: f9feb373-5bff-4f4f-9198-94805d00cfd7 diff --git a/src/insdel.c b/src/insdel.c index 2b00de88711..8b0b2f7ab01 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -51,7 +51,7 @@ static void adjust_markers_for_replace (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT); static void adjust_point (EMACS_INT nchars, EMACS_INT nbytes); -Lisp_Object Fcombine_after_change_execute (); +Lisp_Object Fcombine_after_change_execute (void); /* Non-nil means don't call the after-change-functions right away, just record an element in combine_after_change_list. */ @@ -85,7 +85,7 @@ static int check_markers_debug_flag; else void -check_markers () +check_markers (void) { register struct Lisp_Marker *tail; int multibyte = ! NILP (current_buffer->enable_multibyte_characters); @@ -164,28 +164,9 @@ gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap) /* Move at most 32000 chars before checking again for a quit. */ if (i > 32000) i = 32000; -#ifdef GAP_USE_BCOPY - if (i >= 128 - /* bcopy is safe if the two areas of memory do not overlap - or on systems where bcopy is always safe for moving upward. */ - && (BCOPY_UPWARD_SAFE - || to - from >= 128)) - { - /* If overlap is not safe, avoid it by not moving too many - characters at once. */ - if (!BCOPY_UPWARD_SAFE && i > to - from) - i = to - from; - new_s1 -= i; - from -= i, to -= i; - bcopy (from, to, i); - } - else -#endif - { - new_s1 -= i; - while (--i >= 0) - *--to = *--from; - } + new_s1 -= i; + from -= i, to -= i; + memmove (to, from, i); } /* Adjust markers, and buffer data structure, to put the gap at BYTEPOS. @@ -238,28 +219,9 @@ gap_right (EMACS_INT charpos, EMACS_INT bytepos) /* Move at most 32000 chars before checking again for a quit. */ if (i > 32000) i = 32000; -#ifdef GAP_USE_BCOPY - if (i >= 128 - /* bcopy is safe if the two areas of memory do not overlap - or on systems where bcopy is always safe for moving downward. */ - && (BCOPY_DOWNWARD_SAFE - || from - to >= 128)) - { - /* If overlap is not safe, avoid it by not moving too many - characters at once. */ - if (!BCOPY_DOWNWARD_SAFE && i > from - to) - i = from - to; - new_s1 += i; - bcopy (from, to, i); - from += i, to += i; - } - else -#endif - { - new_s1 += i; - while (--i >= 0) - *to++ = *from++; - } + new_s1 += i; + memmove (to, from, i); + from += i, to += i; } adjust_markers_gap_motion (GPT_BYTE + GAP_SIZE, bytepos + GAP_SIZE, @@ -585,7 +547,7 @@ make_gap_smaller (EMACS_INT nbytes_removed) /* Pretend that the last unwanted part of the gap is the entire gap, and that the first desired part of the gap is part of the buffer text. */ - bzero (GPT_ADDR, new_gap_size); + memset (GPT_ADDR, 0, new_gap_size); GPT += new_gap_size; GPT_BYTE += new_gap_size; Z += new_gap_size; @@ -636,7 +598,7 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr, { if (from_multibyte == to_multibyte) { - bcopy (from_addr, to_addr, nbytes); + memcpy (to_addr, from_addr, nbytes); return nbytes; } else if (from_multibyte) @@ -966,7 +928,7 @@ insert_1_both (const unsigned char *string, MODIFF++; CHARS_MODIFF = MODIFF; - bcopy (string, GPT_ADDR, nbytes); + memcpy (GPT_ADDR, string, nbytes); GAP_SIZE -= nbytes; GPT += nchars; @@ -1007,7 +969,7 @@ insert_1_both (const unsigned char *string, copy them into the buffer. It does not work to use `insert' for this, because a GC could happen - before we bcopy the stuff into the buffer, and relocate the string + before we copy the stuff into the buffer, and relocate the string without insert noticing. */ void @@ -1182,7 +1144,7 @@ insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes) into the current buffer. It does not work to use `insert' for this, because a malloc could happen - and relocate BUF's text before the bcopy happens. */ + and relocate BUF's text before the copy happens. */ void insert_from_buffer (struct buffer *buf, @@ -1666,7 +1628,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new, void replace_range_2 (EMACS_INT from, EMACS_INT from_byte, EMACS_INT to, EMACS_INT to_byte, - char *ins, EMACS_INT inschars, EMACS_INT insbytes, + const char *ins, EMACS_INT inschars, EMACS_INT insbytes, int markers) { EMACS_INT nbytes_del, nchars_del; @@ -1712,7 +1674,7 @@ replace_range_2 (EMACS_INT from, EMACS_INT from_byte, make_gap (insbytes - GAP_SIZE); /* Copy the replacement text into the buffer. */ - bcopy (ins, GPT_ADDR, insbytes); + memcpy (GPT_ADDR, ins, insbytes); #ifdef BYTE_COMBINING_DEBUG /* We have copied text into the gap, but we have not marked @@ -2132,8 +2094,7 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end, NO-ERROR-FLAG is nil if there was an error, anything else meaning no error (so this function does nothing). */ Lisp_Object -reset_var_on_error (val) - Lisp_Object val; +reset_var_on_error (Lisp_Object val) { if (NILP (XCDR (val))) Fset (XCAR (val), Qnil); @@ -2297,8 +2258,7 @@ signal_after_change (EMACS_INT charpos, EMACS_INT lendel, EMACS_INT lenins) } Lisp_Object -Fcombine_after_change_execute_1 (val) - Lisp_Object val; +Fcombine_after_change_execute_1 (Lisp_Object val) { Vcombine_after_change_calls = val; return val; @@ -2307,7 +2267,7 @@ Fcombine_after_change_execute_1 (val) DEFUN ("combine-after-change-execute", Fcombine_after_change_execute, Scombine_after_change_execute, 0, 0, 0, doc: /* This function is for use internally in `combine-after-change-calls'. */) - () + (void) { int count = SPECPDL_INDEX (); EMACS_INT beg, end, change; @@ -2390,7 +2350,7 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute, } void -syms_of_insdel () +syms_of_insdel (void) { staticpro (&combine_after_change_list); staticpro (&combine_after_change_buffer); diff --git a/src/intervals.c b/src/intervals.c index 9836f763489..86cbe1effcc 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -52,9 +52,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define TMEM(sym, set) (CONSP (set) ? ! NILP (Fmemq (sym, set)) : ! NILP (set)) -Lisp_Object merge_properties_sticky (); -static INTERVAL reproduce_tree P_ ((INTERVAL, INTERVAL)); -static INTERVAL reproduce_tree_obj P_ ((INTERVAL, Lisp_Object)); +Lisp_Object merge_properties_sticky (Lisp_Object pleft, Lisp_Object pright); +static INTERVAL reproduce_tree (INTERVAL, INTERVAL); +static INTERVAL reproduce_tree_obj (INTERVAL, Lisp_Object); /* Utility functions for intervals. */ @@ -62,8 +62,7 @@ static INTERVAL reproduce_tree_obj P_ ((INTERVAL, Lisp_Object)); /* Create the root interval of some object, a buffer or string. */ INTERVAL -create_root_interval (parent) - Lisp_Object parent; +create_root_interval (Lisp_Object parent) { INTERVAL new; @@ -95,8 +94,7 @@ create_root_interval (parent) /* Make the interval TARGET have exactly the properties of SOURCE */ void -copy_properties (source, target) - register INTERVAL source, target; +copy_properties (register INTERVAL source, register INTERVAL target) { if (DEFAULT_INTERVAL_P (source) && DEFAULT_INTERVAL_P (target)) return; @@ -110,8 +108,7 @@ copy_properties (source, target) is added to TARGET if TARGET has no such property as yet. */ static void -merge_properties (source, target) - register INTERVAL source, target; +merge_properties (register INTERVAL source, register INTERVAL target) { register Lisp_Object o, sym, val; @@ -149,8 +146,7 @@ merge_properties (source, target) 0 otherwise. */ int -intervals_equal (i0, i1) - INTERVAL i0, i1; +intervals_equal (INTERVAL i0, INTERVAL i1) { register Lisp_Object i0_cdr, i0_sym; register Lisp_Object i1_cdr, i1_val; @@ -206,10 +202,7 @@ intervals_equal (i0, i1) Pass FUNCTION two args: an interval, and ARG. */ void -traverse_intervals_noorder (tree, function, arg) - INTERVAL tree; - void (* function) P_ ((INTERVAL, Lisp_Object)); - Lisp_Object arg; +traverse_intervals_noorder (INTERVAL tree, void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg) { /* Minimize stack usage. */ while (!NULL_INTERVAL_P (tree)) @@ -229,11 +222,7 @@ traverse_intervals_noorder (tree, function, arg) Pass FUNCTION two args: an interval, and ARG. */ void -traverse_intervals (tree, position, function, arg) - INTERVAL tree; - int position; - void (* function) P_ ((INTERVAL, Lisp_Object)); - Lisp_Object arg; +traverse_intervals (INTERVAL tree, int position, void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg) { while (!NULL_INTERVAL_P (tree)) { @@ -323,8 +312,7 @@ root_interval (interval) */ static INLINE INTERVAL -rotate_right (interval) - INTERVAL interval; +rotate_right (INTERVAL interval) { INTERVAL i; INTERVAL B = interval->left; @@ -371,8 +359,7 @@ rotate_right (interval) */ static INLINE INTERVAL -rotate_left (interval) - INTERVAL interval; +rotate_left (INTERVAL interval) { INTERVAL i; INTERVAL B = interval->right; @@ -413,8 +400,7 @@ rotate_left (interval) themselves are already balanced. */ static INTERVAL -balance_an_interval (i) - INTERVAL i; +balance_an_interval (INTERVAL i) { register int old_diff, new_diff; @@ -451,8 +437,7 @@ balance_an_interval (i) Lisp Object. */ static INLINE INTERVAL -balance_possible_root_interval (interval) - register INTERVAL interval; +balance_possible_root_interval (register INTERVAL interval) { Lisp_Object parent; int have_parent = 0; @@ -482,8 +467,7 @@ balance_possible_root_interval (interval) (the amount of text). */ static INTERVAL -balance_intervals_internal (tree) - register INTERVAL tree; +balance_intervals_internal (register INTERVAL tree) { /* Balance within each side. */ if (tree->left) @@ -496,8 +480,7 @@ balance_intervals_internal (tree) /* Advertised interface to balance intervals. */ INTERVAL -balance_intervals (tree) - INTERVAL tree; +balance_intervals (INTERVAL tree) { if (tree == NULL_INTERVAL) return NULL_INTERVAL; @@ -519,9 +502,7 @@ balance_intervals (tree) it is still a root after this operation. */ INTERVAL -split_interval_right (interval, offset) - INTERVAL interval; - int offset; +split_interval_right (INTERVAL interval, int offset) { INTERVAL new = make_interval (); int position = interval->position; @@ -566,9 +547,7 @@ split_interval_right (interval, offset) it is still a root after this operation. */ INTERVAL -split_interval_left (interval, offset) - INTERVAL interval; - int offset; +split_interval_left (INTERVAL interval, int offset) { INTERVAL new = make_interval (); int new_length = offset; @@ -608,8 +587,7 @@ split_interval_left (interval, offset) of another interval! */ int -interval_start_pos (source) - INTERVAL source; +interval_start_pos (INTERVAL source) { Lisp_Object parent; @@ -635,9 +613,7 @@ interval_start_pos (source) will update this cache based on the result of find_interval. */ INTERVAL -find_interval (tree, position) - register INTERVAL tree; - register int position; +find_interval (register INTERVAL tree, register int position) { /* The distance from the left edge of the subtree at TREE to POSITION. */ @@ -691,8 +667,7 @@ find_interval (tree, position) find_interval). */ INTERVAL -next_interval (interval) - register INTERVAL interval; +next_interval (register INTERVAL interval) { register INTERVAL i = interval; register int next_position; @@ -731,8 +706,7 @@ next_interval (interval) find_interval). */ INTERVAL -previous_interval (interval) - register INTERVAL interval; +previous_interval (register INTERVAL interval) { register INTERVAL i; @@ -771,9 +745,7 @@ previous_interval (interval) To speed up the process, we assume that the ->position of I and all its parents is already uptodate. */ INTERVAL -update_interval (i, pos) - register INTERVAL i; - int pos; +update_interval (register INTERVAL i, int pos) { if (NULL_INTERVAL_P (i)) return NULL_INTERVAL; @@ -892,9 +864,7 @@ adjust_intervals_for_insertion (tree, position, length) this text, and make it have the merged properties of both ends. */ static INTERVAL -adjust_intervals_for_insertion (tree, position, length) - INTERVAL tree; - int position, length; +adjust_intervals_for_insertion (INTERVAL tree, int position, int length) { register INTERVAL i; register INTERVAL temp; @@ -1119,8 +1089,7 @@ FR 8 9 A B */ Lisp_Object -merge_properties_sticky (pleft, pright) - Lisp_Object pleft, pright; +merge_properties_sticky (Lisp_Object pleft, Lisp_Object pright) { register Lisp_Object props, front, rear; Lisp_Object lfront, lrear, rfront, rrear; @@ -1256,8 +1225,7 @@ merge_properties_sticky (pleft, pright) storing the resulting subtree into its parent. */ static INTERVAL -delete_node (i) - register INTERVAL i; +delete_node (register INTERVAL i) { register INTERVAL migrate, this; register int migrate_amt; @@ -1290,8 +1258,7 @@ delete_node (i) for the length of I. */ void -delete_interval (i) - register INTERVAL i; +delete_interval (register INTERVAL i) { register INTERVAL parent; int amt = LENGTH (i); @@ -1345,9 +1312,7 @@ delete_interval (i) deleting the appropriate amount of text. */ static int -interval_deletion_adjustment (tree, from, amount) - register INTERVAL tree; - register int from, amount; +interval_deletion_adjustment (register INTERVAL tree, register int from, register int amount) { register int relative_position = from; @@ -1407,9 +1372,7 @@ interval_deletion_adjustment (tree, from, amount) buffer position, i.e. origin 1). */ static void -adjust_intervals_for_deletion (buffer, start, length) - struct buffer *buffer; - int start, length; +adjust_intervals_for_deletion (struct buffer *buffer, int start, int length) { register int left_to_delete = length; register INTERVAL tree = BUF_INTERVALS (buffer); @@ -1460,9 +1423,7 @@ adjust_intervals_for_deletion (buffer, start, length) of LENGTH. */ INLINE void -offset_intervals (buffer, start, length) - struct buffer *buffer; - int start, length; +offset_intervals (struct buffer *buffer, int start, int length) { if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0) return; @@ -1483,8 +1444,7 @@ offset_intervals (buffer, start, length) interval. */ INTERVAL -merge_interval_right (i) - register INTERVAL i; +merge_interval_right (register INTERVAL i) { register int absorb = LENGTH (i); register INTERVAL successor; @@ -1540,8 +1500,7 @@ merge_interval_right (i) The caller must verify that this is not the first (leftmost) interval. */ INTERVAL -merge_interval_left (i) - register INTERVAL i; +merge_interval_left (register INTERVAL i) { register int absorb = LENGTH (i); register INTERVAL predecessor; @@ -1595,12 +1554,11 @@ merge_interval_left (i) the pointers of the copy. */ static INTERVAL -reproduce_tree (source, parent) - INTERVAL source, parent; +reproduce_tree (INTERVAL source, INTERVAL parent) { register INTERVAL t = make_interval (); - bcopy (source, t, INTERVAL_SIZE); + memcpy (t, source, INTERVAL_SIZE); copy_properties (source, t); SET_INTERVAL_PARENT (t, parent); if (! NULL_LEFT_CHILD (source)) @@ -1612,13 +1570,11 @@ reproduce_tree (source, parent) } static INTERVAL -reproduce_tree_obj (source, parent) - INTERVAL source; - Lisp_Object parent; +reproduce_tree_obj (INTERVAL source, Lisp_Object parent) { register INTERVAL t = make_interval (); - bcopy (source, t, INTERVAL_SIZE); + memcpy (t, source, INTERVAL_SIZE); copy_properties (source, t); SET_INTERVAL_OBJECT (t, parent); if (! NULL_LEFT_CHILD (source)) @@ -1714,11 +1670,7 @@ make_new_interval (intervals, start, length) text... */ void -graft_intervals_into_buffer (source, position, length, buffer, inherit) - INTERVAL source; - int position, length; - struct buffer *buffer; - int inherit; +graft_intervals_into_buffer (INTERVAL source, int position, int length, struct buffer *buffer, int inherit) { register INTERVAL under, over, this, prev; register INTERVAL tree; @@ -1876,18 +1828,13 @@ graft_intervals_into_buffer (source, position, length, buffer, inherit) and for PROP appearing on the default-text-properties list. */ Lisp_Object -textget (plist, prop) - Lisp_Object plist; - register Lisp_Object prop; +textget (Lisp_Object plist, register Lisp_Object prop) { return lookup_char_property (plist, prop, 1); } Lisp_Object -lookup_char_property (plist, prop, textprop) - Lisp_Object plist; - register Lisp_Object prop; - int textprop; +lookup_char_property (Lisp_Object plist, register Lisp_Object prop, int textprop) { register Lisp_Object tail, fallback = Qnil; @@ -1974,8 +1921,7 @@ set_point (EMACS_INT charpos) if the invisible property comes from an overlay. */ static int -adjust_for_invis_intang (pos, test_offs, adj, test_intang) - int pos, test_offs, adj, test_intang; +adjust_for_invis_intang (int pos, int test_offs, int adj, int test_intang) { Lisp_Object invis_propval, invis_overlay; Lisp_Object test_pos; @@ -2237,8 +2183,7 @@ set_point_both (EMACS_INT charpos, EMACS_INT bytepos) segment that reaches all the way to point. */ void -move_if_not_intangible (position) - int position; +move_if_not_intangible (int position) { Lisp_Object pos; Lisp_Object intangible_propval; @@ -2301,11 +2246,7 @@ move_if_not_intangible (position) nil means the current buffer. */ int -get_property_and_range (pos, prop, val, start, end, object) - int pos; - Lisp_Object prop, *val; - EMACS_INT *start, *end; - Lisp_Object object; +get_property_and_range (int pos, Lisp_Object prop, Lisp_Object *val, EMACS_INT *start, EMACS_INT *end, Lisp_Object object) { INTERVAL i, prev, next; @@ -2348,10 +2289,7 @@ get_property_and_range (pos, prop, val, start, end, object) POSITION must be in the accessible part of BUFFER. */ Lisp_Object -get_local_map (position, buffer, type) - register int position; - register struct buffer *buffer; - Lisp_Object type; +get_local_map (register int position, register struct buffer *buffer, Lisp_Object type) { Lisp_Object prop, lispy_position, lispy_buffer; int old_begv, old_zv, old_begv_byte, old_zv_byte; @@ -2404,9 +2342,7 @@ get_local_map (position, buffer, type) The new interval tree has no parent and has a starting-position of 0. */ INTERVAL -copy_intervals (tree, start, length) - INTERVAL tree; - int start, length; +copy_intervals (INTERVAL tree, int start, int length) { register INTERVAL i, new, t; register int got, prevlen; @@ -2447,10 +2383,7 @@ copy_intervals (tree, start, length) /* Give STRING the properties of BUFFER from POSITION to LENGTH. */ INLINE void -copy_intervals_to_string (string, buffer, position, length) - Lisp_Object string; - struct buffer *buffer; - int position, length; +copy_intervals_to_string (Lisp_Object string, struct buffer *buffer, int position, int length) { INTERVAL interval_copy = copy_intervals (BUF_INTERVALS (buffer), position, length); @@ -2465,8 +2398,7 @@ copy_intervals_to_string (string, buffer, position, length) Assume they have identical characters. */ int -compare_string_intervals (s1, s2) - Lisp_Object s1, s2; +compare_string_intervals (Lisp_Object s1, Lisp_Object s2) { INTERVAL i1, i2; int pos = 0; @@ -2504,10 +2436,7 @@ compare_string_intervals (s1, s2) START_BYTE ... END_BYTE in bytes. */ static void -set_intervals_multibyte_1 (i, multi_flag, start, start_byte, end, end_byte) - INTERVAL i; - int multi_flag; - int start, start_byte, end, end_byte; +set_intervals_multibyte_1 (INTERVAL i, int multi_flag, int start, int start_byte, int end, int end_byte) { /* Fix the length of this interval. */ if (multi_flag) @@ -2617,8 +2546,7 @@ set_intervals_multibyte_1 (i, multi_flag, start, start_byte, end, end_byte) or to fit them as non-multibyte (if MULTI_FLAG is 0). */ void -set_intervals_multibyte (multi_flag) - int multi_flag; +set_intervals_multibyte (int multi_flag) { if (BUF_INTERVALS (current_buffer)) set_intervals_multibyte_1 (BUF_INTERVALS (current_buffer), multi_flag, diff --git a/src/intervals.h b/src/intervals.h index 5d1132e11ba..612c1a99848 100644 --- a/src/intervals.h +++ b/src/intervals.h @@ -28,8 +28,8 @@ struct interval { /* The first group of entries deal with the tree structure. */ - unsigned EMACS_INT total_length; /* Length of myself and both children. */ - unsigned EMACS_INT position; /* Cache of interval's character position. */ + EMACS_UINT total_length; /* Length of myself and both children. */ + EMACS_UINT position; /* Cache of interval's character position. */ /* This field is usually updated simultaneously with an interval traversal, there is no guarantee @@ -243,49 +243,49 @@ struct interval /* Declared in alloc.c */ -extern INTERVAL make_interval P_ ((void)); +extern INTERVAL make_interval (void); /* Declared in intervals.c */ -extern INTERVAL create_root_interval P_ ((Lisp_Object)); -extern void copy_properties P_ ((INTERVAL, INTERVAL)); -extern int intervals_equal P_ ((INTERVAL, INTERVAL)); -extern void traverse_intervals P_ ((INTERVAL, int, - void (*) (INTERVAL, Lisp_Object), - Lisp_Object)); -extern void traverse_intervals_noorder P_ ((INTERVAL, - void (*) (INTERVAL, Lisp_Object), - Lisp_Object)); -extern INTERVAL split_interval_right P_ ((INTERVAL, int)); -extern INTERVAL split_interval_left P_ ((INTERVAL, int)); -extern INTERVAL find_interval P_ ((INTERVAL, int)); -extern INTERVAL next_interval P_ ((INTERVAL)); -extern INTERVAL previous_interval P_ ((INTERVAL)); -extern INTERVAL merge_interval_left P_ ((INTERVAL)); -extern INTERVAL merge_interval_right P_ ((INTERVAL)); -extern void delete_interval P_ ((INTERVAL)); -extern INLINE void offset_intervals P_ ((struct buffer *, int, int)); -extern void graft_intervals_into_buffer P_ ((INTERVAL, int, int, - struct buffer *, int)); -extern void verify_interval_modification P_ ((struct buffer *, int, int)); -extern INTERVAL balance_intervals P_ ((INTERVAL)); -extern INLINE void copy_intervals_to_string P_ ((Lisp_Object, struct buffer *, - int, int)); -extern INTERVAL copy_intervals P_ ((INTERVAL, int, int)); -extern int compare_string_intervals P_ ((Lisp_Object, Lisp_Object)); -extern Lisp_Object textget P_ ((Lisp_Object, Lisp_Object)); -extern Lisp_Object lookup_char_property P_ ((Lisp_Object, Lisp_Object, int)); -extern void move_if_not_intangible P_ ((int)); -extern int get_property_and_range P_ ((int, Lisp_Object, Lisp_Object *, - EMACS_INT *, EMACS_INT *, Lisp_Object)); -extern Lisp_Object get_local_map P_ ((int, struct buffer *, Lisp_Object)); -extern INTERVAL update_interval P_ ((INTERVAL, int)); -extern void set_intervals_multibyte P_ ((int)); -extern INTERVAL validate_interval_range P_ ((Lisp_Object, Lisp_Object *, - Lisp_Object *, int)); +extern INTERVAL create_root_interval (Lisp_Object); +extern void copy_properties (INTERVAL, INTERVAL); +extern int intervals_equal (INTERVAL, INTERVAL); +extern void traverse_intervals (INTERVAL, int, + void (*) (INTERVAL, Lisp_Object), + Lisp_Object); +extern void traverse_intervals_noorder (INTERVAL, + void (*) (INTERVAL, Lisp_Object), + Lisp_Object); +extern INTERVAL split_interval_right (INTERVAL, int); +extern INTERVAL split_interval_left (INTERVAL, int); +extern INTERVAL find_interval (INTERVAL, int); +extern INTERVAL next_interval (INTERVAL); +extern INTERVAL previous_interval (INTERVAL); +extern INTERVAL merge_interval_left (INTERVAL); +extern INTERVAL merge_interval_right (INTERVAL); +extern void delete_interval (INTERVAL); +extern INLINE void offset_intervals (struct buffer *, int, int); +extern void graft_intervals_into_buffer (INTERVAL, int, int, + struct buffer *, int); +extern void verify_interval_modification (struct buffer *, int, int); +extern INTERVAL balance_intervals (INTERVAL); +extern INLINE void copy_intervals_to_string (Lisp_Object, struct buffer *, + int, int); +extern INTERVAL copy_intervals (INTERVAL, int, int); +extern int compare_string_intervals (Lisp_Object, Lisp_Object); +extern Lisp_Object textget (Lisp_Object, Lisp_Object); +extern Lisp_Object lookup_char_property (Lisp_Object, Lisp_Object, int); +extern void move_if_not_intangible (int); +extern int get_property_and_range (int, Lisp_Object, Lisp_Object *, + EMACS_INT *, EMACS_INT *, Lisp_Object); +extern Lisp_Object get_local_map (int, struct buffer *, Lisp_Object); +extern INTERVAL update_interval (INTERVAL, int); +extern void set_intervals_multibyte (int); +extern INTERVAL validate_interval_range (Lisp_Object, Lisp_Object *, + Lisp_Object *, int); /* Defined in xdisp.c */ -extern int invisible_p P_ ((Lisp_Object, Lisp_Object)); +extern int invisible_p (Lisp_Object, Lisp_Object); /* Declared in textprop.c */ @@ -323,27 +323,27 @@ EXFUN (Fremove_text_properties, 4); EXFUN (Ftext_property_any, 5); EXFUN (Ftext_property_not_all, 5); EXFUN (Fprevious_single_char_property_change, 4); -extern Lisp_Object copy_text_properties P_ ((Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object)); -extern Lisp_Object set_text_properties P_ ((Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object, - Lisp_Object)); -extern void set_text_properties_1 P_ ((Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object, INTERVAL)); +extern Lisp_Object copy_text_properties (Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object); +extern Lisp_Object set_text_properties (Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object, + Lisp_Object); +extern void set_text_properties_1 (Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object, INTERVAL); -Lisp_Object text_property_list P_ ((Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object)); -int add_text_properties_from_list P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); -Lisp_Object extend_property_ranges P_ ((Lisp_Object, Lisp_Object)); -Lisp_Object get_char_property_and_overlay P_ ((Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object*)); -extern int text_property_stickiness P_ ((Lisp_Object prop, Lisp_Object pos, - Lisp_Object buffer)); -extern Lisp_Object get_pos_property P_ ((Lisp_Object pos, Lisp_Object prop, - Lisp_Object object)); +Lisp_Object text_property_list (Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object); +int add_text_properties_from_list (Lisp_Object, Lisp_Object, Lisp_Object); +Lisp_Object extend_property_ranges (Lisp_Object, Lisp_Object); +Lisp_Object get_char_property_and_overlay (Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object*); +extern int text_property_stickiness (Lisp_Object prop, Lisp_Object pos, + Lisp_Object buffer); +extern Lisp_Object get_pos_property (Lisp_Object pos, Lisp_Object prop, + Lisp_Object object); -extern void syms_of_textprop P_ ((void)); +extern void syms_of_textprop (void); #include "composite.h" diff --git a/src/keyboard.c b/src/keyboard.c index 18d75f9b01c..ce80bb9d641 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -42,7 +42,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "puresize.h" #include "systime.h" #include "atimer.h" -#include <setjmp.h> +#include "process.h" #include <errno.h> #ifdef HAVE_GTK_AND_PTHREAD @@ -521,17 +521,15 @@ extern Lisp_Object Qleft_margin, Qright_margin; extern Lisp_Object Qleft_fringe, Qright_fringe; extern Lisp_Object QCmap; -Lisp_Object recursive_edit_unwind (), command_loop (); -Lisp_Object Fthis_command_keys (); +Lisp_Object recursive_edit_unwind (Lisp_Object buffer), command_loop (void); +Lisp_Object Fthis_command_keys (void); Lisp_Object Qextended_command_history; -EMACS_TIME timer_check (); +EMACS_TIME timer_check (int do_it_now); extern Lisp_Object Vhistory_length, Vtranslation_table_for_input; -extern char *x_get_keysym_name (); - -static void record_menu_key (); -static int echo_length (); +static void record_menu_key (Lisp_Object c); +static int echo_length (void); Lisp_Object Qpolling_period; @@ -611,41 +609,40 @@ Lisp_Object Venable_disabled_menus_and_buttons; #define READABLE_EVENTS_IGNORE_SQUEEZABLES (1 << 2) /* Function for init_keyboard to call with no args (if nonzero). */ -void (*keyboard_init_hook) (); +void (*keyboard_init_hook) (void); -static int read_avail_input P_ ((int)); -static void get_input_pending P_ ((int *, int)); -static int readable_events P_ ((int)); -static Lisp_Object read_char_x_menu_prompt P_ ((int, Lisp_Object *, - Lisp_Object, int *)); -static Lisp_Object read_char_x_menu_prompt (); -static Lisp_Object read_char_minibuf_menu_prompt P_ ((int, int, - Lisp_Object *)); -static Lisp_Object make_lispy_event P_ ((struct input_event *)); +static int read_avail_input (int); +static void get_input_pending (int *, int); +static int readable_events (int); +static Lisp_Object read_char_x_menu_prompt (int, Lisp_Object *, + Lisp_Object, int *); +static Lisp_Object read_char_minibuf_menu_prompt (int, int, + Lisp_Object *); +static Lisp_Object make_lispy_event (struct input_event *); #if defined (HAVE_MOUSE) || defined (HAVE_GPM) -static Lisp_Object make_lispy_movement P_ ((struct frame *, Lisp_Object, - enum scroll_bar_part, - Lisp_Object, Lisp_Object, - unsigned long)); +static Lisp_Object make_lispy_movement (struct frame *, Lisp_Object, + enum scroll_bar_part, + Lisp_Object, Lisp_Object, + unsigned long); #endif -static Lisp_Object modify_event_symbol P_ ((int, unsigned, Lisp_Object, - Lisp_Object, char **, - Lisp_Object *, unsigned)); -static Lisp_Object make_lispy_switch_frame P_ ((Lisp_Object)); -static void save_getcjmp P_ ((jmp_buf)); -static void save_getcjmp (); -static void restore_getcjmp P_ ((jmp_buf)); -static Lisp_Object apply_modifiers P_ ((int, Lisp_Object)); -static void clear_event P_ ((struct input_event *)); -static Lisp_Object restore_kboard_configuration P_ ((Lisp_Object)); -static SIGTYPE interrupt_signal P_ ((int signalnum)); -static void handle_interrupt P_ ((void)); -static void timer_start_idle P_ ((void)); -static void timer_stop_idle P_ ((void)); -static void timer_resume_idle P_ ((void)); -static SIGTYPE handle_user_signal P_ ((int)); -static char *find_user_signal_name P_ ((int)); -static int store_user_signal_events P_ ((void)); +static Lisp_Object modify_event_symbol (int, unsigned, Lisp_Object, + Lisp_Object, char **, + Lisp_Object *, unsigned); +static Lisp_Object make_lispy_switch_frame (Lisp_Object); +static void save_getcjmp (jmp_buf); +static void restore_getcjmp (jmp_buf); +static Lisp_Object apply_modifiers (int, Lisp_Object); +static void clear_event (struct input_event *); +static Lisp_Object restore_kboard_configuration (Lisp_Object); +static SIGTYPE interrupt_signal (int signalnum); +static SIGTYPE input_available_signal (int signo); +static void handle_interrupt (void); +static void timer_start_idle (void); +static void timer_stop_idle (void); +static void timer_resume_idle (void); +static SIGTYPE handle_user_signal (int); +static char *find_user_signal_name (int); +static int store_user_signal_events (void); /* Nonzero means don't try to suspend even if the operating system seems to support it. */ @@ -658,8 +655,7 @@ extern Lisp_Object Qidentity, Qonly; Also start echoing. */ void -echo_prompt (str) - Lisp_Object str; +echo_prompt (Lisp_Object str) { current_kboard->echo_string = str; current_kboard->echo_after_prompt = SCHARS (str); @@ -671,8 +667,7 @@ echo_prompt (str) jazz), or a symbol, whose name is printed. */ void -echo_char (c) - Lisp_Object c; +echo_char (Lisp_Object c) { if (current_kboard->immediate_echo) { @@ -721,7 +716,7 @@ echo_char (c) ptr = buffer + offset; } - bcopy (text, ptr, len); + memcpy (ptr, text, len); ptr += len; } @@ -759,7 +754,7 @@ echo_char (c) empty, so that it serves as a mini-prompt for the very next character. */ void -echo_dash () +echo_dash (void) { /* Do nothing if not echoing at all. */ if (NILP (current_kboard->echo_string)) @@ -800,7 +795,7 @@ echo_dash () doing so. */ void -echo_now () +echo_now (void) { if (!current_kboard->immediate_echo) { @@ -850,7 +845,7 @@ echo_now () /* Turn off echoing, for the start of a new command. */ void -cancel_echoing () +cancel_echoing (void) { current_kboard->immediate_echo = 0; current_kboard->echo_after_prompt = -1; @@ -863,7 +858,7 @@ cancel_echoing () /* Return the length of the current echo string. */ static int -echo_length () +echo_length (void) { return (STRINGP (current_kboard->echo_string) ? SCHARS (current_kboard->echo_string) @@ -875,8 +870,7 @@ echo_length () switches frames while entering a key sequence. */ static void -echo_truncate (nchars) - int nchars; +echo_truncate (int nchars) { if (STRINGP (current_kboard->echo_string)) current_kboard->echo_string @@ -888,8 +882,7 @@ echo_truncate (nchars) /* Functions for manipulating this_command_keys. */ static void -add_command_key (key) - Lisp_Object key; +add_command_key (Lisp_Object key) { #if 0 /* Not needed after we made Freset_this_command_lengths do the job immediately. */ @@ -916,7 +909,7 @@ add_command_key (key) Lisp_Object -recursive_edit_1 () +recursive_edit_1 (void) { int count = SPECPDL_INDEX (); Lisp_Object val; @@ -961,7 +954,7 @@ recursive_edit_1 () /* When an auto-save happens, record the "time", and don't do again soon. */ void -record_auto_save () +record_auto_save (void) { last_auto_save = num_nonmacro_input_events; } @@ -969,7 +962,7 @@ record_auto_save () /* Make an auto save happen as soon as possible at command level. */ void -force_auto_save_soon () +force_auto_save_soon (void) { last_auto_save = - auto_save_interval - 1; @@ -982,7 +975,7 @@ To get out of the recursive edit, a command can do `(throw 'exit nil)'; that tells this function to return. Alternatively, `(throw 'exit t)' makes this function signal an error. This function is called by the editor initialization to begin editing. */) - () + (void) { int count = SPECPDL_INDEX (); Lisp_Object buffer; @@ -1014,8 +1007,7 @@ This function is called by the editor initialization to begin editing. */) } Lisp_Object -recursive_edit_unwind (buffer) - Lisp_Object buffer; +recursive_edit_unwind (Lisp_Object buffer) { if (BUFFERP (buffer)) Fset_buffer (buffer); @@ -1060,8 +1052,7 @@ single_kboard_state () get out of it. */ void -not_single_kboard_state (kboard) - KBOARD *kboard; +not_single_kboard_state (KBOARD *kboard) { if (kboard == current_kboard) single_kboard = 0; @@ -1080,8 +1071,7 @@ struct kboard_stack static struct kboard_stack *kboard_stack; void -push_kboard (k) - struct kboard *k; +push_kboard (struct kboard *k) { struct kboard_stack *p = (struct kboard_stack *) xmalloc (sizeof (struct kboard_stack)); @@ -1094,7 +1084,7 @@ push_kboard (k) } void -pop_kboard () +pop_kboard (void) { struct terminal *t; struct kboard_stack *p = kboard_stack; @@ -1129,8 +1119,7 @@ pop_kboard () locked, then this function will throw an errow. */ void -temporarily_switch_to_single_kboard (f) - struct frame *f; +temporarily_switch_to_single_kboard (struct frame *f) { int was_locked = single_kboard; if (was_locked) @@ -1170,8 +1159,7 @@ record_single_kboard_state () #endif static Lisp_Object -restore_kboard_configuration (was_locked) - Lisp_Object was_locked; +restore_kboard_configuration (Lisp_Object was_locked) { if (NILP (was_locked)) single_kboard = 0; @@ -1192,8 +1180,7 @@ restore_kboard_configuration (was_locked) by printing an error message and returning to the editor command loop. */ Lisp_Object -cmd_error (data) - Lisp_Object data; +cmd_error (Lisp_Object data) { Lisp_Object old_level, old_length; char macroerror[50]; @@ -1251,9 +1238,7 @@ cmd_error (data) string. */ void -cmd_error_internal (data, context) - Lisp_Object data; - char *context; +cmd_error_internal (Lisp_Object data, const char *context) { struct frame *sf = SELECTED_FRAME (); @@ -1304,16 +1289,16 @@ cmd_error_internal (data, context) Vsignaling_function = Qnil; } -Lisp_Object command_loop_1 (); -Lisp_Object command_loop_2 (); -Lisp_Object top_level_1 (); +Lisp_Object command_loop_1 (void); +Lisp_Object command_loop_2 (Lisp_Object); +Lisp_Object top_level_1 (Lisp_Object); /* Entry to editor-command-loop. This level has the catches for exiting/returning to editor command loop. It returns nil to exit recursive edit, t to abort it. */ Lisp_Object -command_loop () +command_loop (void) { if (command_loop_level > 0 || minibuf_level > 0) { @@ -1348,7 +1333,7 @@ command_loop () returned due to end of file (or end of kbd macro). */ Lisp_Object -command_loop_2 () +command_loop_2 (Lisp_Object ignore) { register Lisp_Object val; @@ -1360,13 +1345,13 @@ command_loop_2 () } Lisp_Object -top_level_2 () +top_level_2 (void) { return Feval (Vtop_level); } Lisp_Object -top_level_1 () +top_level_1 (Lisp_Object ignore) { /* On entry to the outer level, run the startup file */ if (!NILP (Vtop_level)) @@ -1381,7 +1366,7 @@ top_level_1 () DEFUN ("top-level", Ftop_level, Stop_level, 0, 0, "", doc: /* Exit all recursive editing levels. This also exits all active minibuffers. */) - () + (void) { #ifdef HAVE_WINDOW_SYSTEM if (display_hourglass_p) @@ -1398,7 +1383,7 @@ This also exits all active minibuffers. */) DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, "", doc: /* Exit from the innermost recursive edit or minibuffer. */) - () + (void) { if (command_loop_level > 0 || minibuf_level > 0) Fthrow (Qexit, Qnil); @@ -1409,7 +1394,7 @@ DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, 0, "", doc: /* Abort the command that requested this recursive edit or minibuffer input. */) - () + (void) { if (command_loop_level > 0 || minibuf_level > 0) Fthrow (Qexit, Qt); @@ -1424,8 +1409,7 @@ DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, of this function. */ static Lisp_Object -tracking_off (old_value) - Lisp_Object old_value; +tracking_off (Lisp_Object old_value) { do_mouse_tracking = old_value; if (NILP (old_value)) @@ -1451,8 +1435,7 @@ Within a `track-mouse' form, mouse motion generates input events that you can read with `read-event'. Normally, mouse motion is ignored. usage: (track-mouse BODY...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { int count = SPECPDL_INDEX (); Lisp_Object val; @@ -1475,7 +1458,7 @@ usage: (track-mouse BODY...) */) int ignore_mouse_drag_p; static FRAME_PTR -some_mouse_moved () +some_mouse_moved (void) { Lisp_Object tail, frame; @@ -1499,17 +1482,16 @@ some_mouse_moved () /* This is the actual command reading loop, sans error-handling encapsulation. */ -static int read_key_sequence P_ ((Lisp_Object *, int, Lisp_Object, - int, int, int)); -void safe_run_hooks P_ ((Lisp_Object)); -static void adjust_point_for_property P_ ((int, int)); +static int read_key_sequence (Lisp_Object *, int, Lisp_Object, + int, int, int); +void safe_run_hooks (Lisp_Object); +static void adjust_point_for_property (int, int); /* Cancel hourglass from protect_unwind. ARG is not used. */ #ifdef HAVE_WINDOW_SYSTEM static Lisp_Object -cancel_hourglass_unwind (arg) - Lisp_Object arg; +cancel_hourglass_unwind (Lisp_Object arg) { cancel_hourglass (); return Qnil; @@ -1517,7 +1499,7 @@ cancel_hourglass_unwind (arg) #endif Lisp_Object -command_loop_1 () +command_loop_1 (void) { Lisp_Object cmd; Lisp_Object keybuf[30]; @@ -1862,12 +1844,10 @@ extern Lisp_Object Qcomposition, Qdisplay; LAST_PT is the last position of point. */ extern Lisp_Object Qafter_string, Qbefore_string; -extern Lisp_Object get_pos_property P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); +extern Lisp_Object get_pos_property (Lisp_Object, Lisp_Object, Lisp_Object); static void -adjust_point_for_property (last_pt, modified) - int last_pt; - int modified; +adjust_point_for_property (int last_pt, int modified) { EMACS_INT beg, end; Lisp_Object val, overlay, tmp; @@ -2017,8 +1997,7 @@ adjust_point_for_property (last_pt, modified) /* Subroutine for safe_run_hooks: run the hook HOOK. */ static Lisp_Object -safe_run_hooks_1 (hook) - Lisp_Object hook; +safe_run_hooks_1 (void) { if (NILP (Vrun_hooks)) return Qnil; @@ -2028,8 +2007,7 @@ safe_run_hooks_1 (hook) /* Subroutine for safe_run_hooks: handle an error by clearing out the hook. */ static Lisp_Object -safe_run_hooks_error (data) - Lisp_Object data; +safe_run_hooks_error (Lisp_Object data) { Lisp_Object args[3]; args[0] = build_string ("Error in %s: %s"); @@ -2044,8 +2022,7 @@ safe_run_hooks_error (data) to mysteriously evaporate. */ void -safe_run_hooks (hook) - Lisp_Object hook; +safe_run_hooks (Lisp_Object hook) { int count = SPECPDL_INDEX (); specbind (Qinhibit_quit, hook); @@ -2077,7 +2054,7 @@ struct atimer *poll_timer; there. */ void -poll_for_input_1 () +poll_for_input_1 (void) { /* Tell ns_read_socket() it is being called asynchronously so it can avoid doing anything dangerous. */ @@ -2096,8 +2073,7 @@ poll_for_input_1 () poll_timer. */ void -poll_for_input (timer) - struct atimer *timer; +poll_for_input (struct atimer *timer) { if (poll_suppress_count == 0) { @@ -2116,7 +2092,7 @@ poll_for_input (timer) This function is called unconditionally from various places. */ void -start_polling () +start_polling (void) { #ifdef POLL_FOR_INPUT /* XXX This condition was (read_socket_hook && !interrupt_input), @@ -2153,7 +2129,7 @@ start_polling () /* Nonzero if we are using polling to handle input asynchronously. */ int -input_polling_used () +input_polling_used (void) { #ifdef POLL_FOR_INPUT /* XXX This condition was (read_socket_hook && !interrupt_input), @@ -2168,7 +2144,7 @@ input_polling_used () /* Turn off polling. */ void -stop_polling () +stop_polling (void) { #ifdef POLL_FOR_INPUT /* XXX This condition was (read_socket_hook && !interrupt_input), @@ -2183,8 +2159,7 @@ stop_polling () and start or stop polling accordingly. */ void -set_poll_suppress_count (count) - int count; +set_poll_suppress_count (int count) { #ifdef POLL_FOR_INPUT if (count == 0 && poll_suppress_count != 0) @@ -2204,8 +2179,7 @@ set_poll_suppress_count (count) But don't decrease it. */ void -bind_polling_period (n) - int n; +bind_polling_period (int n) { #ifdef POLL_FOR_INPUT int new = polling_period; @@ -2224,8 +2198,7 @@ bind_polling_period (n) /* Apply the control modifier to CHARACTER. */ int -make_ctrl_char (c) - int c; +make_ctrl_char (int c) { /* Save the upper bits here. */ int upper = c & ~0177; @@ -2294,9 +2267,8 @@ make_ctrl_char (c) from X code running asynchronously. */ void -show_help_echo (help, window, object, pos, ok_to_overwrite_keystroke_echo) - Lisp_Object help, window, object, pos; - int ok_to_overwrite_keystroke_echo; +show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object, + Lisp_Object pos, int ok_to_overwrite_keystroke_echo) { if (!NILP (help) && !STRINGP (help)) { @@ -2343,9 +2315,10 @@ show_help_echo (help, window, object, pos, ok_to_overwrite_keystroke_echo) /* Input of single characters from keyboard */ -Lisp_Object print_help (); -static Lisp_Object kbd_buffer_get_event (); -static void record_char (); +Lisp_Object print_help (Lisp_Object object); +static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, int *used_mouse_menu, + struct timeval *end_time); +static void record_char (Lisp_Object c); static Lisp_Object help_form_saved_window_configs; static Lisp_Object @@ -2394,13 +2367,8 @@ do { if (polling_stopped_here) start_polling (); \ Value is t if we showed a menu and the user rejected it. */ Lisp_Object -read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) - int commandflag; - int nmaps; - Lisp_Object *maps; - Lisp_Object prev_event; - int *used_mouse_menu; - EMACS_TIME *end_time; +read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event, + int *used_mouse_menu, struct timeval *end_time) { volatile Lisp_Object c; int count, jmpcount; @@ -3311,8 +3279,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) Record it for echoing, for this-command-keys, and so on. */ static void -record_menu_key (c) - Lisp_Object c; +record_menu_key (Lisp_Object c) { /* Wipe the echo area. */ clear_message (1, 0); @@ -3346,8 +3313,7 @@ record_menu_key (c) /* Return 1 if should recognize C as "the help character". */ int -help_char_p (c) - Lisp_Object c; +help_char_p (Lisp_Object c) { Lisp_Object tail; @@ -3362,8 +3328,7 @@ help_char_p (c) /* Record the input event C in various ways. */ static void -record_char (c) - Lisp_Object c; +record_char (Lisp_Object c) { int recorded = 0; @@ -3497,8 +3462,7 @@ record_char (c) } Lisp_Object -print_help (object) - Lisp_Object object; +print_help (Lisp_Object object) { struct buffer *old = current_buffer; Fprinc (object, Qnil); @@ -3514,17 +3478,15 @@ print_help (object) See read_process_output. */ static void -save_getcjmp (temp) - jmp_buf temp; +save_getcjmp (jmp_buf temp) { - bcopy (getcjmp, temp, sizeof getcjmp); + memcpy (temp, getcjmp, sizeof getcjmp); } static void -restore_getcjmp (temp) - jmp_buf temp; +restore_getcjmp (jmp_buf temp) { - bcopy (temp, getcjmp, sizeof getcjmp); + memcpy (getcjmp, temp, sizeof getcjmp); } /* Low level keyboard/mouse input. @@ -3534,8 +3496,7 @@ restore_getcjmp (temp) /* Return true if there are any events in the queue that read-char would return. If this returns false, a read-char would block. */ static int -readable_events (flags) - int flags; +readable_events (int flags) { #ifdef HAVE_DBUS /* Check whether a D-Bus message has arrived. */ @@ -3611,8 +3572,7 @@ readable_events (flags) int stop_character; static KBOARD * -event_to_kboard (event) - struct input_event *event; +event_to_kboard (struct input_event *event) { Lisp_Object frame; frame = event->frame_or_window; @@ -3630,14 +3590,25 @@ event_to_kboard (event) return FRAME_KBOARD (XFRAME (frame)); } +/* Return the number of slots occupied in kbd_buffer. */ + +static int +kbd_buffer_nr_stored (void) +{ + return kbd_fetch_ptr == kbd_store_ptr + ? 0 + : (kbd_fetch_ptr < kbd_store_ptr + ? kbd_store_ptr - kbd_fetch_ptr + : ((kbd_buffer + KBD_BUFFER_SIZE) - kbd_fetch_ptr + + (kbd_store_ptr - kbd_buffer))); +} Lisp_Object Vthrow_on_input; /* Store an event obtained at interrupt level into kbd_buffer, fifo */ void -kbd_buffer_store_event (event) - register struct input_event *event; +kbd_buffer_store_event (register struct input_event *event) { kbd_buffer_store_event_hold (event, 0); } @@ -3655,9 +3626,8 @@ kbd_buffer_store_event (event) */ void -kbd_buffer_store_event_hold (event, hold_quit) - register struct input_event *event; - struct input_event *hold_quit; +kbd_buffer_store_event_hold (register struct input_event *event, + struct input_event *hold_quit) { if (event->kind == NO_EVENT) abort (); @@ -3704,7 +3674,7 @@ kbd_buffer_store_event_hold (event, hold_quit) if (hold_quit) { - bcopy (event, (char *) hold_quit, sizeof (*event)); + memcpy (hold_quit, event, sizeof (*event)); return; } @@ -3753,6 +3723,17 @@ kbd_buffer_store_event_hold (event, hold_quit) { *kbd_store_ptr = *event; ++kbd_store_ptr; + if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE/2 && ! kbd_on_hold_p ()) + { + /* Don't read keyboard input until we have processed kbd_buffer. + This happens when pasting text longer than KBD_BUFFER_SIZE/2. */ + hold_keyboard_input (); +#ifdef SIGIO + if (!noninteractive) + signal (SIGIO, SIG_IGN); +#endif + stop_polling (); + } } /* If we're inside while-no-input, and this event qualifies @@ -3778,8 +3759,7 @@ kbd_buffer_store_event_hold (event, hold_quit) /* Put an input event back in the head of the event queue. */ void -kbd_buffer_unget_event (event) - register struct input_event *event; +kbd_buffer_unget_event (register struct input_event *event) { if (kbd_fetch_ptr == kbd_buffer) kbd_fetch_ptr = kbd_buffer + KBD_BUFFER_SIZE; @@ -3807,9 +3787,8 @@ kbd_buffer_unget_event (event) Value is the number of input_events generated. */ void -gen_help_event (help, frame, window, object, pos) - Lisp_Object help, frame, object, window; - int pos; +gen_help_event (Lisp_Object help, Lisp_Object frame, Lisp_Object window, + Lisp_Object object, int pos) { struct input_event event; @@ -3828,8 +3807,7 @@ gen_help_event (help, frame, window, object, pos) /* Store HELP_EVENTs for HELP on FRAME in the input queue. */ void -kbd_buffer_store_help_event (frame, help) - Lisp_Object frame, help; +kbd_buffer_store_help_event (Lisp_Object frame, Lisp_Object help) { struct input_event event; @@ -3846,7 +3824,7 @@ kbd_buffer_store_help_event (frame, help) /* Discard any mouse events in the event buffer by setting them to NO_EVENT. */ void -discard_mouse_events () +discard_mouse_events (void) { struct input_event *sp; for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++) @@ -3876,8 +3854,7 @@ discard_mouse_events () are no real input events. */ int -kbd_buffer_events_waiting (discard) - int discard; +kbd_buffer_events_waiting (int discard) { struct input_event *sp; @@ -3899,8 +3876,7 @@ kbd_buffer_events_waiting (discard) /* Clear input event EVENT. */ static INLINE void -clear_event (event) - struct input_event *event; +clear_event (struct input_event *event) { event->kind = NO_EVENT; } @@ -3913,13 +3889,24 @@ clear_event (event) We always read and discard one event. */ static Lisp_Object -kbd_buffer_get_event (kbp, used_mouse_menu, end_time) - KBOARD **kbp; - int *used_mouse_menu; - EMACS_TIME *end_time; +kbd_buffer_get_event (KBOARD **kbp, + int *used_mouse_menu, + struct timeval *end_time) { register int c; Lisp_Object obj; + + if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE/4) + { + /* Start reading input again, we have processed enough so we can + accept new events again. */ + unhold_keyboard_input (); +#ifdef SIGIO + if (!noninteractive) + signal (SIGIO, input_available_signal); +#endif /* SIGIO */ + start_polling (); + } if (noninteractive /* In case we are running as a daemon, only do this before @@ -4283,8 +4270,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) then return, without reading any user-visible events. */ void -swallow_events (do_display) - int do_display; +swallow_events (int do_display) { int old_timers_run; @@ -4334,7 +4320,7 @@ swallow_events (do_display) for the sake of running idle-time timers. */ static void -timer_start_idle () +timer_start_idle (void) { Lisp_Object timers; @@ -4362,7 +4348,7 @@ timer_start_idle () /* Record that Emacs is no longer idle, so stop running idle-time timers. */ static void -timer_stop_idle () +timer_stop_idle (void) { EMACS_SET_SECS_USECS (timer_idleness_start_time, -1, -1); } @@ -4370,7 +4356,7 @@ timer_stop_idle () /* Resume idle timer from last idle start time. */ static void -timer_resume_idle () +timer_resume_idle (void) { if (! EMACS_TIME_NEG_P (timer_idleness_start_time)) return; @@ -4401,7 +4387,7 @@ extern Lisp_Object Qapply; should be done. */ static EMACS_TIME -timer_check_2 () +timer_check_2 (void) { EMACS_TIME nexttime; EMACS_TIME now, idleness_now; @@ -4602,12 +4588,11 @@ timer_check_2 () Now we always run timers directly. */ EMACS_TIME -timer_check (do_it_now) - int do_it_now; +timer_check (int do_it_now) { EMACS_TIME nexttime; - do + do { nexttime = timer_check_2 (); } @@ -4626,7 +4611,7 @@ The value when Emacs is not idle is nil. The microsecond count is zero on systems that do not provide resolution finer than a second. */) - () + (void) { if (! EMACS_TIME_NEG_P (timer_idleness_start_time)) { @@ -5254,10 +5239,8 @@ int double_click_count; /* Return position of a mouse click or wheel event */ static Lisp_Object -make_lispy_position (f, x, y, time) - struct frame *f; - Lisp_Object *x, *y; - unsigned long time; +make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, + unsigned long time) { Lisp_Object window; enum window_part part; @@ -5444,8 +5427,7 @@ make_lispy_position (f, x, y, time) in order to build drag events when the button is released. */ static Lisp_Object -make_lispy_event (event) - struct input_event *event; +make_lispy_event (struct input_event *event) { int i; @@ -6152,12 +6134,8 @@ make_lispy_event (event) #if defined(HAVE_MOUSE) || defined(HAVE_GPM) static Lisp_Object -make_lispy_movement (frame, bar_window, part, x, y, time) - FRAME_PTR frame; - Lisp_Object bar_window; - enum scroll_bar_part part; - Lisp_Object x, y; - unsigned long time; +make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part, + Lisp_Object x, Lisp_Object y, unsigned long time) { /* Is it a scroll bar movement? */ if (frame && ! NILP (bar_window)) @@ -6192,8 +6170,7 @@ make_lispy_movement (frame, bar_window, part, x, y, time) /* Construct a switch frame event. */ static Lisp_Object -make_lispy_switch_frame (frame) - Lisp_Object frame; +make_lispy_switch_frame (Lisp_Object frame) { return Fcons (Qswitch_frame, Fcons (frame, Qnil)); } @@ -6209,9 +6186,7 @@ make_lispy_switch_frame (frame) This doesn't use any caches. */ static int -parse_modifiers_uncached (symbol, modifier_end) - Lisp_Object symbol; - int *modifier_end; +parse_modifiers_uncached (Lisp_Object symbol, int *modifier_end) { Lisp_Object name; int i; @@ -6321,10 +6296,7 @@ parse_modifiers_uncached (symbol, modifier_end) prepended to the string BASE[0..BASE_LEN-1]. This doesn't use any caches. */ static Lisp_Object -apply_modifiers_uncached (modifiers, base, base_len, base_len_byte) - int modifiers; - char *base; - int base_len, base_len_byte; +apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_byte) { /* Since BASE could contain nulls, we can't use intern here; we have to use Fintern, which expects a genuine Lisp_String, and keeps a @@ -6363,8 +6335,8 @@ apply_modifiers_uncached (modifiers, base, base_len, base_len_byte) new_name = make_uninit_multibyte_string (mod_len + base_len, mod_len + base_len_byte); - bcopy (new_mods, SDATA (new_name), mod_len); - bcopy (base, SDATA (new_name) + mod_len, base_len_byte); + memcpy (SDATA (new_name), new_mods, mod_len); + memcpy (SDATA (new_name) + mod_len, base, base_len_byte); return Fintern (new_name, Qnil); } @@ -6383,8 +6355,7 @@ static Lisp_Object modifier_symbols; /* Return the list of modifier symbols corresponding to the mask MODIFIERS. */ static Lisp_Object -lispy_modifier_list (modifiers) - int modifiers; +lispy_modifier_list (int modifiers) { Lisp_Object modifier_list; int i; @@ -6409,8 +6380,7 @@ lispy_modifier_list (modifiers) #define KEY_TO_CHAR(k) (XINT (k) & ((1 << CHARACTERBITS) - 1)) Lisp_Object -parse_modifiers (symbol) - Lisp_Object symbol; +parse_modifiers (Lisp_Object symbol) { Lisp_Object elements; @@ -6458,8 +6428,7 @@ parse_modifiers (symbol) DEFUN ("internal-event-symbol-parse-modifiers", Fevent_symbol_parse_modifiers, Sevent_symbol_parse_modifiers, 1, 1, 0, doc: /* Parse the event symbol. For internal use. */) - (symbol) - Lisp_Object symbol; + (Lisp_Object symbol) { /* Fill the cache if needed. */ parse_modifiers (symbol); @@ -6479,9 +6448,7 @@ DEFUN ("internal-event-symbol-parse-modifiers", Fevent_symbol_parse_modifiers, apply_modifiers copies the value of BASE's Qevent_kind property to the modified symbol. */ static Lisp_Object -apply_modifiers (modifiers, base) - int modifiers; - Lisp_Object base; +apply_modifiers (int modifiers, Lisp_Object base) { Lisp_Object cache, index, entry, new_symbol; @@ -6550,8 +6517,7 @@ apply_modifiers (modifiers, base) and M-C-foo end up being equivalent in the keymap. */ Lisp_Object -reorder_modifiers (symbol) - Lisp_Object symbol; +reorder_modifiers (Lisp_Object symbol) { /* It's hopefully okay to write the code this way, since everything will soon be in caches, and no consing will be done at all. */ @@ -6596,15 +6562,9 @@ reorder_modifiers (symbol) in the symbol's name. */ static Lisp_Object -modify_event_symbol (symbol_num, modifiers, symbol_kind, name_alist_or_stem, - name_table, symbol_table, table_size) - int symbol_num; - unsigned modifiers; - Lisp_Object symbol_kind; - Lisp_Object name_alist_or_stem; - char **name_table; - Lisp_Object *symbol_table; - unsigned int table_size; +modify_event_symbol (int symbol_num, unsigned int modifiers, Lisp_Object symbol_kind, + Lisp_Object name_alist_or_stem, char **name_table, + Lisp_Object *symbol_table, unsigned int table_size) { Lisp_Object value; Lisp_Object symbol_int; @@ -6697,8 +6657,7 @@ and zero or more modifier names (control, meta, hyper, super, shift, alt, drag, down, double or triple). The base must be last. The return value is an event type (a character or symbol) which has the same base event type and all the specified modifiers. */) - (event_desc) - Lisp_Object event_desc; + (Lisp_Object event_desc) { Lisp_Object base; int modifiers = 0; @@ -6841,8 +6800,7 @@ parse_solitary_modifier (Lisp_Object symbol) but it can be a Lucid-style event type list. */ int -lucid_event_type_list_p (object) - Lisp_Object object; +lucid_event_type_list_p (Lisp_Object object) { Lisp_Object tail; @@ -6879,9 +6837,7 @@ lucid_event_type_list_p (object) movements and toolkit scroll bar thumb drags. */ static void -get_input_pending (addr, flags) - int *addr; - int flags; +get_input_pending (int *addr, int flags) { /* First of all, have we already counted some input? */ *addr = (!NILP (Vquit_flag) || readable_events (flags)); @@ -6898,8 +6854,7 @@ get_input_pending (addr, flags) /* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */ void -gobble_input (expected) - int expected; +gobble_input (int expected) { #ifdef HAVE_DBUS /* Read D-Bus messages. */ @@ -6936,7 +6891,7 @@ gobble_input (expected) so that read_key_sequence will notice the new current buffer. */ void -record_asynch_buffer_change () +record_asynch_buffer_change (void) { struct input_event event; Lisp_Object tem; @@ -6946,18 +6901,15 @@ record_asynch_buffer_change () event.frame_or_window = Qnil; event.arg = Qnil; -#ifdef subprocesses /* We don't need a buffer-switch event unless Emacs is waiting for input. The purpose of the event is to make read_key_sequence look up the keymaps again. If we aren't in read_key_sequence, we don't need one, - and the event could cause trouble by messing up (input-pending-p). */ + and the event could cause trouble by messing up (input-pending-p). + Note: Fwaiting_for_user_input_p always returns nil when async + subprocesses aren't supported. */ tem = Fwaiting_for_user_input_p (); if (NILP (tem)) return; -#else - /* We never need these events if we have no asynchronous subprocesses. */ - return; -#endif /* Make sure no interrupt happens while storing the event. */ #ifdef SIGIO @@ -6986,8 +6938,7 @@ record_asynch_buffer_change () this is a bad time to try to read input. */ static int -read_avail_input (expected) - int expected; +read_avail_input (int expected) { int nread = 0; int err = 0; @@ -7120,6 +7071,10 @@ tty_read_avail_input (struct terminal *terminal, int n_to_read, i; struct tty_display_info *tty = terminal->display_info.tty; int nread = 0; + int buffer_free = KBD_BUFFER_SIZE - kbd_buffer_nr_stored () - 1; + + if (kbd_on_hold_p () || buffer_free <= 0) + return 0; if (!terminal->name) /* Don't read from a dead terminal. */ return 0; @@ -7201,6 +7156,10 @@ tty_read_avail_input (struct terminal *terminal, #endif #endif + /* Don't read more than we can store. */ + if (n_to_read > buffer_free) + n_to_read = buffer_free; + /* Now read; for one reason or another, this will not block. NREAD is set to the number of chars read. */ do @@ -7313,7 +7272,7 @@ tty_read_avail_input (struct terminal *terminal, } void -handle_async_input () +handle_async_input (void) { interrupt_input_pending = 0; #ifdef SYNC_INPUT @@ -7340,7 +7299,7 @@ handle_async_input () } void -process_pending_signals () +process_pending_signals (void) { if (interrupt_input_pending) handle_async_input (); @@ -7351,8 +7310,7 @@ process_pending_signals () /* Note SIGIO has been undef'd if FIONREAD is missing. */ static SIGTYPE -input_available_signal (signo) - int signo; +input_available_signal (int signo) { /* Must preserve main program's value of errno. */ int old_errno = errno; @@ -7381,7 +7339,7 @@ input_available_signal (signo) dealing with, without assuming that every file which uses UNBLOCK_INPUT also has #included the files necessary to get SIGIO. */ void -reinvoke_input_signal () +reinvoke_input_signal (void) { #ifdef SIGIO handle_async_input (); @@ -7410,9 +7368,7 @@ struct user_signal_info static struct user_signal_info *user_signals = NULL; void -add_user_signal (sig, name) - int sig; - const char *name; +add_user_signal (int sig, const char *name) { struct user_signal_info *p; @@ -7432,8 +7388,7 @@ add_user_signal (sig, name) } static SIGTYPE -handle_user_signal (sig) - int sig; +handle_user_signal (int sig) { int old_errno = errno; struct user_signal_info *p; @@ -7462,8 +7417,7 @@ handle_user_signal (sig) } static char * -find_user_signal_name (sig) - int sig; +find_user_signal_name (int sig) { struct user_signal_info *p; @@ -7475,7 +7429,7 @@ find_user_signal_name (sig) } static int -store_user_signal_events () +store_user_signal_events (void) { struct user_signal_info *p; struct input_event buf; @@ -7488,7 +7442,7 @@ store_user_signal_events () if (nstored == 0) { - bzero (&buf, sizeof buf); + memset (&buf, 0, sizeof buf); buf.kind = USER_SIGNAL_EVENT; buf.frame_or_window = selected_frame; } @@ -7509,7 +7463,7 @@ store_user_signal_events () } -static void menu_bar_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, void*)); +static void menu_bar_item (Lisp_Object, Lisp_Object, Lisp_Object, void*); static Lisp_Object menu_bar_one_keymap_changed_items; /* These variables hold the vector under construction within @@ -7525,8 +7479,7 @@ static int menu_bar_items_index; OLD is an old vector we can optionally reuse, or nil. */ Lisp_Object -menu_bar_items (old) - Lisp_Object old; +menu_bar_items (Lisp_Object old) { /* The number of keymaps we're scanning right now, and the number of keymaps we have allocated space for. */ @@ -7593,7 +7546,7 @@ menu_bar_items (old) nmaps = 0; if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) maps[nmaps++] = tem; - bcopy (tmaps, (void *) (maps + nmaps), nminor * sizeof (maps[0])); + memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); nmaps += nminor; maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map); } @@ -7634,9 +7587,9 @@ menu_bar_items (old) tem2 = XVECTOR (menu_bar_items_vector)->contents[i + 2]; tem3 = XVECTOR (menu_bar_items_vector)->contents[i + 3]; if (end > i + 4) - bcopy (&XVECTOR (menu_bar_items_vector)->contents[i + 4], - &XVECTOR (menu_bar_items_vector)->contents[i], - (end - i - 4) * sizeof (Lisp_Object)); + memmove (&XVECTOR (menu_bar_items_vector)->contents[i], + &XVECTOR (menu_bar_items_vector)->contents[i + 4], + (end - i - 4) * sizeof (Lisp_Object)); XVECTOR (menu_bar_items_vector)->contents[end - 4] = tem0; XVECTOR (menu_bar_items_vector)->contents[end - 3] = tem1; XVECTOR (menu_bar_items_vector)->contents[end - 2] = tem2; @@ -7666,9 +7619,7 @@ menu_bar_items (old) Lisp_Object item_properties; static void -menu_bar_item (key, item, dummy1, dummy2) - Lisp_Object key, item, dummy1; - void *dummy2; +menu_bar_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy1, void *dummy2) { struct gcpro gcpro1; int i; @@ -7683,9 +7634,9 @@ menu_bar_item (key, item, dummy1, dummy2) if (EQ (key, XVECTOR (menu_bar_items_vector)->contents[i])) { if (menu_bar_items_index > i + 4) - bcopy (&XVECTOR (menu_bar_items_vector)->contents[i + 4], - &XVECTOR (menu_bar_items_vector)->contents[i], - (menu_bar_items_index - i - 4) * sizeof (Lisp_Object)); + memmove (&XVECTOR (menu_bar_items_vector)->contents[i], + &XVECTOR (menu_bar_items_vector)->contents[i + 4], + (menu_bar_items_index - i - 4) * sizeof (Lisp_Object)); menu_bar_items_index -= 4; } } @@ -7743,8 +7694,7 @@ menu_bar_item (key, item, dummy1, dummy2) /* This is used as the handler when calling menu_item_eval_property. */ static Lisp_Object -menu_item_eval_property_1 (arg) - Lisp_Object arg; +menu_item_eval_property_1 (Lisp_Object arg) { /* If we got a quit from within the menu computation, quit all the way out of it. This takes care of C-] in the debugger. */ @@ -7757,8 +7707,7 @@ menu_item_eval_property_1 (arg) /* Evaluate an expression and return the result (or nil if something went wrong). Used to evaluate dynamic parts of menu items. */ Lisp_Object -menu_item_eval_property (sexpr) - Lisp_Object sexpr; +menu_item_eval_property (Lisp_Object sexpr) { int count = SPECPDL_INDEX (); Lisp_Object val; @@ -7778,9 +7727,7 @@ menu_item_eval_property (sexpr) otherwise. */ int -parse_menu_item (item, inmenubar) - Lisp_Object item; - int inmenubar; +parse_menu_item (Lisp_Object item, int inmenubar) { Lisp_Object def, tem, item_string, start; Lisp_Object filter; @@ -8077,10 +8024,10 @@ Lisp_Object Qrtl; /* Function prototypes. */ -static void init_tool_bar_items P_ ((Lisp_Object)); -static void process_tool_bar_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, void*)); -static int parse_tool_bar_item P_ ((Lisp_Object, Lisp_Object)); -static void append_tool_bar_item P_ ((void)); +static void init_tool_bar_items (Lisp_Object); +static void process_tool_bar_item (Lisp_Object, Lisp_Object, Lisp_Object, void*); +static int parse_tool_bar_item (Lisp_Object, Lisp_Object); +static void append_tool_bar_item (void); /* Return a vector of tool bar items for keymaps currently in effect. @@ -8088,9 +8035,7 @@ static void append_tool_bar_item P_ ((void)); tool bar items found. */ Lisp_Object -tool_bar_items (reuse, nitems) - Lisp_Object reuse; - int *nitems; +tool_bar_items (Lisp_Object reuse, int *nitems) { Lisp_Object *maps; int nmaps, i; @@ -8139,7 +8084,7 @@ tool_bar_items (reuse, nitems) nmaps = 0; if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) maps[nmaps++] = tem; - bcopy (tmaps, (void *) (maps + nmaps), nminor * sizeof (maps[0])); + memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); nmaps += nminor; maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map); } @@ -8168,9 +8113,7 @@ tool_bar_items (reuse, nitems) /* Process the definition of KEY which is DEF. */ static void -process_tool_bar_item (key, def, data, args) - Lisp_Object key, def, data; - void *args; +process_tool_bar_item (Lisp_Object key, Lisp_Object def, Lisp_Object data, void *args) { int i; extern Lisp_Object Qundefined; @@ -8191,9 +8134,9 @@ process_tool_bar_item (key, def, data, args) if (EQ (key, v[TOOL_BAR_ITEM_KEY])) { if (ntool_bar_items > i + TOOL_BAR_ITEM_NSLOTS) - bcopy (v + TOOL_BAR_ITEM_NSLOTS, v, - ((ntool_bar_items - i - TOOL_BAR_ITEM_NSLOTS) - * sizeof (Lisp_Object))); + memmove (v, v + TOOL_BAR_ITEM_NSLOTS, + ((ntool_bar_items - i - TOOL_BAR_ITEM_NSLOTS) + * sizeof (Lisp_Object))); ntool_bar_items -= TOOL_BAR_ITEM_NSLOTS; break; } @@ -8255,8 +8198,7 @@ process_tool_bar_item (key, def, data, args) A text label to show with the tool bar button if labels are enabled. */ static int -parse_tool_bar_item (key, item) - Lisp_Object key, item; +parse_tool_bar_item (Lisp_Object key, Lisp_Object item) { /* Access slot with index IDX of vector tool_bar_item_properties. */ #define PROP(IDX) XVECTOR (tool_bar_item_properties)->contents[IDX] @@ -8386,7 +8328,7 @@ parse_tool_bar_item (key, item) EMACS_INT max_lbl = 2*tool_bar_max_label_size; Lisp_Object new_lbl; - if (strlen (caption) < max_lbl && caption[0] != '\0') + if (strlen (caption) < max_lbl && caption[0] != '\0') { strcpy (buf, caption); while (buf[0] != '\0' && buf[strlen (buf) -1] == '.') @@ -8398,17 +8340,17 @@ parse_tool_bar_item (key, item) if (strlen (caption) <= max_lbl) label = caption; - if (strlen (label) <= max_lbl && label[0] != '\0') + if (strlen (label) <= max_lbl && label[0] != '\0') { int i; if (label != buf) strcpy (buf, label); - for (i = 0; i < strlen (buf); ++i) + for (i = 0; i < strlen (buf); ++i) { if (buf[i] == '-') buf[i] = ' '; } label = buf; - + } else label = ""; @@ -8448,8 +8390,7 @@ parse_tool_bar_item (key, item) that can be reused. */ static void -init_tool_bar_items (reuse) - Lisp_Object reuse; +init_tool_bar_items (Lisp_Object reuse) { if (VECTORP (reuse)) tool_bar_items_vector = reuse; @@ -8463,7 +8404,7 @@ init_tool_bar_items (reuse) tool_bar_item_properties */ static void -append_tool_bar_item () +append_tool_bar_item (void) { Lisp_Object *to, *from; @@ -8478,7 +8419,7 @@ append_tool_bar_item () tool_bar_items_vector. */ to = XVECTOR (tool_bar_items_vector)->contents + ntool_bar_items; from = XVECTOR (tool_bar_item_properties)->contents; - bcopy (from, to, TOOL_BAR_ITEM_NSLOTS * sizeof *to); + memcpy (to, from, TOOL_BAR_ITEM_NSLOTS * sizeof *to); ntool_bar_items += TOOL_BAR_ITEM_NSLOTS; } @@ -8507,11 +8448,8 @@ append_tool_bar_item () and do auto-saving in the inner call of read_char. */ static Lisp_Object -read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu) - int nmaps; - Lisp_Object *maps; - Lisp_Object prev_event; - int *used_mouse_menu; +read_char_x_menu_prompt (int nmaps, Lisp_Object *maps, Lisp_Object prev_event, + int *used_mouse_menu) { int mapno; @@ -8595,10 +8533,7 @@ static char *read_char_minibuf_menu_text; static int read_char_minibuf_menu_width; static Lisp_Object -read_char_minibuf_menu_prompt (commandflag, nmaps, maps) - int commandflag ; - int nmaps; - Lisp_Object *maps; +read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps) { int mapno; register Lisp_Object name; @@ -8777,7 +8712,7 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps) thiswidth = SCHARS (desc); if (thiswidth + i > width) thiswidth = width - i; - bcopy (SDATA (desc), menu + i, thiswidth); + memcpy (menu + i, SDATA (desc), thiswidth); i += thiswidth; strcpy (menu + i, " = "); i += 3; @@ -8787,7 +8722,7 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps) thiswidth = SCHARS (s); if (thiswidth + i > width) thiswidth = width - i; - bcopy (SDATA (s), menu + i, thiswidth); + memcpy (menu + i, SDATA (s), thiswidth); i += thiswidth; menu[i] = 0; } @@ -8863,10 +8798,8 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps) NEXT may be the same array as CURRENT. */ static int -follow_key (key, nmaps, current, defs, next) - Lisp_Object key; - Lisp_Object *current, *defs, *next; - int nmaps; +follow_key (Lisp_Object key, int nmaps, Lisp_Object *current, Lisp_Object *defs, + Lisp_Object *next) { int i, first_binding; @@ -8915,9 +8848,8 @@ typedef struct keyremap that it is indeed a vector). */ static Lisp_Object -access_keymap_keyremap (map, key, prompt, do_funcall) - Lisp_Object map, key, prompt; - int do_funcall; +access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt, + int do_funcall) { Lisp_Object next; @@ -8968,10 +8900,8 @@ access_keymap_keyremap (map, key, prompt, do_funcall) The return value is non-zero if the remapping actually took place. */ static int -keyremap_step (keybuf, bufsize, fkey, input, doit, diff, prompt) - Lisp_Object *keybuf, prompt; - keyremap *fkey; - int input, doit, *diff, bufsize; +keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey, + int input, int doit, int *diff, Lisp_Object prompt) { Lisp_Object next, key; @@ -9063,57 +8993,52 @@ keyremap_step (keybuf, bufsize, fkey, input, doit, diff, prompt) from the selected window's buffer. */ static int -read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, - can_return_switch_frame, fix_current_buffer) - Lisp_Object *keybuf; - int bufsize; - Lisp_Object prompt; - int dont_downcase_last; - int can_return_switch_frame; - int fix_current_buffer; +read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, + int dont_downcase_last, int can_return_switch_frame, + int fix_current_buffer) { - volatile Lisp_Object from_string; - volatile int count = SPECPDL_INDEX (); + Lisp_Object from_string; + int count = SPECPDL_INDEX (); /* How many keys there are in the current key sequence. */ - volatile int t; + int t; /* The length of the echo buffer when we started reading, and the length of this_command_keys when we started reading. */ - volatile int echo_start; - volatile int keys_start; + int echo_start; + int keys_start; /* The number of keymaps we're scanning right now, and the number of keymaps we have allocated space for. */ - volatile int nmaps; - volatile int nmaps_allocated = 0; + int nmaps; + int nmaps_allocated = 0; /* defs[0..nmaps-1] are the definitions of KEYBUF[0..t-1] in the current keymaps. */ - Lisp_Object *volatile defs = NULL; + Lisp_Object *defs = NULL; /* submaps[0..nmaps-1] are the prefix definitions of KEYBUF[0..t-1] in the current keymaps, or nil where it is not a prefix. */ - Lisp_Object *volatile submaps = NULL; + Lisp_Object *submaps = NULL; /* The local map to start out with at start of key sequence. */ - volatile Lisp_Object orig_local_map; + Lisp_Object orig_local_map; /* The map from the `keymap' property to start out with at start of key sequence. */ - volatile Lisp_Object orig_keymap; + Lisp_Object orig_keymap; /* 1 if we have already considered switching to the local-map property of the place where a mouse click occurred. */ - volatile int localized_local_map = 0; + int localized_local_map = 0; /* The index in submaps[] of the first keymap that has a binding for this key sequence. In other words, the lowest i such that submaps[i] is non-nil. */ - volatile int first_binding; + int first_binding; /* Index of the first key that has no binding. It is useless to try fkey.start larger than that. */ - volatile int first_unbound; + int first_unbound; /* If t < mock_input, then KEYBUF[t] should be read as the next input key. @@ -9128,7 +9053,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, restart_sequence; the loop will read keys from keybuf up until mock_input, thus rebuilding the state; and then it will resume reading characters from the keyboard. */ - volatile int mock_input = 0; + int mock_input = 0; /* If the sequence is unbound in submaps[], then keybuf[fkey.start..fkey.end-1] is a prefix in Vfunction_key_map, @@ -9138,28 +9063,28 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, should hold off until t reaches them. We do this when we've just recognized a function key, to avoid searching for the function key's again in Vfunction_key_map. */ - volatile keyremap fkey; + keyremap fkey; /* Likewise, for key_translation_map and input-decode-map. */ - volatile keyremap keytran, indec; + keyremap keytran, indec; /* Non-zero if we are trying to map a key by changing an upper-case letter to lower case, or a shifted function key to an unshifted one. */ - volatile int shift_translated = 0; + int shift_translated = 0; /* If we receive a `switch-frame' or `select-window' event in the middle of a key sequence, we put it off for later. While we're reading, we keep the event here. */ - volatile Lisp_Object delayed_switch_frame; + Lisp_Object delayed_switch_frame; /* See the comment below... */ #if defined (GOBBLE_FIRST_EVENT) Lisp_Object first_event; #endif - volatile Lisp_Object original_uppercase; - volatile int original_uppercase_position = -1; + Lisp_Object original_uppercase; + int original_uppercase_position = -1; /* Gets around Microsoft compiler limitations. */ int dummyflag = 0; @@ -9167,7 +9092,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, struct buffer *starting_buffer; /* List of events for which a fake prefix key has been generated. */ - volatile Lisp_Object fake_prefixed_keys = Qnil; + Lisp_Object fake_prefixed_keys = Qnil; #if defined (GOBBLE_FIRST_EVENT) int junk; @@ -9281,8 +9206,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, if (!NILP (orig_keymap)) submaps[nmaps++] = orig_keymap; - bcopy (maps, (void *) (submaps + nmaps), - nminor * sizeof (submaps[0])); + memcpy (submaps + nmaps, maps, nminor * sizeof (submaps[0])); nmaps += nminor; @@ -9325,13 +9249,13 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, (say, a mouse click on the mode line which is being treated as [mode-line (mouse-...)], then we backtrack to this point of keybuf. */ - volatile int last_real_key_start; + int last_real_key_start; /* These variables are analogous to echo_start and keys_start; while those allow us to restart the entire key sequence, echo_local_start and keys_local_start allow us to throw away just one key. */ - volatile int echo_local_start, keys_local_start, local_first_binding; + int echo_local_start, keys_local_start, local_first_binding; eassert (indec.end == t || (indec.end > t && indec.end <= mock_input)); eassert (indec.start <= indec.end); @@ -10197,10 +10121,7 @@ The optional fifth argument COMMAND-LOOP, if non-nil, means that this key sequence is being read by something that will read commands one after another. It should be nil if the caller will read just one key sequence. */) - (prompt, continue_echo, dont_downcase_last, can_return_switch_frame, - command_loop) - Lisp_Object prompt, continue_echo, dont_downcase_last; - Lisp_Object can_return_switch_frame, command_loop; + (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object command_loop) { Lisp_Object keybuf[30]; register int i; @@ -10216,7 +10137,7 @@ will read just one key sequence. */) specbind (Qinput_method_use_echo_area, (NILP (command_loop) ? Qt : Qnil)); - bzero (keybuf, sizeof keybuf); + memset (keybuf, 0, sizeof keybuf); GCPRO1 (keybuf[0]); gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); @@ -10257,10 +10178,7 @@ will read just one key sequence. */) DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, Sread_key_sequence_vector, 1, 5, 0, doc: /* Like `read-key-sequence' but always return a vector. */) - (prompt, continue_echo, dont_downcase_last, can_return_switch_frame, - command_loop) - Lisp_Object prompt, continue_echo, dont_downcase_last; - Lisp_Object can_return_switch_frame, command_loop; + (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object command_loop) { Lisp_Object keybuf[30]; register int i; @@ -10276,7 +10194,7 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, specbind (Qinput_method_use_echo_area, (NILP (command_loop) ? Qt : Qnil)); - bzero (keybuf, sizeof keybuf); + memset (keybuf, 0, sizeof keybuf); GCPRO1 (keybuf[0]); gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); @@ -10320,8 +10238,7 @@ The argument KEYS specifies the value to use instead of (this-command-keys) when reading the arguments; if it is nil, (this-command-keys) is used. The argument SPECIAL, if non-nil, means that this command is executing a special event, so ignore the prefix argument and don't clear it. */) - (cmd, record_flag, keys, special) - Lisp_Object cmd, record_flag, keys, special; + (Lisp_Object cmd, Lisp_Object record_flag, Lisp_Object keys, Lisp_Object special) { register Lisp_Object final; register Lisp_Object tem; @@ -10410,8 +10327,7 @@ the numeric argument to this command. Noninteractively, the argument PREFIXARG is the prefix argument to give to the command you invoke, if it asks for an argument. */) - (prefixarg) - Lisp_Object prefixarg; + (Lisp_Object prefixarg) { Lisp_Object function; char buf[40]; @@ -10565,7 +10481,7 @@ give to the command you invoke, if it asks for an argument. */) /* Return nonzero if input events are pending. */ int -detect_input_pending () +detect_input_pending (void) { if (!input_pending) get_input_pending (&input_pending, 0); @@ -10577,7 +10493,7 @@ detect_input_pending () pending. */ int -detect_input_pending_ignore_squeezables () +detect_input_pending_ignore_squeezables (void) { if (!input_pending) get_input_pending (&input_pending, READABLE_EVENTS_IGNORE_SQUEEZABLES); @@ -10588,8 +10504,7 @@ detect_input_pending_ignore_squeezables () /* Return nonzero if input events are pending, and run any pending timers. */ int -detect_input_pending_run_timers (do_display) - int do_display; +detect_input_pending_run_timers (int do_display) { int old_timers_run = timers_run; @@ -10620,7 +10535,7 @@ detect_input_pending_run_timers (do_display) So calling this function unnecessarily can't do any harm. */ void -clear_input_pending () +clear_input_pending (void) { input_pending = 0; } @@ -10632,7 +10547,7 @@ clear_input_pending () to do in that case. It isn't trivial. */ int -requeued_events_pending_p () +requeued_events_pending_p (void) { return (!NILP (Vunread_command_events) || unread_command_char != -1); } @@ -10642,7 +10557,7 @@ DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 0, 0, doc: /* Return t if command input is currently available with no wait. Actually, the value is nil only if we can be sure that no input is available; if there is a doubt, the value is t. */) - () + (void) { if (!NILP (Vunread_command_events) || unread_command_char != -1 || !NILP (Vunread_post_input_method_events) @@ -10657,7 +10572,7 @@ if there is a doubt, the value is t. */) DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0, doc: /* Return vector of last 300 events, not counting those from keyboard macros. */) - () + (void) { Lisp_Object *keys = XVECTOR (recent_keys)->contents; Lisp_Object val; @@ -10667,12 +10582,10 @@ DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0, else { val = Fvector (NUM_RECENT_KEYS, keys); - bcopy (keys + recent_keys_index, - XVECTOR (val)->contents, - (NUM_RECENT_KEYS - recent_keys_index) * sizeof (Lisp_Object)); - bcopy (keys, - XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index, - recent_keys_index * sizeof (Lisp_Object)); + memcpy (XVECTOR (val)->contents, keys + recent_keys_index, + (NUM_RECENT_KEYS - recent_keys_index) * sizeof (Lisp_Object)); + memcpy (XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index, + keys, recent_keys_index * sizeof (Lisp_Object)); return val; } } @@ -10684,7 +10597,7 @@ the last key sequence that has been read. The value is a string or a vector. See also `this-command-keys-vector'. */) - () + (void) { return make_event_array (this_command_key_count, XVECTOR (this_command_keys)->contents); @@ -10696,7 +10609,7 @@ However, if the command has called `read-key-sequence', it returns the last key sequence that has been read. See also `this-command-keys'. */) - () + (void) { return Fvector (this_command_key_count, XVECTOR (this_command_keys)->contents); @@ -10710,7 +10623,7 @@ the command loop or by `read-key-sequence'. Unlike `this-command-keys', this function's value does not include prefix arguments. The value is always a vector. */) - () + (void) { return Fvector (this_command_key_count - this_single_command_key_start, @@ -10726,7 +10639,7 @@ the command loop or by `read-key-sequence'. Unlike `this-single-command-keys', this function's value shows the events before all translations (except for input methods). The value is always a vector. */) - () + (void) { return Fvector (raw_keybuf_count, (XVECTOR (raw_keybuf)->contents)); @@ -10744,7 +10657,7 @@ both in the value of (this-command-keys) and in echoing. To achieve this, `universal-argument-other-key' calls `reset-this-command-lengths', which discards the record of reading these events the first time. */) - () + (void) { this_command_key_count = before_command_key_count; if (this_command_key_count < this_single_command_key_start) @@ -10764,8 +10677,7 @@ DEFUN ("clear-this-command-keys", Fclear_this_command_keys, doc: /* Clear out the vector that `this-command-keys' returns. Also clear the record of the last 100 events, unless optional arg KEEP-RECORD is non-nil. */) - (keep_record) - Lisp_Object keep_record; + (Lisp_Object keep_record) { int i; @@ -10784,7 +10696,7 @@ KEEP-RECORD is non-nil. */) DEFUN ("recursion-depth", Frecursion_depth, Srecursion_depth, 0, 0, 0, doc: /* Return the current depth in recursive edits. */) - () + (void) { Lisp_Object temp; XSETFASTINT (temp, command_loop_level + minibuf_level); @@ -10795,8 +10707,7 @@ DEFUN ("open-dribble-file", Fopen_dribble_file, Sopen_dribble_file, 1, 1, "FOpen dribble file: ", doc: /* Start writing all keyboard characters to a dribble file called FILE. If FILE is nil, close any open dribble file. */) - (file) - Lisp_Object file; + (Lisp_Object file) { if (dribble) { @@ -10818,7 +10729,7 @@ If FILE is nil, close any open dribble file. */) DEFUN ("discard-input", Fdiscard_input, Sdiscard_input, 0, 0, 0, doc: /* Discard the contents of the terminal input buffer. Also end any kbd macro being defined. */) - () + (void) { if (!NILP (current_kboard->defining_kbd_macro)) { @@ -10853,8 +10764,7 @@ After resumption run the normal hook `suspend-resume-hook'. Some operating systems cannot stop the Emacs process and resume it later. On such systems, Emacs starts a subshell instead of suspending. */) - (stuffstring) - Lisp_Object stuffstring; + (Lisp_Object stuffstring) { int count = SPECPDL_INDEX (); int old_height, old_width; @@ -10876,7 +10786,7 @@ On such systems, Emacs starts a subshell instead of suspending. */) reset_all_sys_modes (); /* sys_suspend can get an error if it tries to fork a subshell and the system resources aren't available for that. */ - record_unwind_protect ((Lisp_Object (*) P_ ((Lisp_Object))) init_all_sys_modes, + record_unwind_protect ((Lisp_Object (*) (Lisp_Object)) init_all_sys_modes, Qnil); stuff_buffered_input (stuffstring); if (cannot_suspend) @@ -10904,8 +10814,7 @@ On such systems, Emacs starts a subshell instead of suspending. */) Then in any case stuff anything Emacs has read ahead and not used. */ void -stuff_buffered_input (stuffstring) - Lisp_Object stuffstring; +stuff_buffered_input (Lisp_Object stuffstring) { #ifdef SIGTSTP /* stuff_char is defined if SIGTSTP. */ register unsigned char *p; @@ -10943,8 +10852,7 @@ stuff_buffered_input (stuffstring) } void -set_waiting_for_input (time_to_clear) - EMACS_TIME *time_to_clear; +set_waiting_for_input (struct timeval *time_to_clear) { input_available_clear_time = time_to_clear; @@ -10958,7 +10866,7 @@ set_waiting_for_input (time_to_clear) } void -clear_waiting_for_input () +clear_waiting_for_input (void) { /* Tell handle_interrupt not to throw back to read_char, */ waiting_for_input = 0; @@ -10972,8 +10880,8 @@ clear_waiting_for_input () Otherwise, the handler kills Emacs. */ static SIGTYPE -interrupt_signal (signalnum) /* If we don't have an argument, */ - int signalnum; /* some compilers complain in signal calls. */ +interrupt_signal (int signalnum) /* If we don't have an argument, some */ + /* compilers complain in signal calls. */ { /* Must preserve main program's value of errno. */ int old_errno = errno; @@ -11017,7 +10925,7 @@ interrupt_signal (signalnum) /* If we don't have an argument, */ non-nil, it stops the job right away. */ static void -handle_interrupt () +handle_interrupt (void) { char c; @@ -11143,7 +11051,7 @@ handle_interrupt () /* Handle a C-g by making read_char return C-g. */ void -quit_throw_to_read_char () +quit_throw_to_read_char (void) { sigfree (); /* Prevent another signal from doing this before we finish. */ @@ -11176,8 +11084,7 @@ If INTERRUPT is non-nil, Emacs will use input interrupts; otherwise Emacs uses CBREAK mode. See also `current-input-mode'. */) - (interrupt) - Lisp_Object interrupt; + (Lisp_Object interrupt) { int new_interrupt_input; #ifdef SIGIO @@ -11227,8 +11134,7 @@ This setting only has an effect on tty terminals and only when Emacs reads input in CBREAK mode; see `set-input-interrupt-mode'. See also `current-input-mode'. */) - (flow, terminal) - Lisp_Object flow, terminal; + (Lisp_Object flow, Lisp_Object terminal) { struct terminal *t = get_terminal (terminal, 1); struct tty_display_info *tty; @@ -11270,8 +11176,7 @@ It may be a terminal object, a frame, or nil for the terminal used by the currently selected frame. See also `current-input-mode'. */) - (meta, terminal) - Lisp_Object meta, terminal; + (Lisp_Object meta, Lisp_Object terminal) { struct terminal *t = get_terminal (terminal, 1); struct tty_display_info *tty; @@ -11312,8 +11217,7 @@ This function only has an effect on the controlling tty of the Emacs process. See also `current-input-mode'. */) - (quit) - Lisp_Object quit; + (Lisp_Object quit) { struct terminal *t = get_named_tty ("/dev/tty"); struct tty_display_info *tty; @@ -11350,8 +11254,7 @@ Third arg META t means accept 8-bit input (for a Meta key). Otherwise, accept 8-bit input and don't use the top bit for Meta. Optional fourth arg QUIT if non-nil specifies character to use for quitting. See also `current-input-mode'. */) - (interrupt, flow, meta, quit) - Lisp_Object interrupt, flow, meta, quit; + (Lisp_Object interrupt, Lisp_Object flow, Lisp_Object meta, Lisp_Object quit) { Fset_input_interrupt_mode (interrupt); Fset_output_flow_control (flow, Qnil); @@ -11375,7 +11278,7 @@ The value is a list of the form (INTERRUPT FLOW META QUIT), where QUIT is the character Emacs currently uses to quit. The elements of this list correspond to the arguments of `set-input-mode'. */) - () + (void) { Lisp_Object val[4]; struct frame *sf = XFRAME (selected_frame); @@ -11409,8 +11312,7 @@ The return value is similar to a mouse click position: (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW) IMAGE (DX . DY) (WIDTH . HEIGHT)) The `posn-' functions access elements of such lists. */) - (x, y, frame_or_window, whole) - Lisp_Object x, y, frame_or_window, whole; + (Lisp_Object x, Lisp_Object y, Lisp_Object frame_or_window, Lisp_Object whole) { CHECK_NATNUM (x); CHECK_NATNUM (y); @@ -11450,8 +11352,7 @@ to the given buffer position: (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW) IMAGE (DX . DY) (WIDTH . HEIGHT)) The `posn-' functions access elements of such lists. */) - (pos, window) - Lisp_Object pos, window; + (Lisp_Object pos, Lisp_Object window) { Lisp_Object tem; @@ -11478,8 +11379,7 @@ The `posn-' functions access elements of such lists. */) * Set up a new kboard object with reasonable initial values. */ void -init_kboard (kb) - KBOARD *kb; +init_kboard (KBOARD *kb) { kb->Voverriding_terminal_local_map = Qnil; kb->Vlast_command = Qnil; @@ -11513,8 +11413,7 @@ init_kboard (kb) * it a second time. */ static void -wipe_kboard (kb) - KBOARD *kb; +wipe_kboard (KBOARD *kb) { xfree (kb->kbd_macro_buffer); } @@ -11522,8 +11421,7 @@ wipe_kboard (kb) /* Free KB and memory referenced from it. */ void -delete_kboard (kb) - KBOARD *kb; +delete_kboard (KBOARD *kb) { KBOARD **kbp; @@ -11548,7 +11446,7 @@ delete_kboard (kb) } void -init_keyboard () +init_keyboard (void) { /* This is correct before outermost invocation of the editor loop */ command_loop_level = -1; @@ -11635,7 +11533,7 @@ struct event_head { Lisp_Object *kind; }; -struct event_head head_table[] = { +static const struct event_head head_table[] = { {&Qmouse_movement, "mouse-movement", &Qmouse_movement}, {&Qscroll_bar_movement, "scroll-bar-movement", &Qmouse_movement}, {&Qswitch_frame, "switch-frame", &Qswitch_frame}, @@ -11648,7 +11546,7 @@ struct event_head head_table[] = { }; void -syms_of_keyboard () +syms_of_keyboard (void) { pending_funcalls = Qnil; staticpro (&pending_funcalls); @@ -11820,7 +11718,7 @@ syms_of_keyboard () last_point_position_window = Qnil; { - struct event_head *p; + const struct event_head *p; for (p = head_table; p < head_table + (sizeof (head_table) / sizeof (head_table[0])); @@ -12424,7 +12322,7 @@ and tool-bar buttons. */); } void -keys_of_keyboard () +keys_of_keyboard (void) { initial_define_key (global_map, Ctl ('Z'), "suspend-emacs"); initial_define_key (control_x_map, Ctl ('Z'), "suspend-emacs"); @@ -12484,7 +12382,7 @@ keys_of_keyboard () /* Mark the pointers in the kboard objects. Called by the Fgarbage_collector. */ void -mark_kboards () +mark_kboards (void) { KBOARD *kb; Lisp_Object *p; diff --git a/src/keyboard.h b/src/keyboard.h index 27fc0e5eb6a..a6eb750c373 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -300,7 +300,7 @@ enum menu_item_idx MENU_ITEMS_ITEM_LENGTH }; -extern Lisp_Object unuse_menu_items P_ ((Lisp_Object dummy)); +extern Lisp_Object unuse_menu_items (Lisp_Object dummy); /* This is how to deal with multibyte text if HAVE_MULTILINGUAL_MENU isn't defined. The use of HAVE_MULTILINGUAL_MENU could probably be @@ -366,8 +366,8 @@ typedef struct _widget_value struct _widget_value* next; } widget_value; -extern widget_value *xmalloc_widget_value P_ ((void)); -extern widget_value *digest_single_submenu P_ ((int, int, int)); +extern widget_value *xmalloc_widget_value (void); +extern widget_value *digest_single_submenu (int, int, int); #endif /* HAVE_NS || HAVE_NTGUI */ @@ -430,10 +430,10 @@ extern Lisp_Object Qmode_line, Qvertical_line, Qheader_line; /* Forward declaration for prototypes. */ struct input_event; -extern Lisp_Object parse_modifiers P_ ((Lisp_Object)); -extern Lisp_Object reorder_modifiers P_ ((Lisp_Object)); -extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, - int *, EMACS_TIME *)); +extern Lisp_Object parse_modifiers (Lisp_Object); +extern Lisp_Object reorder_modifiers (Lisp_Object); +extern Lisp_Object read_char (int, int, Lisp_Object *, Lisp_Object, + int *, EMACS_TIME *); extern int parse_solitary_modifier (Lisp_Object symbol); @@ -445,50 +445,49 @@ extern Lisp_Object Vkey_translation_map; extern int parse_menu_item (Lisp_Object, int); -extern void echo_now P_ ((void)); -extern void init_kboard P_ ((KBOARD *)); -extern void delete_kboard P_ ((KBOARD *)); -extern void not_single_kboard_state P_ ((KBOARD *)); -extern void push_kboard P_ ((struct kboard *)); -extern void push_frame_kboard P_ ((struct frame *)); -extern void pop_kboard P_ ((void)); -extern void temporarily_switch_to_single_kboard P_ ((struct frame *)); -extern void record_asynch_buffer_change P_ ((void)); -extern SIGTYPE input_poll_signal P_ ((int)); -extern void start_polling P_ ((void)); -extern void stop_polling P_ ((void)); -extern void set_poll_suppress_count P_ ((int)); -extern void gobble_input P_ ((int)); -extern int input_polling_used P_ ((void)); -extern void clear_input_pending P_ ((void)); -extern int requeued_events_pending_p P_ ((void)); -extern void bind_polling_period P_ ((int)); -extern void stuff_buffered_input P_ ((Lisp_Object)); -extern void clear_waiting_for_input P_ ((void)); -extern void swallow_events P_ ((int)); -extern int help_char_p P_ ((Lisp_Object)); -extern void quit_throw_to_read_char P_ ((void)) NO_RETURN; -extern void cmd_error_internal P_ ((Lisp_Object, char *)); -extern int lucid_event_type_list_p P_ ((Lisp_Object)); -extern void kbd_buffer_store_event P_ ((struct input_event *)); -extern void kbd_buffer_store_event_hold P_ ((struct input_event *, - struct input_event *)); -extern void kbd_buffer_unget_event P_ ((struct input_event *)); +extern void echo_now (void); +extern void init_kboard (KBOARD *); +extern void delete_kboard (KBOARD *); +extern void not_single_kboard_state (KBOARD *); +extern void push_kboard (struct kboard *); +extern void push_frame_kboard (struct frame *); +extern void pop_kboard (void); +extern void temporarily_switch_to_single_kboard (struct frame *); +extern void record_asynch_buffer_change (void); +extern SIGTYPE input_poll_signal (int); +extern void start_polling (void); +extern void stop_polling (void); +extern void set_poll_suppress_count (int); +extern void gobble_input (int); +extern int input_polling_used (void); +extern void clear_input_pending (void); +extern int requeued_events_pending_p (void); +extern void bind_polling_period (int); +extern void stuff_buffered_input (Lisp_Object); +extern void clear_waiting_for_input (void); +extern void swallow_events (int); +extern int help_char_p (Lisp_Object); +extern void quit_throw_to_read_char (void) NO_RETURN; +extern int lucid_event_type_list_p (Lisp_Object); +extern void kbd_buffer_store_event (struct input_event *); +extern void kbd_buffer_store_event_hold (struct input_event *, + struct input_event *); +extern void kbd_buffer_unget_event (struct input_event *); #ifdef POLL_FOR_INPUT -extern void poll_for_input_1 P_ ((void)); +extern void poll_for_input_1 (void); #endif -extern void show_help_echo P_ ((Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object, int)); -extern void gen_help_event P_ ((Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object, int)); -extern void kbd_buffer_store_help_event P_ ((Lisp_Object, Lisp_Object)); -extern Lisp_Object menu_item_eval_property P_ ((Lisp_Object)); -extern int kbd_buffer_events_waiting P_ ((int)); -extern void add_user_signal P_ ((int, const char *)); +extern void show_help_echo (Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object, int); +extern void gen_help_event (Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object, int); +extern void kbd_buffer_store_help_event (Lisp_Object, Lisp_Object); +extern Lisp_Object menu_item_eval_property (Lisp_Object); +extern int kbd_buffer_events_waiting (int); +extern void add_user_signal (int, const char *); -extern int tty_read_avail_input P_ ((struct terminal *, int, - struct input_event *)); -extern EMACS_TIME timer_check P_ ((int)); +extern int tty_read_avail_input (struct terminal *, int, + struct input_event *); +extern EMACS_TIME timer_check (int); /* arch-tag: 769cbade-1ba9-4950-b886-db265b061aa3 (do not change this comment) */ diff --git a/src/keymap.c b/src/keymap.c index c3a9d9e5cc0..8a0c855e0dc 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -115,20 +115,20 @@ static Lisp_Object where_is_cache; /* Which keymaps are reverse-stored in the cache. */ static Lisp_Object where_is_cache_keymaps; -static Lisp_Object store_in_keymap P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); -static void fix_submap_inheritance P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); +static Lisp_Object store_in_keymap (Lisp_Object, Lisp_Object, Lisp_Object); +static void fix_submap_inheritance (Lisp_Object, Lisp_Object, Lisp_Object); -static Lisp_Object define_as_prefix P_ ((Lisp_Object, Lisp_Object)); -static void describe_command P_ ((Lisp_Object, Lisp_Object)); -static void describe_translation P_ ((Lisp_Object, Lisp_Object)); -static void describe_map P_ ((Lisp_Object, Lisp_Object, - void (*) P_ ((Lisp_Object, Lisp_Object)), - int, Lisp_Object, Lisp_Object*, int, int)); -static void describe_vector P_ ((Lisp_Object, Lisp_Object, Lisp_Object, - void (*) (Lisp_Object, Lisp_Object), int, - Lisp_Object, Lisp_Object, int *, - int, int, int)); -static void silly_event_symbol_error P_ ((Lisp_Object)); +static Lisp_Object define_as_prefix (Lisp_Object, Lisp_Object); +static void describe_command (Lisp_Object, Lisp_Object); +static void describe_translation (Lisp_Object, Lisp_Object); +static void describe_map (Lisp_Object, Lisp_Object, + void (*) (Lisp_Object, Lisp_Object), + int, Lisp_Object, Lisp_Object*, int, int); +static void describe_vector (Lisp_Object, Lisp_Object, Lisp_Object, + void (*) (Lisp_Object, Lisp_Object), int, + Lisp_Object, Lisp_Object, int *, + int, int, int); +static void silly_event_symbol_error (Lisp_Object); /* Keymap object support - constructors and predicates. */ @@ -142,8 +142,7 @@ input stream. Initially, ALIST is nil. The optional arg STRING supplies a menu name for the keymap in case you use it as a menu with `x-popup-menu'. */) - (string) - Lisp_Object string; + (Lisp_Object string) { Lisp_Object tail; if (!NILP (string)) @@ -163,8 +162,7 @@ Initially the alist is nil. The optional arg STRING supplies a menu name for the keymap in case you use it as a menu with `x-popup-menu'. */) - (string) - Lisp_Object string; + (Lisp_Object string) { if (!NILP (string)) { @@ -183,19 +181,13 @@ in case you use it as a menu with `x-popup-menu'. */) initial_define_key (control_x_map, Ctl('X'), "exchange-point-and-mark"); */ void -initial_define_key (keymap, key, defname) - Lisp_Object keymap; - int key; - char *defname; +initial_define_key (Lisp_Object keymap, int key, char *defname) { store_in_keymap (keymap, make_number (key), intern_c_string (defname)); } void -initial_define_lispy_key (keymap, keyname, defname) - Lisp_Object keymap; - char *keyname; - char *defname; +initial_define_lispy_key (Lisp_Object keymap, char *keyname, char *defname) { store_in_keymap (keymap, intern_c_string (keyname), intern_c_string (defname)); } @@ -208,8 +200,7 @@ or a symbol whose function definition is itself a keymap. ALIST elements look like (CHAR . DEFN) or (SYMBOL . DEFN); a vector of densely packed bindings for small character codes is also allowed as an element. */) - (object) - Lisp_Object object; + (Lisp_Object object) { return (KEYMAPP (object) ? Qt : Qnil); } @@ -218,8 +209,7 @@ DEFUN ("keymap-prompt", Fkeymap_prompt, Skeymap_prompt, 1, 1, 0, doc: /* Return the prompt-string of a keymap MAP. If non-nil, the prompt is shown in the echo-area when reading a key-sequence to be looked-up in this keymap. */) - (map) - Lisp_Object map; + (Lisp_Object map) { map = get_keymap (map, 0, 0); while (CONSP (map)) @@ -255,9 +245,7 @@ when reading a key-sequence to be looked-up in this keymap. */) do_autoload which can GC. */ Lisp_Object -get_keymap (object, error, autoload) - Lisp_Object object; - int error, autoload; +get_keymap (Lisp_Object object, int error, int autoload) { Lisp_Object tem; @@ -309,9 +297,7 @@ get_keymap (object, error, autoload) We assume that KEYMAP is a valid keymap. */ Lisp_Object -keymap_parent (keymap, autoload) - Lisp_Object keymap; - int autoload; +keymap_parent (Lisp_Object keymap, int autoload) { Lisp_Object list; @@ -332,16 +318,14 @@ keymap_parent (keymap, autoload) DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0, doc: /* Return the parent keymap of KEYMAP. If KEYMAP has no parent, return nil. */) - (keymap) - Lisp_Object keymap; + (Lisp_Object keymap) { return keymap_parent (keymap, 1); } /* Check whether MAP is one of MAPS parents. */ int -keymap_memberp (map, maps) - Lisp_Object map, maps; +keymap_memberp (Lisp_Object map, Lisp_Object maps) { if (NILP (map)) return 0; while (KEYMAPP (maps) && !EQ (map, maps)) @@ -354,8 +338,7 @@ keymap_memberp (map, maps) DEFUN ("set-keymap-parent", Fset_keymap_parent, Sset_keymap_parent, 2, 2, 0, doc: /* Modify KEYMAP to set its parent map to PARENT. Return PARENT. PARENT should be nil or another keymap. */) - (keymap, parent) - Lisp_Object keymap, parent; + (Lisp_Object keymap, Lisp_Object parent) { Lisp_Object list, prev; struct gcpro gcpro1, gcpro2; @@ -437,8 +420,7 @@ Return PARENT. PARENT should be nil or another keymap. */) make sure that SUBMAP inherits that definition as its own parent. */ static void -fix_submap_inheritance (map, event, submap) - Lisp_Object map, event, submap; +fix_submap_inheritance (Lisp_Object map, Lisp_Object event, Lisp_Object submap) { Lisp_Object map_parent, parent_entry; @@ -500,12 +482,7 @@ fix_submap_inheritance (map, event, submap) If NOINHERIT, don't accept a subkeymap found in an inherited keymap. */ Lisp_Object -access_keymap (map, idx, t_ok, noinherit, autoload) - Lisp_Object map; - Lisp_Object idx; - int t_ok; - int noinherit; - int autoload; +access_keymap (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int autoload) { Lisp_Object val; @@ -634,10 +611,7 @@ access_keymap (map, idx, t_ok, noinherit, autoload) } static void -map_keymap_item (fun, args, key, val, data) - map_keymap_function_t fun; - Lisp_Object args, key, val; - void *data; +map_keymap_item (map_keymap_function_t fun, Lisp_Object args, Lisp_Object key, Lisp_Object val, void *data) { /* We should maybe try to detect bindings shadowed by previous ones and things like that. */ @@ -647,8 +621,7 @@ map_keymap_item (fun, args, key, val, data) } static void -map_keymap_char_table_item (args, key, val) - Lisp_Object args, key, val; +map_keymap_char_table_item (Lisp_Object args, Lisp_Object key, Lisp_Object val) { if (!NILP (val)) { @@ -707,9 +680,7 @@ map_keymap_internal (Lisp_Object map, } static void -map_keymap_call (key, val, fun, dummy) - Lisp_Object key, val, fun; - void *dummy; +map_keymap_call (Lisp_Object key, Lisp_Object val, Lisp_Object fun, void *dummy) { call2 (fun, key, val); } @@ -717,11 +688,7 @@ map_keymap_call (key, val, fun, dummy) /* Same as map_keymap_internal, but doesn't traverses parent keymaps as well. A non-zero AUTOLOAD indicates that autoloaded keymaps should be loaded. */ void -map_keymap (map, fun, args, data, autoload) - map_keymap_function_t fun; - Lisp_Object map, args; - void *data; - int autoload; +map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args, void *data, int autoload) { struct gcpro gcpro1; GCPRO1 (args); @@ -739,10 +706,7 @@ Lisp_Object Qkeymap_canonicalize; /* Same as map_keymap, but does it right, properly eliminating duplicate bindings due to inheritance. */ void -map_keymap_canonical (map, fun, args, data) - map_keymap_function_t fun; - Lisp_Object map, args; - void *data; +map_keymap_canonical (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args, void *data) { struct gcpro gcpro1; GCPRO1 (args); @@ -759,8 +723,7 @@ DEFUN ("map-keymap-internal", Fmap_keymap_internal, Smap_keymap_internal, 2, 2, FUNCTION is called with two arguments: the event that is bound, and the definition it is bound to. The event may be a character range. If KEYMAP has a parent, this function returns it without processing it. */) - (function, keymap) - Lisp_Object function, keymap; + (Lisp_Object function, Lisp_Object keymap) { struct gcpro gcpro1; GCPRO1 (function); @@ -779,8 +742,7 @@ If KEYMAP has a parent, the parent's bindings are included as well. This works recursively: if the parent has itself a parent, then the grandparent's bindings are also included and so on. usage: (map-keymap FUNCTION KEYMAP) */) - (function, keymap, sort_first) - Lisp_Object function, keymap, sort_first; + (Lisp_Object function, Lisp_Object keymap, Lisp_Object sort_first) { if (! NILP (sort_first)) return call2 (intern ("map-keymap-sorted"), function, keymap); @@ -804,9 +766,7 @@ usage: (map-keymap FUNCTION KEYMAP) */) This can GC because menu_item_eval_property calls Feval. */ Lisp_Object -get_keyelt (object, autoload) - Lisp_Object object; - int autoload; +get_keyelt (Lisp_Object object, int autoload) { while (1) { @@ -886,10 +846,7 @@ get_keyelt (object, autoload) } static Lisp_Object -store_in_keymap (keymap, idx, def) - Lisp_Object keymap; - register Lisp_Object idx; - Lisp_Object def; +store_in_keymap (Lisp_Object keymap, register Lisp_Object idx, Lisp_Object def) { /* Flush any reverse-map cache. */ where_is_cache = Qnil; @@ -1044,8 +1001,7 @@ store_in_keymap (keymap, idx, def) EXFUN (Fcopy_keymap, 1); Lisp_Object -copy_keymap_item (elt) - Lisp_Object elt; +copy_keymap_item (Lisp_Object elt) { Lisp_Object res, tem; @@ -1118,8 +1074,7 @@ copy_keymap_item (elt) } static void -copy_keymap_1 (chartable, idx, elt) - Lisp_Object chartable, idx, elt; +copy_keymap_1 (Lisp_Object chartable, Lisp_Object idx, Lisp_Object elt) { Fset_char_table_range (chartable, idx, copy_keymap_item (elt)); } @@ -1131,8 +1086,7 @@ but changing either the copy or KEYMAP does not affect the other. Any key definitions that are subkeymaps are recursively copied. However, a key definition which is a symbol whose definition is a keymap is not copied. */) - (keymap) - Lisp_Object keymap; + (Lisp_Object keymap) { register Lisp_Object copy, tail; keymap = get_keymap (keymap, 1, 0); @@ -1172,11 +1126,13 @@ DEFUN ("define-key", Fdefine_key, Sdefine_key, 3, 3, 0, doc: /* In KEYMAP, define key sequence KEY as DEF. KEYMAP is a keymap. -KEY is a string or a vector of symbols and characters meaning a +KEY is a string or a vector of symbols and characters, representing a sequence of keystrokes and events. Non-ASCII characters with codes -above 127 (such as ISO Latin-1) can be included if you use a vector. -Using [t] for KEY creates a default definition, which applies to any -event type that has no other definition in this keymap. +above 127 (such as ISO Latin-1) can be represented by vectors. +Two types of vector have special meanings: + [remap COMMAND] remaps any key binding for COMMAND. + [t] creates a default definition, which applies to any event with no + other definition in KEYMAP. DEF is anything that can be a key's definition: nil (means key is undefined in this keymap), @@ -1195,10 +1151,7 @@ DEF is anything that can be a key's definition: If KEYMAP is a sparse keymap with a binding for KEY, the existing binding is altered. If there is no binding for KEY, the new pair binding KEY to DEF is added at the front of KEYMAP. */) - (keymap, key, def) - Lisp_Object keymap; - Lisp_Object key; - Lisp_Object def; + (Lisp_Object keymap, Lisp_Object key, Lisp_Object def) { register int idx; register Lisp_Object c; @@ -1314,8 +1267,7 @@ ignored if POSITION is non-nil. If the optional argument KEYMAPS is non-nil, it should be a list of keymaps to search for command remapping. Otherwise, search for the remapping in all currently active keymaps. */) - (command, position, keymaps) - Lisp_Object command, position, keymaps; + (Lisp_Object command, Lisp_Object position, Lisp_Object keymaps) { if (!SYMBOLP (command)) return Qnil; @@ -1357,10 +1309,7 @@ bindings, used when nothing else in the keymap applies; this makes it usable as a general function for probing keymaps. However, if the third optional argument ACCEPT-DEFAULT is non-nil, `lookup-key' will recognize the default bindings, just as `read-key-sequence' does. */) - (keymap, key, accept_default) - Lisp_Object keymap; - Lisp_Object key; - Lisp_Object accept_default; + (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default) { register int idx; register Lisp_Object cmd; @@ -1412,8 +1361,7 @@ recognize the default bindings, just as `read-key-sequence' does. */) Return the keymap. */ static Lisp_Object -define_as_prefix (keymap, c) - Lisp_Object keymap, c; +define_as_prefix (Lisp_Object keymap, Lisp_Object c) { Lisp_Object cmd; @@ -1430,8 +1378,7 @@ define_as_prefix (keymap, c) /* Append a key to the end of a key sequence. We always make a vector. */ Lisp_Object -append_key (key_sequence, key) - Lisp_Object key_sequence, key; +append_key (Lisp_Object key_sequence, Lisp_Object key) { Lisp_Object args[2]; @@ -1445,8 +1392,7 @@ append_key (key_sequence, key) signal an error if is a mistake such as RET or M-RET or C-DEL, etc. */ static void -silly_event_symbol_error (c) - Lisp_Object c; +silly_event_symbol_error (Lisp_Object c) { Lisp_Object parsed, base, name, assoc; int modifiers; @@ -1515,8 +1461,7 @@ static int cmm_size = 0; list, let the key sequence be read, and hope some other piece of code signals the error. */ int -current_minor_maps (modeptr, mapptr) - Lisp_Object **modeptr, **mapptr; +current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr) { int i = 0; int list_number = 0; @@ -1575,7 +1520,8 @@ current_minor_maps (modeptr, mapptr) { if (cmm_modes) { - bcopy (cmm_modes, newmodes, cmm_size * sizeof cmm_modes[0]); + memcpy (newmodes, cmm_modes, + cmm_size * sizeof cmm_modes[0]); free (cmm_modes); } cmm_modes = newmodes; @@ -1586,7 +1532,8 @@ current_minor_maps (modeptr, mapptr) { if (cmm_maps) { - bcopy (cmm_maps, newmaps, cmm_size * sizeof cmm_maps[0]); + memcpy (newmaps, cmm_maps, + cmm_size * sizeof cmm_maps[0]); free (cmm_maps); } cmm_maps = newmaps; @@ -1620,8 +1567,7 @@ DEFUN ("current-active-maps", Fcurrent_active_maps, Scurrent_active_maps, OLP if non-nil indicates that we should obey `overriding-local-map' and `overriding-terminal-local-map'. POSITION can specify a click position like in the respective argument of `key-binding'. */) - (olp, position) - Lisp_Object olp, position; + (Lisp_Object olp, Lisp_Object position) { int count = SPECPDL_INDEX (); @@ -1784,8 +1730,7 @@ occurs in the keymaps associated with it instead of KEY. It can also be a number or marker, in which case the keymap properties at the specified buffer position instead of point are used. */) - (key, accept_default, no_remap, position) - Lisp_Object key, accept_default, no_remap, position; + (Lisp_Object key, Lisp_Object accept_default, Lisp_Object no_remap, Lisp_Object position) { Lisp_Object *maps, value; int nmaps, i; @@ -1975,8 +1920,7 @@ The binding is probably a symbol with a function definition. If optional argument ACCEPT-DEFAULT is non-nil, recognize default bindings; see the description of `lookup-key' for more details about this. */) - (keys, accept_default) - Lisp_Object keys, accept_default; + (Lisp_Object keys, Lisp_Object accept_default) { register Lisp_Object map; map = current_buffer->keymap; @@ -1996,8 +1940,7 @@ This function's return values are the same as those of `lookup-key' If optional argument ACCEPT-DEFAULT is non-nil, recognize default bindings; see the description of `lookup-key' for more details about this. */) - (keys, accept_default) - Lisp_Object keys, accept_default; + (Lisp_Object keys, Lisp_Object accept_default) { return Flookup_key (current_global_map, keys, accept_default); } @@ -2016,8 +1959,7 @@ that come after prefix bindings. If optional argument ACCEPT-DEFAULT is non-nil, recognize default bindings; see the description of `lookup-key' for more details about this. */) - (key, accept_default) - Lisp_Object key, accept_default; + (Lisp_Object key, Lisp_Object accept_default) { Lisp_Object *modes, *maps; int nmaps; @@ -2056,8 +1998,7 @@ as a function. The third optional argument NAME, if given, supplies a menu name string for the map. This is required to use the keymap as a menu. This function returns COMMAND. */) - (command, mapvar, name) - Lisp_Object command, mapvar, name; + (Lisp_Object command, Lisp_Object mapvar, Lisp_Object name) { Lisp_Object map; map = Fmake_sparse_keymap (name); @@ -2071,8 +2012,7 @@ This function returns COMMAND. */) DEFUN ("use-global-map", Fuse_global_map, Suse_global_map, 1, 1, 0, doc: /* Select KEYMAP as the global keymap. */) - (keymap) - Lisp_Object keymap; + (Lisp_Object keymap) { keymap = get_keymap (keymap, 1, 1); current_global_map = keymap; @@ -2083,8 +2023,7 @@ DEFUN ("use-global-map", Fuse_global_map, Suse_global_map, 1, 1, 0, DEFUN ("use-local-map", Fuse_local_map, Suse_local_map, 1, 1, 0, doc: /* Select KEYMAP as the local keymap. If KEYMAP is nil, that means no local keymap. */) - (keymap) - Lisp_Object keymap; + (Lisp_Object keymap) { if (!NILP (keymap)) keymap = get_keymap (keymap, 1, 1); @@ -2097,21 +2036,21 @@ If KEYMAP is nil, that means no local keymap. */) DEFUN ("current-local-map", Fcurrent_local_map, Scurrent_local_map, 0, 0, 0, doc: /* Return current buffer's local keymap, or nil if it has none. Normally the local keymap is set by the major mode with `use-local-map'. */) - () + (void) { return current_buffer->keymap; } DEFUN ("current-global-map", Fcurrent_global_map, Scurrent_global_map, 0, 0, 0, doc: /* Return the current global keymap. */) - () + (void) { return current_global_map; } DEFUN ("current-minor-mode-maps", Fcurrent_minor_mode_maps, Scurrent_minor_mode_maps, 0, 0, 0, doc: /* Return a list of keymaps for the minor modes of the current buffer. */) - () + (void) { Lisp_Object *maps; int nmaps = current_minor_maps (0, &maps); @@ -2128,10 +2067,8 @@ struct accessible_keymaps_data { }; static void -accessible_keymaps_1 (key, cmd, args, data) - Lisp_Object key, cmd, args; - /* Use void* to be compatible with map_keymap_function_t. */ - void *data; +accessible_keymaps_1 (Lisp_Object key, Lisp_Object cmd, Lisp_Object args, void *data) +/* Use void* data to be compatible with map_keymap_function_t. */ { struct accessible_keymaps_data *d = data; /* Cast! */ Lisp_Object maps = d->maps; @@ -2201,8 +2138,7 @@ KEYS starting from KEYMAP gets you to MAP. These elements are ordered so that the KEYS increase in length. The first element is ([] . KEYMAP). An optional argument PREFIX, if non-nil, should be a key sequence; then the value includes only maps for prefixes that start with PREFIX. */) - (keymap, prefix) - Lisp_Object keymap, prefix; + (Lisp_Object keymap, Lisp_Object prefix) { Lisp_Object maps, tail; int prefixlen = XINT (Flength (prefix)); @@ -2290,8 +2226,7 @@ DEFUN ("key-description", Fkey_description, Skey_description, 1, 2, 0, Optional arg PREFIX is the sequence of keys leading up to KEYS. Control characters turn into "C-foo" sequences, meta into "M-foo", spaces are put between sequence elements, etc. */) - (keys, prefix) - Lisp_Object keys, prefix; + (Lisp_Object keys, Lisp_Object prefix) { int len = 0; int i, i_byte; @@ -2389,10 +2324,7 @@ spaces are put between sequence elements, etc. */) char * -push_key_description (c, p, force_multibyte) - register unsigned int c; - register char *p; - int force_multibyte; +push_key_description (register unsigned int c, register char *p, int force_multibyte) { unsigned c2; @@ -2514,8 +2446,7 @@ DEFUN ("single-key-description", Fsingle_key_description, Control characters turn into C-whatever, etc. Optional argument NO-ANGLES non-nil means don't put angle brackets around function keys and event symbols. */) - (key, no_angles) - Lisp_Object key, no_angles; + (Lisp_Object key, Lisp_Object no_angles) { if (CONSP (key) && lucid_event_type_list_p (key)) key = Fevent_convert_list (key); @@ -2549,9 +2480,7 @@ around function keys and event symbols. */) } char * -push_text_char_description (c, p) - register unsigned int c; - register char *p; +push_text_char_description (register unsigned int c, register char *p) { if (c >= 0200) { @@ -2583,8 +2512,7 @@ Control characters turn into "^char", etc. This differs from Also, this function recognizes the 2**7 bit as the Meta character, whereas `single-key-description' uses the 2**27 bit for Meta. See Info node `(elisp)Describing Characters' for examples. */) - (character) - Lisp_Object character; + (Lisp_Object character) { /* Currently MAX_MULTIBYTE_LENGTH is 4 (< 6). */ unsigned char str[6]; @@ -2611,8 +2539,7 @@ static int where_is_preferred_modifier; Else, return 2 if SEQ uses the where_is_preferred_modifier, and 1 otherwise. */ static int -preferred_sequence_p (seq) - Lisp_Object seq; +preferred_sequence_p (Lisp_Object seq) { int i; int len = XINT (Flength (seq)); @@ -2643,8 +2570,8 @@ preferred_sequence_p (seq) /* where-is - finding a command in a set of keymaps. */ -static void where_is_internal_1 P_ ((Lisp_Object key, Lisp_Object binding, - Lisp_Object args, void *data)); +static void where_is_internal_1 (Lisp_Object key, Lisp_Object binding, + Lisp_Object args, void *data); /* Like Flookup_key, but uses a list of keymaps SHADOW instead of a single map. Returns the first non-nil binding found in any of those maps. @@ -2814,9 +2741,7 @@ indirect definition itself. If optional 5th arg NO-REMAP is non-nil, don't search for key sequences that invoke a command which is remapped to DEFINITION, but include the remapped command in the returned list. */) - (definition, keymap, firstonly, noindirect, no_remap) - Lisp_Object definition, keymap; - Lisp_Object firstonly, noindirect, no_remap; + (Lisp_Object definition, Lisp_Object keymap, Lisp_Object firstonly, Lisp_Object noindirect, Lisp_Object no_remap) { /* The keymaps in which to search. */ Lisp_Object keymaps; @@ -2982,9 +2907,7 @@ remapped command in the returned list. */) /* This function can GC because get_keyelt can. */ static void -where_is_internal_1 (key, binding, args, data) - Lisp_Object key, binding, args; - void *data; +where_is_internal_1 (Lisp_Object key, Lisp_Object binding, Lisp_Object args, void *data) { struct where_is_internal_data *d = data; /* Cast! */ Lisp_Object definition = d->definition; @@ -3039,8 +2962,7 @@ The optional argument PREFIX, if non-nil, should be a key sequence; then we display only bindings that start with that prefix. The optional argument MENUS, if non-nil, says to mention menu bindings. \(Ordinarily these are omitted from the output.) */) - (buffer, prefix, menus) - Lisp_Object buffer, prefix, menus; + (Lisp_Object buffer, Lisp_Object prefix, Lisp_Object menus) { Lisp_Object outbuf, shadow; int nomenu = NILP (menus); @@ -3151,12 +3073,12 @@ You type Translation\n\ *p++ = '\f'; *p++ = '\n'; *p++ = '`'; - bcopy (SDATA (SYMBOL_NAME (modes[i])), p, - SCHARS (SYMBOL_NAME (modes[i]))); + memcpy (p, SDATA (SYMBOL_NAME (modes[i])), + SCHARS (SYMBOL_NAME (modes[i]))); p += SCHARS (SYMBOL_NAME (modes[i])); *p++ = '\''; - bcopy (" Minor Mode Bindings", p, sizeof (" Minor Mode Bindings") - 1); - p += sizeof (" Minor Mode Bindings") - 1; + memcpy (p, " Minor Mode Bindings", strlen (" Minor Mode Bindings")); + p += strlen (" Minor Mode Bindings"); *p = 0; describe_map_tree (maps[i], 1, shadow, prefix, @@ -3218,15 +3140,9 @@ You type Translation\n\ don't omit it; instead, mention it but say it is shadowed. */ void -describe_map_tree (startmap, partial, shadow, prefix, title, nomenu, transl, - always_title, mention_shadow) - Lisp_Object startmap, shadow, prefix; - int partial; - char *title; - int nomenu; - int transl; - int always_title; - int mention_shadow; +describe_map_tree (Lisp_Object startmap, int partial, Lisp_Object shadow, + Lisp_Object prefix, char *title, int nomenu, int transl, + int always_title, int mention_shadow) { Lisp_Object maps, orig_maps, seen, sub_shadows; struct gcpro gcpro1, gcpro2, gcpro3; @@ -3342,8 +3258,7 @@ key binding\n\ static int previous_description_column; static void -describe_command (definition, args) - Lisp_Object definition, args; +describe_command (Lisp_Object definition, Lisp_Object args) { register Lisp_Object tem1; int column = (int) current_column (); /* iftc */ @@ -3379,8 +3294,7 @@ describe_command (definition, args) } static void -describe_translation (definition, args) - Lisp_Object definition, args; +describe_translation (Lisp_Object definition, Lisp_Object args) { register Lisp_Object tem1; @@ -3413,8 +3327,7 @@ struct describe_map_elt { Lisp_Object event; Lisp_Object definition; int shadowe the event field. */ static int -describe_map_compare (aa, bb) - const void *aa, *bb; +describe_map_compare (const void *aa, const void *bb) { const struct describe_map_elt *a = aa, *b = bb; if (INTEGERP (a->event) && INTEGERP (b->event)) @@ -3436,16 +3349,10 @@ describe_map_compare (aa, bb) PARTIAL, SHADOW, NOMENU are as in `describe_map_tree' above. */ static void -describe_map (map, prefix, elt_describer, partial, shadow, - seen, nomenu, mention_shadow) - register Lisp_Object map; - Lisp_Object prefix; - void (*elt_describer) P_ ((Lisp_Object, Lisp_Object)); - int partial; - Lisp_Object shadow; - Lisp_Object *seen; - int nomenu; - int mention_shadow; +describe_map (Lisp_Object map, Lisp_Object prefix, + void (*elt_describer) (Lisp_Object, Lisp_Object), + int partial, Lisp_Object shadow, + Lisp_Object *seen, int nomenu, int mention_shadow) { Lisp_Object tail, definition, event; Lisp_Object tem; @@ -3624,8 +3531,7 @@ describe_map (map, prefix, elt_describer, partial, shadow, } static void -describe_vector_princ (elt, fun) - Lisp_Object elt, fun; +describe_vector_princ (Lisp_Object elt, Lisp_Object fun) { Findent_to (make_number (16), make_number (1)); call1 (fun, elt); @@ -3636,8 +3542,7 @@ DEFUN ("describe-vector", Fdescribe_vector, Sdescribe_vector, 1, 2, 0, doc: /* Insert a description of contents of VECTOR. This is text showing the elements of vector matched against indices. DESCRIBER is the output function used; nil means use `princ'. */) - (vector, describer) - Lisp_Object vector, describer; + (Lisp_Object vector, Lisp_Object describer) { int count = SPECPDL_INDEX (); if (NILP (describer)) @@ -3686,20 +3591,11 @@ DESCRIBER is the output function used; nil means use `princ'. */) ARGS is simply passed as the second argument to ELT_DESCRIBER. */ static void -describe_vector (vector, prefix, args, elt_describer, - partial, shadow, entire_map, - indices, char_table_depth, keymap_p, - mention_shadow) - register Lisp_Object vector; - Lisp_Object prefix, args; - void (*elt_describer) P_ ((Lisp_Object, Lisp_Object)); - int partial; - Lisp_Object shadow; - Lisp_Object entire_map; - int *indices; - int char_table_depth; - int keymap_p; - int mention_shadow; +describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args, + void (*elt_describer) (Lisp_Object, Lisp_Object), + int partial, Lisp_Object shadow, Lisp_Object entire_map, + int *indices, int char_table_depth, int keymap_p, + int mention_shadow) { Lisp_Object definition; Lisp_Object tem2; @@ -3893,8 +3789,7 @@ static Lisp_Object apropos_predicate; static Lisp_Object apropos_accumulate; static void -apropos_accum (symbol, string) - Lisp_Object symbol, string; +apropos_accum (Lisp_Object symbol, Lisp_Object string) { register Lisp_Object tem; @@ -3910,8 +3805,7 @@ DEFUN ("apropos-internal", Fapropos_internal, Sapropos_internal, 1, 2, 0, If optional 2nd arg PREDICATE is non-nil, (funcall PREDICATE SYMBOL) is done for each symbol and a symbol is mentioned only if that returns non-nil. Return list of symbols found. */) - (regexp, predicate) - Lisp_Object regexp, predicate; + (Lisp_Object regexp, Lisp_Object predicate) { Lisp_Object tem; CHECK_STRING (regexp); @@ -3925,7 +3819,7 @@ Return list of symbols found. */) } void -syms_of_keymap () +syms_of_keymap (void) { Qkeymap = intern_c_string ("keymap"); staticpro (&Qkeymap); @@ -4119,7 +4013,7 @@ preferred. */); } void -keys_of_keymap () +keys_of_keymap (void) { initial_define_key (global_map, 033, "ESC-prefix"); initial_define_key (global_map, Ctl ('X'), "Control-X-prefix"); diff --git a/src/keymap.h b/src/keymap.h index ed9bf7f192c..024b03dd1c3 100644 --- a/src/keymap.h +++ b/src/keymap.h @@ -33,21 +33,21 @@ EXFUN (Fkey_description, 2); EXFUN (Fsingle_key_description, 2); EXFUN (Fwhere_is_internal, 5); EXFUN (Fcurrent_active_maps, 2); -extern Lisp_Object access_keymap P_ ((Lisp_Object, Lisp_Object, int, int, int)); -extern Lisp_Object get_keyelt P_ ((Lisp_Object, int)); -extern Lisp_Object get_keymap P_ ((Lisp_Object, int, int)); +extern Lisp_Object access_keymap (Lisp_Object, Lisp_Object, int, int, int); +extern Lisp_Object get_keyelt (Lisp_Object, int); +extern Lisp_Object get_keymap (Lisp_Object, int, int); EXFUN (Fset_keymap_parent, 2); -extern void describe_map_tree P_ ((Lisp_Object, int, Lisp_Object, Lisp_Object, - char *, int, int, int, int)); -extern int current_minor_maps P_ ((Lisp_Object **, Lisp_Object **)); -extern void initial_define_key P_ ((Lisp_Object, int, char *)); -extern void initial_define_lispy_key P_ ((Lisp_Object, char *, char *)); -extern void syms_of_keymap P_ ((void)); -extern void keys_of_keymap P_ ((void)); +extern void describe_map_tree (Lisp_Object, int, Lisp_Object, Lisp_Object, + char *, int, int, int, int); +extern int current_minor_maps (Lisp_Object **, Lisp_Object **); +extern void initial_define_key (Lisp_Object, int, char *); +extern void initial_define_lispy_key (Lisp_Object, char *, char *); +extern void syms_of_keymap (void); +extern void keys_of_keymap (void); typedef void (*map_keymap_function_t) - P_ ((Lisp_Object key, Lisp_Object val, Lisp_Object args, void* data)); -extern void map_keymap P_ ((Lisp_Object map, map_keymap_function_t fun, Lisp_Object largs, void* cargs, int autoload)); + (Lisp_Object key, Lisp_Object val, Lisp_Object args, void* data); +extern void map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object largs, void* cargs, int autoload); extern void map_keymap_canonical (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args, void *data); diff --git a/src/lisp.h b/src/lisp.h index c7e8ea0fb8b..0559503c890 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -21,8 +21,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifndef EMACS_LISP_H #define EMACS_LISP_H -/* Declare the prototype for a general external function. */ -#define P_(proto) proto +#include <stdarg.h> +#include <stddef.h> /* Use the configure flag --enable-checking[=LIST] to enable various types of run time checks for Lisp objects. */ @@ -54,7 +54,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Extra internal type checking? */ extern int suppress_checking; -extern void die P_((const char *, const char *, int)) NO_RETURN; +extern void die (const char *, const char *, int) NO_RETURN; #ifdef ENABLE_CHECKING @@ -95,10 +95,9 @@ extern void die P_((const char *, const char *, int)) NO_RETURN; #endif #endif /* ENABLE_CHECKING */ -/* Define this to make Lisp_Object use a union type instead of the - default int. FIXME: It might be better to add a flag to configure - to do this. */ -/* #define USE_LISP_UNION_TYPE */ +/* Use the configure flag --enable-use-lisp-union-type to make + Lisp_Object use a union type instead of the default int. The flag + causes USE_LISP_UNION_TYPE to be defined. */ /***** Select the tagging scheme. *****/ /* There are basically two options that control the tagging scheme: @@ -493,7 +492,7 @@ enum pvec_type #define make_number(N) \ (__extension__ ({ Lisp_Object _l; _l.s.val = (N); _l.s.type = Lisp_Int; _l; })) #else -extern Lisp_Object make_number P_ ((EMACS_INT)); +extern Lisp_Object make_number (EMACS_INT); #endif #endif /* USE_LISP_UNION_TYPE */ @@ -654,7 +653,7 @@ extern size_t pure_size; (XSTRING (string)->size = (newsize)) #define STRING_COPYIN(string, index, new, count) \ - bcopy (new, SDATA (string) + index, count) + memcpy (SDATA (string) + index, new, count) /* Type checking. */ @@ -750,7 +749,7 @@ struct Lisp_Cons #ifdef GC_CHECK_STRING_BYTES struct Lisp_String; -extern int string_bytes P_ ((struct Lisp_String *)); +extern int string_bytes (struct Lisp_String *); #define STRING_BYTES(S) string_bytes ((S)) #else /* not GC_CHECK_STRING_BYTES */ @@ -789,13 +788,6 @@ struct Lisp_String unsigned char *data; }; -#ifdef offsetof -#define OFFSETOF(type,field) offsetof(type,field) -#else -#define OFFSETOF(type,field) \ - ((int)((char*)&((type*)0)->field - (char*)0)) -#endif - struct Lisp_Vector { EMACS_UINT size; @@ -806,7 +798,7 @@ struct Lisp_Vector /* If a struct is made to look like a vector, this macro returns the length of the shortest vector that would hold that struct. */ #define VECSIZE(type) ((sizeof (type) \ - - OFFSETOF (struct Lisp_Vector, contents[0]) \ + - offsetof (struct Lisp_Vector, contents[0]) \ + sizeof(Lisp_Object) - 1) /* round up */ \ / sizeof (Lisp_Object)) @@ -814,7 +806,7 @@ struct Lisp_Vector at the end and we need to compute the number of Lisp_Object fields (the ones that the GC needs to trace). */ #define PSEUDOVECSIZE(type, nonlispfield) \ - ((OFFSETOF(type, nonlispfield) - OFFSETOF(struct Lisp_Vector, contents[0])) \ + ((offsetof(type, nonlispfield) - offsetof(struct Lisp_Vector, contents[0])) \ / sizeof (Lisp_Object)) /* A char-table is a kind of vectorlike, with contents are like a @@ -972,7 +964,19 @@ struct Lisp_Bool_Vector struct Lisp_Subr { EMACS_UINT size; - Lisp_Object (*function) (); + union { + Lisp_Object (*a0) (void); + Lisp_Object (*a1) (Lisp_Object); + Lisp_Object (*a2) (Lisp_Object, Lisp_Object); + Lisp_Object (*a3) (Lisp_Object, Lisp_Object, Lisp_Object); + Lisp_Object (*a4) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); + Lisp_Object (*a5) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); + Lisp_Object (*a6) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); + Lisp_Object (*a7) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); + Lisp_Object (*a8) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); + Lisp_Object (*aUNEVALLED) (Lisp_Object args); + Lisp_Object (*aMANY) (int, Lisp_Object *); + } function; short min_args, max_args; const char *symbol_name; char *intspec; @@ -1162,11 +1166,11 @@ struct Lisp_Hash_Table struct Lisp_Hash_Table *next_weak; /* C function to compare two keys. */ - int (* cmpfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object, - unsigned, Lisp_Object, unsigned)); + int (* cmpfn) (struct Lisp_Hash_Table *, Lisp_Object, + unsigned, Lisp_Object, unsigned); /* C function to compute hash code. */ - unsigned (* hashfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object)); + unsigned (* hashfn) (struct Lisp_Hash_Table *, Lisp_Object); }; @@ -1798,7 +1802,8 @@ typedef struct { Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ DECL_ALIGN (struct Lisp_Subr, sname) = \ { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \ - fnname, minargs, maxargs, lname, intspec, 0}; \ + { .a ## maxargs = fnname }, \ + minargs, maxargs, lname, intspec, 0}; \ Lisp_Object fnname /* Note that the weird token-substitution semantics of ANSI C makes @@ -1828,7 +1833,7 @@ typedef struct { /* defsubr (Sname); is how we define the symbol for function `name' at start-up time. */ -extern void defsubr P_ ((struct Lisp_Subr *)); +extern void defsubr (struct Lisp_Subr *); #define MANY -2 #define UNEVALLED -1 @@ -1894,7 +1899,7 @@ extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int); WHERE being a buffer or frame means we saw a buffer-local or frame-local value. Other values of WHERE mean an internal error. */ -typedef Lisp_Object (*specbinding_func) P_ ((Lisp_Object)); +typedef Lisp_Object (*specbinding_func) (Lisp_Object); struct specbinding { @@ -1994,7 +1999,7 @@ extern char *stack_bottom; and (in particular) cannot call arbitrary Lisp code. */ #ifdef SYNC_INPUT -extern void process_pending_signals P_ ((void)); +extern void process_pending_signals (void); extern int pending_signals; #define ELSE_PENDING_SIGNALS \ else if (pending_signals) \ @@ -2267,7 +2272,7 @@ while (0) /* Call staticpro (&var) to protect static variable `var'. */ -void staticpro P_ ((Lisp_Object *)); +void staticpro (Lisp_Object *); /* Declare a Lisp-callable function. The MAXARGS parameter has the same meaning as in the DEFUN macro, and is used to construct a prototype. */ @@ -2310,7 +2315,7 @@ extern Lisp_Object Qinteger; extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object; -extern void circular_list_error P_ ((Lisp_Object)) NO_RETURN; +extern void circular_list_error (Lisp_Object) NO_RETURN; EXFUN (Finteractive_form, 1); EXFUN (Fbyteorder, 0); @@ -2353,12 +2358,12 @@ EXFUN (Ffmakunbound, 1); EXFUN (Fsymbol_function, 1); EXFUN (Fsymbol_plist, 1); EXFUN (Fsymbol_name, 1); -extern Lisp_Object indirect_function P_ ((Lisp_Object)); +extern Lisp_Object indirect_function (Lisp_Object); EXFUN (Findirect_function, 2); EXFUN (Ffset, 2); EXFUN (Fsetplist, 2); EXFUN (Fsymbol_value, 1); -extern Lisp_Object find_symbol_value P_ ((Lisp_Object)); +extern Lisp_Object find_symbol_value (Lisp_Object); EXFUN (Fset, 2); EXFUN (Fdefault_value, 1); EXFUN (Fset_default, 2); @@ -2398,25 +2403,25 @@ EXFUN (Fsub1, 1); EXFUN (Fmake_variable_buffer_local, 1); extern struct Lisp_Symbol *indirect_variable (struct Lisp_Symbol *); -extern Lisp_Object long_to_cons P_ ((unsigned long)); -extern unsigned long cons_to_long P_ ((Lisp_Object)); -extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object)) NO_RETURN; -extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object, - Lisp_Object)) NO_RETURN; -extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object)) NO_RETURN; +extern Lisp_Object long_to_cons (unsigned long); +extern unsigned long cons_to_long (Lisp_Object); +extern void args_out_of_range (Lisp_Object, Lisp_Object) NO_RETURN; +extern void args_out_of_range_3 (Lisp_Object, Lisp_Object, + Lisp_Object) NO_RETURN; +extern Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object) NO_RETURN; extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *); extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, int); -extern void syms_of_data P_ ((void)); -extern void init_data P_ ((void)); -extern void swap_in_global_binding P_ ((struct Lisp_Symbol *)); +extern void syms_of_data (void); +extern void init_data (void); +extern void swap_in_global_binding (struct Lisp_Symbol *); /* Defined in cmds.c */ EXFUN (Fend_of_line, 1); EXFUN (Fforward_char, 1); EXFUN (Fforward_line, 1); -extern int internal_self_insert P_ ((int, int)); -extern void syms_of_cmds P_ ((void)); -extern void keys_of_cmds P_ ((void)); +extern int internal_self_insert (int, int); +extern void syms_of_cmds (void); +extern void keys_of_cmds (void); /* Defined in coding.c */ EXFUN (Fcoding_system_p, 1); @@ -2430,34 +2435,34 @@ EXFUN (Ffind_operation_coding_system, MANY); EXFUN (Fupdate_coding_systems_internal, 0); EXFUN (Fencode_coding_string, 4); EXFUN (Fdecode_coding_string, 4); -extern Lisp_Object detect_coding_system P_ ((const unsigned char *, EMACS_INT, - EMACS_INT, int, int, Lisp_Object)); -extern void init_coding P_ ((void)); -extern void init_coding_once P_ ((void)); -extern void syms_of_coding P_ ((void)); +extern Lisp_Object detect_coding_system (const unsigned char *, EMACS_INT, + EMACS_INT, int, int, Lisp_Object); +extern void init_coding (void); +extern void init_coding_once (void); +extern void syms_of_coding (void); /* Defined in character.c */ -extern void init_character_once P_ ((void)); -extern void syms_of_character P_ ((void)); +extern void init_character_once (void); +extern void syms_of_character (void); EXFUN (Funibyte_char_to_multibyte, 1); /* Defined in charset.c */ EXFUN (Fchar_bytes, 1); EXFUN (Fchar_width, 1); EXFUN (Fstring, MANY); -extern EMACS_INT chars_in_text P_ ((const unsigned char *, EMACS_INT)); -extern EMACS_INT multibyte_chars_in_text P_ ((const unsigned char *, EMACS_INT)); -extern int multibyte_char_to_unibyte P_ ((int, Lisp_Object)); -extern int multibyte_char_to_unibyte_safe P_ ((int)); +extern EMACS_INT chars_in_text (const unsigned char *, EMACS_INT); +extern EMACS_INT multibyte_chars_in_text (const unsigned char *, EMACS_INT); +extern int multibyte_char_to_unibyte (int, Lisp_Object); +extern int multibyte_char_to_unibyte_safe (int); extern Lisp_Object Qcharset; -extern void init_charset P_ ((void)); -extern void init_charset_once P_ ((void)); -extern void syms_of_charset P_ ((void)); +extern void init_charset (void); +extern void init_charset_once (void); +extern void syms_of_charset (void); /* Structure forward declarations. */ struct charset; /* Defined in composite.c */ -extern void syms_of_composite P_ ((void)); +extern void syms_of_composite (void); /* Defined in syntax.c */ EXFUN (Fforward_word, 1); @@ -2466,28 +2471,28 @@ EXFUN (Fskip_chars_backward, 2); EXFUN (Fsyntax_table_p, 1); EXFUN (Fsyntax_table, 0); EXFUN (Fset_syntax_table, 1); -extern void init_syntax_once P_ ((void)); -extern void syms_of_syntax P_ ((void)); +extern void init_syntax_once (void); +extern void syms_of_syntax (void); /* Defined in fns.c */ extern int use_dialog_box; -extern int next_almost_prime P_ ((int)); -extern Lisp_Object larger_vector P_ ((Lisp_Object, int, Lisp_Object)); -extern void sweep_weak_hash_tables P_ ((void)); +extern int next_almost_prime (int); +extern Lisp_Object larger_vector (Lisp_Object, int, Lisp_Object); +extern void sweep_weak_hash_tables (void); extern Lisp_Object Qstring_lessp; extern Lisp_Object Vfeatures; extern Lisp_Object QCtest, QCweakness, Qequal, Qeq; -unsigned sxhash P_ ((Lisp_Object, int)); -Lisp_Object make_hash_table P_ ((Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object)); -Lisp_Object copy_hash_table P_ ((struct Lisp_Hash_Table *)); -int hash_lookup P_ ((struct Lisp_Hash_Table *, Lisp_Object, unsigned *)); -int hash_put P_ ((struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, - unsigned)); -void hash_clear P_ ((struct Lisp_Hash_Table *)); -void init_weak_hash_tables P_ ((void)); -extern void init_fns P_ ((void)); +unsigned sxhash (Lisp_Object, int); +Lisp_Object make_hash_table (Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object); +Lisp_Object copy_hash_table (struct Lisp_Hash_Table *); +int hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, unsigned *); +int hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, + unsigned); +void hash_clear (struct Lisp_Hash_Table *); +void init_weak_hash_tables (void); +extern void init_fns (void); EXFUN (Fsxhash, 1); EXFUN (Fmake_hash_table, MANY); EXFUN (Fmakehash, 1); @@ -2521,7 +2526,7 @@ EXFUN (Fstring_as_unibyte, 1); EXFUN (Fstring_to_multibyte, 1); EXFUN (Fstring_to_unibyte, 1); EXFUN (Fsubstring, 3); -extern Lisp_Object substring_both P_ ((Lisp_Object, int, int, int, int)); +extern Lisp_Object substring_both (Lisp_Object, int, int, int, int); EXFUN (Fnth, 2); EXFUN (Fnthcdr, 2); EXFUN (Fmemq, 2); @@ -2543,20 +2548,20 @@ EXFUN (Fnconc, MANY); EXFUN (Fmapcar, 2); EXFUN (Fmapconcat, 3); EXFUN (Fy_or_n_p, 1); -extern Lisp_Object do_yes_or_no_p P_ ((Lisp_Object)); +extern Lisp_Object do_yes_or_no_p (Lisp_Object); EXFUN (Frequire, 3); EXFUN (Fprovide, 2); -extern Lisp_Object concat2 P_ ((Lisp_Object, Lisp_Object)); -extern Lisp_Object concat3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); -extern Lisp_Object nconc2 P_ ((Lisp_Object, Lisp_Object)); -extern Lisp_Object assq_no_quit P_ ((Lisp_Object, Lisp_Object)); -extern Lisp_Object assoc_no_quit P_ ((Lisp_Object, Lisp_Object)); -extern void clear_string_char_byte_cache P_ ((void)); -extern EMACS_INT string_char_to_byte P_ ((Lisp_Object, EMACS_INT)); -extern EMACS_INT string_byte_to_char P_ ((Lisp_Object, EMACS_INT)); -extern Lisp_Object string_make_multibyte P_ ((Lisp_Object)); -extern Lisp_Object string_to_multibyte P_ ((Lisp_Object)); -extern Lisp_Object string_make_unibyte P_ ((Lisp_Object)); +extern Lisp_Object concat2 (Lisp_Object, Lisp_Object); +extern Lisp_Object concat3 (Lisp_Object, Lisp_Object, Lisp_Object); +extern Lisp_Object nconc2 (Lisp_Object, Lisp_Object); +extern Lisp_Object assq_no_quit (Lisp_Object, Lisp_Object); +extern Lisp_Object assoc_no_quit (Lisp_Object, Lisp_Object); +extern void clear_string_char_byte_cache (void); +extern EMACS_INT string_char_to_byte (Lisp_Object, EMACS_INT); +extern EMACS_INT string_byte_to_char (Lisp_Object, EMACS_INT); +extern Lisp_Object string_make_multibyte (Lisp_Object); +extern Lisp_Object string_to_multibyte (Lisp_Object); +extern Lisp_Object string_make_unibyte (Lisp_Object); EXFUN (Fcopy_alist, 1); EXFUN (Fplist_get, 2); EXFUN (Fplist_put, 3); @@ -2565,24 +2570,24 @@ EXFUN (Frassoc, 2); EXFUN (Fstring_equal, 2); EXFUN (Fcompare_strings, 7); EXFUN (Fstring_lessp, 2); -extern void syms_of_fns P_ ((void)); +extern void syms_of_fns (void); /* Defined in floatfns.c */ -extern double extract_float P_ ((Lisp_Object)); +extern double extract_float (Lisp_Object); EXFUN (Ffloat, 1); EXFUN (Ftruncate, 2); -extern void init_floatfns P_ ((void)); -extern void syms_of_floatfns P_ ((void)); +extern void init_floatfns (void); +extern void syms_of_floatfns (void); /* Defined in fringe.c */ -extern void syms_of_fringe P_ ((void)); -extern void init_fringe P_ ((void)); -extern void init_fringe_once P_ ((void)); +extern void syms_of_fringe (void); +extern void init_fringe (void); +extern void init_fringe_once (void); /* Defined in image.c */ EXFUN (Finit_image_library, 2); -extern void syms_of_image P_ ((void)); -extern void init_image P_ ((void)); +extern void syms_of_image (void); +extern void init_image (void); /* Defined in insdel.c */ extern Lisp_Object Qinhibit_modification_hooks; @@ -2633,7 +2638,7 @@ extern void adjust_markers_for_delete (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT); extern void replace_range (EMACS_INT, EMACS_INT, Lisp_Object, int, int, int); extern void replace_range_2 (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, - char *, EMACS_INT, EMACS_INT, int); + const char *, EMACS_INT, EMACS_INT, int); extern void syms_of_insdel (void); /* Defined in dispnew.c */ @@ -2644,10 +2649,9 @@ EXFUN (Fredraw_frame, 1); EXFUN (Fredraw_display, 0); EXFUN (Fsleep_for, 2); EXFUN (Fredisplay, 1); -extern Lisp_Object sit_for P_ ((Lisp_Object, int, int)); -extern void init_display P_ ((void)); -extern void syms_of_display P_ ((void)); -extern void safe_bcopy P_ ((const char *, char *, int)); +extern Lisp_Object sit_for (Lisp_Object, int, int); +extern void init_display (void); +extern void syms_of_display (void); /* Defined in xdisp.c */ extern Lisp_Object Qinhibit_point_motion_hooks; @@ -2658,58 +2662,58 @@ extern Lisp_Object Qimage, Qtext, Qboth, Qboth_horiz; extern Lisp_Object Vmessage_log_max; extern int message_enable_multibyte; extern Lisp_Object echo_area_buffer[2]; -extern void check_message_stack P_ ((void)); -extern void setup_echo_area_for_printing P_ ((int)); -extern int push_message P_ ((void)); -extern Lisp_Object pop_message_unwind P_ ((Lisp_Object)); -extern Lisp_Object restore_message_unwind P_ ((Lisp_Object)); -extern void pop_message P_ ((void)); -extern void restore_message P_ ((void)); -extern Lisp_Object current_message P_ ((void)); -extern void set_message P_ ((const char *s, Lisp_Object, int, int)); -extern void clear_message P_ ((int, int)); -extern void message P_ ((/* char *, ... */)); -extern void message_nolog P_ ((/* char *, ... */)); -extern void message1 P_ ((char *)); -extern void message1_nolog P_ ((char *)); -extern void message2 P_ ((const char *, int, int)); -extern void message2_nolog P_ ((const char *, int, int)); -extern void message3 P_ ((Lisp_Object, int, int)); -extern void message3_nolog P_ ((Lisp_Object, int, int)); -extern void message_dolog P_ ((const char *, int, int, int)); -extern void message_with_string P_ ((char *, Lisp_Object, int)); -extern void message_log_maybe_newline P_ ((void)); -extern void update_echo_area P_ ((void)); -extern void truncate_echo_area P_ ((int)); -extern void redisplay P_ ((void)); +extern void check_message_stack (void); +extern void setup_echo_area_for_printing (int); +extern int push_message (void); +extern Lisp_Object pop_message_unwind (Lisp_Object); +extern Lisp_Object restore_message_unwind (Lisp_Object); +extern void pop_message (void); +extern void restore_message (void); +extern Lisp_Object current_message (void); +extern void set_message (const char *s, Lisp_Object, int, int); +extern void clear_message (int, int); +extern void message (const char *, ...); +extern void message_nolog (const char *, ...); +extern void message1 (const char *); +extern void message1_nolog (const char *); +extern void message2 (const char *, int, int); +extern void message2_nolog (const char *, int, int); +extern void message3 (Lisp_Object, int, int); +extern void message3_nolog (Lisp_Object, int, int); +extern void message_dolog (const char *, int, int, int); +extern void message_with_string (const char *, Lisp_Object, int); +extern void message_log_maybe_newline (void); +extern void update_echo_area (void); +extern void truncate_echo_area (int); +extern void redisplay (void); extern int check_point_in_composition - P_ ((struct buffer *, int, struct buffer *, int)); -extern void redisplay_preserve_echo_area P_ ((int)); -extern void prepare_menu_bars P_ ((void)); + (struct buffer *, int, struct buffer *, int); +extern void redisplay_preserve_echo_area (int); +extern void prepare_menu_bars (void); -void set_frame_cursor_types P_ ((struct frame *, Lisp_Object)); -extern void syms_of_xdisp P_ ((void)); -extern void init_xdisp P_ ((void)); -extern Lisp_Object safe_eval P_ ((Lisp_Object)); -extern int pos_visible_p P_ ((struct window *, int, int *, - int *, int *, int *, int *, int *)); +void set_frame_cursor_types (struct frame *, Lisp_Object); +extern void syms_of_xdisp (void); +extern void init_xdisp (void); +extern Lisp_Object safe_eval (Lisp_Object); +extern int pos_visible_p (struct window *, int, int *, + int *, int *, int *, int *, int *); /* Defined in xsettings.c */ -extern void syms_of_xsettings P_ ((void)); +extern void syms_of_xsettings (void); /* Defined in vm-limit.c. */ -extern void memory_warnings P_ ((POINTER_TYPE *, void (*warnfun) ())); +extern void memory_warnings (POINTER_TYPE *, void (*warnfun) (const char *)); /* Defined in alloc.c */ -extern void check_pure_size P_ ((void)); -extern void allocate_string_data P_ ((struct Lisp_String *, int, int)); -extern void reset_malloc_hooks P_ ((void)); -extern void uninterrupt_malloc P_ ((void)); -extern void malloc_warning P_ ((char *)); -extern void memory_full P_ ((void)) NO_RETURN; -extern void buffer_memory_full P_ ((void)) NO_RETURN; -extern int survives_gc_p P_ ((Lisp_Object)); -extern void mark_object P_ ((Lisp_Object)); +extern void check_pure_size (void); +extern void allocate_string_data (struct Lisp_String *, int, int); +extern void reset_malloc_hooks (void); +extern void uninterrupt_malloc (void); +extern void malloc_warning (const char *); +extern void memory_full (void) NO_RETURN; +extern void buffer_memory_full (void) NO_RETURN; +extern int survives_gc_p (Lisp_Object); +extern void mark_object (Lisp_Object); extern Lisp_Object Vpurify_flag; extern Lisp_Object Vmemory_full; EXFUN (Fcons, 2); @@ -2720,57 +2724,57 @@ EXFUN (list4, 4); EXFUN (list5, 5); EXFUN (Flist, MANY); EXFUN (Fmake_list, 2); -extern Lisp_Object allocate_misc P_ ((void)); +extern Lisp_Object allocate_misc (void); EXFUN (Fmake_vector, 2); EXFUN (Fvector, MANY); EXFUN (Ffunvec, MANY); EXFUN (Fmake_symbol, 1); EXFUN (Fmake_marker, 0); EXFUN (Fmake_string, 2); -extern Lisp_Object build_string P_ ((const char *)); -extern Lisp_Object make_string P_ ((const char *, int)); -extern Lisp_Object make_unibyte_string P_ ((const char *, int)); -extern Lisp_Object make_multibyte_string P_ ((const char *, int, int)); -extern Lisp_Object make_event_array P_ ((int, Lisp_Object *)); -extern Lisp_Object make_uninit_string P_ ((int)); -extern Lisp_Object make_uninit_multibyte_string P_ ((int, int)); -extern Lisp_Object make_string_from_bytes P_ ((const char *, int, int)); -extern Lisp_Object make_specified_string P_ ((const char *, int, int, int)); +extern Lisp_Object build_string (const char *); +extern Lisp_Object make_string (const char *, int); +extern Lisp_Object make_unibyte_string (const char *, int); +extern Lisp_Object make_multibyte_string (const char *, int, int); +extern Lisp_Object make_event_array (int, Lisp_Object *); +extern Lisp_Object make_uninit_string (int); +extern Lisp_Object make_uninit_multibyte_string (int, int); +extern Lisp_Object make_string_from_bytes (const char *, int, int); +extern Lisp_Object make_specified_string (const char *, int, int, int); EXFUN (Fpurecopy, 1); -extern Lisp_Object make_pure_string P_ ((const char *, int, int, int)); +extern Lisp_Object make_pure_string (const char *, int, int, int); extern Lisp_Object make_pure_c_string (const char *data); -extern Lisp_Object pure_cons P_ ((Lisp_Object, Lisp_Object)); -extern Lisp_Object make_pure_vector P_ ((EMACS_INT)); +extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object); +extern Lisp_Object make_pure_vector (EMACS_INT); EXFUN (Fgarbage_collect, 0); -extern Lisp_Object make_funvec P_ ((Lisp_Object, int, int, Lisp_Object *)); +extern Lisp_Object make_funvec (Lisp_Object, int, int, Lisp_Object *); EXFUN (Fmake_byte_code, MANY); EXFUN (Fmake_bool_vector, 2); extern Lisp_Object Qchar_table_extra_slots; -extern struct Lisp_Vector *allocate_vector P_ ((EMACS_INT)); -extern struct Lisp_Vector *allocate_pseudovector P_ ((int memlen, int lisplen, EMACS_INT tag)); +extern struct Lisp_Vector *allocate_vector (EMACS_INT); +extern struct Lisp_Vector *allocate_pseudovector (int memlen, int lisplen, EMACS_INT tag); #define ALLOCATE_PSEUDOVECTOR(typ,field,tag) \ ((typ*) \ allocate_pseudovector \ (VECSIZE (typ), PSEUDOVECSIZE (typ, field), tag)) -extern struct Lisp_Hash_Table *allocate_hash_table P_ ((void)); -extern struct window *allocate_window P_ ((void)); -extern struct frame *allocate_frame P_ ((void)); -extern struct Lisp_Process *allocate_process P_ ((void)); -extern struct terminal *allocate_terminal P_ ((void)); +extern struct Lisp_Hash_Table *allocate_hash_table (void); +extern struct window *allocate_window (void); +extern struct frame *allocate_frame (void); +extern struct Lisp_Process *allocate_process (void); +extern struct terminal *allocate_terminal (void); extern int gc_in_progress; extern int abort_on_gc; -extern Lisp_Object make_float P_ ((double)); -extern void display_malloc_warning P_ ((void)); -extern int inhibit_garbage_collection P_ ((void)); -extern Lisp_Object make_save_value P_ ((void *, int)); -extern void free_misc P_ ((Lisp_Object)); -extern void free_marker P_ ((Lisp_Object)); -extern void free_cons P_ ((struct Lisp_Cons *)); -extern void init_alloc_once P_ ((void)); -extern void init_alloc P_ ((void)); -extern void syms_of_alloc P_ ((void)); -extern struct buffer * allocate_buffer P_ ((void)); -extern int valid_lisp_object_p P_ ((Lisp_Object)); +extern Lisp_Object make_float (double); +extern void display_malloc_warning (void); +extern int inhibit_garbage_collection (void); +extern Lisp_Object make_save_value (void *, int); +extern void free_misc (Lisp_Object); +extern void free_marker (Lisp_Object); +extern void free_cons (struct Lisp_Cons *); +extern void init_alloc_once (void); +extern void init_alloc (void); +extern void syms_of_alloc (void); +extern struct buffer * allocate_buffer (void); +extern int valid_lisp_object_p (Lisp_Object); /* Defined in chartab.c */ EXFUN (Fmake_char_table, 2); @@ -2783,23 +2787,23 @@ EXFUN (Fset_char_table_range, 3); EXFUN (Fset_char_table_default, 3); EXFUN (Foptimize_char_table, 2); EXFUN (Fmap_char_table, 2); -extern Lisp_Object copy_char_table P_ ((Lisp_Object)); -extern Lisp_Object sub_char_table_ref P_ ((Lisp_Object, int)); -extern Lisp_Object char_table_ref P_ ((Lisp_Object, int)); -extern Lisp_Object char_table_ref_and_range P_ ((Lisp_Object, int, - int *, int *)); -extern Lisp_Object char_table_set P_ ((Lisp_Object, int, Lisp_Object)); -extern Lisp_Object char_table_set_range P_ ((Lisp_Object, int, int, - Lisp_Object)); -extern int char_table_translate P_ ((Lisp_Object, int)); -extern void map_char_table P_ ((void (*) (Lisp_Object, Lisp_Object, - Lisp_Object), - Lisp_Object, Lisp_Object, Lisp_Object)); -extern void syms_of_chartab P_ ((void)); +extern Lisp_Object copy_char_table (Lisp_Object); +extern Lisp_Object sub_char_table_ref (Lisp_Object, int); +extern Lisp_Object char_table_ref (Lisp_Object, int); +extern Lisp_Object char_table_ref_and_range (Lisp_Object, int, + int *, int *); +extern Lisp_Object char_table_set (Lisp_Object, int, Lisp_Object); +extern Lisp_Object char_table_set_range (Lisp_Object, int, int, + Lisp_Object); +extern int char_table_translate (Lisp_Object, int); +extern void map_char_table (void (*) (Lisp_Object, Lisp_Object, + Lisp_Object), + Lisp_Object, Lisp_Object, Lisp_Object); +extern void syms_of_chartab (void); /* Defined in print.c */ extern Lisp_Object Vprin1_to_string_buffer; -extern void debug_print P_ ((Lisp_Object)); +extern void debug_print (Lisp_Object); EXFUN (Fprin1, 2); EXFUN (Fprin1_to_string, 2); EXFUN (Fprinc, 2); @@ -2808,19 +2812,20 @@ EXFUN (Fprint, 2); EXFUN (Ferror_message_string, 1); extern Lisp_Object Vstandard_output, Qstandard_output; extern Lisp_Object Qexternal_debugging_output; -extern void temp_output_buffer_setup P_ ((const char *)); +extern void temp_output_buffer_setup (const char *); extern int print_level, print_escape_newlines; extern Lisp_Object Qprint_escape_newlines; -extern void write_string P_ ((char *, int)); -extern void write_string_1 P_ ((char *, int, Lisp_Object)); -extern void print_error_message P_ ((Lisp_Object, Lisp_Object, char *, Lisp_Object)); +extern void write_string (const char *, int); +extern void write_string_1 (const char *, int, Lisp_Object); +extern void print_error_message (Lisp_Object, Lisp_Object, const char *, + Lisp_Object); extern Lisp_Object internal_with_output_to_temp_buffer - P_ ((const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object)); -extern void float_to_string P_ ((unsigned char *, double)); -extern void syms_of_print P_ ((void)); + (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object); +extern void float_to_string (unsigned char *, double); +extern void syms_of_print (void); /* Defined in doprnt.c */ -extern int doprnt P_ ((char *, int, char *, char *, int, char **)); +extern int doprnt (char *, int, const char *, const char *, va_list); /* Defined in lread.c */ extern Lisp_Object Qvariable_documentation, Qstandard_input; @@ -2834,29 +2839,29 @@ EXFUN (Fget_load_suffixes, 0); EXFUN (Fget_file_char, 0); EXFUN (Fread_char, 3); EXFUN (Fread_event, 3); -extern Lisp_Object read_filtered_event P_ ((int, int, int, int, Lisp_Object)); +extern Lisp_Object read_filtered_event (int, int, int, int, Lisp_Object); EXFUN (Feval_region, 4); -extern Lisp_Object check_obarray P_ ((Lisp_Object)); -extern Lisp_Object intern P_ ((const char *)); +extern Lisp_Object check_obarray (Lisp_Object); +extern Lisp_Object intern (const char *); extern Lisp_Object intern_c_string (const char *); -extern Lisp_Object make_symbol P_ ((char *)); -extern Lisp_Object oblookup P_ ((Lisp_Object, const char *, int, int)); +extern Lisp_Object make_symbol (const char *); +extern Lisp_Object oblookup (Lisp_Object, const char *, int, int); #define LOADHIST_ATTACH(x) \ do { \ if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list); \ } while (0) extern Lisp_Object Vcurrent_load_list; extern Lisp_Object Vload_history, Vload_suffixes, Vload_file_rep_suffixes; -extern int openp P_ ((Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object *, Lisp_Object)); -extern int isfloat_string P_ ((char *, int)); -extern void map_obarray P_ ((Lisp_Object, void (*) (Lisp_Object, Lisp_Object), - Lisp_Object)); -extern void dir_warning P_ ((char *, Lisp_Object)); -extern void close_load_descs P_ ((void)); -extern void init_obarray P_ ((void)); -extern void init_lread P_ ((void)); -extern void syms_of_lread P_ ((void)); +extern int openp (Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object *, Lisp_Object); +extern int isfloat_string (const char *, int); +extern void map_obarray (Lisp_Object, void (*) (Lisp_Object, Lisp_Object), + Lisp_Object); +extern void dir_warning (const char *, Lisp_Object); +extern void close_load_descs (void); +extern void init_obarray (void); +extern void init_lread (void); +extern void syms_of_lread (void); /* Defined in eval.c */ extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro; @@ -2865,7 +2870,7 @@ extern Lisp_Object Vautoload_queue; extern Lisp_Object Vdebug_on_error; extern Lisp_Object Vsignaling_function; extern int handling_signal; -extern int interactive_p P_ ((int)); +extern int interactive_p (int); /* To run a normal hook, use the appropriate function from the list below. The calling convention: @@ -2879,8 +2884,8 @@ EXFUN (Frun_hooks, MANY); EXFUN (Frun_hook_with_args, MANY); EXFUN (Frun_hook_with_args_until_success, MANY); EXFUN (Frun_hook_with_args_until_failure, MANY); -extern Lisp_Object run_hook_list_with_args P_ ((Lisp_Object, int, Lisp_Object *)); -extern void run_hook_with_args_2 P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); +extern Lisp_Object run_hook_list_with_args (Lisp_Object, int, Lisp_Object *); +extern void run_hook_with_args_2 (Lisp_Object, Lisp_Object, Lisp_Object); EXFUN (Fand, UNEVALLED); EXFUN (For, UNEVALLED); EXFUN (Fif, UNEVALLED); @@ -2900,48 +2905,49 @@ EXFUN (Fthrow, 2) NO_RETURN; EXFUN (Funwind_protect, UNEVALLED); EXFUN (Fcondition_case, UNEVALLED); EXFUN (Fsignal, 2); -extern void xsignal P_ ((Lisp_Object, Lisp_Object)) NO_RETURN; -extern void xsignal0 P_ ((Lisp_Object)) NO_RETURN; -extern void xsignal1 P_ ((Lisp_Object, Lisp_Object)) NO_RETURN; -extern void xsignal2 P_ ((Lisp_Object, Lisp_Object, Lisp_Object)) NO_RETURN; -extern void xsignal3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)) NO_RETURN; -extern void signal_error P_ ((char *, Lisp_Object)) NO_RETURN; +extern void xsignal (Lisp_Object, Lisp_Object) NO_RETURN; +extern void xsignal0 (Lisp_Object) NO_RETURN; +extern void xsignal1 (Lisp_Object, Lisp_Object) NO_RETURN; +extern void xsignal2 (Lisp_Object, Lisp_Object, Lisp_Object) NO_RETURN; +extern void xsignal3 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object) NO_RETURN; +extern void signal_error (const char *, Lisp_Object) NO_RETURN; EXFUN (Fautoload, 5); EXFUN (Fcommandp, 2); EXFUN (Feval, 1); EXFUN (Fapply, MANY); EXFUN (Ffuncall, MANY); EXFUN (Fbacktrace, 0); -extern Lisp_Object apply1 P_ ((Lisp_Object, Lisp_Object)); -extern Lisp_Object call0 P_ ((Lisp_Object)); -extern Lisp_Object call1 P_ ((Lisp_Object, Lisp_Object)); -extern Lisp_Object call2 P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); -extern Lisp_Object call3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); -extern Lisp_Object call4 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); -extern Lisp_Object call5 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); -extern Lisp_Object call6 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); -extern Lisp_Object call7 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); +extern Lisp_Object apply1 (Lisp_Object, Lisp_Object); +extern Lisp_Object call0 (Lisp_Object); +extern Lisp_Object call1 (Lisp_Object, Lisp_Object); +extern Lisp_Object call2 (Lisp_Object, Lisp_Object, Lisp_Object); +extern Lisp_Object call3 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); +extern Lisp_Object call4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); +extern Lisp_Object call5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); +extern Lisp_Object call6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); +extern Lisp_Object call7 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); EXFUN (Fdo_auto_save, 2); -extern Lisp_Object apply_lambda P_ ((Lisp_Object, Lisp_Object, int, Lisp_Object)); -extern Lisp_Object internal_catch P_ ((Lisp_Object, Lisp_Object (*) (Lisp_Object), Lisp_Object)); -extern Lisp_Object internal_lisp_condition_case P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); -extern Lisp_Object internal_condition_case P_ ((Lisp_Object (*) (void), Lisp_Object, Lisp_Object (*) (Lisp_Object))); -extern Lisp_Object internal_condition_case_1 P_ ((Lisp_Object (*) (Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object))); -extern Lisp_Object internal_condition_case_2 P_ ((Lisp_Object (*) (Lisp_Object, Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object))); -extern Lisp_Object internal_condition_case_n P_ ((Lisp_Object (*) (int, Lisp_Object *), int, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object))); -extern void specbind P_ ((Lisp_Object, Lisp_Object)); -extern void record_unwind_protect P_ ((Lisp_Object (*) (Lisp_Object), Lisp_Object)); -extern Lisp_Object unbind_to P_ ((int, Lisp_Object)); -extern void error P_ ((/* char *, ... */)) NO_RETURN; -extern void do_autoload P_ ((Lisp_Object, Lisp_Object)); -extern Lisp_Object un_autoload P_ ((Lisp_Object)); +extern Lisp_Object apply_lambda (Lisp_Object, Lisp_Object, int, Lisp_Object); +extern Lisp_Object internal_catch (Lisp_Object, Lisp_Object (*) (Lisp_Object), Lisp_Object); +extern Lisp_Object internal_lisp_condition_case (Lisp_Object, Lisp_Object, Lisp_Object); +extern Lisp_Object internal_condition_case (Lisp_Object (*) (void), Lisp_Object, Lisp_Object (*) (Lisp_Object)); +extern Lisp_Object internal_condition_case_1 (Lisp_Object (*) (Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object)); +extern Lisp_Object internal_condition_case_2 (Lisp_Object (*) (Lisp_Object, Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object)); +extern Lisp_Object internal_condition_case_n (Lisp_Object (*) (int, Lisp_Object *), int, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object)); +extern void specbind (Lisp_Object, Lisp_Object); +extern void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object); +extern Lisp_Object unbind_to (int, Lisp_Object); +extern void error (const char *, ...) NO_RETURN; +extern void verror (const char *, va_list) NO_RETURN; +extern void do_autoload (Lisp_Object, Lisp_Object); +extern Lisp_Object un_autoload (Lisp_Object); EXFUN (Ffetch_bytecode, 1); -extern void init_eval_once P_ ((void)); -extern Lisp_Object safe_call P_ ((int, Lisp_Object *)); -extern Lisp_Object safe_call1 P_ ((Lisp_Object, Lisp_Object)); +extern void init_eval_once (void); +extern Lisp_Object safe_call (int, Lisp_Object *); +extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); -extern void init_eval P_ ((void)); -extern void syms_of_eval P_ ((void)); +extern void init_eval (void); +extern void syms_of_eval (void); /* Defined in editfns.c */ EXFUN (Fpropertize, MANY); @@ -2964,20 +2970,20 @@ EXFUN (Finsert_and_inherit, MANY); EXFUN (Finsert_before_markers, MANY); EXFUN (Finsert_buffer_substring, 3); EXFUN (Finsert_char, 3); -extern void insert1 P_ ((Lisp_Object)); +extern void insert1 (Lisp_Object); EXFUN (Feolp, 0); EXFUN (Feobp, 0); EXFUN (Fbolp, 0); EXFUN (Fbobp, 0); EXFUN (Fformat, MANY); EXFUN (Fmessage, MANY); -extern Lisp_Object format2 P_ ((char *, Lisp_Object, Lisp_Object)); +extern Lisp_Object format2 (const char *, Lisp_Object, Lisp_Object); EXFUN (Fbuffer_substring, 2); EXFUN (Fbuffer_string, 0); -extern Lisp_Object save_excursion_save P_ ((void)); -extern Lisp_Object save_restriction_save P_ ((void)); -extern Lisp_Object save_excursion_restore P_ ((Lisp_Object)); -extern Lisp_Object save_restriction_restore P_ ((Lisp_Object)); +extern Lisp_Object save_excursion_save (void); +extern Lisp_Object save_restriction_save (void); +extern Lisp_Object save_excursion_restore (Lisp_Object); +extern Lisp_Object save_restriction_restore (Lisp_Object); EXFUN (Fchar_to_string, 1); EXFUN (Fdelete_region, 2); EXFUN (Fnarrow_to_region, 2); @@ -2985,11 +2991,11 @@ EXFUN (Fwiden, 0); EXFUN (Fuser_login_name, 1); EXFUN (Fsystem_name, 0); EXFUN (Fcurrent_time, 0); -extern int clip_to_bounds P_ ((int, int, int)); -extern Lisp_Object make_buffer_string P_ ((int, int, int)); -extern Lisp_Object make_buffer_string_both P_ ((int, int, int, int, int)); -extern void init_editfns P_ ((void)); -extern void syms_of_editfns P_ ((void)); +extern int clip_to_bounds (int, int, int); +extern Lisp_Object make_buffer_string (int, int, int); +extern Lisp_Object make_buffer_string_both (int, int, int, int, int); +extern void init_editfns (void); +extern void syms_of_editfns (void); extern Lisp_Object Vinhibit_field_text_motion; EXFUN (Fconstrain_to_field, 5); EXFUN (Ffield_string, 1); @@ -2997,21 +3003,21 @@ EXFUN (Fdelete_field, 1); EXFUN (Ffield_beginning, 3); EXFUN (Ffield_end, 3); EXFUN (Ffield_string_no_properties, 1); -extern void set_time_zone_rule P_ ((char *)); +extern void set_time_zone_rule (const char *); /* Defined in buffer.c */ -extern int mouse_face_overlay_overlaps P_ ((Lisp_Object)); -extern void nsberror P_ ((Lisp_Object)) NO_RETURN; +extern int mouse_face_overlay_overlaps (Lisp_Object); +extern void nsberror (Lisp_Object) NO_RETURN; EXFUN (Fset_buffer_multibyte, 1); EXFUN (Foverlay_start, 1); EXFUN (Foverlay_end, 1); EXFUN (Foverlay_buffer, 1); -extern void adjust_overlays_for_insert P_ ((EMACS_INT, EMACS_INT)); -extern void adjust_overlays_for_delete P_ ((EMACS_INT, EMACS_INT)); -extern void fix_start_end_in_overlays P_ ((int, int)); -extern void report_overlay_modification P_ ((Lisp_Object, Lisp_Object, int, - Lisp_Object, Lisp_Object, Lisp_Object)); -extern int overlay_touches_p P_ ((int)); +extern void adjust_overlays_for_insert (EMACS_INT, EMACS_INT); +extern void adjust_overlays_for_delete (EMACS_INT, EMACS_INT); +extern void fix_start_end_in_overlays (int, int); +extern void report_overlay_modification (Lisp_Object, Lisp_Object, int, + Lisp_Object, Lisp_Object, Lisp_Object); +extern int overlay_touches_p (int); extern Lisp_Object Vbuffer_alist, Vinhibit_read_only; EXFUN (Fbuffer_list, 1); EXFUN (Fget_buffer, 1); @@ -3033,14 +3039,14 @@ EXFUN (Fbuffer_enable_undo, 1); EXFUN (Ferase_buffer, 0); extern Lisp_Object Qoverlayp; extern Lisp_Object Qevaporate; -extern Lisp_Object get_truename_buffer P_ ((Lisp_Object)); +extern Lisp_Object get_truename_buffer (Lisp_Object); extern struct buffer *all_buffers; EXFUN (Fprevious_overlay_change, 1); EXFUN (Fbuffer_file_name, 1); -extern void init_buffer_once P_ ((void)); -extern void init_buffer P_ ((void)); -extern void syms_of_buffer P_ ((void)); -extern void keys_of_buffer P_ ((void)); +extern void init_buffer_once (void); +extern void init_buffer (void); +extern void syms_of_buffer (void); +extern void keys_of_buffer (void); /* Defined in marker.c */ @@ -3048,18 +3054,18 @@ EXFUN (Fmarker_position, 1); EXFUN (Fmarker_buffer, 1); EXFUN (Fcopy_marker, 2); EXFUN (Fset_marker, 3); -extern int marker_position P_ ((Lisp_Object)); -extern int marker_byte_position P_ ((Lisp_Object)); -extern void clear_charpos_cache P_ ((struct buffer *)); -extern int charpos_to_bytepos P_ ((int)); -extern int buf_charpos_to_bytepos P_ ((struct buffer *, int)); -extern int buf_bytepos_to_charpos P_ ((struct buffer *, int)); -extern void unchain_marker P_ ((struct Lisp_Marker *marker)); -extern Lisp_Object set_marker_restricted P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); -extern Lisp_Object set_marker_both P_ ((Lisp_Object, Lisp_Object, int, int)); -extern Lisp_Object set_marker_restricted_both P_ ((Lisp_Object, Lisp_Object, - int, int)); -extern void syms_of_marker P_ ((void)); +extern int marker_position (Lisp_Object); +extern int marker_byte_position (Lisp_Object); +extern void clear_charpos_cache (struct buffer *); +extern int charpos_to_bytepos (int); +extern int buf_charpos_to_bytepos (struct buffer *, int); +extern int buf_bytepos_to_charpos (struct buffer *, int); +extern void unchain_marker (struct Lisp_Marker *marker); +extern Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object); +extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, int, int); +extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object, + int, int); +extern void syms_of_marker (void); /* Defined in fileio.c */ @@ -3076,7 +3082,7 @@ EXFUN (Ffile_exists_p, 1); EXFUN (Ffile_name_absolute_p, 1); EXFUN (Fdirectory_file_name, 1); EXFUN (Ffile_name_directory, 1); -extern Lisp_Object expand_and_dir_to_file P_ ((Lisp_Object, Lisp_Object)); +extern Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object); EXFUN (Ffile_accessible_directory_p, 1); EXFUN (Funhandled_file_name_directory, 1); EXFUN (Ffile_directory_p, 1); @@ -3084,47 +3090,47 @@ EXFUN (Fwrite_region, 7); EXFUN (Ffile_readable_p, 1); EXFUN (Ffile_executable_p, 1); EXFUN (Fread_file_name, 6); -extern Lisp_Object close_file_unwind P_ ((Lisp_Object)); -extern Lisp_Object restore_point_unwind P_ ((Lisp_Object)); -extern void report_file_error P_ ((const char *, Lisp_Object)) NO_RETURN; -extern int internal_delete_file P_ ((Lisp_Object)); -extern void syms_of_fileio P_ ((void)); -extern Lisp_Object make_temp_name P_ ((Lisp_Object, int)); +extern Lisp_Object close_file_unwind (Lisp_Object); +extern Lisp_Object restore_point_unwind (Lisp_Object); +extern void report_file_error (const char *, Lisp_Object) NO_RETURN; +extern int internal_delete_file (Lisp_Object); +extern void syms_of_fileio (void); +extern Lisp_Object make_temp_name (Lisp_Object, int); EXFUN (Fmake_symbolic_link, 3); extern Lisp_Object Qdelete_file; /* Defined in abbrev.c */ -extern void syms_of_abbrev P_ ((void)); +extern void syms_of_abbrev (void); /* Defined in search.c */ -extern void shrink_regexp_cache P_ ((void)); +extern void shrink_regexp_cache (void); EXFUN (Fstring_match, 3); -extern void restore_search_regs P_ ((void)); +extern void restore_search_regs (void); EXFUN (Fmatch_data, 3); EXFUN (Fset_match_data, 2); EXFUN (Fmatch_beginning, 1); EXFUN (Fmatch_end, 1); -extern void record_unwind_save_match_data P_ ((void)); +extern void record_unwind_save_match_data (void); EXFUN (Flooking_at, 1); -extern int fast_string_match P_ ((Lisp_Object, Lisp_Object)); -extern int fast_c_string_match_ignore_case P_ ((Lisp_Object, const char *)); -extern int fast_string_match_ignore_case P_ ((Lisp_Object, Lisp_Object)); -extern EMACS_INT fast_looking_at P_ ((Lisp_Object, EMACS_INT, EMACS_INT, - EMACS_INT, EMACS_INT, Lisp_Object)); -extern int scan_buffer P_ ((int, EMACS_INT, EMACS_INT, int, int *, int)); -extern int scan_newline P_ ((EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, - int, int)); -extern int find_next_newline P_ ((EMACS_INT, int)); -extern int find_next_newline_no_quit P_ ((EMACS_INT, int)); -extern int find_before_next_newline P_ ((EMACS_INT, EMACS_INT, int)); -extern void syms_of_search P_ ((void)); -extern void clear_regexp_cache P_ ((void)); +extern int fast_string_match (Lisp_Object, Lisp_Object); +extern int fast_c_string_match_ignore_case (Lisp_Object, const char *); +extern int fast_string_match_ignore_case (Lisp_Object, Lisp_Object); +extern EMACS_INT fast_looking_at (Lisp_Object, EMACS_INT, EMACS_INT, + EMACS_INT, EMACS_INT, Lisp_Object); +extern int scan_buffer (int, EMACS_INT, EMACS_INT, int, int *, int); +extern int scan_newline (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, + int, int); +extern int find_next_newline (EMACS_INT, int); +extern int find_next_newline_no_quit (EMACS_INT, int); +extern int find_before_next_newline (EMACS_INT, EMACS_INT, int); +extern void syms_of_search (void); +extern void clear_regexp_cache (void); /* Defined in minibuf.c */ extern Lisp_Object last_minibuf_string; -extern void choose_minibuf_frame P_ ((void)); +extern void choose_minibuf_frame (void); EXFUN (Fcompleting_read, 8); EXFUN (Fread_from_minibuffer, 7); EXFUN (Fread_variable, 2); @@ -3134,10 +3140,10 @@ EXFUN (Feval_minibuffer, 2); EXFUN (Fread_string, 5); EXFUN (Fread_no_blanks_input, 3); EXFUN (Fassoc_string, 3); -extern Lisp_Object get_minibuffer P_ ((int)); -extern void temp_echo_area_glyphs P_ ((Lisp_Object)); -extern void init_minibuf_once P_ ((void)); -extern void syms_of_minibuf P_ ((void)); +extern Lisp_Object get_minibuffer (int); +extern void temp_echo_area_glyphs (Lisp_Object); +extern void init_minibuf_once (void); +extern void syms_of_minibuf (void); /* Defined in callint.c */ @@ -3146,7 +3152,7 @@ extern Lisp_Object Vcommand_history; extern Lisp_Object Qcall_interactively, Qmouse_leave_buffer_hook; EXFUN (Fcall_interactively, 3); EXFUN (Fprefix_numeric_value, 1); -extern void syms_of_callint P_ ((void)); +extern void syms_of_callint (void); /* Defined in casefiddle.c */ @@ -3156,22 +3162,22 @@ EXFUN (Fcapitalize, 1); EXFUN (Fupcase_region, 2); EXFUN (Fupcase_initials, 1); EXFUN (Fupcase_initials_region, 2); -extern void syms_of_casefiddle P_ ((void)); -extern void keys_of_casefiddle P_ ((void)); +extern void syms_of_casefiddle (void); +extern void keys_of_casefiddle (void); /* Defined in casetab.c */ EXFUN (Fset_case_table, 1); EXFUN (Fset_standard_case_table, 1); -extern void init_casetab_once P_ ((void)); -extern void syms_of_casetab P_ ((void)); +extern void init_casetab_once (void); +extern void syms_of_casetab (void); /* Defined in keyboard.c */ extern int echoing; extern Lisp_Object echo_message_buffer; extern struct kboard *echo_kboard; -extern void cancel_echoing P_ ((void)); +extern void cancel_echoing (void); extern Lisp_Object Qdisabled, QCfilter; extern Lisp_Object Vtty_erase_char, Vhelp_form, Vtop_level; extern Lisp_Object Vthrow_on_input; @@ -3181,10 +3187,10 @@ EXFUN (Frecursive_edit, 0); EXFUN (Ftop_level, 0); EXFUN (Fcommand_execute, 4); EXFUN (Finput_pending_p, 0); -extern Lisp_Object menu_bar_items P_ ((Lisp_Object)); -extern Lisp_Object tool_bar_items P_ ((Lisp_Object, int *)); +extern Lisp_Object menu_bar_items (Lisp_Object); +extern Lisp_Object tool_bar_items (Lisp_Object, int *); extern Lisp_Object Qvertical_scroll_bar; -extern void discard_mouse_events P_ ((void)); +extern void discard_mouse_events (void); EXFUN (Fevent_convert_list, 1); EXFUN (Fread_key_sequence, 5); EXFUN (Fset_input_interrupt_mode, 1); @@ -3193,18 +3199,18 @@ EXFUN (Fset_input_meta_mode, 2); EXFUN (Fset_quit_char, 1); EXFUN (Fset_input_mode, 4); extern Lisp_Object pending_funcalls; -extern int detect_input_pending P_ ((void)); -extern int detect_input_pending_ignore_squeezables P_ ((void)); -extern int detect_input_pending_run_timers P_ ((int)); -extern void safe_run_hooks P_ ((Lisp_Object)); -extern void cmd_error_internal P_ ((Lisp_Object, char *)); -extern Lisp_Object command_loop_1 P_ ((void)); -extern Lisp_Object recursive_edit_1 P_ ((void)); -extern void record_auto_save P_ ((void)); -extern void init_keyboard P_ ((void)); -extern void syms_of_keyboard P_ ((void)); -extern void keys_of_keyboard P_ ((void)); -extern char *push_key_description P_ ((unsigned int, char *, int)); +extern int detect_input_pending (void); +extern int detect_input_pending_ignore_squeezables (void); +extern int detect_input_pending_run_timers (int); +extern void safe_run_hooks (Lisp_Object); +extern void cmd_error_internal (Lisp_Object, const char *); +extern Lisp_Object command_loop_1 (void); +extern Lisp_Object recursive_edit_1 (void); +extern void record_auto_save (void); +extern void init_keyboard (void); +extern void syms_of_keyboard (void); +extern void keys_of_keyboard (void); +extern char *push_key_description (unsigned int, char *, int); /* Defined in indent.c */ @@ -3212,10 +3218,10 @@ EXFUN (Fvertical_motion, 2); EXFUN (Findent_to, 2); EXFUN (Fcurrent_column, 0); EXFUN (Fmove_to_column, 2); -extern double current_column P_ ((void)); -extern void invalidate_current_column P_ ((void)); -extern int indented_beyond_p P_ ((int, int, double)); -extern void syms_of_indent P_ ((void)); +extern double current_column (void); +extern void invalidate_current_column (void); +extern int indented_beyond_p (int, int, double); +extern void syms_of_indent (void); /* Defined in frame.c */ #ifdef HAVE_WINDOW_SYSTEM @@ -3223,11 +3229,11 @@ extern Lisp_Object Vx_resource_name; extern Lisp_Object Vx_resource_class; #endif /* HAVE_WINDOW_SYSTEM */ extern Lisp_Object Qvisible; -extern void store_frame_param P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern void store_in_alist P_ ((Lisp_Object *, Lisp_Object, Lisp_Object)); -extern Lisp_Object do_switch_frame P_ ((Lisp_Object, int, int, Lisp_Object)); -extern Lisp_Object get_frame_param P_ ((struct frame *, Lisp_Object)); -extern Lisp_Object frame_buffer_predicate P_ ((Lisp_Object)); +extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object); +extern void store_in_alist (Lisp_Object *, Lisp_Object, Lisp_Object); +extern Lisp_Object do_switch_frame (Lisp_Object, int, int, Lisp_Object); +extern Lisp_Object get_frame_param (struct frame *, Lisp_Object); +extern Lisp_Object frame_buffer_predicate (Lisp_Object); EXFUN (Fframep, 1); EXFUN (Fselect_frame, 2); EXFUN (Fselected_frame, 0); @@ -3254,30 +3260,30 @@ EXFUN (Fset_frame_position, 3); EXFUN (Fraise_frame, 1); EXFUN (Fredirect_frame_focus, 2); EXFUN (Fset_frame_selected_window, 3); -extern Lisp_Object frame_buffer_list P_ ((Lisp_Object)); -extern void frames_discard_buffer P_ ((Lisp_Object)); -extern void set_frame_buffer_list P_ ((Lisp_Object, Lisp_Object)); -extern void frames_bury_buffer P_ ((Lisp_Object)); -extern void syms_of_frame P_ ((void)); +extern Lisp_Object frame_buffer_list (Lisp_Object); +extern void frames_discard_buffer (Lisp_Object); +extern void set_frame_buffer_list (Lisp_Object, Lisp_Object); +extern void frames_bury_buffer (Lisp_Object); +extern void syms_of_frame (void); /* Defined in emacs.c */ -extern Lisp_Object decode_env_path P_ ((char *, char *)); +extern Lisp_Object decode_env_path (const char *, const char *); extern Lisp_Object Vinvocation_name, Vinvocation_directory; extern Lisp_Object Vbefore_init_time, Vafter_init_time; extern Lisp_Object Vinstallation_directory; extern Lisp_Object empty_unibyte_string, empty_multibyte_string; EXFUN (Fkill_emacs, 1); #if HAVE_SETLOCALE -void fixup_locale P_ ((void)); -void synchronize_system_messages_locale P_ ((void)); -void synchronize_system_time_locale P_ ((void)); +void fixup_locale (void); +void synchronize_system_messages_locale (void); +void synchronize_system_time_locale (void); #else #define setlocale(category, locale) #define fixup_locale() #define synchronize_system_messages_locale() #define synchronize_system_time_locale() #endif -void shut_down_emacs P_ ((int, int, Lisp_Object)); +void shut_down_emacs (int, int, Lisp_Object); /* Nonzero means don't do interactive redisplay and don't change tty modes. */ extern int noninteractive; @@ -3303,70 +3309,70 @@ EXFUN (Fkill_process, 2); EXFUN (Fprocess_send_eof, 1); EXFUN (Fwaiting_for_user_input_p, 0); extern Lisp_Object Qprocessp; -extern void kill_buffer_processes P_ ((Lisp_Object)); -extern int wait_reading_process_output P_ ((int, int, int, int, - Lisp_Object, - struct Lisp_Process *, - int)); -extern void add_keyboard_wait_descriptor P_ ((int)); -extern void delete_keyboard_wait_descriptor P_ ((int)); -extern void add_gpm_wait_descriptor P_ ((int)); -extern void delete_gpm_wait_descriptor P_ ((int)); -extern void close_process_descs P_ ((void)); -extern void init_process P_ ((void)); -extern void syms_of_process P_ ((void)); -extern void setup_process_coding_systems P_ ((Lisp_Object)); +extern void kill_buffer_processes (Lisp_Object); +extern int wait_reading_process_output (int, int, int, int, + Lisp_Object, + struct Lisp_Process *, + int); +extern void add_keyboard_wait_descriptor (int); +extern void delete_keyboard_wait_descriptor (int); +extern void add_gpm_wait_descriptor (int); +extern void delete_gpm_wait_descriptor (int); +extern void close_process_descs (void); +extern void init_process (void); +extern void syms_of_process (void); +extern void setup_process_coding_systems (Lisp_Object); /* Defined in callproc.c */ extern Lisp_Object Vexec_path, Vexec_suffixes, Vexec_directory, Vdata_directory; extern Lisp_Object Vdoc_directory; EXFUN (Fcall_process, MANY); -extern int child_setup P_ ((int, int, int, char **, int, Lisp_Object)); -extern void init_callproc_1 P_ ((void)); -extern void init_callproc P_ ((void)); -extern void set_initial_environment P_ ((void)); -extern void syms_of_callproc P_ ((void)); +extern int child_setup (int, int, int, char **, int, Lisp_Object); +extern void init_callproc_1 (void); +extern void init_callproc (void); +extern void set_initial_environment (void); +extern void syms_of_callproc (void); /* Defined in doc.c */ extern Lisp_Object Vdoc_file_name; EXFUN (Fsubstitute_command_keys, 1); EXFUN (Fdocumentation, 2); EXFUN (Fdocumentation_property, 3); -extern Lisp_Object read_doc_string P_ ((Lisp_Object)); -extern Lisp_Object get_doc_string P_ ((Lisp_Object, int, int)); -extern void syms_of_doc P_ ((void)); -extern int read_bytecode_char P_ ((int)); +extern Lisp_Object read_doc_string (Lisp_Object); +extern Lisp_Object get_doc_string (Lisp_Object, int, int); +extern void syms_of_doc (void); +extern int read_bytecode_char (int); /* Defined in bytecode.c */ extern Lisp_Object Qbytecode; EXFUN (Fbyte_code, MANY); -extern void syms_of_bytecode P_ ((void)); +extern void syms_of_bytecode (void); extern struct byte_stack *byte_stack_list; -extern void mark_byte_stack P_ ((void)); -extern void unmark_byte_stack P_ ((void)); -extern Lisp_Object exec_byte_code P_ ((Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object, int, Lisp_Object *)); +extern void mark_byte_stack (void); +extern void unmark_byte_stack (void); +extern Lisp_Object exec_byte_code (Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object, int, Lisp_Object *); /* Defined in macros.c */ extern Lisp_Object Qexecute_kbd_macro; EXFUN (Fexecute_kbd_macro, 3); EXFUN (Fcancel_kbd_macro_events, 0); -extern void init_macros P_ ((void)); -extern void syms_of_macros P_ ((void)); +extern void init_macros (void); +extern void syms_of_macros (void); /* Defined in undo.c */ extern Lisp_Object Qinhibit_read_only; EXFUN (Fundo_boundary, 0); -extern void truncate_undo_list P_ ((struct buffer *)); -extern void record_marker_adjustment P_ ((Lisp_Object, int)); -extern void record_insert P_ ((int, int)); -extern void record_delete P_ ((int, Lisp_Object)); -extern void record_first_change P_ ((void)); -extern void record_change P_ ((int, int)); -extern void record_property_change P_ ((int, int, Lisp_Object, Lisp_Object, - Lisp_Object)); -extern void syms_of_undo P_ ((void)); +extern void truncate_undo_list (struct buffer *); +extern void record_marker_adjustment (Lisp_Object, int); +extern void record_insert (int, int); +extern void record_delete (int, Lisp_Object); +extern void record_first_change (void); +extern void record_change (int, int); +extern void record_property_change (int, int, Lisp_Object, Lisp_Object, + Lisp_Object); +extern void syms_of_undo (void); extern Lisp_Object Vundo_outer_limit; /* Defined in textprop.c */ @@ -3380,19 +3386,19 @@ EXFUN (Fput_text_property, 5); EXFUN (Fget_text_property, 3); EXFUN (Fprevious_char_property_change, 2); EXFUN (Fnext_char_property_change, 2); -extern void report_interval_modification P_ ((Lisp_Object, Lisp_Object)); -extern Lisp_Object next_single_char_property_change P_ ((Lisp_Object, - Lisp_Object, - Lisp_Object, - Lisp_Object)); +extern void report_interval_modification (Lisp_Object, Lisp_Object); +extern Lisp_Object next_single_char_property_change (Lisp_Object, + Lisp_Object, + Lisp_Object, + Lisp_Object); /* Defined in menu.c */ -extern void syms_of_menu P_ ((void)); +extern void syms_of_menu (void); /* Defined in xmenu.c */ EXFUN (Fx_popup_menu, 2); EXFUN (Fx_popup_dialog, 3); -extern void syms_of_xmenu P_ ((void)); +extern void syms_of_xmenu (void); /* Defined in termchar.h */ struct tty_display_info; @@ -3402,73 +3408,85 @@ struct terminal; /* Defined in sysdep.c */ #ifndef HAVE_GET_CURRENT_DIR_NAME -extern char *get_current_dir_name P_ ((void)); +extern char *get_current_dir_name (void); +#endif +extern void stuff_char (char c); +extern void init_sigio (int); +extern void sys_subshell (void); +extern void sys_suspend (void); +extern void discard_tty_input (void); +extern void init_sys_modes (struct tty_display_info *); +extern void reset_sys_modes (struct tty_display_info *); +extern void init_all_sys_modes (void); +extern void reset_all_sys_modes (void); +extern void wait_for_termination (int); +extern void flush_pending_output (int); +extern void child_setup_tty (int); +extern void setup_pty (int); +extern int set_window_size (int, int, int); +extern void create_process (Lisp_Object, char **, Lisp_Object); +extern int emacs_open (const char *, int, int); +extern int emacs_close (int); +extern int emacs_read (int, char *, unsigned int); +extern int emacs_write (int, const char *, unsigned int); +#ifndef HAVE_MEMSET +extern void *memset (void *, int, size_t); +#endif +#ifndef HAVE_MEMCPY +extern void *memcpy (void *, void *, size_t); +#endif +#ifndef HAVE_MEMMOVE +extern void *memmove (void *, void *, size_t); +#endif +#ifndef HAVE_MEMCMP +extern int memcmp (void *, void *, size_t); #endif -extern void stuff_char P_ ((char c)); -extern void init_sigio P_ ((int)); -extern void sys_subshell P_ ((void)); -extern void sys_suspend P_ ((void)); -extern void discard_tty_input P_ ((void)); -extern void init_sys_modes P_ ((struct tty_display_info *)); -extern void reset_sys_modes P_ ((struct tty_display_info *)); -extern void init_all_sys_modes P_ ((void)); -extern void reset_all_sys_modes P_ ((void)); -extern void wait_for_termination P_ ((int)); -extern void flush_pending_output P_ ((int)); -extern void child_setup_tty P_ ((int)); -extern void setup_pty P_ ((int)); -extern int set_window_size P_ ((int, int, int)); -extern void create_process P_ ((Lisp_Object, char **, Lisp_Object)); -extern int emacs_open P_ ((const char *, int, int)); -extern int emacs_close P_ ((int)); -extern int emacs_read P_ ((int, char *, unsigned int)); -extern int emacs_write P_ ((int, const char *, unsigned int)); /* Defined in filelock.c */ EXFUN (Funlock_buffer, 0); EXFUN (Ffile_locked_p, 1); -extern void unlock_all_files P_ ((void)); -extern void lock_file P_ ((Lisp_Object)); -extern void unlock_file P_ ((Lisp_Object)); -extern void unlock_buffer P_ ((struct buffer *)); -extern void syms_of_filelock P_ ((void)); -extern void init_filelock P_ ((void)); +extern void unlock_all_files (void); +extern void lock_file (Lisp_Object); +extern void unlock_file (Lisp_Object); +extern void unlock_buffer (struct buffer *); +extern void syms_of_filelock (void); +extern void init_filelock (void); /* Defined in sound.c */ -extern void syms_of_sound P_ ((void)); -extern void init_sound P_ ((void)); +extern void syms_of_sound (void); +extern void init_sound (void); /* Defined in category.c */ -extern void init_category_once P_ ((void)); -extern Lisp_Object char_category_set P_ ((int)); -extern void syms_of_category P_ ((void)); +extern void init_category_once (void); +extern Lisp_Object char_category_set (int); +extern void syms_of_category (void); /* Defined in ccl.c */ -extern void syms_of_ccl P_ ((void)); +extern void syms_of_ccl (void); /* Defined in dired.c */ EXFUN (Ffile_attributes, 2); -extern void syms_of_dired P_ ((void)); -extern Lisp_Object directory_files_internal P_ ((Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object, - int, Lisp_Object)); +extern void syms_of_dired (void); +extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object, + int, Lisp_Object); /* Defined in term.c */ -extern void syms_of_term P_ ((void)); -extern void fatal P_ ((const char *msgid, ...)) NO_RETURN; +extern void syms_of_term (void); +extern void fatal (const char *msgid, ...) NO_RETURN; /* Defined in terminal.c */ EXFUN (Fframe_terminal, 1); EXFUN (Fdelete_terminal, 2); -extern void syms_of_terminal P_ ((void)); +extern void syms_of_terminal (void); /* Defined in font.c */ -extern void syms_of_font P_ ((void)); -extern void init_font P_ ((void)); +extern void syms_of_font (void); +extern void init_font (void); #ifdef HAVE_WINDOW_SYSTEM /* Defined in fontset.c */ -extern void syms_of_fontset P_ ((void)); +extern void syms_of_fontset (void); EXFUN (Fset_fontset_font, 5); EXFUN (Fnew_fontset, 2); @@ -3481,28 +3499,33 @@ EXFUN (Fx_focus_frame, 1); /* Defined in xfaces.c */ EXFUN (Fclear_face_cache, 1); EXFUN (Fx_load_color_file, 1); -extern void syms_of_xfaces P_ ((void)); +extern void syms_of_xfaces (void); #ifndef HAVE_GETLOADAVG /* Defined in getloadavg.c */ -extern int getloadavg P_ ((double *, int)); +extern int getloadavg (double *, int); #endif #ifdef HAVE_X_WINDOWS /* Defined in xfns.c */ -extern void syms_of_xfns P_ ((void)); +extern void syms_of_xfns (void); /* Defined in xsmfns.c */ -extern void syms_of_xsmfns P_ ((void)); +extern void syms_of_xsmfns (void); /* Defined in xselect.c */ EXFUN (Fx_send_client_event, 6); -extern void syms_of_xselect P_ ((void)); +extern void syms_of_xselect (void); /* Defined in xterm.c */ -extern void syms_of_xterm P_ ((void)); +extern void syms_of_xterm (void); #endif /* HAVE_X_WINDOWS */ +#ifdef HAVE_WINDOW_SYSTEM +/* Defined in xterm.c, nsterm.m, w32term.c */ +extern char *x_get_keysym_name (int); +#endif /* HAVE_WINDOW_SYSTEM */ + #ifdef MSDOS /* Defined in msdos.c */ EXFUN (Fmsdos_downcase_filename, 1); @@ -3510,14 +3533,14 @@ EXFUN (Fmsdos_downcase_filename, 1); #ifdef HAVE_MENUS /* Defined in (x|w32)fns.c, nsfns.m... */ -extern int have_menus_p P_ ((void)); +extern int have_menus_p (void); #endif #ifdef HAVE_DBUS /* Defined in dbusbind.c */ -int xd_pending_messages P_ ((void)); -void xd_read_queued_messages P_ ((void)); -void syms_of_dbusbind P_ ((void)); +int xd_pending_messages (void); +void xd_read_queued_messages (void); +void syms_of_dbusbind (void); #endif /* Nonzero means Emacs has already been initialized. @@ -3526,16 +3549,16 @@ extern int initialized; extern int immediate_quit; /* Nonzero means ^G can quit instantly */ -extern POINTER_TYPE *xmalloc P_ ((size_t)); -extern POINTER_TYPE *xrealloc P_ ((POINTER_TYPE *, size_t)); -extern void xfree P_ ((POINTER_TYPE *)); +extern POINTER_TYPE *xmalloc (size_t); +extern POINTER_TYPE *xrealloc (POINTER_TYPE *, size_t); +extern void xfree (POINTER_TYPE *); -extern char *xstrdup P_ ((const char *)); +extern char *xstrdup (const char *); -extern char *egetenv P_ ((char *)); +extern char *egetenv (const char *); /* Set up the name of the machine we're running on. */ -extern void init_system_name P_ ((void)); +extern void init_system_name (void); /* Some systems (e.g., NT) use a different path separator than Unix, in addition to a device separator. Set the path separator diff --git a/src/lread.c b/src/lread.c index 95b5dcd45ed..96c425850e4 100644 --- a/src/lread.c +++ b/src/lread.c @@ -224,18 +224,18 @@ int force_load_messages; static Lisp_Object Vbytecomp_version_regexp; -static int read_emacs_mule_char P_ ((int, int (*) (int, Lisp_Object), - Lisp_Object)); +static int read_emacs_mule_char (int, int (*) (int, Lisp_Object), + Lisp_Object); -static void readevalloop P_ ((Lisp_Object, FILE*, Lisp_Object, - Lisp_Object (*) (), int, - Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object)); -static Lisp_Object load_unwind P_ ((Lisp_Object)); -static Lisp_Object load_descriptor_unwind P_ ((Lisp_Object)); +static void readevalloop (Lisp_Object, FILE*, Lisp_Object, + Lisp_Object (*) (Lisp_Object), int, + Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object); +static Lisp_Object load_unwind (Lisp_Object); +static Lisp_Object load_descriptor_unwind (Lisp_Object); -static void invalid_syntax P_ ((const char *, int)) NO_RETURN; -static void end_of_file_error P_ (()) NO_RETURN; +static void invalid_syntax (const char *, int) NO_RETURN; +static void end_of_file_error (void) NO_RETURN; /* Functions that read one byte from the current source READCHARFUN @@ -244,9 +244,9 @@ static void end_of_file_error P_ (()) NO_RETURN; is 0 or positive, it unreads C, and the return value is not interesting. */ -static int readbyte_for_lambda P_ ((int, Lisp_Object)); -static int readbyte_from_file P_ ((int, Lisp_Object)); -static int readbyte_from_string P_ ((int, Lisp_Object)); +static int readbyte_for_lambda (int, Lisp_Object); +static int readbyte_from_file (int, Lisp_Object); +static int readbyte_from_string (int, Lisp_Object); /* Handle unreading and rereading of characters. Write READCHAR to read a character, @@ -267,13 +267,11 @@ static int readbyte_from_string P_ ((int, Lisp_Object)); static int unread_char; static int -readchar (readcharfun, multibyte) - Lisp_Object readcharfun; - int *multibyte; +readchar (Lisp_Object readcharfun, int *multibyte) { Lisp_Object tem; register int c; - int (*readbyte) P_ ((int, Lisp_Object)); + int (*readbyte) (int, Lisp_Object); unsigned char buf[MAX_MULTIBYTE_LENGTH]; int i, len; int emacs_mule_encoding = 0; @@ -440,9 +438,7 @@ readchar (readcharfun, multibyte) If the stream is a user function, call it with the char as argument. */ static void -unreadchar (readcharfun, c) - Lisp_Object readcharfun; - int c; +unreadchar (Lisp_Object readcharfun, int c) { readchar_count--; if (c == -1) @@ -506,18 +502,14 @@ unreadchar (readcharfun, c) } static int -readbyte_for_lambda (c, readcharfun) - int c; - Lisp_Object readcharfun; +readbyte_for_lambda (int c, Lisp_Object readcharfun) { return read_bytecode_char (c >= 0); } static int -readbyte_from_file (c, readcharfun) - int c; - Lisp_Object readcharfun; +readbyte_from_file (int c, Lisp_Object readcharfun) { if (c >= 0) { @@ -548,9 +540,7 @@ readbyte_from_file (c, readcharfun) } static int -readbyte_from_string (c, readcharfun) - int c; - Lisp_Object readcharfun; +readbyte_from_string (int c, Lisp_Object readcharfun) { Lisp_Object string = XCAR (readcharfun); @@ -578,10 +568,7 @@ readbyte_from_string (c, readcharfun) extern char emacs_mule_bytes[256]; static int -read_emacs_mule_char (c, readbyte, readcharfun) - int c; - int (*readbyte) P_ ((int, Lisp_Object)); - Lisp_Object readcharfun; +read_emacs_mule_char (int c, int (*readbyte) (int, Lisp_Object), Lisp_Object readcharfun) { /* Emacs-mule coding uses at most 4-byte for one character. */ unsigned char buf[4]; @@ -640,19 +627,19 @@ read_emacs_mule_char (c, readbyte, readcharfun) } -static Lisp_Object read_internal_start P_ ((Lisp_Object, Lisp_Object, - Lisp_Object)); -static Lisp_Object read0 P_ ((Lisp_Object)); -static Lisp_Object read1 P_ ((Lisp_Object, int *, int)); +static Lisp_Object read_internal_start (Lisp_Object, Lisp_Object, + Lisp_Object); +static Lisp_Object read0 (Lisp_Object); +static Lisp_Object read1 (Lisp_Object, int *, int); -static Lisp_Object read_list P_ ((int, Lisp_Object)); -static Lisp_Object read_vector P_ ((Lisp_Object, int)); +static Lisp_Object read_list (int, Lisp_Object); +static Lisp_Object read_vector (Lisp_Object, int); -static Lisp_Object substitute_object_recurse P_ ((Lisp_Object, Lisp_Object, - Lisp_Object)); -static void substitute_object_in_subtree P_ ((Lisp_Object, - Lisp_Object)); -static void substitute_in_interval P_ ((INTERVAL, Lisp_Object)); +static Lisp_Object substitute_object_recurse (Lisp_Object, Lisp_Object, + Lisp_Object); +static void substitute_object_in_subtree (Lisp_Object, + Lisp_Object); +static void substitute_in_interval (INTERVAL, Lisp_Object); /* Get a character from the tty. */ @@ -679,10 +666,8 @@ static void substitute_in_interval P_ ((INTERVAL, Lisp_Object)); return Qnil if no input arrives within that time. */ Lisp_Object -read_filtered_event (no_switch_frame, ascii_required, error_nonascii, - input_method, seconds) - int no_switch_frame, ascii_required, error_nonascii, input_method; - Lisp_Object seconds; +read_filtered_event (int no_switch_frame, int ascii_required, + int error_nonascii, int input_method, Lisp_Object seconds) { Lisp_Object val, delayed_switch_frame; EMACS_TIME end_time; @@ -797,8 +782,7 @@ If the optional argument SECONDS is non-nil, it should be a number specifying the maximum number of seconds to wait for input. If no input arrives in that time, return nil. SECONDS may be a floating-point value. */) - (prompt, inherit_input_method, seconds) - Lisp_Object prompt, inherit_input_method, seconds; + (Lisp_Object prompt, Lisp_Object inherit_input_method, Lisp_Object seconds) { Lisp_Object val; @@ -820,8 +804,7 @@ If the optional argument SECONDS is non-nil, it should be a number specifying the maximum number of seconds to wait for input. If no input arrives in that time, return nil. SECONDS may be a floating-point value. */) - (prompt, inherit_input_method, seconds) - Lisp_Object prompt, inherit_input_method, seconds; + (Lisp_Object prompt, Lisp_Object inherit_input_method, Lisp_Object seconds) { if (! NILP (prompt)) message_with_string ("%s", prompt, 0); @@ -842,8 +825,7 @@ If the optional argument SECONDS is non-nil, it should be a number specifying the maximum number of seconds to wait for input. If no input arrives in that time, return nil. SECONDS may be a floating-point value. */) - (prompt, inherit_input_method, seconds) - Lisp_Object prompt, inherit_input_method, seconds; + (Lisp_Object prompt, Lisp_Object inherit_input_method, Lisp_Object seconds) { Lisp_Object val; @@ -858,7 +840,7 @@ floating-point value. */) DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0, doc: /* Don't use this yourself. */) - () + (void) { register Lisp_Object val; BLOCK_INPUT; @@ -988,8 +970,7 @@ lisp_file_lexically_bound_p (readcharfun) because of an incompatible change in the byte compiler. */ static int -safe_to_load_p (fd) - int fd; +safe_to_load_p (int fd) { char buf[512]; int nbytes, i; @@ -1026,8 +1007,7 @@ safe_to_load_p (fd) after loading a file successfully. */ static Lisp_Object -record_load_unwind (old) - Lisp_Object old; +record_load_unwind (Lisp_Object old) { return Vloads_in_progress = old; } @@ -1035,15 +1015,13 @@ record_load_unwind (old) /* This handler function is used via internal_condition_case_1. */ static Lisp_Object -load_error_handler (data) - Lisp_Object data; +load_error_handler (Lisp_Object data) { return Qnil; } static Lisp_Object -load_warn_old_style_backquotes (file) - Lisp_Object file; +load_warn_old_style_backquotes (Lisp_Object file) { if (!NILP (Vold_style_backquotes)) { @@ -1059,7 +1037,7 @@ DEFUN ("get-load-suffixes", Fget_load_suffixes, Sget_load_suffixes, 0, 0, 0, doc: /* Return the suffixes that `load' should try if a suffix is \ required. This uses the variables `load-suffixes' and `load-file-rep-suffixes'. */) - () + (void) { Lisp_Object lst = Qnil, suffixes = Vload_suffixes, suffix, ext; while (CONSP (suffixes)) @@ -1114,8 +1092,7 @@ Loading a file records its definitions, and its `provide' and car is the file name loaded. See `load-history'. Return t if the file exists and loads successfully. */) - (file, noerror, nomessage, nosuffix, must_suffix) - Lisp_Object file, noerror, nomessage, nosuffix, must_suffix; + (Lisp_Object file, Lisp_Object noerror, Lisp_Object nomessage, Lisp_Object nosuffix, Lisp_Object must_suffix) { register FILE *stream; register int fd = -1; @@ -1265,8 +1242,7 @@ Return t if the file exists and loads successfully. */) specbind (Qold_style_backquotes, Qnil); record_unwind_protect (load_warn_old_style_backquotes, file); - if (!bcmp (SDATA (found) + SBYTES (found) - 4, - ".elc", 4) + if (!memcmp (SDATA (found) + SBYTES (found) - 4, ".elc", 4) || (fd >= 0 && (version = safe_to_load_p (fd)) > 0)) /* Load .elc files directly, but not when they are remote and have no handler! */ @@ -1428,8 +1404,8 @@ Return t if the file exists and loads successfully. */) } static Lisp_Object -load_unwind (arg) /* used as unwind-protect function in load */ - Lisp_Object arg; +load_unwind (Lisp_Object arg) /* used as unwind-protect function in load */ + { FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer; if (stream != NULL) @@ -1442,8 +1418,7 @@ load_unwind (arg) /* used as unwind-protect function in load */ } static Lisp_Object -load_descriptor_unwind (oldlist) - Lisp_Object oldlist; +load_descriptor_unwind (Lisp_Object oldlist) { load_descriptor_list = oldlist; return Qnil; @@ -1453,7 +1428,7 @@ load_descriptor_unwind (oldlist) This is used when starting a subprocess. */ void -close_load_descs () +close_load_descs (void) { #ifndef WINDOWSNT Lisp_Object tail; @@ -1463,8 +1438,7 @@ close_load_descs () } static int -complete_filename_p (pathname) - Lisp_Object pathname; +complete_filename_p (Lisp_Object pathname) { register const unsigned char *s = SDATA (pathname); return (IS_DIRECTORY_SEP (s[0]) @@ -1480,8 +1454,7 @@ file name when searching. If non-nil, PREDICATE is used instead of `file-readable-p'. PREDICATE can also be an integer to pass to the access(2) function, in which case file-name-handlers are ignored. */) - (filename, path, suffixes, predicate) - Lisp_Object filename, path, suffixes, predicate; + (Lisp_Object filename, Lisp_Object path, Lisp_Object suffixes, Lisp_Object predicate) { Lisp_Object file; int fd = openp (path, filename, suffixes, &file, predicate); @@ -1512,11 +1485,7 @@ in which case file-name-handlers are ignored. */) but store the found remote file name in *STOREPTR. */ int -openp (path, str, suffixes, storeptr, predicate) - Lisp_Object path, str; - Lisp_Object suffixes; - Lisp_Object *storeptr; - Lisp_Object predicate; +openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *storeptr, Lisp_Object predicate) { register int fd; int fn_size = 100; @@ -1668,9 +1637,7 @@ openp (path, str, suffixes, storeptr, predicate) ENTIRE is 1 if loading that entire file, 0 if evaluating part of it. */ static void -build_load_history (filename, entire) - Lisp_Object filename; - int entire; +build_load_history (Lisp_Object filename, int entire) { register Lisp_Object tail, prev, newelt; register Lisp_Object tem, tem2; @@ -1730,16 +1697,15 @@ build_load_history (filename, entire) } Lisp_Object -unreadpure (junk) /* Used as unwind-protect function in readevalloop */ - Lisp_Object junk; +unreadpure (Lisp_Object junk) /* Used as unwind-protect function in readevalloop */ + { read_pure = 0; return Qnil; } static Lisp_Object -readevalloop_1 (old) - Lisp_Object old; +readevalloop_1 (Lisp_Object old) { load_convert_to_unibyte = ! NILP (old); return Qnil; @@ -1749,7 +1715,7 @@ readevalloop_1 (old) information. */ static void -end_of_file_error () +end_of_file_error (void) { if (STRINGP (Vload_file_name)) xsignal1 (Qend_of_file, Vload_file_name); @@ -1765,15 +1731,13 @@ end_of_file_error () If the input is not from a buffer, they must be nil. */ static void -readevalloop (readcharfun, stream, sourcename, evalfun, - printflag, unibyte, readfun, start, end) - Lisp_Object readcharfun; - FILE *stream; - Lisp_Object sourcename; - Lisp_Object (*evalfun) (); - int printflag; - Lisp_Object unibyte, readfun; - Lisp_Object start, end; +readevalloop (Lisp_Object readcharfun, + FILE *stream, + Lisp_Object sourcename, + Lisp_Object (*evalfun) (Lisp_Object), + int printflag, + Lisp_Object unibyte, Lisp_Object readfun, + Lisp_Object start, Lisp_Object end) { register int c; register Lisp_Object val; @@ -1953,8 +1917,7 @@ DO-ALLOW-PRINT, if non-nil, specifies that `print' and related functions should work normally even if PRINTFLAG is nil. This function preserves the position of point. */) - (buffer, printflag, filename, unibyte, do_allow_print) - Lisp_Object buffer, printflag, filename, unibyte, do_allow_print; + (Lisp_Object buffer, Lisp_Object printflag, Lisp_Object filename, Lisp_Object unibyte, Lisp_Object do_allow_print) { int count = SPECPDL_INDEX (); Lisp_Object tem, buf; @@ -2000,8 +1963,7 @@ instead of `read' to read each expression. It gets one argument which is the input stream for reading characters. This function does not move point. */) - (start, end, printflag, read_function) - Lisp_Object start, end, printflag, read_function; + (Lisp_Object start, Lisp_Object end, Lisp_Object printflag, Lisp_Object read_function) { int count = SPECPDL_INDEX (); Lisp_Object tem, cbuf; @@ -2035,8 +1997,7 @@ STREAM or the value of `standard-input' may be: a string (takes text from string, starting at the beginning) t (read text line using minibuffer and use it, or read from standard input in batch mode). */) - (stream) - Lisp_Object stream; + (Lisp_Object stream) { if (NILP (stream)) stream = Vstandard_input; @@ -2053,8 +2014,7 @@ DEFUN ("read-from-string", Fread_from_string, Sread_from_string, 1, 3, 0, Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX). START and END optionally delimit a substring of STRING from which to read; they default to 0 and (length STRING) respectively. */) - (string, start, end) - Lisp_Object string, start, end; + (Lisp_Object string, Lisp_Object start, Lisp_Object end) { Lisp_Object ret; CHECK_STRING (string); @@ -2066,10 +2026,8 @@ START and END optionally delimit a substring of STRING from which to read; /* Function to set up the global context we need in toplevel read calls. */ static Lisp_Object -read_internal_start (stream, start, end) - Lisp_Object stream; - Lisp_Object start; /* Only used when stream is a string. */ - Lisp_Object end; /* Only used when stream is a string. */ +read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end) +/* start, end only used when stream is a string. */ { Lisp_Object retval; @@ -2127,9 +2085,7 @@ read_internal_start (stream, start, end) S is error string of length N (if > 0) */ static void -invalid_syntax (s, n) - const char *s; - int n; +invalid_syntax (const char *s, int n) { if (!n) n = strlen (s); @@ -2141,8 +2097,7 @@ invalid_syntax (s, n) are not allowed. */ static Lisp_Object -read0 (readcharfun) - Lisp_Object readcharfun; +read0 (Lisp_Object readcharfun) { register Lisp_Object val; int c; @@ -2162,9 +2117,7 @@ static char *read_buffer; If the escape sequence forces unibyte, return eight-bit char. */ static int -read_escape (readcharfun, stringp) - Lisp_Object readcharfun; - int stringp; +read_escape (Lisp_Object readcharfun, int stringp) { register int c = READCHAR; /* \u allows up to four hex digits, \U up to eight. Default to the @@ -2378,9 +2331,7 @@ read_escape (readcharfun, stringp) range. */ static Lisp_Object -read_integer (readcharfun, radix) - Lisp_Object readcharfun; - int radix; +read_integer (Lisp_Object readcharfun, int radix) { int ndigits = 0, invalid_p, c, sign = 0; /* We use a floating point number because */ @@ -2445,10 +2396,7 @@ read_integer (readcharfun, radix) FIRST_IN_LIST is nonzero if this is the first element of a list. */ static Lisp_Object -read1 (readcharfun, pch, first_in_list) - register Lisp_Object readcharfun; - int *pch; - int first_in_list; +read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) { register int c; int uninterned_symbol = 0; @@ -2508,28 +2456,28 @@ read1 (readcharfun, pch, first_in_list) /* This is repetitive but fast and simple. */ params[param_count] = QCsize; params[param_count+1] = Fplist_get (tmp, Qsize); - if (!NILP (params[param_count+1])) - param_count+=2; + if (!NILP (params[param_count + 1])) + param_count += 2; params[param_count] = QCtest; params[param_count+1] = Fplist_get (tmp, Qtest); - if (!NILP (params[param_count+1])) - param_count+=2; + if (!NILP (params[param_count + 1])) + param_count += 2; params[param_count] = QCweakness; params[param_count+1] = Fplist_get (tmp, Qweakness); - if (!NILP (params[param_count+1])) - param_count+=2; + if (!NILP (params[param_count + 1])) + param_count += 2; params[param_count] = QCrehash_size; params[param_count+1] = Fplist_get (tmp, Qrehash_size); - if (!NILP (params[param_count+1])) - param_count+=2; + if (!NILP (params[param_count + 1])) + param_count += 2; params[param_count] = QCrehash_threshold; params[param_count+1] = Fplist_get (tmp, Qrehash_threshold); - if (!NILP (params[param_count+1])) - param_count+=2; + if (!NILP (params[param_count + 1])) + param_count += 2; /* This is the hashtable data. */ data = Fplist_get (tmp, Qdata); @@ -2550,6 +2498,8 @@ read1 (readcharfun, pch, first_in_list) return ht; } + UNREAD (c); + invalid_syntax ("#", 1); } if (c == '^') { @@ -2612,8 +2562,7 @@ read1 (readcharfun, pch, first_in_list) invalid_syntax ("#&...", 5); val = Fmake_bool_vector (length, Qnil); - bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data, - size_in_chars); + memcpy (XBOOL_VECTOR (val)->data, SDATA (tmp), size_in_chars); /* Clear the extraneous bits in the last byte. */ if (XINT (length) != size_in_chars * BOOL_VECTOR_BITS_PER_CHAR) XBOOL_VECTOR (val)->data[size_in_chars - 1] @@ -2819,32 +2768,35 @@ read1 (readcharfun, pch, first_in_list) } case '`': - /* Transition from old-style to new-style: - If we see "(`" it used to mean old-style, which usually works - fine because ` should almost never appear in such a position - for new-style. But occasionally we need "(`" to mean new - style, so we try to distinguish the two by the fact that we - can either write "( `foo" or "(` foo", where the first - intends to use new-style whereas the second intends to use - old-style. For Emacs-25, we should completely remove this - first_in_list exception (old-style can still be obtained via - "(\`" anyway). */ - if (first_in_list && (c = READCHAR, UNREAD (c), c == ' ')) - { - Vold_style_backquotes = Qt; - goto default_label; - } - else - { - Lisp_Object value; + { + int next_char = READCHAR; + UNREAD (next_char); + /* Transition from old-style to new-style: + If we see "(`" it used to mean old-style, which usually works + fine because ` should almost never appear in such a position + for new-style. But occasionally we need "(`" to mean new + style, so we try to distinguish the two by the fact that we + can either write "( `foo" or "(` foo", where the first + intends to use new-style whereas the second intends to use + old-style. For Emacs-25, we should completely remove this + first_in_list exception (old-style can still be obtained via + "(\`" anyway). */ + if (first_in_list && next_char == ' ') + { + Vold_style_backquotes = Qt; + goto default_label; + } + else + { + Lisp_Object value; - new_backquote_flag++; - value = read0 (readcharfun); - new_backquote_flag--; - - return Fcons (Qbackquote, Fcons (value, Qnil)); - } + new_backquote_flag++; + value = read0 (readcharfun); + new_backquote_flag--; + return Fcons (Qbackquote, Fcons (value, Qnil)); + } + } case ',': if (new_backquote_flag) { @@ -2907,7 +2859,7 @@ read1 (readcharfun, pch, first_in_list) ok = (next_next_char <= 040 || (next_next_char < 0200 - && (index ("\"';([#?", next_next_char) + && (strchr ("\"';([#?", next_next_char) || (!first_in_list && next_next_char == '`') || (new_backquote_flag && next_next_char == ',')))); } @@ -2915,7 +2867,7 @@ read1 (readcharfun, pch, first_in_list) { ok = (next_char <= 040 || (next_char < 0200 - && (index ("\"';()[]#?", next_char) + && (strchr ("\"';()[]#?", next_char) || (!first_in_list && next_char == '`') || (new_backquote_flag && next_char == ',')))); } @@ -3060,7 +3012,7 @@ read1 (readcharfun, pch, first_in_list) if (next_char <= 040 || (next_char < 0200 - && (index ("\"';([#?", next_char) + && (strchr ("\"';([#?", next_char) || (!first_in_list && next_char == '`') || (new_backquote_flag && next_char == ',')))) { @@ -3087,7 +3039,7 @@ read1 (readcharfun, pch, first_in_list) while (c > 040 && c != 0x8a0 /* NBSP */ && (c >= 0200 - || (!index ("\"';()[]#", c) + || (!strchr ("\"';()[]#", c) && !(!first_in_list && c == '`') && !(new_backquote_flag && c == ',')))) { @@ -3246,9 +3198,7 @@ read1 (readcharfun, pch, first_in_list) static Lisp_Object seen_list; static void -substitute_object_in_subtree (object, placeholder) - Lisp_Object object; - Lisp_Object placeholder; +substitute_object_in_subtree (Lisp_Object object, Lisp_Object placeholder) { Lisp_Object check_object; @@ -3283,10 +3233,7 @@ substitute_object_in_subtree (object, placeholder) } while (0) static Lisp_Object -substitute_object_recurse (object, placeholder, subtree) - Lisp_Object object; - Lisp_Object placeholder; - Lisp_Object subtree; +substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Object subtree) { /* If we find the placeholder, return the target object. */ if (EQ (placeholder, subtree)) @@ -3361,9 +3308,7 @@ substitute_object_recurse (object, placeholder, subtree) /* Helper function for substitute_object_recurse. */ static void -substitute_in_interval (interval, arg) - INTERVAL interval; - Lisp_Object arg; +substitute_in_interval (INTERVAL interval, Lisp_Object arg) { Lisp_Object object = Fcar (arg); Lisp_Object placeholder = Fcdr (arg); @@ -3379,13 +3324,10 @@ substitute_in_interval (interval, arg) #define EXP_INT 16 int -isfloat_string (cp, ignore_trailing) - register char *cp; - int ignore_trailing; +isfloat_string (const char *cp, int ignore_trailing) { - register int state; - - char *start = cp; + int state; + const char *start = cp; state = 0; if (*cp == '+' || *cp == '-') @@ -3436,7 +3378,8 @@ isfloat_string (cp, ignore_trailing) } return ((ignore_trailing - || (*cp == 0) || (*cp == ' ') || (*cp == '\t') || (*cp == '\n') || (*cp == '\r') || (*cp == '\f')) + || *cp == 0 || *cp == ' ' || *cp == '\t' || *cp == '\n' + || *cp == '\r' || *cp == '\f') && (state == (LEAD_INT|DOT_CHAR|TRAIL_INT) || state == (DOT_CHAR|TRAIL_INT) || state == (LEAD_INT|E_CHAR|EXP_INT) @@ -3446,9 +3389,7 @@ isfloat_string (cp, ignore_trailing) static Lisp_Object -read_vector (readcharfun, read_funvec) - Lisp_Object readcharfun; - int read_funvec; +read_vector (Lisp_Object readcharfun, int read_funvec) { register int i; register int size; @@ -3552,9 +3493,7 @@ read_vector (readcharfun, read_funvec) and make structure pure. */ static Lisp_Object -read_list (flag, readcharfun) - int flag; - register Lisp_Object readcharfun; +read_list (int flag, register Lisp_Object readcharfun) { /* -1 means check next element for defun, 0 means don't check, @@ -3742,14 +3681,13 @@ Lisp_Object initial_obarray; int oblookup_last_bucket_number; -static int hash_string (); +static int hash_string (const unsigned char *ptr, int len); /* Get an error if OBARRAY is not an obarray. If it is one, return it. */ Lisp_Object -check_obarray (obarray) - Lisp_Object obarray; +check_obarray (Lisp_Object obarray) { if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) { @@ -3764,8 +3702,7 @@ check_obarray (obarray) interned in the current obarray. */ Lisp_Object -intern (str) - const char *str; +intern (const char *str) { Lisp_Object tem; int len = strlen (str); @@ -3806,14 +3743,13 @@ intern_c_string (const char *str) /* Create an uninterned symbol with name STR. */ Lisp_Object -make_symbol (str) - char *str; +make_symbol (const char *str) { int len = strlen (str); - return Fmake_symbol ((!NILP (Vpurify_flag) - ? make_pure_string (str, len, len, 0) - : make_string (str, len))); + return Fmake_symbol (!NILP (Vpurify_flag) + ? make_pure_string (str, len, len, 0) + : make_string (str, len)); } DEFUN ("intern", Fintern, Sintern, 1, 2, 0, @@ -3821,8 +3757,7 @@ DEFUN ("intern", Fintern, Sintern, 1, 2, 0, If there is none, one is created by this function and returned. A second optional argument specifies the obarray to use; it defaults to the value of `obarray'. */) - (string, obarray) - Lisp_Object string, obarray; + (Lisp_Object string, Lisp_Object obarray) { register Lisp_Object tem, sym, *ptr; @@ -3869,8 +3804,7 @@ NAME may be a string or a symbol. If it is a symbol, that exact symbol is searched for. A second optional argument specifies the obarray to use; it defaults to the value of `obarray'. */) - (name, obarray) - Lisp_Object name, obarray; + (Lisp_Object name, Lisp_Object obarray) { register Lisp_Object tem, string; @@ -3898,8 +3832,7 @@ The value is t if a symbol was found and deleted, nil otherwise. NAME may be a string or a symbol. If it is a symbol, that symbol is deleted, if it belongs to OBARRAY--no other symbol is deleted. OBARRAY defaults to the value of the variable `obarray'. */) - (name, obarray) - Lisp_Object name, obarray; + (Lisp_Object name, Lisp_Object obarray) { register Lisp_Object string, tem; int hash; @@ -3969,10 +3902,7 @@ OBARRAY defaults to the value of the variable `obarray'. */) Also store the bucket number in oblookup_last_bucket_number. */ Lisp_Object -oblookup (obarray, ptr, size, size_byte) - Lisp_Object obarray; - register const char *ptr; - int size, size_byte; +oblookup (Lisp_Object obarray, register const char *ptr, int size, int size_byte) { int hash; int obsize; @@ -3999,7 +3929,7 @@ oblookup (obarray, ptr, size, size_byte) { if (SBYTES (SYMBOL_NAME (tail)) == size_byte && SCHARS (SYMBOL_NAME (tail)) == size - && !bcmp (SDATA (SYMBOL_NAME (tail)), ptr, size_byte)) + && !memcmp (SDATA (SYMBOL_NAME (tail)), ptr, size_byte)) return tail; else if (XSYMBOL (tail)->next == 0) break; @@ -4009,9 +3939,7 @@ oblookup (obarray, ptr, size, size_byte) } static int -hash_string (ptr, len) - const unsigned char *ptr; - int len; +hash_string (const unsigned char *ptr, int len) { register const unsigned char *p = ptr; register const unsigned char *end = p + len; @@ -4028,10 +3956,7 @@ hash_string (ptr, len) } void -map_obarray (obarray, fn, arg) - Lisp_Object obarray; - void (*fn) P_ ((Lisp_Object, Lisp_Object)); - Lisp_Object arg; +map_obarray (Lisp_Object obarray, void (*fn) (Lisp_Object, Lisp_Object), Lisp_Object arg) { register int i; register Lisp_Object tail; @@ -4051,8 +3976,7 @@ map_obarray (obarray, fn, arg) } void -mapatoms_1 (sym, function) - Lisp_Object sym, function; +mapatoms_1 (Lisp_Object sym, Lisp_Object function) { call1 (function, sym); } @@ -4060,8 +3984,7 @@ mapatoms_1 (sym, function) DEFUN ("mapatoms", Fmapatoms, Smapatoms, 1, 2, 0, doc: /* Call FUNCTION on every symbol in OBARRAY. OBARRAY defaults to the value of `obarray'. */) - (function, obarray) - Lisp_Object function, obarray; + (Lisp_Object function, Lisp_Object obarray) { if (NILP (obarray)) obarray = Vobarray; obarray = check_obarray (obarray); @@ -4073,7 +3996,7 @@ OBARRAY defaults to the value of `obarray'. */) #define OBARRAY_SIZE 1511 void -init_obarray () +init_obarray (void) { Lisp_Object oblength; @@ -4114,8 +4037,7 @@ init_obarray () } void -defsubr (sname) - struct Lisp_Subr *sname; +defsubr (struct Lisp_Subr *sname) { Lisp_Object sym; sym = intern_c_string (sname->symbol_name); @@ -4215,7 +4137,7 @@ defvar_kboard (struct Lisp_Kboard_Objfwd *ko_fwd, static Lisp_Object dump_path; void -init_lread () +init_lread (void) { char *normal; int turn_off_warning = 0; @@ -4408,9 +4330,7 @@ init_lread () does not exist. Print it on stderr and put it in *Messages*. */ void -dir_warning (format, dirname) - char *format; - Lisp_Object dirname; +dir_warning (const char *format, Lisp_Object dirname) { char *buffer = (char *) alloca (SCHARS (dirname) + strlen (format) + 5); @@ -4423,7 +4343,7 @@ dir_warning (format, dirname) } void -syms_of_lread () +syms_of_lread (void) { defsubr (&Sread); defsubr (&Sread_from_string); diff --git a/src/m/alpha.h b/src/m/alpha.h index c57fd0d9821..ae8fd62d6f8 100644 --- a/src/m/alpha.h +++ b/src/m/alpha.h @@ -47,33 +47,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Convert that into an integer that is 100 for a load average of 1.0 */ #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) -/* GNU malloc and the relocating allocator do not work together - with X. [Who wrote that?] */ - -/* May 1995: reportedly [Rainer Schoepf <schoepf@uni-mainz.de>] both the - system and the gnu malloc system work with "alpha-dec-osf3.0" and - "alpha-dec-osf3.2". */ - -/* May 1995: it seems to me [Morten Welinder <terra@diku.dk>] that both - mallocs work with "alpha-dec-osf2.0", but I daren't break anything - right now. Feel free to play if you want. */ - -/* #define SYSTEM_MALLOC */ - #ifdef __ELF__ #if !defined(GNU_LINUX) && !defined(__NetBSD__) #define DATA_START 0x140000000 #endif -#if (defined (__NetBSD__) || defined (__OpenBSD__)) -#define HAVE_TEXT_START -#endif - #else /* not __ELF__ */ /* Describe layout of the address space in an executing process. */ -#define TEXT_START 0x120000000 #define DATA_START 0x140000000 #endif /* __ELF__ */ diff --git a/src/m/ia64.h b/src/m/ia64.h index 76e2bb87d80..5266c682c78 100644 --- a/src/m/ia64.h +++ b/src/m/ia64.h @@ -58,7 +58,5 @@ extern void r_alloc_free (); #endif /* not _MALLOC_INTERNAL */ #endif /* REL_ALLOC */ -#define HAVE_TEXT_START - /* arch-tag: 9b8e9fb2-2e49-4c22-b68f-11a488e77c66 (do not change this comment) */ diff --git a/src/m/ibmrs6000.h b/src/m/ibmrs6000.h index 3831e500641..a44b2c4ec3b 100644 --- a/src/m/ibmrs6000.h +++ b/src/m/ibmrs6000.h @@ -22,7 +22,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* The data segment in this machine always starts at address 0x20000000. An address of data cannot be stored correctly in a Lisp object; we always lose the high bits. We must tell XPNTR to add them back. */ -#define TEXT_START 0x10000000 #define DATA_START 0x20000000 #define WORDS_BIG_ENDIAN #define DATA_SEG_BITS 0x20000000 diff --git a/src/m/intel386.h b/src/m/intel386.h index 984a9959736..76e5929e4e6 100644 --- a/src/m/intel386.h +++ b/src/m/intel386.h @@ -23,10 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ is the most significant byte. */ #undef WORDS_BIG_ENDIAN -#ifdef USG -#define TEXT_START 0 -#endif /* USG */ - #ifdef WINDOWSNT #define VIRT_ADDR_VARIES #define DATA_START get_data_start () diff --git a/src/m/iris4d.h b/src/m/iris4d.h index e7f332057e5..2ba6b5ba7ce 100644 --- a/src/m/iris4d.h +++ b/src/m/iris4d.h @@ -30,8 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ This flag only matters if you use USE_LISP_UNION_TYPE. */ #define EXPLICIT_SIGN_EXTEND -#define TEXT_START 0x400000 - /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for the value field of a LISP_OBJECT). */ diff --git a/src/m/m68k.h b/src/m/m68k.h index 668db282593..5a083205e50 100644 --- a/src/m/m68k.h +++ b/src/m/m68k.h @@ -41,7 +41,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #endif #define NO_REMAP -#define TEXT_START 0 #endif /* arch-tag: 4eadd161-b4e8-4b82-82a1-e4ce7f42969d diff --git a/src/m/macppc.h b/src/m/macppc.h index f348286030c..2764ae56115 100644 --- a/src/m/macppc.h +++ b/src/m/macppc.h @@ -28,10 +28,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Convert that into an integer that is 100 for a load average of 1.0 */ #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) -#if (defined (__NetBSD__) || defined (__OpenBSD__)) && defined (__ELF__) -#define HAVE_TEXT_START -#endif - #ifdef _ARCH_PPC64 #ifndef _LP64 #define _LP64 diff --git a/src/m/mips.h b/src/m/mips.h index 8e81c077426..39a948c0cde 100644 --- a/src/m/mips.h +++ b/src/m/mips.h @@ -31,8 +31,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ This flag only matters if you use USE_LISP_UNION_TYPE. */ #define EXPLICIT_SIGN_EXTEND -/* Describe layout of the address space in an executing process. */ -#define TEXT_START 0x00400000 - /* arch-tag: 8fd020ee-78a7-4d87-96ce-6129f52f7bee (do not change this comment) */ diff --git a/src/m/template.h b/src/m/template.h index 3beac1a7808..0b149411a0a 100644 --- a/src/m/template.h +++ b/src/m/template.h @@ -39,11 +39,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Convert that into an integer that is 100 for a load average of 1.0 */ #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) -/* Define CANNOT_DUMP on machines where unexec does not work. - Then the function dump-emacs will not be defined - and temacs will do (load "loadup") automatically unless told otherwise. */ -#define CANNOT_DUMP - /* Define VIRT_ADDR_VARIES if the virtual addresses of pure and impure space as loaded can vary, and even their relative order cannot be relied on. diff --git a/src/macros.c b/src/macros.c index 62aeb0fa635..0e0d3f3597e 100644 --- a/src/macros.c +++ b/src/macros.c @@ -53,7 +53,7 @@ Lisp_Object executing_kbd_macro; extern Lisp_Object real_this_command; -Lisp_Object Fexecute_kbd_macro (); +Lisp_Object Fexecute_kbd_macro (Lisp_Object macro, Lisp_Object count, Lisp_Object loopfunc); DEFUN ("start-kbd-macro", Fstart_kbd_macro, Sstart_kbd_macro, 1, 2, "P", doc: /* Record subsequent keyboard input, defining a keyboard macro. @@ -64,8 +64,7 @@ Non-nil arg (prefix arg) means append to last macro defined; this begins by re-executing that macro as if you typed it again. If optional second arg, NO-EXEC, is non-nil, do not re-execute last macro before appending to it. */) - (append, no_exec) - Lisp_Object append, no_exec; + (Lisp_Object append, Lisp_Object no_exec) { if (!NILP (current_kboard->defining_kbd_macro)) error ("Already defining kbd macro"); @@ -140,7 +139,7 @@ macro before appending to it. */) /* Finish defining the current keyboard macro. */ void -end_kbd_macro () +end_kbd_macro (void) { current_kboard->defining_kbd_macro = Qnil; update_mode_lines++; @@ -163,8 +162,7 @@ An argument of zero means repeat until error. In Lisp, optional second arg LOOPFUNC may be a function that is called prior to each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) - (repeat, loopfunc) - Lisp_Object repeat, loopfunc; + (Lisp_Object repeat, Lisp_Object loopfunc) { if (NILP (current_kboard->defining_kbd_macro)) error ("Not defining kbd macro"); @@ -194,8 +192,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) /* Store character c into kbd macro being defined */ void -store_kbd_macro_char (c) - Lisp_Object c; +store_kbd_macro_char (Lisp_Object c) { struct kboard *kb = current_kboard; @@ -223,7 +220,7 @@ store_kbd_macro_char (c) really belong to it. This is done in between editor commands. */ void -finalize_kbd_macro_chars () +finalize_kbd_macro_chars (void) { current_kboard->kbd_macro_end = current_kboard->kbd_macro_ptr; } @@ -231,7 +228,7 @@ finalize_kbd_macro_chars () DEFUN ("cancel-kbd-macro-events", Fcancel_kbd_macro_events, Scancel_kbd_macro_events, 0, 0, 0, doc: /* Cancel the events added to a keyboard macro for this command. */) - () + (void) { current_kboard->kbd_macro_ptr = current_kboard->kbd_macro_end; return Qnil; @@ -240,8 +237,7 @@ DEFUN ("cancel-kbd-macro-events", Fcancel_kbd_macro_events, DEFUN ("store-kbd-macro-event", Fstore_kbd_macro_event, Sstore_kbd_macro_event, 1, 1, 0, doc: /* Store EVENT into the keyboard macro being defined. */) - (event) - Lisp_Object event; + (Lisp_Object event) { store_kbd_macro_char (event); return Qnil; @@ -258,8 +254,7 @@ defining others, use \\[name-last-kbd-macro]. In Lisp, optional second arg LOOPFUNC may be a function that is called prior to each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) - (prefix, loopfunc) - Lisp_Object prefix, loopfunc; + (Lisp_Object prefix, Lisp_Object loopfunc) { /* Don't interfere with recognition of the previous command from before this macro started. */ @@ -286,8 +281,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) Called when the unwind-protect in Fexecute_kbd_macro gets invoked. */ static Lisp_Object -pop_kbd_macro (info) - Lisp_Object info; +pop_kbd_macro (Lisp_Object info) { Lisp_Object tem; Vexecuting_kbd_macro = XCAR (info); @@ -305,8 +299,7 @@ COUNT is a repeat count, or nil for once, or 0 for infinite loop. Optional third arg LOOPFUNC may be a function that is called prior to each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) - (macro, count, loopfunc) - Lisp_Object macro, count, loopfunc; + (Lisp_Object macro, Lisp_Object count, Lisp_Object loopfunc) { Lisp_Object final; Lisp_Object tem; @@ -367,14 +360,14 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) } void -init_macros () +init_macros (void) { Vexecuting_kbd_macro = Qnil; executing_kbd_macro = Qnil; } void -syms_of_macros () +syms_of_macros (void) { Qexecute_kbd_macro = intern_c_string ("execute-kbd-macro"); staticpro (&Qexecute_kbd_macro); diff --git a/src/macros.h b/src/macros.h index 00b7b5ba421..761b5fdf514 100644 --- a/src/macros.h +++ b/src/macros.h @@ -41,16 +41,16 @@ extern Lisp_Object executing_kbd_macro; /* Finish defining the current keyboard macro. */ -extern void end_kbd_macro P_ ((void)); +extern void end_kbd_macro (void); /* Declare that all chars stored so far in the kbd macro being defined really belong to it. This is done in between editor commands. */ -extern void finalize_kbd_macro_chars P_ ((void)); +extern void finalize_kbd_macro_chars (void); /* Store a character into kbd macro being defined */ -extern void store_kbd_macro_char P_ ((Lisp_Object)); +extern void store_kbd_macro_char (Lisp_Object); /* arch-tag: 8edb7088-682f-4d1f-a4d9-0fbb7284234e (do not change this comment) */ diff --git a/src/makefile.w32-in b/src/makefile.w32-in index e8d08727915..c938ae752bf 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -965,6 +965,7 @@ $(BLD)/keyboard.$(O) : \ $(SRC)/keyboard.h \ $(SRC)/keymap.h \ $(SRC)/macros.h \ + $(SRC)/process.h \ $(SRC)/puresize.h \ $(SRC)/syntax.h \ $(SRC)/syssignal.h \ diff --git a/src/marker.c b/src/marker.c index b3381f9c369..911d2e57706 100644 --- a/src/marker.c +++ b/src/marker.c @@ -32,15 +32,14 @@ static int cached_bytepos; static struct buffer *cached_buffer; static int cached_modiff; -static void byte_char_debug_check P_ ((struct buffer *, int, int)); +static void byte_char_debug_check (struct buffer *, int, int); /* Nonzero means enable debugging checks on byte/char correspondences. */ static int byte_debug_flag; void -clear_charpos_cache (b) - struct buffer *b; +clear_charpos_cache (struct buffer *b) { if (cached_buffer == b) cached_buffer = 0; @@ -100,9 +99,7 @@ clear_charpos_cache (b) } static void -byte_char_debug_check (b, charpos, bytepos) - struct buffer *b; - int charpos, bytepos; +byte_char_debug_check (struct buffer *b, int charpos, int bytepos) { int nchars = 0; @@ -122,16 +119,13 @@ byte_char_debug_check (b, charpos, bytepos) } int -charpos_to_bytepos (charpos) - int charpos; +charpos_to_bytepos (int charpos) { return buf_charpos_to_bytepos (current_buffer, charpos); } int -buf_charpos_to_bytepos (b, charpos) - struct buffer *b; - int charpos; +buf_charpos_to_bytepos (struct buffer *b, int charpos) { struct Lisp_Marker *tail; int best_above, best_above_byte; @@ -254,8 +248,7 @@ buf_charpos_to_bytepos (b, charpos) in the simplest, most reliable way. */ int -verify_bytepos (charpos) - int charpos; +verify_bytepos (int charpos) { int below = 1; int below_byte = 1; @@ -315,16 +308,13 @@ verify_bytepos (charpos) } int -bytepos_to_charpos (bytepos) - int bytepos; +bytepos_to_charpos (int bytepos) { return buf_bytepos_to_charpos (current_buffer, bytepos); } int -buf_bytepos_to_charpos (b, bytepos) - struct buffer *b; - int bytepos; +buf_bytepos_to_charpos (struct buffer *b, int bytepos) { struct Lisp_Marker *tail; int best_above, best_above_byte; @@ -443,8 +433,7 @@ buf_bytepos_to_charpos (b, bytepos) DEFUN ("marker-buffer", Fmarker_buffer, Smarker_buffer, 1, 1, 0, doc: /* Return the buffer that MARKER points into, or nil if none. Returns nil if MARKER points into a dead buffer. */) - (marker) - register Lisp_Object marker; + (register Lisp_Object marker) { register Lisp_Object buf; CHECK_MARKER (marker); @@ -464,8 +453,7 @@ Returns nil if MARKER points into a dead buffer. */) DEFUN ("marker-position", Fmarker_position, Smarker_position, 1, 1, 0, doc: /* Return the position MARKER points at, as a character number. Returns nil if MARKER points nowhere. */) - (marker) - Lisp_Object marker; + (Lisp_Object marker) { CHECK_MARKER (marker); if (XMARKER (marker)->buffer) @@ -480,8 +468,7 @@ BUFFER defaults to the current buffer. If POSITION is nil, makes marker point nowhere. Then it no longer slows down editing in any buffer. Returns MARKER. */) - (marker, position, buffer) - Lisp_Object marker, position, buffer; + (Lisp_Object marker, Lisp_Object position, Lisp_Object buffer) { register int charno, bytepos; register struct buffer *b; @@ -556,8 +543,7 @@ Returns MARKER. */) be outside the visible part. */ Lisp_Object -set_marker_restricted (marker, pos, buffer) - Lisp_Object marker, pos, buffer; +set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer) { register int charno, bytepos; register struct buffer *b; @@ -632,9 +618,7 @@ set_marker_restricted (marker, pos, buffer) character position and the corresponding byte position. */ Lisp_Object -set_marker_both (marker, buffer, charpos, bytepos) - Lisp_Object marker, buffer; - int charpos, bytepos; +set_marker_both (Lisp_Object marker, Lisp_Object buffer, int charpos, int bytepos) { register struct buffer *b; register struct Lisp_Marker *m; @@ -682,9 +666,7 @@ set_marker_both (marker, buffer, charpos, bytepos) be outside the visible part. */ Lisp_Object -set_marker_restricted_both (marker, buffer, charpos, bytepos) - Lisp_Object marker, buffer; - int charpos, bytepos; +set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, int charpos, int bytepos) { register struct buffer *b; register struct Lisp_Marker *m; @@ -745,8 +727,7 @@ set_marker_restricted_both (marker, buffer, charpos, bytepos) including those in chain fields of markers. */ void -unchain_marker (marker) - register struct Lisp_Marker *marker; +unchain_marker (register struct Lisp_Marker *marker) { register struct Lisp_Marker *tail, *prev, *next; register struct buffer *b; @@ -796,8 +777,7 @@ unchain_marker (marker) /* Return the char position of marker MARKER, as a C integer. */ int -marker_position (marker) - Lisp_Object marker; +marker_position (Lisp_Object marker) { register struct Lisp_Marker *m = XMARKER (marker); register struct buffer *buf = m->buffer; @@ -811,8 +791,7 @@ marker_position (marker) /* Return the byte position of marker MARKER, as a C integer. */ int -marker_byte_position (marker) - Lisp_Object marker; +marker_byte_position (Lisp_Object marker) { register struct Lisp_Marker *m = XMARKER (marker); register struct buffer *buf = m->buffer; @@ -833,8 +812,7 @@ If argument is a number, makes a new marker pointing at that position in the current buffer. The optional argument TYPE specifies the insertion type of the new marker; see `marker-insertion-type'. */) - (marker, type) - register Lisp_Object marker, type; + (register Lisp_Object marker, Lisp_Object type) { register Lisp_Object new; @@ -851,8 +829,7 @@ DEFUN ("marker-insertion-type", Fmarker_insertion_type, Smarker_insertion_type, 1, 1, 0, doc: /* Return insertion type of MARKER: t if it stays after inserted text. The value nil means the marker stays before text inserted there. */) - (marker) - register Lisp_Object marker; + (register Lisp_Object marker) { CHECK_MARKER (marker); return XMARKER (marker)->insertion_type ? Qt : Qnil; @@ -863,8 +840,7 @@ DEFUN ("set-marker-insertion-type", Fset_marker_insertion_type, doc: /* Set the insertion-type of MARKER to TYPE. If TYPE is t, it means the marker advances when you insert text at it. If TYPE is nil, it means the marker stays behind when you insert text at it. */) - (marker, type) - Lisp_Object marker, type; + (Lisp_Object marker, Lisp_Object type) { CHECK_MARKER (marker); @@ -875,8 +851,7 @@ If TYPE is nil, it means the marker stays behind when you insert text at it. */ DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, Sbuffer_has_markers_at, 1, 1, 0, doc: /* Return t if there are markers pointing at POSITION in the current buffer. */) - (position) - Lisp_Object position; + (Lisp_Object position) { register struct Lisp_Marker *tail; register int charno; @@ -898,8 +873,7 @@ DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, Sbuffer_has_markers_at, /* For debugging -- count the markers in buffer BUF. */ int -count_markers (buf) - struct buffer *buf; +count_markers (struct buffer *buf) { int total = 0; struct Lisp_Marker *tail; @@ -911,7 +885,7 @@ count_markers (buf) } void -syms_of_marker () +syms_of_marker (void) { defsubr (&Smarker_position); defsubr (&Smarker_buffer); diff --git a/src/md5.c b/src/md5.c index 37ae2e6acb5..1840c2ac92b 100644 --- a/src/md5.c +++ b/src/md5.c @@ -71,8 +71,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ void -md5_init_ctx (ctx) - struct md5_ctx *ctx; +md5_init_ctx (struct md5_ctx *ctx) { ctx->A = 0x67452301; ctx->B = 0xefcdab89; @@ -89,9 +88,7 @@ md5_init_ctx (ctx) IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * -md5_read_ctx (ctx, resbuf) - const struct md5_ctx *ctx; - void *resbuf; +md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) { ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A); ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B); @@ -107,9 +104,7 @@ md5_read_ctx (ctx, resbuf) IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * -md5_finish_ctx (ctx, resbuf) - struct md5_ctx *ctx; - void *resbuf; +md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) { /* Take yet unprocessed bytes into account. */ md5_uint32 bytes = ctx->buflen; @@ -138,9 +133,7 @@ md5_finish_ctx (ctx, resbuf) resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ int -md5_stream (stream, resblock) - FILE *stream; - void *resblock; +md5_stream (FILE *stream, void *resblock) { /* Important: BLOCKSIZE must be a multiple of 64. */ #define BLOCKSIZE 4096 @@ -195,10 +188,7 @@ md5_stream (stream, resblock) output yields to the wanted ASCII representation of the message digest. */ void * -md5_buffer (buffer, len, resblock) - const char *buffer; - size_t len; - void *resblock; +md5_buffer (const char *buffer, size_t len, void *resblock) { struct md5_ctx ctx; @@ -214,10 +204,7 @@ md5_buffer (buffer, len, resblock) void -md5_process_bytes (buffer, len, ctx) - const void *buffer; - size_t len; - struct md5_ctx *ctx; +md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) { /* const void aligned_buffer = buffer; */ @@ -287,10 +274,7 @@ md5_process_bytes (buffer, len, ctx) It is assumed that LEN % 64 == 0. */ void -md5_process_block (buffer, len, ctx) - const void *buffer; - size_t len; - struct md5_ctx *ctx; +md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx) { md5_uint32 correct_words[16]; const md5_uint32 *words = buffer; diff --git a/src/md5.h b/src/md5.h index a23dbd089ba..cf9566b864b 100644 --- a/src/md5.h +++ b/src/md5.h @@ -97,21 +97,21 @@ struct md5_ctx /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ -extern void md5_init_ctx __P ((struct md5_ctx *ctx)); +extern void md5_init_ctx (struct md5_ctx *ctx); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is necessary that LEN is a multiple of 64!!! */ -extern void md5_process_block __P ((const void *buffer, size_t len, - struct md5_ctx *ctx)); +extern void md5_process_block (const void *buffer, size_t len, + struct md5_ctx *ctx); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ -extern void md5_process_bytes __P ((const void *buffer, size_t len, - struct md5_ctx *ctx)); +extern void md5_process_bytes (const void *buffer, size_t len, + struct md5_ctx *ctx); /* Process the remaining bytes in the buffer and put result from CTX in first 16 bytes following RESBUF. The result is always in little @@ -120,7 +120,7 @@ extern void md5_process_bytes __P ((const void *buffer, size_t len, IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ -extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf)); +extern void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf); /* Put result from CTX in first 16 bytes following RESBUF. The result is @@ -129,20 +129,20 @@ extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf)); IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ -extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf)); +extern void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf); /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ -extern int md5_stream __P ((FILE *stream, void *resblock)); +extern int md5_stream (FILE *stream, void *resblock); /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ -extern void *md5_buffer __P ((const char *buffer, size_t len, - void *resblock)); +extern void *md5_buffer (const char *buffer, size_t len, + void *resblock); #endif /* md5.h */ diff --git a/src/mem-limits.h b/src/mem-limits.h index d811968b13f..a550e1464b8 100644 --- a/src/mem-limits.h +++ b/src/mem-limits.h @@ -25,17 +25,6 @@ extern int etext; /* Some systems need this before <sys/resource.h>. */ #include <sys/types.h> -#ifdef _LIBC - -#include <sys/resource.h> -#define BSD4_2 /* Tell code below to use getrlimit. */ - -/* Old Linux startup code won't define __data_start. */ -extern int etext, __data_start; weak_extern (__data_start) -#define start_of_data() (&__data_start ?: &etext) - -#else /* not _LIBC */ - #ifdef HAVE_SYS_RESOURCE_H # include <sys/time.h> # include <sys/resource.h> @@ -49,20 +38,11 @@ extern int etext, __data_start; weak_extern (__data_start) #define BSD4_2 #endif -#ifndef BSD4_2 -#ifndef USG -#ifndef MSDOS -#ifndef WINDOWSNT -#include <sys/vlimit.h> -#endif /* not WINDOWSNT */ -#endif /* not MSDOS */ -#endif /* not USG */ -#else /* if BSD4_2 */ +#ifdef BSD4_2 #include <sys/time.h> #include <sys/resource.h> #endif /* BSD4_2 */ -#ifdef emacs /* The important properties of this type are that 1) it's a pointer, and 2) arithmetic on it should work as if the size of the object pointed to has a size of 1. */ @@ -75,7 +55,7 @@ typedef unsigned long SIZE; #endif #define NULL ((POINTER) 0) -extern POINTER start_of_data (); +extern POINTER start_of_data (void); #if defined USE_LSB_TAG #define EXCEEDS_LISP_PTR(ptr) 0 #elif defined DATA_SEG_BITS @@ -85,26 +65,5 @@ extern POINTER start_of_data (); #define EXCEEDS_LISP_PTR(ptr) ((EMACS_UINT) (ptr) >> VALBITS) #endif -#ifdef DATA_START -#define start_of_data() ((char *)DATA_START) -#endif - -#ifdef BSD_SYSTEM -#ifndef DATA_SEG_BITS -#ifndef DATA_START -extern char etext; -#define start_of_data() &etext -#endif -#endif -#endif - -#else /* not emacs */ -extern char etext; -#define start_of_data() &etext -#endif /* not emacs */ - -#endif /* not _LIBC */ - - /* arch-tag: fe39244e-e54f-4208-b7aa-02556f7841c5 (do not change this comment) */ diff --git a/src/menu.c b/src/menu.c index ca00c06a98b..321dc2677a1 100644 --- a/src/menu.c +++ b/src/menu.c @@ -87,7 +87,7 @@ int menu_items_n_panes; static int menu_items_submenu_depth; void -init_menu_items () +init_menu_items (void) { if (!NILP (menu_items_inuse)) error ("Trying to use a menu from within a menu-entry"); @@ -107,13 +107,12 @@ init_menu_items () /* Call at the end of generating the data in menu_items. */ void -finish_menu_items () +finish_menu_items (void) { } Lisp_Object -unuse_menu_items (dummy) - Lisp_Object dummy; +unuse_menu_items (Lisp_Object dummy) { return menu_items_inuse = Qnil; } @@ -122,7 +121,7 @@ unuse_menu_items (dummy) in menu_items. */ void -discard_menu_items () +discard_menu_items (void) { /* Free the structure if it is especially large. Otherwise, hold on to it, to save time. */ @@ -134,19 +133,20 @@ discard_menu_items () xassert (NILP (menu_items_inuse)); } +#ifdef HAVE_NS static Lisp_Object cleanup_popup_menu (Lisp_Object arg) { discard_menu_items (); return Qnil; } +#endif /* This undoes save_menu_items, and it is called by the specpdl unwind mechanism. */ static Lisp_Object -restore_menu_items (saved) - Lisp_Object saved; +restore_menu_items (Lisp_Object saved) { menu_items = XCAR (saved); menu_items_inuse = (! NILP (menu_items) ? Qt : Qnil); @@ -164,7 +164,7 @@ restore_menu_items (saved) It will be restored when the specpdl is unwound. */ void -save_menu_items () +save_menu_items (void) { Lisp_Object saved = list4 (!NILP (menu_items_inuse) ? menu_items : Qnil, make_number (menu_items_used), @@ -179,7 +179,7 @@ save_menu_items () /* Make the menu_items vector twice as large. */ static void -grow_menu_items () +grow_menu_items (void) { menu_items_allocated *= 2; menu_items = larger_vector (menu_items, menu_items_allocated, Qnil); @@ -188,7 +188,7 @@ grow_menu_items () /* Begin a submenu. */ static void -push_submenu_start () +push_submenu_start (void) { if (menu_items_used + 1 > menu_items_allocated) grow_menu_items (); @@ -200,7 +200,7 @@ push_submenu_start () /* End a submenu. */ static void -push_submenu_end () +push_submenu_end (void) { if (menu_items_used + 1 > menu_items_allocated) grow_menu_items (); @@ -212,7 +212,7 @@ push_submenu_end () /* Indicate boundary between left and right. */ static void -push_left_right_boundary () +push_left_right_boundary (void) { if (menu_items_used + 1 > menu_items_allocated) grow_menu_items (); @@ -224,8 +224,7 @@ push_left_right_boundary () NAME is the pane name. PREFIX_VEC is a prefix key for this pane. */ static void -push_menu_pane (name, prefix_vec) - Lisp_Object name, prefix_vec; +push_menu_pane (Lisp_Object name, Lisp_Object prefix_vec) { if (menu_items_used + MENU_ITEMS_PANE_LENGTH > menu_items_allocated) grow_menu_items (); @@ -246,8 +245,7 @@ push_menu_pane (name, prefix_vec) item, one of nil, `toggle' or `radio'. */ static void -push_menu_item (name, enable, key, def, equiv, type, selected, help) - Lisp_Object name, enable, key, def, equiv, type, selected, help; +push_menu_item (Lisp_Object name, Lisp_Object enable, Lisp_Object key, Lisp_Object def, Lisp_Object equiv, Lisp_Object type, Lisp_Object selected, Lisp_Object help) { if (menu_items_used + MENU_ITEMS_ITEM_LENGTH > menu_items_allocated) grow_menu_items (); @@ -272,8 +270,8 @@ struct skp int notbuttons; }; -static void single_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, - void *)); +static void single_menu_item (Lisp_Object, Lisp_Object, Lisp_Object, + void *); /* This is a recursive subroutine of keymap_panes. It handles one keymap, KEYMAP. @@ -332,9 +330,7 @@ single_keymap_panes (Lisp_Object keymap, Lisp_Object pane_name, If we encounter submenus deeper than SKP->MAXDEPTH levels, ignore them. */ static void -single_menu_item (key, item, dummy, skp_v) - Lisp_Object key, item, dummy; - void *skp_v; +single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *skp_v) { Lisp_Object map, item_string, enabled; struct gcpro gcpro1, gcpro2; @@ -456,9 +452,7 @@ single_menu_item (key, item, dummy, skp_v) and generate menu panes for them in menu_items. */ static void -keymap_panes (keymaps, nmaps) - Lisp_Object *keymaps; - int nmaps; +keymap_panes (Lisp_Object *keymaps, int nmaps) { int mapno; @@ -477,8 +471,7 @@ keymap_panes (keymaps, nmaps) /* Push the items in a single pane defined by the alist PANE. */ static void -list_of_items (pane) - Lisp_Object pane; +list_of_items (Lisp_Object pane) { Lisp_Object tail, item, item1; @@ -505,8 +498,7 @@ list_of_items (pane) alist-of-alists MENU. This handles old-fashioned calls to x-popup-menu. */ void -list_of_panes (menu) - Lisp_Object menu; +list_of_panes (Lisp_Object menu) { Lisp_Object tail; @@ -531,8 +523,7 @@ list_of_panes (menu) whose event type is ITEM_KEY (with string ITEM_NAME) and whose contents come from the list of keymaps MAPS. */ int -parse_single_submenu (item_key, item_name, maps) - Lisp_Object item_key, item_name, maps; +parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name, Lisp_Object maps) { Lisp_Object length; int len; @@ -583,7 +574,7 @@ parse_single_submenu (item_key, item_name, maps) /* Allocate a widget_value, blocking input. */ widget_value * -xmalloc_widget_value () +xmalloc_widget_value (void) { widget_value *value; @@ -600,8 +591,7 @@ xmalloc_widget_value () must be left alone. */ void -free_menubar_widget_value_tree (wv) - widget_value *wv; +free_menubar_widget_value_tree (widget_value *wv) { if (! wv) return; @@ -627,8 +617,7 @@ free_menubar_widget_value_tree (wv) in menu_items starting at index START, up to index END. */ widget_value * -digest_single_submenu (start, end, top_level_items) - int start, end, top_level_items; +digest_single_submenu (int start, int end, int top_level_items) { widget_value *wv, *prev_wv, *save_wv, *first_wv; int i; @@ -856,8 +845,7 @@ digest_single_submenu (start, end, top_level_items) tree is constructed, and small strings are relocated. So we must wait until no GC can happen before storing pointers into lisp values. */ void -update_submenu_strings (first_wv) - widget_value *first_wv; +update_submenu_strings (widget_value *first_wv) { widget_value *wv; @@ -891,11 +879,7 @@ update_submenu_strings (first_wv) VECTOR is an array of menu events for the whole menu. */ void -find_and_call_menu_selection (f, menu_bar_items_used, vector, client_data) - FRAME_PTR f; - int menu_bar_items_used; - Lisp_Object vector; - void *client_data; +find_and_call_menu_selection (FRAME_PTR f, int menu_bar_items_used, Lisp_Object vector, void *client_data) { Lisp_Object prefix, entry; Lisp_Object *subprefix_stack; @@ -1082,8 +1066,7 @@ keyboard input, then this normally results in a quit and `x-popup-menu' does not return. But if POSITION is a mouse button event (indicating that the user invoked the menu with the mouse) then no quit occurs and `x-popup-menu' returns nil. */) - (position, menu) - Lisp_Object position, menu; + (Lisp_Object position, Lisp_Object menu) { Lisp_Object keymap, tem; int xpos = 0, ypos = 0; @@ -1164,12 +1147,12 @@ no quit occurs and `x-popup-menu' returns nil. */) Lisp_Object bar_window; enum scroll_bar_part part; unsigned long time; - void (*mouse_position_hook) P_ ((struct frame **, int, - Lisp_Object *, - enum scroll_bar_part *, - Lisp_Object *, - Lisp_Object *, - unsigned long *)) = + void (*mouse_position_hook) (struct frame **, int, + Lisp_Object *, + enum scroll_bar_part *, + Lisp_Object *, + Lisp_Object *, + unsigned long *) = FRAME_TERMINAL (new_f)->mouse_position_hook; if (mouse_position_hook) @@ -1368,7 +1351,7 @@ no quit occurs and `x-popup-menu' returns nil. */) } void -syms_of_menu () +syms_of_menu (void) { staticpro (&menu_items); menu_items = Qnil; diff --git a/src/menu.h b/src/menu.h index 5f3c3d24e22..eff6f5ddf70 100644 --- a/src/menu.h +++ b/src/menu.h @@ -21,17 +21,17 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ extern Lisp_Object Vmenu_updating_frame; -extern void init_menu_items P_ ((void)); -extern void finish_menu_items P_ ((void)); -extern void discard_menu_items P_ ((void)); -extern void save_menu_items P_ ((void)); -extern int parse_single_submenu P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); -extern void list_of_panes P_ ((Lisp_Object)); +extern void init_menu_items (void); +extern void finish_menu_items (void); +extern void discard_menu_items (void); +extern void save_menu_items (void); +extern int parse_single_submenu (Lisp_Object, Lisp_Object, Lisp_Object); +extern void list_of_panes (Lisp_Object); #if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI) -extern void free_menubar_widget_value_tree P_ ((widget_value *)); -extern void update_submenu_strings P_ ((widget_value *)); -extern void find_and_call_menu_selection P_ ((FRAME_PTR, int, - Lisp_Object, void *)); +extern void free_menubar_widget_value_tree (widget_value *); +extern void update_submenu_strings (widget_value *); +extern void find_and_call_menu_selection (FRAME_PTR, int, + Lisp_Object, void *); #endif #ifdef HAVE_X_WINDOWS diff --git a/src/minibuf.c b/src/minibuf.c index 539a953f7ee..5dc7b0b1f06 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -154,7 +154,7 @@ extern Lisp_Object Qfield; or when a minibuffer exits. */ void -choose_minibuf_frame () +choose_minibuf_frame (void) { if (FRAMEP (selected_frame) && FRAME_LIVE_P (XFRAME (selected_frame)) @@ -193,8 +193,7 @@ choose_minibuf_frame () } Lisp_Object -choose_minibuf_frame_1 (ignore) - Lisp_Object ignore; +choose_minibuf_frame_1 (Lisp_Object ignore) { choose_minibuf_frame (); return Qnil; @@ -205,8 +204,7 @@ DEFUN ("set-minibuffer-window", Fset_minibuffer_window, doc: /* Specify which minibuffer window to use for the minibuffer. This affects where the minibuffer is displayed if you put text in it without invoking the usual minibuffer commands. */) - (window) - Lisp_Object window; + (Lisp_Object window) { CHECK_WINDOW (window); if (! MINI_WINDOW_P (XWINDOW (window))) @@ -220,27 +218,26 @@ without invoking the usual minibuffer commands. */) /* Actual minibuffer invocation. */ -static Lisp_Object read_minibuf_unwind P_ ((Lisp_Object)); -static Lisp_Object run_exit_minibuf_hook P_ ((Lisp_Object)); -static Lisp_Object read_minibuf P_ ((Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object, - int, Lisp_Object, - Lisp_Object, Lisp_Object, - int, int)); -static Lisp_Object read_minibuf_noninteractive P_ ((Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object, - int, Lisp_Object, - Lisp_Object, Lisp_Object, - int, int)); -static Lisp_Object string_to_object P_ ((Lisp_Object, Lisp_Object)); +static Lisp_Object read_minibuf_unwind (Lisp_Object); +static Lisp_Object run_exit_minibuf_hook (Lisp_Object); +static Lisp_Object read_minibuf (Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object, + int, Lisp_Object, + Lisp_Object, Lisp_Object, + int, int); +static Lisp_Object read_minibuf_noninteractive (Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object, + int, Lisp_Object, + Lisp_Object, Lisp_Object, + int, int); +static Lisp_Object string_to_object (Lisp_Object, Lisp_Object); /* Read a Lisp object from VAL and return it. If VAL is an empty string, and DEFALT is a string, read from DEFALT instead of VAL. */ static Lisp_Object -string_to_object (val, defalt) - Lisp_Object val, defalt; +string_to_object (Lisp_Object val, Lisp_Object defalt) { struct gcpro gcpro1, gcpro2; Lisp_Object expr_and_pos; @@ -281,19 +278,12 @@ string_to_object (val, defalt) from read_minibuf to do the job if noninteractive. */ static Lisp_Object -read_minibuf_noninteractive (map, initial, prompt, backup_n, expflag, - histvar, histpos, defalt, allow_props, - inherit_input_method) - Lisp_Object map; - Lisp_Object initial; - Lisp_Object prompt; - Lisp_Object backup_n; - int expflag; - Lisp_Object histvar; - Lisp_Object histpos; - Lisp_Object defalt; - int allow_props; - int inherit_input_method; +read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial, + Lisp_Object prompt, Lisp_Object backup_n, + int expflag, + Lisp_Object histvar, Lisp_Object histpos, + Lisp_Object defalt, + int allow_props, int inherit_input_method) { int size, len; char *line, *s; @@ -342,8 +332,7 @@ DEFUN ("minibufferp", Fminibufferp, doc: /* Return t if BUFFER is a minibuffer. No argument or nil as argument means use current buffer as BUFFER. BUFFER can be a buffer or a buffer name. */) - (buffer) - Lisp_Object buffer; + (Lisp_Object buffer) { Lisp_Object tem; @@ -362,7 +351,7 @@ DEFUN ("minibuffer-prompt-end", Fminibuffer_prompt_end, Sminibuffer_prompt_end, 0, 0, 0, doc: /* Return the buffer position of the end of the minibuffer prompt. Return (point-min) if current buffer is not a minibuffer. */) - () + (void) { /* This function is written to be most efficient when there's a prompt. */ Lisp_Object beg, end, tem; @@ -384,7 +373,7 @@ DEFUN ("minibuffer-contents", Fminibuffer_contents, Sminibuffer_contents, 0, 0, 0, doc: /* Return the user input in a minibuffer as a string. If the current buffer is not a minibuffer, return its entire contents. */) - () + (void) { int prompt_end = XINT (Fminibuffer_prompt_end ()); return make_buffer_string (prompt_end, ZV, 1); @@ -394,7 +383,7 @@ DEFUN ("minibuffer-contents-no-properties", Fminibuffer_contents_no_properties, Sminibuffer_contents_no_properties, 0, 0, 0, doc: /* Return the user input in a minibuffer as a string, without text-properties. If the current buffer is not a minibuffer, return its entire contents. */) - () + (void) { int prompt_end = XINT (Fminibuffer_prompt_end ()); return make_buffer_string (prompt_end, ZV, 0); @@ -405,7 +394,7 @@ DEFUN ("minibuffer-completion-contents", Fminibuffer_completion_contents, doc: /* Return the user input in a minibuffer before point as a string. That is what completion commands operate on. If the current buffer is not a minibuffer, return its entire contents. */) - () + (void) { int prompt_end = XINT (Fminibuffer_prompt_end ()); if (PT < prompt_end) @@ -438,18 +427,10 @@ If the current buffer is not a minibuffer, return its entire contents. */) current input method. */ static Lisp_Object -read_minibuf (map, initial, prompt, backup_n, expflag, - histvar, histpos, defalt, allow_props, inherit_input_method) - Lisp_Object map; - Lisp_Object initial; - Lisp_Object prompt; - Lisp_Object backup_n; - int expflag; - Lisp_Object histvar; - Lisp_Object histpos; - Lisp_Object defalt; - int allow_props; - int inherit_input_method; +read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, + Lisp_Object backup_n, int expflag, + Lisp_Object histvar, Lisp_Object histpos, Lisp_Object defalt, + int allow_props, int inherit_input_method) { Lisp_Object val; int count = SPECPDL_INDEX (); @@ -839,12 +820,11 @@ read_minibuf (map, initial, prompt, backup_n, expflag, used for nonrecursive minibuffer invocations */ Lisp_Object -get_minibuffer (depth) - int depth; +get_minibuffer (int depth) { Lisp_Object tail, num, buf; char name[24]; - extern Lisp_Object nconc2 (); + extern Lisp_Object nconc2 (Lisp_Object, Lisp_Object); XSETFASTINT (num, depth); tail = Fnthcdr (num, Vminibuffer_list); @@ -884,8 +864,7 @@ get_minibuffer (depth) } static Lisp_Object -run_exit_minibuf_hook (data) - Lisp_Object data; +run_exit_minibuf_hook (Lisp_Object data) { if (!NILP (Vminibuffer_exit_hook) && !EQ (Vminibuffer_exit_hook, Qunbound) && !NILP (Vrun_hooks)) @@ -898,8 +877,7 @@ run_exit_minibuf_hook (data) not, and it restores the current window, buffer, etc. */ static Lisp_Object -read_minibuf_unwind (data) - Lisp_Object data; +read_minibuf_unwind (Lisp_Object data) { Lisp_Object old_deactivate_mark; Lisp_Object window; @@ -1001,9 +979,7 @@ POSITION in the minibuffer. Any integer value less than or equal to one puts point at the beginning of the string. *Note* that this behavior differs from the way such arguments are used in `completing-read' and some related functions, which use zero-indexing for POSITION. */) - (prompt, initial_contents, keymap, read, hist, default_value, inherit_input_method) - Lisp_Object prompt, initial_contents, keymap, read, hist, default_value; - Lisp_Object inherit_input_method; + (Lisp_Object prompt, Lisp_Object initial_contents, Lisp_Object keymap, Lisp_Object read, Lisp_Object hist, Lisp_Object default_value, Lisp_Object inherit_input_method) { Lisp_Object histvar, histpos, val; struct gcpro gcpro1; @@ -1045,8 +1021,7 @@ Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS is a string to insert in the minibuffer before reading. \(INITIAL-CONTENTS can also be a cons of a string and an integer. Such arguments are used as in `read-from-minibuffer'.) */) - (prompt, initial_contents) - Lisp_Object prompt, initial_contents; + (Lisp_Object prompt, Lisp_Object initial_contents) { CHECK_STRING (prompt); return read_minibuf (Vminibuffer_local_map, initial_contents, @@ -1060,8 +1035,7 @@ Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS is a string to insert in the minibuffer before reading. \(INITIAL-CONTENTS can also be a cons of a string and an integer. Such arguments are used as in `read-from-minibuffer'.) */) - (prompt, initial_contents) - Lisp_Object prompt, initial_contents; + (Lisp_Object prompt, Lisp_Object initial_contents) { return Feval (read_minibuf (Vread_expression_map, initial_contents, prompt, Qnil, 1, Qread_expression_history, @@ -1085,9 +1059,7 @@ Fourth arg DEFAULT-VALUE is the default value or the list of default values. empty string. Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits the current input method and the setting of `enable-multibyte-characters'. */) - (prompt, initial_input, history, default_value, inherit_input_method) - Lisp_Object prompt, initial_input, history, default_value; - Lisp_Object inherit_input_method; + (Lisp_Object prompt, Lisp_Object initial_input, Lisp_Object history, Lisp_Object default_value, Lisp_Object inherit_input_method) { Lisp_Object val; val = Fread_from_minibuffer (prompt, initial_input, Qnil, @@ -1108,8 +1080,7 @@ Such values are treated as in `read-from-minibuffer', but are normally not useful in this function.) Third arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits the current input method and the setting of`enable-multibyte-characters'. */) - (prompt, initial, inherit_input_method) - Lisp_Object prompt, initial, inherit_input_method; + (Lisp_Object prompt, Lisp_Object initial, Lisp_Object inherit_input_method) { CHECK_STRING (prompt); return read_minibuf (Vminibuffer_local_ns_map, initial, prompt, Qnil, @@ -1121,8 +1092,7 @@ DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0, doc: /* Read the name of a command and return as a symbol. Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element if it is a list. */) - (prompt, default_value) - Lisp_Object prompt, default_value; + (Lisp_Object prompt, Lisp_Object default_value) { Lisp_Object name, default_string; @@ -1144,8 +1114,7 @@ if it is a list. */) DEFUN ("read-function", Fread_function, Sread_function, 1, 1, 0, doc: /* One arg PROMPT, a string. Read the name of a function and return as a symbol. Prompt with PROMPT. */) - (prompt) - Lisp_Object prompt; + (Lisp_Object prompt) { return Fintern (Fcompleting_read (prompt, Vobarray, Qfboundp, Qt, Qnil, Qnil, Qnil, Qnil), Qnil); @@ -1157,8 +1126,7 @@ DEFUN ("read-variable", Fread_variable, Sread_variable, 1, 2, 0, Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element if it is a list. A user variable is one for which `user-variable-p' returns non-nil. */) - (prompt, default_value) - Lisp_Object prompt, default_value; + (Lisp_Object prompt, Lisp_Object default_value) { Lisp_Object name, default_string; @@ -1190,8 +1158,7 @@ If `read-buffer-completion-ignore-case' is non-nil, completion ignores case while reading the buffer name. If `read-buffer-function' is non-nil, this works by calling it as a function, instead of the usual behavior. */) - (prompt, def, require_match) - Lisp_Object prompt, def, require_match; + (Lisp_Object prompt, Lisp_Object def, Lisp_Object require_match) { Lisp_Object args[4], result; unsigned char *s; @@ -1249,8 +1216,7 @@ function, instead of the usual behavior. */) } static Lisp_Object -minibuf_conform_representation (string, basis) - Lisp_Object string, basis; +minibuf_conform_representation (Lisp_Object string, Lisp_Object basis) { if (STRING_MULTIBYTE (string) == STRING_MULTIBYTE (basis)) return string; @@ -1292,8 +1258,7 @@ or the symbol from the obarray. If COLLECTION is a hash-table, predicate is called with two arguments: the key and the value. Additionally to this predicate, `completion-regexp-list' is used to further constrain the set of candidates. */) - (string, collection, predicate) - Lisp_Object string, collection, predicate; + (Lisp_Object string, Lisp_Object collection, Lisp_Object predicate) { Lisp_Object bestmatch, tail, elt, eltstring; /* Size in bytes of BESTMATCH. */ @@ -1564,8 +1529,7 @@ is used to further constrain the set of candidates. An obsolete optional fourth argument HIDE-SPACES is still accepted for backward compatibility. If non-nil, strings in COLLECTION that start with a space are ignored unless STRING itself starts with a space. */) - (string, collection, predicate, hide_spaces) - Lisp_Object string, collection, predicate, hide_spaces; + (Lisp_Object string, Lisp_Object collection, Lisp_Object predicate, Lisp_Object hide_spaces) { Lisp_Object tail, elt, eltstring; Lisp_Object allmatches; @@ -1774,9 +1738,7 @@ If INHERIT-INPUT-METHOD is non-nil, the minibuffer inherits Completion ignores case if the ambient value of `completion-ignore-case' is non-nil. */) - (prompt, collection, predicate, require_match, initial_input, hist, def, inherit_input_method) - Lisp_Object prompt, collection, predicate, require_match, initial_input; - Lisp_Object hist, def, inherit_input_method; + (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method) { Lisp_Object val, histvar, histpos, position; Lisp_Object init; @@ -1843,7 +1805,7 @@ Completion ignores case if the ambient value of RETURN_UNGCPRO (unbind_to (count, val)); } -Lisp_Object Fassoc_string (); +Lisp_Object Fassoc_string (register Lisp_Object key, Lisp_Object list, Lisp_Object case_fold); /* Test whether TXT is an exact completion. */ DEFUN ("test-completion", Ftest_completion, Stest_completion, 2, 3, 0, @@ -1851,8 +1813,7 @@ DEFUN ("test-completion", Ftest_completion, Stest_completion, 2, 3, 0, Takes the same arguments as `all-completions' and `try-completion'. If COLLECTION is a function, it is called with three arguments: the values STRING, PREDICATE and `lambda'. */) - (string, collection, predicate) - Lisp_Object string, collection, predicate; + (Lisp_Object string, Lisp_Object collection, Lisp_Object predicate) { Lisp_Object regexps, tail, tem = Qnil; int i = 0; @@ -1970,8 +1931,7 @@ If the argument FLAG is nil, invoke `try-completion', if it's t, invoke The arguments STRING and PREDICATE are as in `try-completion', `all-completions', and `test-completion'. */) - (string, predicate, flag) - Lisp_Object string, predicate, flag; + (Lisp_Object string, Lisp_Object predicate, Lisp_Object flag) { if (NILP (flag)) return Ftry_completion (string, Vbuffer_alist, predicate); @@ -2015,9 +1975,7 @@ is ignored. Unlike `assoc', KEY can also match an entry in LIST consisting of a single string, rather than a cons cell whose car is a string. */) - (key, list, case_fold) - register Lisp_Object key; - Lisp_Object list, case_fold; + (register Lisp_Object key, Lisp_Object list, Lisp_Object case_fold) { register Lisp_Object tail; @@ -2046,7 +2004,7 @@ single string, rather than a cons cell whose car is a string. */) DEFUN ("minibuffer-depth", Fminibuffer_depth, Sminibuffer_depth, 0, 0, 0, doc: /* Return current depth of activations of minibuffer, a nonnegative integer. */) - () + (void) { return make_number (minibuf_level); } @@ -2054,21 +2012,21 @@ DEFUN ("minibuffer-depth", Fminibuffer_depth, Sminibuffer_depth, 0, 0, 0, DEFUN ("minibuffer-prompt", Fminibuffer_prompt, Sminibuffer_prompt, 0, 0, 0, doc: /* Return the prompt string of the currently-active minibuffer. If no minibuffer is active, return nil. */) - () + (void) { return Fcopy_sequence (minibuf_prompt); } void -init_minibuf_once () +init_minibuf_once (void) { Vminibuffer_list = Qnil; staticpro (&Vminibuffer_list); } void -syms_of_minibuf () +syms_of_minibuf (void) { minibuf_level = 0; minibuf_prompt = Qnil; diff --git a/src/mktime.c b/src/mktime.c index 20c1092a62a..3570cecd451 100644 --- a/src/mktime.c +++ b/src/mktime.c @@ -57,14 +57,6 @@ # define mktime my_mktime #endif /* DEBUG */ -#ifndef __P -# if defined __GNUC__ || (defined __STDC__ && __STDC__) -# define __P(args) args -# else -# define __P(args) () -# endif /* GCC. */ -#endif /* Not __P. */ - #ifndef CHAR_BIT # define CHAR_BIT 8 #endif diff --git a/src/msdos.c b/src/msdos.c index ea604d29992..8bfdce22fcd 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -35,7 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <sys/time.h> #include <dos.h> #include <errno.h> -#include <string.h> /* for bzero and string functions */ +#include <string.h> /* for memset and string functions */ #include <sys/stat.h> /* for _fixpath */ #include <unistd.h> /* for chdir, dup, dup2, etc. */ #include <dir.h> /* for getdisk */ @@ -102,7 +102,7 @@ int _crt0_startup_flags = (_CRT0_FLAG_UNIX_SBRK | _CRT0_FLAG_FILL_SBRK_MEMORY); #endif /* not SYSTEM_MALLOC */ static unsigned long -event_timestamp () +event_timestamp (void) { struct time t; unsigned long s; @@ -138,7 +138,7 @@ static int mouse_button_translate[NUM_MOUSE_BUTTONS]; static int mouse_button_count; void -mouse_on () +mouse_on (void) { union REGS regs; @@ -155,7 +155,7 @@ mouse_on () } void -mouse_off () +mouse_off (void) { union REGS regs; @@ -195,8 +195,7 @@ DEFUN ("msdos-set-mouse-buttons", Fmsdos_set_mouse_buttons, Smsdos_set_mouse_but This is useful with mice that report the number of buttons inconsistently, e.g., if the number of buttons is reported as 3, but Emacs only sees 2 of them. This happens with wheeled mice on Windows 9X, for example. */) - (nbuttons) - Lisp_Object nbuttons; + (Lisp_Object nbuttons) { int n; @@ -222,8 +221,7 @@ mouse_get_xy (int *x, int *y) } void -mouse_moveto (x, y) - int x, y; +mouse_moveto (int x, int y) { union REGS regs; struct tty_display_info *tty = CURTTY (); @@ -237,8 +235,7 @@ mouse_moveto (x, y) } static int -mouse_pressed (b, xp, yp) - int b, *xp, *yp; +mouse_pressed (int b, int *xp, int *yp) { union REGS regs; @@ -253,8 +250,7 @@ mouse_pressed (b, xp, yp) } static int -mouse_released (b, xp, yp) - int b, *xp, *yp; +mouse_released (int b, int *xp, int *yp) { union REGS regs; @@ -269,8 +265,7 @@ mouse_released (b, xp, yp) } static int -mouse_button_depressed (b, xp, yp) - int b, *xp, *yp; +mouse_button_depressed (int b, int *xp, int *yp) { union REGS regs; @@ -288,12 +283,9 @@ mouse_button_depressed (b, xp, yp) } void -mouse_get_pos (f, insist, bar_window, part, x, y, time) - FRAME_PTR *f; - int insist; - Lisp_Object *bar_window, *x, *y; - enum scroll_bar_part *part; - unsigned long *time; +mouse_get_pos (FRAME_PTR *f, int insist, Lisp_Object *bar_window, + enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, + unsigned long *time) { int ix, iy; Lisp_Object frame, tail; @@ -311,7 +303,7 @@ mouse_get_pos (f, insist, bar_window, part, x, y, time) } static void -mouse_check_moved () +mouse_check_moved (void) { int x, y; @@ -338,7 +330,7 @@ mouse_clear_clicks (void) } void -mouse_init () +mouse_init (void) { union REGS regs; struct tty_display_info *tty = CURTTY (); @@ -440,10 +432,7 @@ dosv_refresh_virtual_screen (int offset, int count) } static void -dos_direct_output (y, x, buf, len) - int x, y; - char *buf; - int len; +dos_direct_output (int y, int x, char *buf, int len) { int t0 = 2 * (x + y * screen_size_X); int t = t0 + (int) ScreenPrimary; @@ -510,8 +499,7 @@ vga_installed (void) ROWS x COLS frame. */ void -dos_set_window_size (rows, cols) - int *rows, *cols; +dos_set_window_size (int *rows, int *cols) { char video_name[30]; union REGS regs; @@ -620,7 +608,7 @@ dos_set_window_size (rows, cols) the mouse cursor may need to be refreshed. */ static void -mouse_off_maybe () +mouse_off_maybe (void) { int x, y; @@ -1864,10 +1852,7 @@ IT_copy_glyphs (int xfrom, int xto, size_t len, int ypos) /* Insert and delete glyphs. */ static void -IT_insert_glyphs (f, start, len) - struct frame *f; - register struct glyph *start; - register int len; +IT_insert_glyphs (struct frame *f, struct glyph *start, int len) { int shift_by_width = screen_size_X - (new_pos_X + len); @@ -1880,18 +1865,14 @@ IT_insert_glyphs (f, start, len) } static void -IT_delete_glyphs (f, n) - struct frame *f; - register int n; +IT_delete_glyphs (struct frame *f, int n) { abort (); } /* set-window-configuration on window.c needs this. */ void -x_set_menu_bar_lines (f, value, oldval) - struct frame *f; - Lisp_Object value, oldval; +x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { set_menu_bar_lines (f, value, oldval); } @@ -2063,8 +2044,7 @@ IT_set_terminal_window (struct frame *f, int foo) DEFUN ("msdos-remember-default-colors", Fmsdos_remember_default_colors, Smsdos_remember_default_colors, 1, 1, 0, doc: /* Remember the screen colors of the current frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { struct frame *f; @@ -2080,9 +2060,7 @@ DEFUN ("msdos-remember-default-colors", Fmsdos_remember_default_colors, } void -IT_set_frame_parameters (f, alist) - struct frame *f; - Lisp_Object alist; +IT_set_frame_parameters (struct frame *f, Lisp_Object alist) { Lisp_Object tail; int i, j, length = XINT (Flength (alist)); @@ -2092,33 +2070,23 @@ IT_set_frame_parameters (f, alist) = (Lisp_Object *) alloca (length * sizeof (Lisp_Object)); /* Do we have to reverse the foreground and background colors? */ int reverse = EQ (Fcdr (Fassq (Qreverse, f->param_alist)), Qt); - int need_to_reverse, was_reverse = reverse; int redraw = 0, fg_set = 0, bg_set = 0; unsigned long orig_fg, orig_bg; Lisp_Object frame_bg, frame_fg; - extern Lisp_Object Qdefault, QCforeground, QCbackground; struct tty_display_info *tty = FRAME_TTY (f); /* If we are creating a new frame, begin with the original screen colors used for the initial frame. */ - if (EQ (alist, Vdefault_frame_alist) + if (!f->default_face_done_p && initial_screen_colors[0] != -1 && initial_screen_colors[1] != -1) { FRAME_FOREGROUND_PIXEL (f) = initial_screen_colors[0]; FRAME_BACKGROUND_PIXEL (f) = initial_screen_colors[1]; init_frame_faces (f); + f->default_face_done_p = 1; } - orig_fg = FRAME_FOREGROUND_PIXEL (f); - orig_bg = FRAME_BACKGROUND_PIXEL (f); - frame_fg = Fcdr (Fassq (Qforeground_color, f->param_alist)); - frame_bg = Fcdr (Fassq (Qbackground_color, f->param_alist)); - /* frame_fg and frame_bg could be nil if, for example, - f->param_alist is nil, e.g. if we are called from - Fmake_terminal_frame. */ - if (NILP (frame_fg)) - frame_fg = build_string (unspecified_fg); - if (NILP (frame_bg)) - frame_bg = build_string (unspecified_bg); + orig_fg = reverse ? FRAME_BACKGROUND_PIXEL (f) : FRAME_FOREGROUND_PIXEL (f); + orig_bg = reverse ? FRAME_FOREGROUND_PIXEL (f) : FRAME_BACKGROUND_PIXEL (f); /* Extract parm names and values into those vectors. */ i = 0; @@ -2146,58 +2114,75 @@ IT_set_frame_parameters (f, alist) reverse = EQ (val, Qt); } - need_to_reverse = reverse && !was_reverse; - if (tty->termscript && need_to_reverse) + if (tty->termscript && reverse) fprintf (tty->termscript, "<INVERSE-VIDEO>\n"); /* Now process the alist elements in reverse of specified order. */ for (i--; i >= 0; i--) { - Lisp_Object prop, val, frame; + Lisp_Object prop, val; prop = parms[i]; val = values[i]; if (EQ (prop, Qforeground_color)) { - unsigned long new_color = load_color (f, NULL, val, need_to_reverse + unsigned long new_color = load_color (f, NULL, val, reverse ? LFACE_BACKGROUND_INDEX : LFACE_FOREGROUND_INDEX); if (new_color != FACE_TTY_DEFAULT_COLOR && new_color != FACE_TTY_DEFAULT_FG_COLOR && new_color != FACE_TTY_DEFAULT_BG_COLOR) { - FRAME_FOREGROUND_PIXEL (f) = new_color; - /* Make sure the foreground of the default face for this - frame is changed as well. */ - XSETFRAME (frame, f); - Finternal_set_lisp_face_attribute (Qdefault, QCforeground, - val, frame); - fg_set = 1; + if (!reverse) + { + FRAME_FOREGROUND_PIXEL (f) = new_color; + /* Make sure the foreground of the default face for + this frame is changed as well. */ + update_face_from_frame_parameter (f, Qforeground_color, val); + fg_set = 1; + if (tty->termscript) + fprintf (tty->termscript, "<FGCOLOR %lu>\n", new_color); + } + else + { + FRAME_BACKGROUND_PIXEL (f) = new_color; + update_face_from_frame_parameter (f, Qbackground_color, val); + bg_set = 1; + if (tty->termscript) + fprintf (tty->termscript, "<BGCOLOR %lu>\n", new_color); + } redraw = 1; - if (tty->termscript) - fprintf (tty->termscript, "<FGCOLOR %lu>\n", new_color); } } else if (EQ (prop, Qbackground_color)) { - unsigned long new_color = load_color (f, NULL, val, need_to_reverse + unsigned long new_color = load_color (f, NULL, val, reverse ? LFACE_FOREGROUND_INDEX : LFACE_BACKGROUND_INDEX); if (new_color != FACE_TTY_DEFAULT_COLOR && new_color != FACE_TTY_DEFAULT_FG_COLOR && new_color != FACE_TTY_DEFAULT_BG_COLOR) { - FRAME_BACKGROUND_PIXEL (f) = new_color; - /* Make sure the background of the default face for this - frame is changed as well. */ - XSETFRAME (frame, f); - Finternal_set_lisp_face_attribute (Qdefault, QCbackground, - val, frame); - bg_set = 1; + if (!reverse) + { + FRAME_BACKGROUND_PIXEL (f) = new_color; + /* Make sure the background of the default face for + this frame is changed as well. */ + bg_set = 1; + update_face_from_frame_parameter (f, Qbackground_color, val); + if (tty->termscript) + fprintf (tty->termscript, "<BGCOLOR %lu>\n", new_color); + } + else + { + FRAME_FOREGROUND_PIXEL (f) = new_color; + fg_set = 1; + update_face_from_frame_parameter (f, Qforeground_color, val); + if (tty->termscript) + fprintf (tty->termscript, "<FGCOLOR %lu>\n", new_color); + } redraw = 1; - if (tty->termscript) - fprintf (tty->termscript, "<BGCOLOR %lu>\n", new_color); } } else if (EQ (prop, Qtitle)) @@ -2228,24 +2213,22 @@ IT_set_frame_parameters (f, alist) /* If they specified "reverse", but not the colors, we need to swap the current frame colors. */ - if (need_to_reverse) + if (reverse) { Lisp_Object frame; if (!fg_set) { - XSETFRAME (frame, f); - Finternal_set_lisp_face_attribute (Qdefault, QCforeground, - tty_color_name (f, orig_bg), - frame); + FRAME_FOREGROUND_PIXEL (f) = orig_bg; + update_face_from_frame_parameter (f, Qforeground_color, + tty_color_name (f, orig_bg)); redraw = 1; } if (!bg_set) { - XSETFRAME (frame, f); - Finternal_set_lisp_face_attribute (Qdefault, QCbackground, - tty_color_name (f, orig_fg), - frame); + FRAME_BACKGROUND_PIXEL (f) = orig_fg; + update_face_from_frame_parameter (f, Qbackground_color, + tty_color_name (f, orig_fg)); redraw = 1; } } @@ -2266,7 +2249,7 @@ extern void init_frame_faces (FRAME_PTR); /* Do we need the internal terminal? */ void -internal_terminal_init () +internal_terminal_init (void) { static int init_needed = 1; char *term = getenv ("TERM"), *colors; @@ -2402,10 +2385,8 @@ initialize_msdos_display (struct terminal *term) term->read_socket_hook = &tty_read_avail_input; /* from keyboard.c */ } -dos_get_saved_screen (screen, rows, cols) - char **screen; - int *rows; - int *cols; +int +dos_get_saved_screen (char **screen, int *rows, int *cols) { #ifndef HAVE_X_WINDOWS *screen = startup_screen_buffer; @@ -2564,9 +2545,7 @@ static int keyboard_map_all; static int international_keyboard; int -dos_set_keyboard (code, always) - int code; - int always; +dos_set_keyboard (int code, int always) { int i; _go32_dpmi_registers regs; @@ -2833,8 +2812,7 @@ ibmpc_translate_map[] = #define HYPER_P 0x8000 /* pseudo */ static int -dos_get_modifiers (keymask) - int *keymask; +dos_get_modifiers (int *keymask) { union REGS regs; int mask, modifiers = 0; @@ -2916,13 +2894,13 @@ dos_get_modifiers (keymask) #define NUM_RECENT_DOSKEYS (100) int recent_doskeys_index; /* Index for storing next element into recent_doskeys */ int total_doskeys; /* Total number of elements stored into recent_doskeys */ -Lisp_Object recent_doskeys; /* A vector, holding the last 100 keystrokes */ +Lisp_Object recent_doskeys; /* A vector, holding the last 100 keystrokes */ DEFUN ("recent-doskeys", Frecent_doskeys, Srecent_doskeys, 0, 0, 0, doc: /* Return vector of last 100 keyboard input values seen in dos_rawgetc. Each input key receives two values in this vector: first the ASCII code, and then the scan code. */) - () + (void) { Lisp_Object val, *keys = XVECTOR (recent_doskeys)->contents; @@ -2931,19 +2909,17 @@ and then the scan code. */) else { val = Fvector (NUM_RECENT_DOSKEYS, keys); - bcopy (keys + recent_doskeys_index, - XVECTOR (val)->contents, - (NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof (Lisp_Object)); - bcopy (keys, - XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index, - recent_doskeys_index * sizeof (Lisp_Object)); + memcpy (XVECTOR (val)->contents, keys + recent_doskeys_index, + (NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof (Lisp_Object)); + memcpy (XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index, + keys, recent_doskeys_index * sizeof (Lisp_Object)); return val; } } /* Get a char from keyboard. Function keys are put into the event queue. */ static int -dos_rawgetc () +dos_rawgetc (void) { struct input_event event; union REGS regs; @@ -3294,8 +3270,8 @@ dos_rawgetc () static int prev_get_char = -1; /* Return 1 if a key is ready to be read without suspending execution. */ - -dos_keysns () +int +dos_keysns (void) { if (prev_get_char != -1) return 1; @@ -3304,8 +3280,8 @@ dos_keysns () } /* Read a key. Return -1 if no key is ready. */ - -dos_keyread () +int +dos_keyread (void) { if (prev_get_char != -1) { @@ -3334,7 +3310,7 @@ static char *menu_help_message, *prev_menu_help_message; static int menu_help_paneno, menu_help_itemno; static XMenu * -IT_menu_create () +IT_menu_create (void) { XMenu *menu; @@ -3503,7 +3479,7 @@ IT_menu_display (XMenu *menu, int y, int x, int pn, int *faces, int disp_help) /* Report availability of menus. */ int -have_menus_p () { return 1; } +have_menus_p (void) { return 1; } /* Create a brand new menu structure. */ @@ -3861,8 +3837,7 @@ void msdos_downcase_filename (unsigned char *); /* Destructively turn backslashes into slashes. */ void -dostounix_filename (p) - register char *p; +dostounix_filename (char *p) { msdos_downcase_filename (p); @@ -3877,8 +3852,7 @@ dostounix_filename (p) /* Destructively turn slashes into backslashes. */ void -unixtodos_filename (p) - register char *p; +unixtodos_filename (char *p) { if (p[1] == ':' && *p >= 'A' && *p <= 'Z') { @@ -3897,9 +3871,7 @@ unixtodos_filename (p) /* Get the default directory for a given drive. 0=def, 1=A, 2=B, ... */ int -getdefdir (drive, dst) - int drive; - char *dst; +getdefdir (int drive, char *dst) { char in_path[4], *p = in_path, e = errno; @@ -3938,9 +3910,7 @@ emacs_root_dir (void) /* Remove all CR's that are followed by a LF. */ int -crlf_to_lf (n, buf) - register int n; - register unsigned char *buf; +crlf_to_lf (int n, unsigned char *buf) { unsigned char *np = buf, *startp = buf, *endp = buf + n; @@ -3964,7 +3934,7 @@ crlf_to_lf (n, buf) DEFUN ("msdos-long-file-names", Fmsdos_long_file_names, Smsdos_long_file_names, 0, 0, 0, doc: /* Return non-nil if long file names are supported on MS-DOS. */) - () + (void) { return (_USE_LFN ? Qt : Qnil); } @@ -3972,8 +3942,7 @@ DEFUN ("msdos-long-file-names", Fmsdos_long_file_names, Smsdos_long_file_names, /* Convert alphabetic characters in a filename to lower-case. */ void -msdos_downcase_filename (p) - register unsigned char *p; +msdos_downcase_filename (unsigned char *p) { /* Always lower-case drive letters a-z, even if the filesystem preserves case in filenames. @@ -3999,8 +3968,7 @@ DEFUN ("msdos-downcase-filename", Fmsdos_downcase_filename, Smsdos_downcase_file When long filenames are supported, doesn't change FILENAME. If FILENAME is not a string, returns nil. The argument object is never altered--the value is a copy. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { Lisp_Object tem; @@ -4017,8 +3985,7 @@ The argument object is never altered--the value is a copy. */) static char emacsroot[MAXPATHLEN]; char * -rootrelativepath (rel) - char *rel; +rootrelativepath (char *rel) { static char result[MAXPATHLEN + 10]; @@ -4033,10 +4000,7 @@ rootrelativepath (rel) break if one or more of these are missing. */ void -init_environment (argc, argv, skip_args) - int argc; - char **argv; - int skip_args; +init_environment (int argc, char **argv, int skip_args) { char *s, *t, *root; int len, i; @@ -4270,7 +4234,7 @@ dos_ttraw (struct tty_display_info *tty) /* Restore status of standard input and Ctrl-C checking. */ int -dos_ttcooked () +dos_ttcooked (void) { union REGS inregs, outregs; @@ -4296,11 +4260,8 @@ dos_ttcooked () file TEMPOUT and stderr to TEMPERR. */ int -run_msdos_command (argv, working_dir, tempin, tempout, temperr, envv) - unsigned char **argv; - const char *working_dir; - int tempin, tempout, temperr; - char **envv; +run_msdos_command (unsigned char **argv, const char *working_dir, + int tempin, int tempout, int temperr, char **envv) { char *saveargv1, *saveargv2, *lowcase_argv0, *pa, *pl; char oldwd[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */ @@ -4441,8 +4402,7 @@ run_msdos_command (argv, working_dir, tempin, tempout, temperr, envv) } void -croak (badfunc) - char *badfunc; +croak (char *badfunc) { fprintf (stderr, "%s not yet implemented\r\n", badfunc); reset_all_sys_modes (); @@ -4452,8 +4412,8 @@ croak (badfunc) /* * A few unimplemented functions that we silently ignore. */ -setpgrp () {return 0; } -setpriority (x,y,z) int x,y,z; { return 0; } +int setpgrp (void) {return 0; } +int setpriority (int x, int y, int z) { return 0; } #if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2 @@ -4478,17 +4438,13 @@ static sighandler_t prev_handlers[320]; /* A signal handler which just records that a signal occurred (it will be raised later, if and when the signal is unblocked). */ static void -sig_suspender (signo) - int signo; +sig_suspender (int signo) { sigaddset (&msdos_pending_signals, signo); } int -sigprocmask (how, new_set, old_set) - int how; - const sigset_t *new_set; - sigset_t *old_set; +sigprocmask (int how, const sigset_t *new_set, sigset_t *old_set) { int signo; sigset_t new_mask; @@ -4590,10 +4546,8 @@ dos_yield_time_slice (void) /* We don't have to call timer_check here because wait_reading_process_output takes care of that. */ int -sys_select (nfds, rfds, wfds, efds, timeout) - int nfds; - SELECT_TYPE *rfds, *wfds, *efds; - EMACS_TIME *timeout; +sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, + EMACS_TIME *timeout) { int check_input; struct time t; @@ -4663,11 +4617,10 @@ sys_select (nfds, rfds, wfds, efds, timeout) #ifdef chdir #undef chdir -extern int chdir (); +extern int chdir (const char *); int -sys_chdir (path) - const char* path; +sys_chdir (const char *path) { int len = strlen (path); char *tmp = (char *)path; @@ -4696,7 +4649,7 @@ sys_chdir (path) extern void tzset (void); void -init_gettimeofday () +init_gettimeofday (void) { time_t ltm, gtm; struct tm *lstm; @@ -4714,9 +4667,7 @@ init_gettimeofday () #ifdef abort #undef abort void -dos_abort (file, line) - char *file; - int line; +dos_abort (char *file, int line) { char buffer1[200], buffer2[400]; int i, j; @@ -4732,7 +4683,7 @@ dos_abort (file, line) } #else void -abort () +abort (void) { dos_ttcooked (); ScreenSetCursor (10, 0); @@ -4750,14 +4701,8 @@ abort () } #endif -/* The following variables are required so that cus-start.el won't - complain about unbound variables. */ -#ifndef subprocesses -/* Nonzero means delete a process right away if it exits (process.c). */ -static int delete_exited_processes; -#endif - -syms_of_msdos () +void +syms_of_msdos (void) { recent_doskeys = Fmake_vector (make_number (NUM_RECENT_DOSKEYS), Qnil); staticpro (&recent_doskeys); @@ -4773,12 +4718,6 @@ syms_of_msdos () This variable is used only by MS-DOS terminals. */); Vdos_unsupported_char_glyph = make_number ('\177'); -#endif -#ifndef subprocesses - DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes, - doc: /* *Non-nil means delete processes immediately when they exit. -A value of nil means don't delete them until `list-processes' is run. */); - delete_exited_processes = 0; #endif defsubr (&Srecent_doskeys); diff --git a/src/msdos.h b/src/msdos.h index bf44d3a9aa4..fe9964af25e 100644 --- a/src/msdos.h +++ b/src/msdos.h @@ -23,7 +23,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <dpmi.h> int dos_ttraw (struct tty_display_info *); -int dos_ttcooked (); +int dos_ttcooked (void); int dos_get_saved_screen (char **, int *, int *); int dos_set_keyboard (int, int); void dos_set_window_size (int *, int *); @@ -32,15 +32,13 @@ int getdefdir (int, char*); void unixtodos_filename (char *); void dostounix_filename (char *); char *rootrelativepath (char *); -void init_environment (); -void internal_terminal_init (); -void ctrl_break_func (_go32_dpmi_registers *); -void install_ctrl_break_check (); +void init_environment (int, char **, int); +void internal_terminal_init (void); extern int have_mouse; -void mouse_init (); -void mouse_on (); -void mouse_off (); +void mouse_init (void); +void mouse_on (void); +void mouse_off (void); void mouse_moveto (int, int); #ifndef HAVE_X_WINDOWS @@ -70,13 +68,12 @@ struct window; /* Defined in xfns.c; emulated on msdos.c */ -extern void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern int x_pixel_width P_ ((struct frame *)); -extern int x_pixel_height P_ ((struct frame *)); +extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); +extern int x_pixel_width (struct frame *); +extern int x_pixel_height (struct frame *); #define XFreeGC (void) #define x_destroy_bitmap(p1,p2) -#define load_pixmap(p1,p2,p3,p4) (0) #define XGetGeometry(p1,p2,p3,p4,p5,p6,p7,p8,p9) #define DisplayWidth(p1,p2) (SELECTED_FRAME()->text_cols) #define DisplayHeight(p1,p2) (SELECTED_FRAME()->text_lines) diff --git a/src/nsfns.m b/src/nsfns.m index 53264a5f595..fd0ec1a965c 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -83,6 +83,10 @@ Updated by Christian Limpach (chris@nice.ch) extern Lisp_Object Qnone; extern Lisp_Object Vframe_title_format; +/* The below are defined in frame.c. */ + +extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode; + Lisp_Object Qbuffered; Lisp_Object Qfontsize; @@ -224,7 +228,8 @@ Updated by Christian Limpach (chris@nice.ch) else { struct ns_display_info *dpyinfo = terminal->display_info.ns; - f = (dpyinfo->x_focus_frame || dpyinfo->x_highlight_frame); + f = dpyinfo->x_focus_frame + ? dpyinfo->x_focus_frame : dpyinfo->x_highlight_frame; } return ((f && FRAME_NS_P (f)) ? [[FRAME_NS_VIEW (f) window] screen] @@ -1058,8 +1063,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side and do not specify a specific minibuffer window to use, then `default-minibuffer-frame' must be a frame whose minibuffer can be shared by the new frame. */) - (parms) - Lisp_Object parms; + (Lisp_Object parms) { static int desc_ctr = 1; struct frame *f; @@ -1154,7 +1158,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side f->output_method = output_ns; f->output_data.ns = (struct ns_output *)xmalloc (sizeof *(f->output_data.ns)); - bzero (f->output_data.ns, sizeof (*(f->output_data.ns))); + memset (f->output_data.ns, 0, sizeof (*(f->output_data.ns))); FRAME_FONTSET (f) = -1; @@ -1234,10 +1238,18 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side init_frame_faces (f); - x_default_parameter (f, parms, Qmenu_bar_lines, make_number (0), "menuBar", - "menuBar", RES_TYPE_NUMBER); - x_default_parameter (f, parms, Qtool_bar_lines, make_number (0), "toolBar", - "toolBar", RES_TYPE_NUMBER); + /* The X resources controlling the menu-bar and tool-bar are + processed specially at startup, and reflected in the mode + variables; ignore them here. */ + x_default_parameter (f, parms, Qmenu_bar_lines, + NILP (Vmenu_bar_mode) + ? make_number (0) : make_number (1), + NULL, NULL, RES_TYPE_NUMBER); + x_default_parameter (f, parms, Qtool_bar_lines, + NILP (Vtool_bar_mode) + ? make_number (0) : make_number (1), + NULL, NULL, RES_TYPE_NUMBER); + x_default_parameter (f, parms, Qbuffer_predicate, Qnil, "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); x_default_parameter (f, parms, Qtitle, Qnil, "title", "Title", @@ -1360,8 +1372,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, doc: /* Set the input focus to FRAME. FRAME nil means use the selected frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { struct frame *f = check_ns_frame (frame); struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); @@ -1382,8 +1393,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side DEFUN ("ns-popup-font-panel", Fns_popup_font_panel, Sns_popup_font_panel, 0, 1, "", doc: /* Pop up the font panel. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { id fm; struct frame *f; @@ -1408,8 +1418,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side DEFUN ("ns-popup-color-panel", Fns_popup_color_panel, Sns_popup_color_panel, 0, 1, "", doc: /* Pop up the color panel. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { struct frame *f; @@ -1432,8 +1441,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side Optional arg DIR, if non-nil, supplies a default directory. Optional arg ISLOAD, if non-nil, means read a file name for saving. Optional arg INIT, if non-nil, provides a default file name to use. */) - (prompt, dir, isLoad, init) - Lisp_Object prompt, dir, isLoad, init; + (Lisp_Object prompt, Lisp_Object dir, Lisp_Object isLoad, Lisp_Object init) { static id fileDelegate = nil; int ret; @@ -1497,8 +1505,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side DEFUN ("ns-get-resource", Fns_get_resource, Sns_get_resource, 2, 2, 0, doc: /* Return the value of the property NAME of OWNER from the defaults database. If OWNER is nil, Emacs is assumed. */) - (owner, name) - Lisp_Object owner, name; + (Lisp_Object owner, Lisp_Object name) { const char *value; @@ -1522,8 +1529,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side doc: /* Set property NAME of OWNER to VALUE, from the defaults database. If OWNER is nil, Emacs is assumed. If VALUE is nil, the default is removed. */) - (owner, name, value) - Lisp_Object owner, name, value; + (Lisp_Object owner, Lisp_Object name, Lisp_Object value) { check_ns (); if (NILP (owner)) @@ -1551,8 +1557,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side Sx_server_max_request_size, 0, 1, 0, doc: /* This function is a no-op. It is only present for completeness. */) - (display) - Lisp_Object display; + (Lisp_Object display) { check_ns (); /* This function has no real equivalent under NeXTstep. Return nil to @@ -1565,8 +1570,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side doc: /* Return the vendor ID string of Nextstep display server DISPLAY. DISPLAY should be either a frame or a display name (a string). If omitted or nil, the selected frame's display is used. */) - (display) - Lisp_Object display; + (Lisp_Object display) { #ifdef NS_IMPL_GNUSTEP return build_string ("GNU"); @@ -1585,8 +1589,7 @@ DISPLAY should be either a frame or a display name (a string). The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { /*NOTE: it is unclear what would best correspond with "protocol"; we return 10.3, meaning Panther, since this is roughly the @@ -1604,8 +1607,7 @@ and GNUstep implementations ("distributor-specific release doc: /* Return the number of screens on Nextstep display server DISPLAY. DISPLAY should be a frame, the display name as a string, or a terminal ID. If omitted or nil, the selected frame's display is used. */) - (display) - Lisp_Object display; + (Lisp_Object display) { int num; @@ -1621,8 +1623,7 @@ and GNUstep implementations ("distributor-specific release doc: /* Return the height of Nextstep display server DISPLAY, in millimeters. DISPLAY should be a frame, the display name as a string, or a terminal ID. If omitted or nil, the selected frame's display is used. */) - (display) - Lisp_Object display; + (Lisp_Object display) { check_ns (); return make_number ((int) @@ -1635,8 +1636,7 @@ and GNUstep implementations ("distributor-specific release doc: /* Return the width of Nextstep display server DISPLAY, in millimeters. DISPLAY should be a frame, the display name as a string, or a terminal ID. If omitted or nil, the selected frame's display is used. */) - (display) - Lisp_Object display; + (Lisp_Object display) { check_ns (); return make_number ((int) @@ -1650,8 +1650,7 @@ and GNUstep implementations ("distributor-specific release The value may be `buffered', `retained', or `non-retained'. DISPLAY should be a frame, the display name as a string, or a terminal ID. If omitted or nil, the selected frame's display is used. */) - (display) - Lisp_Object display; + (Lisp_Object display) { check_ns (); switch ([ns_get_window (display) backingType]) @@ -1676,8 +1675,7 @@ and GNUstep implementations ("distributor-specific release `static-color', `pseudo-color', `true-color', or `direct-color'. DISPLAY should be a frame, the display name as a string, or a terminal ID. If omitted or nil, the selected frame's display is used. */) - (display) - Lisp_Object display; + (Lisp_Object display) { NSWindowDepth depth; check_ns (); @@ -1705,8 +1703,7 @@ and GNUstep implementations ("distributor-specific release The optional argument DISPLAY specifies which display to ask about. DISPLAY should be a frame, the display name as a string, or a terminal ID. If omitted or nil, the selected frame's display is used. */) - (display) - Lisp_Object display; + (Lisp_Object display) { check_ns (); switch ([ns_get_window (display) backingType]) @@ -1730,8 +1727,7 @@ and GNUstep implementations ("distributor-specific release doc: /* Open a connection to a Nextstep display server. DISPLAY is the name of the display to connect to. Optional arguments XRM-STRING and MUST-SUCCEED are currently ignored. */) - (display, resource_string, must_succeed) - Lisp_Object display, resource_string, must_succeed; + (Lisp_Object display, Lisp_Object resource_string, Lisp_Object must_succeed) { struct ns_display_info *dpyinfo; @@ -1769,8 +1765,7 @@ and GNUstep implementations ("distributor-specific release 1, 1, 0, doc: /* Close the connection to the current Nextstep display server. The argument DISPLAY is currently ignored. */) - (display) - Lisp_Object display; + (Lisp_Object display) { check_ns (); /*ns_delete_terminal (dpyinfo->terminal); */ @@ -1781,7 +1776,7 @@ and GNUstep implementations ("distributor-specific release DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, doc: /* Return the list of display names that Emacs has connections to. */) - () + (void) { Lisp_Object tail, result; @@ -1796,7 +1791,7 @@ and GNUstep implementations ("distributor-specific release DEFUN ("ns-hide-others", Fns_hide_others, Sns_hide_others, 0, 0, 0, doc: /* Hides all applications other than Emacs. */) - () + (void) { check_ns (); [NSApp hideOtherApplications: NSApp]; @@ -1809,8 +1804,7 @@ and GNUstep implementations ("distributor-specific release Otherwise if Emacs is hidden, it is unhidden. If ON is equal to `activate', Emacs is unhidden and becomes the active application. */) - (on) - Lisp_Object on; + (Lisp_Object on) { check_ns (); if (EQ (on, intern ("activate"))) @@ -1829,7 +1823,7 @@ and GNUstep implementations ("distributor-specific release DEFUN ("ns-emacs-info-panel", Fns_emacs_info_panel, Sns_emacs_info_panel, 0, 0, 0, doc: /* Shows the 'Info' or 'About' panel for Emacs. */) - () + (void) { check_ns (); [NSApp orderFrontStandardAboutPanel: nil]; @@ -1842,8 +1836,7 @@ and GNUstep implementations ("distributor-specific release NAME should be a string containing either the font name or an XLFD font descriptor. If string contains `fontset' and not `fontset-startup', it is left alone. */) - (name) - Lisp_Object name; + (Lisp_Object name) { char *nm; CHECK_STRING (name); @@ -1861,8 +1854,7 @@ and GNUstep implementations ("distributor-specific release DEFUN ("ns-list-colors", Fns_list_colors, Sns_list_colors, 0, 1, 0, doc: /* Return a list of all available colors. The optional argument FRAME is currently ignored. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { Lisp_Object list = Qnil; NSEnumerator *colorlists; @@ -1901,7 +1893,7 @@ and GNUstep implementations ("distributor-specific release DEFUN ("ns-list-services", Fns_list_services, Sns_list_services, 0, 0, 0, doc: /* List available Nextstep services by querying NSApp. */) - () + (void) { Lisp_Object ret = Qnil; NSMenu *svcs; @@ -1955,8 +1947,7 @@ and GNUstep implementations ("distributor-specific release SEND should be either a string or nil. The return value is the result of the service, as string, or nil if there was no result. */) - (service, send) - Lisp_Object service, send; + (Lisp_Object service, Lisp_Object send) { id pb; NSString *svcName; @@ -1984,8 +1975,7 @@ and GNUstep implementations ("distributor-specific release DEFUN ("ns-convert-utf8-nfd-to-nfc", Fns_convert_utf8_nfd_to_nfc, Sns_convert_utf8_nfd_to_nfc, 1, 1, 0, doc: /* Return an NFC string that matches the UTF-8 NFD string STR. */) - (str) - Lisp_Object str; + (Lisp_Object str) { /* TODO: If GNUstep ever implements precomposedStringWithCanonicalMapping, remove this. */ @@ -2072,8 +2062,7 @@ and GNUstep implementations ("distributor-specific release If compilation and execution are successful, the resulting script value is returned as a string, a number or, in the case of other constructs, t. In case the execution fails, an error is signaled. */) - (script) - Lisp_Object script; + (Lisp_Object script) { Lisp_Object result; long status; @@ -2218,8 +2207,7 @@ and GNUstep implementations ("distributor-specific release DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, doc: /* Return t if the current Nextstep display supports the color COLOR. The optional argument FRAME is currently ignored. */) - (color, frame) - Lisp_Object color, frame; + (Lisp_Object color, Lisp_Object frame) { NSColor * col; check_ns (); @@ -2229,8 +2217,7 @@ and GNUstep implementations ("distributor-specific release DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, doc: /* Internal function called by `color-values', which see. */) - (color, frame) - Lisp_Object color, frame; + (Lisp_Object color, Lisp_Object frame) { NSColor * col; CGFloat red, green, blue, alpha; @@ -2254,8 +2241,7 @@ and GNUstep implementations ("distributor-specific release The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame, a display name (a string), or terminal ID. If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { NSWindowDepth depth; NSString *colorSpace; @@ -2276,8 +2262,7 @@ and GNUstep implementations ("distributor-specific release The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame, a display name (a string), or terminal ID. If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { NSWindowDepth depth; check_ns (); @@ -2293,8 +2278,7 @@ and GNUstep implementations ("distributor-specific release The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame, a display name (a string), or terminal ID. If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { check_ns (); return make_number ((int) [ns_get_screen (display) frame].size.width); @@ -2307,8 +2291,7 @@ and GNUstep implementations ("distributor-specific release The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame, a display name (a string), or terminal ID. If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { check_ns (); return make_number ((int) [ns_get_screen (display) frame].size.height); @@ -2325,8 +2308,7 @@ The return value is a list of integers (LEFT TOP WIDTH HEIGHT), which The screen queried corresponds to DISPLAY, which should be either a frame, a display name (a string), or terminal ID. If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { int top; NSScreen *screen; @@ -2355,8 +2337,7 @@ The return value is a list of integers (LEFT TOP WIDTH HEIGHT), which The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame, a display name (a string), or terminal ID. If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { check_ns (); return make_number @@ -2370,12 +2351,12 @@ The return value is a list of integers (LEFT TOP WIDTH HEIGHT), which The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame, a display name (a string), or terminal ID. If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { + struct ns_display_info *dpyinfo; check_ns (); - struct ns_display_info *dpyinfo = check_ns_display_info (display); - + + dpyinfo = check_ns_display_info (display); /* We force 24+ bit depths to 24-bit to prevent an overflow. */ return make_number (1 << min (dpyinfo->n_planes, 24)); } @@ -2398,22 +2379,27 @@ The return value is a list of integers (LEFT TOP WIDTH HEIGHT), which /* Start with user-specified or mouse position. */ left = Fcdr (Fassq (Qleft, parms)); - if (INTEGERP (left)) - pt.x = XINT (left); - else - pt.x = last_mouse_motion_position.x; top = Fcdr (Fassq (Qtop, parms)); - if (INTEGERP (top)) - pt.y = XINT (top); + + if (!INTEGERP (left) || !INTEGERP (top)) + { + pt = last_mouse_motion_position; + /* Convert to screen coordinates */ + pt = [view convertPoint: pt toView: nil]; + pt = [[view window] convertBaseToScreen: pt]; + } else - pt.y = last_mouse_motion_position.y; - - /* Convert to screen coordinates */ - pt = [view convertPoint: pt toView: nil]; - pt = [[view window] convertBaseToScreen: pt]; - + { + /* Absolute coordinates. */ + pt.x = XINT (left); + pt.y = x_display_pixel_height (FRAME_NS_DISPLAY_INFO (f)) - XINT (top) + - height; + } + /* Ensure in bounds. (Note, screen origin = lower left.) */ - if (pt.x + XINT (dx) <= 0) + if (INTEGERP (left)) + *root_x = pt.x; + else if (pt.x + XINT (dx) <= 0) *root_x = 0; /* Can happen for negative dx */ else if (pt.x + XINT (dx) + width <= x_display_pixel_width (FRAME_NS_DISPLAY_INFO (f))) @@ -2426,7 +2412,9 @@ The return value is a list of integers (LEFT TOP WIDTH HEIGHT), which /* Put it left justified on the screen -- it ought to fit that way. */ *root_x = 0; - if (pt.y - XINT (dy) - height >= 0) + if (INTEGERP (top)) + *root_y = pt.y; + else if (pt.y - XINT (dy) - height >= 0) /* It fits below the pointer. */ *root_y = pt.y - height - XINT (dy); else if (pt.y + XINT (dy) + height @@ -2461,8 +2449,7 @@ DY added (default is -10). A tooltip's maximum size is specified by `x-max-tooltip-size'. Text larger than the specified size is clipped. */) - (string, frame, parms, timeout, dx, dy) - Lisp_Object string, frame, parms, timeout, dx, dy; + (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy) { int root_x, root_y; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; @@ -2518,7 +2505,7 @@ DY added (default is -10). DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0, doc: /* Hide the current tooltip window, if there is any. Value is t if tooltip was open, nil otherwise. */) - () + (void) { if (ns_tooltip == nil || ![ns_tooltip isActive]) return Qnil; diff --git a/src/nsfont.m b/src/nsfont.m index db2399a7fa0..3cc1f7fb076 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -776,8 +776,8 @@ when setting family in ns_spec_to_descriptor(). */ xmalloc (0x100 * sizeof (struct font_metrics *)); if (!font_info->glyphs || !font_info->metrics) return Qnil; - bzero (font_info->glyphs, 0x100 * sizeof (unsigned short *)); - bzero (font_info->metrics, 0x100 * sizeof (struct font_metrics *)); + memset (font_info->glyphs, 0, 0x100 * sizeof (unsigned short *)); + memset (font_info->metrics, 0, 0x100 * sizeof (struct font_metrics *)); BLOCK_INPUT; @@ -816,8 +816,8 @@ when setting family in ns_spec_to_descriptor(). */ [font_info->nsfont retain]; /* set up ns_font (defined in nsgui.h) */ - font_info->name = (char *)xmalloc (strlen (fontName) + 1); - bcopy (fontName, font_info->name, strlen (fontName) + 1); + font_info->name = (char *)xmalloc (strlen (fontName)+1); + strcpy (font_info->name, fontName); font_info->bold = [fontMgr traitsOfFont: nsfont] & NSBoldFontMask; font_info->ital = synthItal || ([fontMgr traitsOfFont: nsfont] & NSItalicFontMask); @@ -972,7 +972,7 @@ that causes need for cache in nsfont_open () */ int totalWidth = 0; int i; - bzero (metrics, sizeof (struct font_metrics)); + memset (metrics, 0, sizeof (struct font_metrics)); for (i =0; i<nglyphs; i++) { @@ -1395,7 +1395,7 @@ WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). */ sfont = [font_info->nsfont screenFont]; font_info->metrics[block] = xmalloc (0x100 * sizeof (struct font_metrics)); - bzero (font_info->metrics[block], 0x100 * sizeof (struct font_metrics)); + memset (font_info->metrics[block], 0, 0x100 * sizeof (struct font_metrics)); if (!(font_info->metrics[block])) abort (); diff --git a/src/nsimage.m b/src/nsimage.m index 3e6a8c77ed7..6912156eb99 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -315,9 +315,9 @@ - (void)dealloc [self addRepresentation: bmRep]; - bzero (planes[0], w*h); - bzero (planes[1], w*h); - bzero (planes[2], w*h); + memset (planes[0], 0, w*h); + memset (planes[1], 0, w*h); + memset (planes[2], 0, w*h); [self setXBMColor: [NSColor blackColor]]; return self; } @@ -379,7 +379,7 @@ - (void)dealloc [bmRep getBitmapDataPlanes: pixmapData]; for (i =0; i<4; i++) - bzero (pixmapData[i], width*height); + memset (pixmapData[i], 0, width*height); [self addRepresentation: bmRep]; return self; } diff --git a/src/nsmenu.m b/src/nsmenu.m index f85ebc165af..e5b9379258f 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -219,8 +219,8 @@ /* Save the frame's previous menu bar contents data */ if (previous_menu_items_used) - bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items, - previous_menu_items_used * sizeof (Lisp_Object)); + memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents, + previous_menu_items_used * sizeof (Lisp_Object)); /* parse stage 1: extract from lisp */ save_menu_items (); @@ -999,7 +999,10 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f Under NS we just hide the toolbar until it might be needed again. -------------------------------------------------------------------------- */ { + BLOCK_INPUT; [[FRAME_NS_VIEW (f) toolbar] setVisible: NO]; + FRAME_TOOLBAR_HEIGHT (f) = 0; + UNBLOCK_INPUT; } void @@ -1009,8 +1012,11 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f -------------------------------------------------------------------------- */ { int i; - EmacsToolbar *toolbar = [FRAME_NS_VIEW (f) toolbar]; + EmacsView *view = FRAME_NS_VIEW (f); + NSWindow *window = [view window]; + EmacsToolbar *toolbar = [view toolbar]; + BLOCK_INPUT; [toolbar clearActive]; /* update EmacsToolbar as in GtkUtils, build items list */ @@ -1094,6 +1100,10 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f [newDict release]; } + FRAME_TOOLBAR_HEIGHT (f) = + NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) + - FRAME_NS_TITLEBAR_HEIGHT (f); + UNBLOCK_INPUT; } @@ -1742,7 +1752,7 @@ - (Lisp_Object)runDialogAt: (NSPoint)p DEFUN ("ns-reset-menu", Fns_reset_menu, Sns_reset_menu, 0, 0, 0, doc: /* Cause the NS menu to be re-calculated. */) - () + (void) { set_frame_menubar (SELECTED_FRAME (), 1, 0); return Qnil; @@ -1772,15 +1782,14 @@ Each ITEM is a cons cell (STRING . VALUE). If the user gets rid of the dialog box without making a valid choice, for instance using the window manager, then this produces a quit and `x-popup-dialog' does not return. */) - (position, contents, header) - Lisp_Object position, contents, header; + (Lisp_Object position, Lisp_Object contents, Lisp_Object header) { return ns_popup_dialog (position, contents, header); } DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0, doc: /* Return t if a menu or popup dialog is active. */) - () + (void) { return popup_activated () ? Qt : Qnil; } diff --git a/src/nsselect.m b/src/nsselect.m index b034eacf77c..23dede9c38e 100644 --- a/src/nsselect.m +++ b/src/nsselect.m @@ -378,8 +378,7 @@ Updated by Christian Limpach (chris@nice.ch) SELECTION-NAME is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. VALUE is typically a string, or a cons of two markers, but may be anything that the functions on `selection-converter-alist' know about. */) - (selection_name, selection_value) - Lisp_Object selection_name, selection_value; + (Lisp_Object selection_name, Lisp_Object selection_value) { id pb; Lisp_Object old_value, new_value; @@ -413,8 +412,7 @@ Updated by Christian Limpach (chris@nice.ch) DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal, Sx_disown_selection_internal, 1, 2, 0, doc: /* If we own the selection SELECTION, disown it. */) - (selection_name, time) - Lisp_Object selection_name, time; + (Lisp_Object selection_name, Lisp_Object time) { id pb; check_ns (); @@ -434,8 +432,7 @@ Updated by Christian Limpach (chris@nice.ch) \(Those are literal upper-case symbol names.) For convenience, the symbol nil is the same as `PRIMARY', and t is the same as `SECONDARY'.) */) - (selection) - Lisp_Object selection; + (Lisp_Object selection) { id pb; NSArray *types; @@ -458,8 +455,7 @@ Updated by Christian Limpach (chris@nice.ch) \(Those are literal upper-case symbol names.) For convenience, the symbol nil is the same as `PRIMARY', and t is the same as `SECONDARY'.) */) - (selection) - Lisp_Object selection; + (Lisp_Object selection) { check_ns (); CHECK_SYMBOL (selection); @@ -475,8 +471,7 @@ Updated by Christian Limpach (chris@nice.ch) SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. \(Those are literal upper-case symbol names.) TYPE is the type of data desired, typically `STRING'. */) - (selection_name, target_type) - Lisp_Object selection_name, target_type; + (Lisp_Object selection_name, Lisp_Object target_type) { Lisp_Object val; @@ -501,8 +496,7 @@ Updated by Christian Limpach (chris@nice.ch) DEFUN ("ns-get-cut-buffer-internal", Fns_get_cut_buffer_internal, Sns_get_cut_buffer_internal, 1, 1, 0, doc: /* Returns the value of the named cut buffer. */) - (buffer) - Lisp_Object buffer; + (Lisp_Object buffer) { id pb; check_ns (); @@ -516,8 +510,7 @@ Updated by Christian Limpach (chris@nice.ch) doc: /* Rotate the values of the cut buffers by N steps. Positive N means move values forward, negative means backward. CURRENTLY NOT IMPLEMENTED UNDER NEXTSTEP. */ ) - (n) - Lisp_Object n; + (Lisp_Object n) { /* XXX This function is unimplemented under NeXTstep XXX */ Fsignal (Qquit, Fcons (build_string ( @@ -529,8 +522,7 @@ Updated by Christian Limpach (chris@nice.ch) DEFUN ("ns-store-cut-buffer-internal", Fns_store_cut_buffer_internal, Sns_store_cut_buffer_internal, 2, 2, 0, doc: /* Sets the value of the named cut buffer (typically CUT_BUFFER0). */) - (buffer, string) - Lisp_Object buffer, string; + (Lisp_Object buffer, Lisp_Object string) { id pb; check_ns (); diff --git a/src/nsterm.h b/src/nsterm.h index 01086e63b69..bc0e6e286c2 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -606,7 +606,7 @@ struct x_output #define NS_FACE_FOREGROUND(f) ((f)->foreground) #define NS_FACE_BACKGROUND(f) ((f)->background) #define FRAME_NS_TITLEBAR_HEIGHT(f) ((f)->output_data.ns->titlebar_height) -#define FRAME_NS_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height) +#define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height) #define FONT_WIDTH(f) ((f)->max_width) #define FONT_HEIGHT(f) ((f)->height) @@ -760,8 +760,8 @@ extern unsigned long ns_get_pixel (void *img, int x, int y); extern void ns_put_pixel (void *img, int x, int y, unsigned long argb); extern void ns_set_alpha (void *img, int x, int y, unsigned char a); -extern int x_display_pixel_height P_ ((struct ns_display_info *)); -extern int x_display_pixel_width P_ ((struct ns_display_info *)); +extern int x_display_pixel_height (struct ns_display_info *); +extern int x_display_pixel_width (struct ns_display_info *); /* This in nsterm.m */ extern unsigned long ns_get_rgb_color (struct frame *f, diff --git a/src/nsterm.m b/src/nsterm.m index 14b824057da..58245f4aebf 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1138,15 +1138,15 @@ Free a pool and temporary objects it refers to (callable from C) /* NOTE: previously this would generate wrong result if toolbar not yet displayed and fixing toolbar_height=32 helped, but now (200903) seems no longer needed */ - FRAME_NS_TOOLBAR_HEIGHT (f) = + FRAME_TOOLBAR_HEIGHT (f) = NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) - FRAME_NS_TITLEBAR_HEIGHT (f); else - FRAME_NS_TOOLBAR_HEIGHT (f) = 0; + FRAME_TOOLBAR_HEIGHT (f) = 0; wr.size.width = pixelwidth + f->border_width; wr.size.height = pixelheight + FRAME_NS_TITLEBAR_HEIGHT (f) - + FRAME_NS_TOOLBAR_HEIGHT (f); + + FRAME_TOOLBAR_HEIGHT (f); /* constrain to screen if we can */ if (screen) @@ -2163,11 +2163,11 @@ Free a pool and temporary objects it refers to (callable from C) { EmacsImage **newBimgs = xmalloc (max_used_fringe_bitmap * sizeof (EmacsImage *)); - bzero (newBimgs, max_used_fringe_bitmap * sizeof (EmacsImage *)); + memset (newBimgs, 0, max_used_fringe_bitmap * sizeof (EmacsImage *)); if (nBimgs) { - bcopy (bimgs, newBimgs, nBimgs * sizeof (EmacsImage *)); + memcpy (newBimgs, bimgs, nBimgs * sizeof (EmacsImage *)); xfree (bimgs); } @@ -2177,20 +2177,7 @@ Free a pool and temporary objects it refers to (callable from C) /* Must clip because of partially visible lines. */ rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); - if (p->y < rowY) - { - /* Adjust position of "bottom aligned" bitmap on partially - visible last row. */ - int oldY = row->y; - int oldVH = row->visible_height; - row->visible_height = p->h; - row->y -= rowY - p->y; - ns_clip_to_row (w, row, -1, NO); - row->y = oldY; - row->visible_height = oldVH; - } - else - ns_clip_to_row (w, row, -1, YES); + ns_clip_to_row (w, row, -1, YES); if (p->bx >= 0 && !p->overlay_p) { @@ -3707,7 +3694,7 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes. name: nil object: nil]; */ dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info)); - bzero (dpyinfo, sizeof (struct ns_display_info)); + memset (dpyinfo, 0, sizeof (struct ns_display_info)); ns_initialize_display_info (dpyinfo); terminal = ns_create_terminal (dpyinfo); @@ -4894,16 +4881,16 @@ - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, frameSize.height #ifdef NS_IMPL_GNUSTEP - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) + 3 - - FRAME_NS_TOOLBAR_HEIGHT (emacsframe)); + - FRAME_TOOLBAR_HEIGHT (emacsframe)); #else - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) - - FRAME_NS_TOOLBAR_HEIGHT (emacsframe)); + - FRAME_TOOLBAR_HEIGHT (emacsframe)); #endif if (rows < MINHEIGHT) rows = MINHEIGHT; frameSize.height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (emacsframe, rows) + FRAME_NS_TITLEBAR_HEIGHT (emacsframe) - + FRAME_NS_TOOLBAR_HEIGHT (emacsframe); + + FRAME_TOOLBAR_HEIGHT (emacsframe); #ifdef NS_IMPL_COCOA { /* this sets window title to have size in it; the wm does this under GS */ @@ -5114,7 +5101,7 @@ - (BOOL)isOpaque [toggleButton setTarget: self]; [toggleButton setAction: @selector (toggleToolbar: )]; #endif - FRAME_NS_TOOLBAR_HEIGHT (f) = 0; + FRAME_TOOLBAR_HEIGHT (f) = 0; tem = f->icon_name; if (!NILP (tem)) diff --git a/src/prefix-args.c b/src/prefix-args.c deleted file mode 100644 index d29085a3dff..00000000000 --- a/src/prefix-args.c +++ /dev/null @@ -1,84 +0,0 @@ -/* prefix-args.c - echo each argument, prefixed by a string. - Copyright (C) 1992, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ - -/* Jim Blandy <jimb@occs.cs.oberlin.edu> - September 1992 - - When using GCC 2 as the linker in the build process, options - intended for the linker need to be prefixed with the "-Xlinker" - option. If an option takes an argument, we need to use -Xlinker - twice - once for the option and once for its argument. For - example, to run the linker with the options "-Bstatic" "-e" - "_start", you'd need to pass the following options to GCC: - - -Xlinker -Bstatic -Xlinker -e -Xlinker _start. - - The Emacs makefile used to use a Bourne Shell `for' loop to prefix - each linker option with "-Xlinker", but 1) the for loop was hairier - than one might hope because it had to work when there were no - arguments to pass to the linker - the shell barfs on a loop like - this: - - for arg in ; do echo -Xlinker "$arg"; done - - and 2) the whole compilation command containing this loop seems to - exit with a non-zero status and halt the build under Ultrix. - - If I can't write a completely portable program to do this in C, - I'm quitting and taking up gardening. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#if STDC_HEADERS -# include <stdlib.h> /* for proper declaration of `exit' */ -#endif - -#include <stdio.h> -#include <stdlib.h> - -int -main (argc, argv) - int argc; - char **argv; -{ - char *progname; - char *prefix; - - progname = argv[0]; - argc--, argv++; - - if (argc < 1) - { - fprintf (stderr, "Usage: %s PREFIX ARGS...\n\ -Echo each ARG preceded by PREFIX and a space.\n", progname); - exit (2); - } - - prefix = argv[0]; - argc--, argv++; - - for (; argc > 0; argc--, argv++) - printf ("%s %s%c", prefix, argv[0], (argc > 1) ? ' ' : '\n'); - - exit (0); -} - -/* arch-tag: 08136d70-e5c0-49c7-bcd8-b4850233977a - (do not change this comment) */ diff --git a/src/print.c b/src/print.c index fb298233666..614ad6f2632 100644 --- a/src/print.c +++ b/src/print.c @@ -168,7 +168,7 @@ extern int noninteractive_need_newline; extern int minibuffer_auto_raise; -void print_interval (); +void print_interval (INTERVAL interval, Lisp_Object printcharfun); /* GDB resets this to zero on W32 to disable OutputDebugString calls. */ int print_output_debug_flag = 1; @@ -287,10 +287,9 @@ int print_output_debug_flag = 1; when there is a recursive call to print. */ static Lisp_Object -print_unwind (saved_text) - Lisp_Object saved_text; +print_unwind (Lisp_Object saved_text) { - bcopy (SDATA (saved_text), print_buffer, SCHARS (saved_text)); + memcpy (print_buffer, SDATA (saved_text), SCHARS (saved_text)); return Qnil; } @@ -301,9 +300,7 @@ print_unwind (saved_text) argument. */ static void -printchar (ch, fun) - unsigned int ch; - Lisp_Object fun; +printchar (unsigned int ch, Lisp_Object fun) { if (!NILP (fun) && !EQ (fun, Qt)) call1 (fun, make_number (ch)); @@ -319,7 +316,7 @@ printchar (ch, fun) if (print_buffer_pos_byte + len >= print_buffer_size) print_buffer = (char *) xrealloc (print_buffer, print_buffer_size *= 2); - bcopy (str, print_buffer + print_buffer_pos_byte, len); + memcpy (print_buffer + print_buffer_pos_byte, str, len); print_buffer_pos += 1; print_buffer_pos_byte += len; } @@ -353,11 +350,8 @@ printchar (ch, fun) to data in a Lisp string. Otherwise that is not safe. */ static void -strout (ptr, size, size_byte, printcharfun, multibyte) - char *ptr; - int size, size_byte; - Lisp_Object printcharfun; - int multibyte; +strout (const char *ptr, int size, int size_byte, Lisp_Object printcharfun, + int multibyte) { if (size < 0) size_byte = size = strlen (ptr); @@ -370,7 +364,7 @@ strout (ptr, size, size_byte, printcharfun, multibyte) print_buffer = (char *) xrealloc (print_buffer, print_buffer_size); } - bcopy (ptr, print_buffer + print_buffer_pos_byte, size_byte); + memcpy (print_buffer + print_buffer_pos_byte, ptr, size_byte); print_buffer_pos += size; print_buffer_pos_byte += size_byte; } @@ -440,9 +434,7 @@ strout (ptr, size, size_byte, printcharfun, multibyte) because printing one char can relocate. */ static void -print_string (string, printcharfun) - Lisp_Object string; - Lisp_Object printcharfun; +print_string (Lisp_Object string, Lisp_Object printcharfun) { if (EQ (printcharfun, Qt) || NILP (printcharfun)) { @@ -469,7 +461,7 @@ print_string (string, printcharfun) if (chars < bytes) { newstr = make_uninit_multibyte_string (chars, bytes); - bcopy (SDATA (string), SDATA (newstr), chars); + memcpy (SDATA (newstr), SDATA (string), chars); str_to_multibyte (SDATA (newstr), bytes, chars); string = newstr; } @@ -488,7 +480,7 @@ print_string (string, printcharfun) USE_SAFE_ALLOCA; SAFE_ALLOCA (buffer, char *, nbytes); - bcopy (SDATA (string), buffer, nbytes); + memcpy (buffer, SDATA (string), nbytes); strout (buffer, chars, SBYTES (string), printcharfun, STRING_MULTIBYTE (string)); @@ -530,8 +522,7 @@ print_string (string, printcharfun) DEFUN ("write-char", Fwrite_char, Swrite_char, 1, 2, 0, doc: /* Output character CHARACTER to stream PRINTCHARFUN. PRINTCHARFUN defaults to the value of `standard-output' (which see). */) - (character, printcharfun) - Lisp_Object character, printcharfun; + (Lisp_Object character, Lisp_Object printcharfun) { PRINTDECLARE; @@ -549,9 +540,7 @@ PRINTCHARFUN defaults to the value of `standard-output' (which see). */) Do not use this on the contents of a Lisp string. */ void -write_string (data, size) - char *data; - int size; +write_string (const char *data, int size) { PRINTDECLARE; Lisp_Object printcharfun; @@ -568,10 +557,7 @@ write_string (data, size) Do not use this on the contents of a Lisp string. */ void -write_string_1 (data, size, printcharfun) - char *data; - int size; - Lisp_Object printcharfun; +write_string_1 (const char *data, int size, Lisp_Object printcharfun) { PRINTDECLARE; @@ -582,8 +568,7 @@ write_string_1 (data, size, printcharfun) void -temp_output_buffer_setup (bufname) - const char *bufname; +temp_output_buffer_setup (const char *bufname) { int count = SPECPDL_INDEX (); register struct buffer *old = current_buffer; @@ -616,10 +601,7 @@ temp_output_buffer_setup (bufname) } Lisp_Object -internal_with_output_to_temp_buffer (bufname, function, args) - const char *bufname; - Lisp_Object (*function) P_ ((Lisp_Object)); - Lisp_Object args; +internal_with_output_to_temp_buffer (const char *bufname, Lisp_Object (*function) (Lisp_Object), Lisp_Object args) { int count = SPECPDL_INDEX (); Lisp_Object buf, val; @@ -670,8 +652,7 @@ temporarily selected. But it doesn't run `temp-buffer-show-hook' if it uses `temp-buffer-show-function'. usage: (with-output-to-temp-buffer BUFNAME BODY...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { struct gcpro gcpro1; Lisp_Object name; @@ -695,16 +676,15 @@ usage: (with-output-to-temp-buffer BUFNAME BODY...) */) } -static void print (); -static void print_preprocess (); -static void print_preprocess_string (); -static void print_object (); +static void print (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag); +static void print_preprocess (Lisp_Object obj); +static void print_preprocess_string (INTERVAL interval, Lisp_Object arg); +static void print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag); DEFUN ("terpri", Fterpri, Sterpri, 0, 1, 0, doc: /* Output a newline to stream PRINTCHARFUN. If PRINTCHARFUN is omitted or nil, the value of `standard-output' is used. */) - (printcharfun) - Lisp_Object printcharfun; + (Lisp_Object printcharfun) { PRINTDECLARE; @@ -739,8 +719,7 @@ of these: If PRINTCHARFUN is omitted, the value of `standard-output' (which see) is used instead. */) - (object, printcharfun) - Lisp_Object object, printcharfun; + (Lisp_Object object, Lisp_Object printcharfun) { PRINTDECLARE; @@ -766,8 +745,7 @@ OBJECT is any of the Lisp data types: a number, a string, a symbol, a list, a buffer, a window, a frame, etc. A printed representation of an object is text which describes that object. */) - (object, noescape) - Lisp_Object object, noescape; + (Lisp_Object object, Lisp_Object noescape) { Lisp_Object printcharfun; /* struct gcpro gcpro1, gcpro2; */ @@ -835,8 +813,7 @@ of these: If PRINTCHARFUN is omitted, the value of `standard-output' (which see) is used instead. */) - (object, printcharfun) - Lisp_Object object, printcharfun; + (Lisp_Object object, Lisp_Object printcharfun) { PRINTDECLARE; @@ -871,8 +848,7 @@ of these: If PRINTCHARFUN is omitted, the value of `standard-output' (which see) is used instead. */) - (object, printcharfun) - Lisp_Object object, printcharfun; + (Lisp_Object object, Lisp_Object printcharfun) { PRINTDECLARE; struct gcpro gcpro1; @@ -897,8 +873,7 @@ DEFUN ("external-debugging-output", Fexternal_debugging_output, Sexternal_debugg doc: /* Write CHARACTER to stderr. You can call print while debugging emacs, and pass it this function to make it write to the debugging output. */) - (character) - Lisp_Object character; + (Lisp_Object character) { CHECK_NUMBER (character); putc (XINT (character), stderr); @@ -919,8 +894,7 @@ to make it write to the debugging output. */) print_output_debug_flag from being optimized away. */ void -debug_output_compilation_hack (x) - int x; +debug_output_compilation_hack (int x) { print_output_debug_flag = x; } @@ -941,8 +915,7 @@ DEFUN ("redirect-debugging-output", Fredirect_debugging_output, Sredirect_debugg If FILE is nil, reset target to the initial stderr stream. Optional arg APPEND non-nil (interactively, with prefix arg) means append to existing target file. */) - (file, append) - Lisp_Object file, append; + (Lisp_Object file, Lisp_Object append) { if (initial_stderr_stream != NULL) { @@ -974,16 +947,14 @@ append to existing target file. */) /* This is the interface for debugging printing. */ void -debug_print (arg) - Lisp_Object arg; +debug_print (Lisp_Object arg) { Fprin1 (arg, Qexternal_debugging_output); fprintf (stderr, "\r\n"); } void -safe_debug_print (arg) - Lisp_Object arg; +safe_debug_print (Lisp_Object arg) { int valid = valid_lisp_object_p (arg); @@ -1002,8 +973,7 @@ DEFUN ("error-message-string", Ferror_message_string, Serror_message_string, doc: /* Convert an error value (ERROR-SYMBOL . DATA) to an error message. See Info anchor `(elisp)Definition of signal' for some details on how this error message is constructed. */) - (obj) - Lisp_Object obj; + (Lisp_Object obj) { struct buffer *old = current_buffer; Lisp_Object value; @@ -1037,10 +1007,8 @@ error message is constructed. */) CALLER is the Lisp function inside which the error was signaled. */ void -print_error_message (data, stream, context, caller) - Lisp_Object data, stream; - char *context; - Lisp_Object caller; +print_error_message (Lisp_Object data, Lisp_Object stream, const char *context, + Lisp_Object caller) { Lisp_Object errname, errmsg, file_error, tail; struct gcpro gcpro1; @@ -1055,7 +1023,7 @@ print_error_message (data, stream, context, caller) { Lisp_Object cname = SYMBOL_NAME (caller); char *name = alloca (SBYTES (cname)); - bcopy (SDATA (cname), name, SBYTES (cname)); + memcpy (name, SDATA (cname), SBYTES (cname)); message_dolog (name, SBYTES (cname), 0, 0); message_dolog (": ", 2, 0, 0); } @@ -1125,9 +1093,7 @@ print_error_message (data, stream, context, caller) */ void -float_to_string (buf, data) - unsigned char *buf; - double data; +float_to_string (unsigned char *buf, double data) { unsigned char *cp; int width; @@ -1250,10 +1216,7 @@ float_to_string (buf, data) static void -print (obj, printcharfun, escapeflag) - Lisp_Object obj; - register Lisp_Object printcharfun; - int escapeflag; +print (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag) { new_backquote_output = 0; @@ -1312,8 +1275,7 @@ print (obj, printcharfun, escapeflag) The status fields of Vprint_number_table mean whether each object appears more than once in OBJ: Qnil at the first time, and Qt after that . */ static void -print_preprocess (obj) - Lisp_Object obj; +print_preprocess (Lisp_Object obj) { int i; EMACS_INT size; @@ -1433,9 +1395,7 @@ print_preprocess (obj) } static void -print_preprocess_string (interval, arg) - INTERVAL interval; - Lisp_Object arg; +print_preprocess_string (INTERVAL interval, Lisp_Object arg) { print_preprocess (interval->plist); } @@ -1445,7 +1405,7 @@ print_preprocess_string (interval, arg) Lisp_Object Vprint_charset_text_property; extern Lisp_Object Qdefault; -static void print_check_string_charset_prop (); +static void print_check_string_charset_prop (INTERVAL interval, Lisp_Object string); #define PRINT_STRING_NON_CHARSET_FOUND 1 #define PRINT_STRING_UNSAFE_CHARSET_FOUND 2 @@ -1454,9 +1414,7 @@ static void print_check_string_charset_prop (); static int print_check_string_result; static void -print_check_string_charset_prop (interval, string) - INTERVAL interval; - Lisp_Object string; +print_check_string_charset_prop (INTERVAL interval, Lisp_Object string) { Lisp_Object val; @@ -1503,8 +1461,7 @@ print_check_string_charset_prop (interval, string) static Lisp_Object print_prune_charset_plist; static Lisp_Object -print_prune_string_charset (string) - Lisp_Object string; +print_prune_string_charset (Lisp_Object string) { print_check_string_result = 0; traverse_intervals (STRING_INTERVALS (string), 0, @@ -1528,10 +1485,7 @@ print_prune_string_charset (string) } static void -print_object (obj, printcharfun, escapeflag) - Lisp_Object obj; - register Lisp_Object printcharfun; - int escapeflag; +print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag) { char buf[40]; @@ -2307,9 +2261,7 @@ print_object (obj, printcharfun, escapeflag) This is part of printing a string that has text properties. */ void -print_interval (interval, printcharfun) - INTERVAL interval; - Lisp_Object printcharfun; +print_interval (INTERVAL interval, Lisp_Object printcharfun) { if (NILP (interval->plist)) return; @@ -2324,7 +2276,7 @@ print_interval (interval, printcharfun) void -syms_of_print () +syms_of_print (void) { Qtemp_buffer_setup_hook = intern_c_string ("temp-buffer-setup-hook"); staticpro (&Qtemp_buffer_setup_hook); diff --git a/src/process.c b/src/process.c index 22b85ff5910..219098905cf 100644 --- a/src/process.c +++ b/src/process.c @@ -21,17 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <signal.h> - -/* This file is split into two parts by the following preprocessor - conditional. The 'then' clause contains all of the support for - asynchronous subprocesses. The 'else' clause contains stub - versions of some of the asynchronous subprocess routines that are - often called elsewhere in Emacs, so we don't have to #ifdef the - sections that call them. */ - - -#ifdef subprocesses - #include <stdio.h> #include <errno.h> #include <setjmp.h> @@ -51,6 +40,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #endif #include <fcntl.h> +/* Only MS-DOS does not define `subprocesses'. */ +#ifdef subprocesses + #ifdef HAVE_SOCKETS /* TCP connection support, if kernel can do it */ #include <sys/socket.h> #include <netdb.h> @@ -101,6 +93,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <resolv.h> #endif +#endif /* subprocesses */ + #include "lisp.h" #include "systime.h" #include "systty.h" @@ -119,11 +113,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "dispextern.h" #include "composite.h" #include "atimer.h" +#include "sysselect.h" +#include "syssignal.h" +#include "syswait.h" #if defined (USE_GTK) || defined (HAVE_GCONF) #include "xgselect.h" #endif /* defined (USE_GTK) || defined (HAVE_GCONF) */ +#ifdef subprocesses + Lisp_Object Qprocessp; Lisp_Object Qrun, Qstop, Qsignal; Lisp_Object Qopen, Qclosed, Qconnect, Qfailed, Qlisten; @@ -135,7 +134,7 @@ Lisp_Object Qipv6; Lisp_Object QCport, QCspeed, QCprocess; Lisp_Object QCbytesize, QCstopbits, QCparity, Qodd, Qeven; Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary; -Lisp_Object QCname, QCbuffer, QChost, QCservice, QCtype; +Lisp_Object QCbuffer, QChost, QCservice; Lisp_Object QClocal, QCremote, QCcoding; Lisp_Object QCserver, QCnowait, QCnoquery, QCstop; Lisp_Object QCsentinel, QClog, QCoptions, QCplist; @@ -151,11 +150,6 @@ extern Lisp_Object QCfamily; /* QCfilter is defined in keyboard.c. */ extern Lisp_Object QCfilter; -Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid; -Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime; -Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs; -Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime; - #ifdef HAVE_SOCKETS #define NETCONN_P(p) (EQ (XPROCESS (p)->type, Qnetwork)) #define NETCONN1_P(p) (EQ ((p)->type, Qnetwork)) @@ -178,11 +172,7 @@ Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime; #define SIGCHLD SIGCLD #endif /* SIGCLD */ -#include "syssignal.h" - -#include "syswait.h" - -extern char *get_operating_system_release (); +extern char *get_operating_system_release (void); /* Serial processes require termios or Windows. */ #if defined (HAVE_TERMIOS) || defined (WINDOWSNT) @@ -282,14 +272,11 @@ static Lisp_Object Vprocess_adaptive_read_buffering; #define process_output_delay_count 0 #endif - -#include "sysselect.h" - -static int keyboard_bit_set P_ ((SELECT_TYPE *)); -static void deactivate_process P_ ((Lisp_Object)); -static void status_notify P_ ((struct Lisp_Process *)); -static int read_process_output P_ ((Lisp_Object, int)); -static void create_pty P_ ((Lisp_Object)); +static int keyboard_bit_set (SELECT_TYPE *); +static void deactivate_process (Lisp_Object); +static void status_notify (struct Lisp_Process *); +static int read_process_output (Lisp_Object, int); +static void create_pty (Lisp_Object); /* If we support a window system, turn on the code to poll periodically to detect C-g. It isn't actually used when doing interrupt input. */ @@ -297,11 +284,32 @@ static void create_pty P_ ((Lisp_Object)); #define POLL_FOR_INPUT #endif -static Lisp_Object get_process (); -static void exec_sentinel (); +static Lisp_Object get_process (register Lisp_Object name); +static void exec_sentinel (Lisp_Object proc, Lisp_Object reason); + +#endif /* subprocesses */ extern int timers_run; + +Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid; +Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime; +Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs; +Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime; +Lisp_Object QCname, QCtype; +/* Non-zero if keyboard input is on hold, zero otherwise. */ + +static int kbd_is_on_hold; + +/* Nonzero means delete a process right away if it exits. */ +static int delete_exited_processes; + +/* Nonzero means don't run process sentinels. This is used + when exiting. */ +int inhibit_sentinels; + +#ifdef subprocesses + /* Mask of bits indicating the descriptors that we wait for input on. */ static SELECT_TYPE input_wait_mask; @@ -329,9 +337,9 @@ static SELECT_TYPE connect_wait_mask; static int num_pending_connects; #define IF_NON_BLOCKING_CONNECT(s) s -#else +#else /* NON_BLOCKING_CONNECT */ #define IF_NON_BLOCKING_CONNECT(s) -#endif +#endif /* NON_BLOCKING_CONNECT */ /* The largest descriptor currently in use for a process object. */ static int max_process_desc; @@ -342,9 +350,6 @@ static int max_keyboard_desc; /* The largest descriptor currently in use for gpm mouse input. */ static int max_gpm_desc; -/* Nonzero means delete a process right away if it exits. */ -static int delete_exited_processes; - /* Indexed by descriptor, gives the process (if any) for that descriptor */ Lisp_Object chan_process[MAXDESC]; @@ -380,10 +385,6 @@ struct sockaddr_and_len { /* Maximum number of bytes to send to a pty without an eof. */ static int pty_max_bytes; -/* Nonzero means don't run process sentinels. This is used - when exiting. */ -int inhibit_sentinels; - #ifdef HAVE_PTYS #ifdef HAVE_PTY_H #include <pty.h> @@ -399,8 +400,7 @@ static char pty_name[24]; static Lisp_Object status_convert (int); static void -update_status (p) - struct Lisp_Process *p; +update_status (struct Lisp_Process *p) { eassert (p->raw_status_new); p->status = status_convert (p->raw_status); @@ -429,11 +429,7 @@ status_convert (int w) and store them individually through the three pointers. */ static void -decode_status (l, symbol, code, coredump) - Lisp_Object l; - Lisp_Object *symbol; - int *code; - int *coredump; +decode_status (Lisp_Object l, Lisp_Object *symbol, int *code, int *coredump) { Lisp_Object tem; @@ -456,8 +452,7 @@ decode_status (l, symbol, code, coredump) /* Return a string describing a process status list. */ static Lisp_Object -status_message (p) - struct Lisp_Process *p; +status_message (struct Lisp_Process *p) { Lisp_Object status = p->status; Lisp_Object symbol; @@ -519,7 +514,7 @@ status_message (p) is left in the variable pty_name. */ static int -allocate_pty () +allocate_pty (void) { register int c, i; int fd; @@ -593,8 +588,7 @@ allocate_pty () #endif /* HAVE_PTYS */ static Lisp_Object -make_process (name) - Lisp_Object name; +make_process (Lisp_Object name) { register Lisp_Object val, tem, name1; register struct Lisp_Process *p; @@ -638,8 +632,7 @@ make_process (name) } static void -remove_process (proc) - register Lisp_Object proc; +remove_process (register Lisp_Object proc) { register Lisp_Object pair; @@ -649,52 +642,17 @@ remove_process (proc) deactivate_process (proc); } -/* Setup coding systems of PROCESS. */ - -void -setup_process_coding_systems (process) - Lisp_Object process; -{ - struct Lisp_Process *p = XPROCESS (process); - int inch = p->infd; - int outch = p->outfd; - Lisp_Object coding_system; - - if (inch < 0 || outch < 0) - return; - - if (!proc_decode_coding_system[inch]) - proc_decode_coding_system[inch] - = (struct coding_system *) xmalloc (sizeof (struct coding_system)); - coding_system = p->decode_coding_system; - if (! NILP (p->filter)) - ; - else if (BUFFERP (p->buffer)) - { - if (NILP (XBUFFER (p->buffer)->enable_multibyte_characters)) - coding_system = raw_text_coding_system (coding_system); - } - setup_coding_system (coding_system, proc_decode_coding_system[inch]); - - if (!proc_encode_coding_system[outch]) - proc_encode_coding_system[outch] - = (struct coding_system *) xmalloc (sizeof (struct coding_system)); - setup_coding_system (p->encode_coding_system, - proc_encode_coding_system[outch]); -} DEFUN ("processp", Fprocessp, Sprocessp, 1, 1, 0, doc: /* Return t if OBJECT is a process. */) - (object) - Lisp_Object object; + (Lisp_Object object) { return PROCESSP (object) ? Qt : Qnil; } DEFUN ("get-process", Fget_process, Sget_process, 1, 1, 0, doc: /* Return the process named NAME, or nil if there is none. */) - (name) - register Lisp_Object name; + (register Lisp_Object name) { if (PROCESSP (name)) return name; @@ -702,35 +660,13 @@ DEFUN ("get-process", Fget_process, Sget_process, 1, 1, 0, return Fcdr (Fassoc (name, Vprocess_alist)); } -DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0, - doc: /* Return the (or a) process associated with BUFFER. -BUFFER may be a buffer or the name of one. */) - (buffer) - register Lisp_Object buffer; -{ - register Lisp_Object buf, tail, proc; - - if (NILP (buffer)) return Qnil; - buf = Fget_buffer (buffer); - if (NILP (buf)) return Qnil; - - for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) - { - proc = Fcdr (XCAR (tail)); - if (PROCESSP (proc) && EQ (XPROCESS (proc)->buffer, buf)) - return proc; - } - return Qnil; -} - /* This is how commands for the user decode process arguments. It accepts a process, a process name, a buffer, a buffer name, or nil. Buffers denote the first process in the buffer, and nil denotes the current buffer. */ static Lisp_Object -get_process (name) - register Lisp_Object name; +get_process (register Lisp_Object name) { register Lisp_Object proc, obj; if (STRINGP (name)) @@ -776,8 +712,7 @@ DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0, doc: /* Delete PROCESS: kill it and forget about it immediately. PROCESS may be a process, a buffer, the name of a process or buffer, or nil, indicating the current buffer's process. */) - (process) - register Lisp_Object process; + (register Lisp_Object process) { register struct Lisp_Process *p; @@ -844,8 +779,7 @@ failed -- when a non-blocking connection has failed. nil -- if arg is a process name and no such process exists. PROCESS may be a process, a buffer, the name of a process, or nil, indicating the current buffer's process. */) - (process) - register Lisp_Object process; + (register Lisp_Object process) { register struct Lisp_Process *p; register Lisp_Object status; @@ -880,8 +814,7 @@ DEFUN ("process-exit-status", Fprocess_exit_status, Sprocess_exit_status, 1, 1, 0, doc: /* Return the exit status of PROCESS or the signal number that killed it. If PROCESS has not yet exited or died, return 0. */) - (process) - register Lisp_Object process; + (register Lisp_Object process) { CHECK_PROCESS (process); if (XPROCESS (process)->raw_status_new) @@ -895,8 +828,7 @@ DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0, doc: /* Return the process id of PROCESS. This is the pid of the external process which PROCESS uses or talks to. For a network connection, this value is nil. */) - (process) - register Lisp_Object process; + (register Lisp_Object process) { /* Assignment to EMACS_INT stops GCC whining about limited range of data type. */ @@ -911,8 +843,7 @@ DEFUN ("process-name", Fprocess_name, Sprocess_name, 1, 1, 0, doc: /* Return the name of PROCESS, as a string. This is the name of the program invoked in PROCESS, possibly modified to make it unique among process names. */) - (process) - register Lisp_Object process; + (register Lisp_Object process) { CHECK_PROCESS (process); return XPROCESS (process)->name; @@ -924,8 +855,7 @@ This is a list of strings, the first string being the program executed and the rest of the strings being the arguments given to it. For a network or serial process, this is nil (process is running) or t \(process is stopped). */) - (process) - register Lisp_Object process; + (register Lisp_Object process) { CHECK_PROCESS (process); return XPROCESS (process)->command; @@ -935,8 +865,7 @@ DEFUN ("process-tty-name", Fprocess_tty_name, Sprocess_tty_name, 1, 1, 0, doc: /* Return the name of the terminal PROCESS uses, or nil if none. This is the terminal that the process itself reads and writes on, not the name of the pty that Emacs uses to talk with that terminal. */) - (process) - register Lisp_Object process; + (register Lisp_Object process) { CHECK_PROCESS (process); return XPROCESS (process)->tty_name; @@ -945,8 +874,7 @@ not the name of the pty that Emacs uses to talk with that terminal. */) DEFUN ("set-process-buffer", Fset_process_buffer, Sset_process_buffer, 2, 2, 0, doc: /* Set buffer associated with PROCESS to BUFFER (a buffer, or nil). */) - (process, buffer) - register Lisp_Object process, buffer; + (register Lisp_Object process, Lisp_Object buffer) { struct Lisp_Process *p; @@ -965,8 +893,7 @@ DEFUN ("process-buffer", Fprocess_buffer, Sprocess_buffer, 1, 1, 0, doc: /* Return the buffer PROCESS is associated with. Output from PROCESS is inserted in this buffer unless PROCESS has a filter. */) - (process) - register Lisp_Object process; + (register Lisp_Object process) { CHECK_PROCESS (process); return XPROCESS (process)->buffer; @@ -975,8 +902,7 @@ Output from PROCESS is inserted in this buffer unless PROCESS has a filter. */) DEFUN ("process-mark", Fprocess_mark, Sprocess_mark, 1, 1, 0, doc: /* Return the marker for the end of the last output from PROCESS. */) - (process) - register Lisp_Object process; + (register Lisp_Object process) { CHECK_PROCESS (process); return XPROCESS (process)->mark; @@ -998,8 +924,7 @@ The string argument is normally a multibyte string, except: - if `default-enable-multibyte-characters' is nil, it is a unibyte string (the result of converting the decoded input multibyte string to unibyte with `string-make-unibyte'). */) - (process, filter) - register Lisp_Object process, filter; + (register Lisp_Object process, Lisp_Object filter) { struct Lisp_Process *p; @@ -1041,8 +966,7 @@ DEFUN ("process-filter", Fprocess_filter, Sprocess_filter, 1, 1, 0, doc: /* Returns the filter function of PROCESS; nil if none. See `set-process-filter' for more info on filter functions. */) - (process) - register Lisp_Object process; + (register Lisp_Object process) { CHECK_PROCESS (process); return XPROCESS (process)->filter; @@ -1053,8 +977,7 @@ DEFUN ("set-process-sentinel", Fset_process_sentinel, Sset_process_sentinel, doc: /* Give PROCESS the sentinel SENTINEL; nil for none. The sentinel is called as a function when the process changes state. It gets two arguments: the process, and a string describing the change. */) - (process, sentinel) - register Lisp_Object process, sentinel; + (register Lisp_Object process, Lisp_Object sentinel) { struct Lisp_Process *p; @@ -1071,8 +994,7 @@ DEFUN ("process-sentinel", Fprocess_sentinel, Sprocess_sentinel, 1, 1, 0, doc: /* Return the sentinel of PROCESS; nil if none. See `set-process-sentinel' for more info on sentinels. */) - (process) - register Lisp_Object process; + (register Lisp_Object process) { CHECK_PROCESS (process); return XPROCESS (process)->sentinel; @@ -1081,8 +1003,7 @@ See `set-process-sentinel' for more info on sentinels. */) DEFUN ("set-process-window-size", Fset_process_window_size, Sset_process_window_size, 3, 3, 0, doc: /* Tell PROCESS that it has logical window size HEIGHT and WIDTH. */) - (process, height, width) - register Lisp_Object process, height, width; + (register Lisp_Object process, Lisp_Object height, Lisp_Object width) { CHECK_PROCESS (process); CHECK_NATNUM (height); @@ -1113,36 +1034,20 @@ is more appropriate for saving the process buffer. Binding the variable `inherit-process-coding-system' to non-nil before starting the process is an alternative way of setting the inherit flag for the process which will run. */) - (process, flag) - register Lisp_Object process, flag; + (register Lisp_Object process, Lisp_Object flag) { CHECK_PROCESS (process); XPROCESS (process)->inherit_coding_system_flag = !NILP (flag); return flag; } -DEFUN ("process-inherit-coding-system-flag", - Fprocess_inherit_coding_system_flag, Sprocess_inherit_coding_system_flag, - 1, 1, 0, - doc: /* Return the value of inherit-coding-system flag for PROCESS. -If this flag is t, `buffer-file-coding-system' of the buffer -associated with PROCESS will inherit the coding system used to decode -the process output. */) - (process) - register Lisp_Object process; -{ - CHECK_PROCESS (process); - return XPROCESS (process)->inherit_coding_system_flag ? Qt : Qnil; -} - DEFUN ("set-process-query-on-exit-flag", Fset_process_query_on_exit_flag, Sset_process_query_on_exit_flag, 2, 2, 0, doc: /* Specify if query is needed for PROCESS when Emacs is exited. If the second argument FLAG is non-nil, Emacs will query the user before exiting or killing a buffer if PROCESS is running. */) - (process, flag) - register Lisp_Object process, flag; + (register Lisp_Object process, Lisp_Object flag) { CHECK_PROCESS (process); XPROCESS (process)->kill_without_query = NILP (flag); @@ -1153,15 +1058,14 @@ DEFUN ("process-query-on-exit-flag", Fprocess_query_on_exit_flag, Sprocess_query_on_exit_flag, 1, 1, 0, doc: /* Return the current value of query-on-exit flag for PROCESS. */) - (process) - register Lisp_Object process; + (register Lisp_Object process) { CHECK_PROCESS (process); return (XPROCESS (process)->kill_without_query ? Qnil : Qt); } #ifdef DATAGRAM_SOCKETS -Lisp_Object Fprocess_datagram_address (); +Lisp_Object Fprocess_datagram_address (Lisp_Object process); #endif DEFUN ("process-contact", Fprocess_contact, Sprocess_contact, @@ -1174,8 +1078,7 @@ connection. If KEY is t, the complete contact information for the connection is returned, else the specific value for the keyword KEY is returned. See `make-network-process' or `make-serial-process' for a list of keywords. */) - (process, key) - register Lisp_Object process, key; + (register Lisp_Object process, Lisp_Object key) { Lisp_Object contact; @@ -1203,8 +1106,7 @@ list of keywords. */) DEFUN ("process-plist", Fprocess_plist, Sprocess_plist, 1, 1, 0, doc: /* Return the plist of PROCESS. */) - (process) - register Lisp_Object process; + (register Lisp_Object process) { CHECK_PROCESS (process); return XPROCESS (process)->plist; @@ -1213,8 +1115,7 @@ DEFUN ("process-plist", Fprocess_plist, Sprocess_plist, DEFUN ("set-process-plist", Fset_process_plist, Sset_process_plist, 2, 2, 0, doc: /* Replace the plist of PROCESS with PLIST. Returns PLIST. */) - (process, plist) - register Lisp_Object process, plist; + (register Lisp_Object process, Lisp_Object plist) { CHECK_PROCESS (process); CHECK_LIST (plist); @@ -1229,8 +1130,7 @@ DEFUN ("process-connection", Fprocess_connection, Sprocess_connection, 1, 1, 0, doc: /* Return the connection type of PROCESS. The value is nil for a pipe, t or `pty' for a pty, or `stream' for a socket connection. */) - (process) - Lisp_Object process; + (Lisp_Object process) { return XPROCESS (process)->type; } @@ -1241,8 +1141,7 @@ DEFUN ("process-type", Fprocess_type, Sprocess_type, 1, 1, 0, The value is either the symbol `real', `network', or `serial'. PROCESS may be a process, a buffer, the name of a process or buffer, or nil, indicating the current buffer's process. */) - (process) - Lisp_Object process; + (Lisp_Object process) { Lisp_Object proc; proc = get_process (process); @@ -1258,8 +1157,7 @@ An 8 or 9 element vector represents an IPv6 address (with port number). If optional second argument OMIT-PORT is non-nil, don't include a port number in the string, even when present in ADDRESS. Returns nil if format of ADDRESS is invalid. */) - (address, omit_port) - Lisp_Object address, omit_port; + (Lisp_Object address, Lisp_Object omit_port) { if (NILP (address)) return Qnil; @@ -1327,8 +1225,7 @@ Returns nil if format of ADDRESS is invalid. */) #endif static Lisp_Object -list_processes_1 (query_only) - Lisp_Object query_only; +list_processes_1 (Lisp_Object query_only) { register Lisp_Object tail, tem; Lisp_Object proc, minspace, tem1; @@ -1562,8 +1459,7 @@ If optional argument QUERY-ONLY is non-nil, only processes with the query-on-exit flag set will be listed. Any process listed as exited or signaled is actually eliminated after the listing is made. */) - (query_only) - Lisp_Object query_only; + (Lisp_Object query_only) { internal_with_output_to_temp_buffer ("*Process List*", list_processes_1, query_only); @@ -1572,14 +1468,14 @@ after the listing is made. */) DEFUN ("process-list", Fprocess_list, Sprocess_list, 0, 0, 0, doc: /* Return a list of all processes. */) - () + (void) { return Fmapcar (Qcdr, Vprocess_alist); } /* Starting asynchronous inferior processes. */ -static Lisp_Object start_process_unwind (); +static Lisp_Object start_process_unwind (Lisp_Object proc); DEFUN ("start-process", Fstart_process, Sstart_process, 3, MANY, 0, doc: /* Start a program in a subprocess. Return the process object for it. @@ -1600,9 +1496,7 @@ the command through a shell and redirect one of them using the shell syntax. usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) - (nargs, args) - int nargs; - register Lisp_Object *args; + (int nargs, register Lisp_Object *args) { Lisp_Object buffer, name, program, proc, current_dir, tem; register unsigned char **new_argv; @@ -1814,8 +1708,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) an error and the process wasn't started successfully, so we should remove it from the process list. */ static Lisp_Object -start_process_unwind (proc) - Lisp_Object proc; +start_process_unwind (Lisp_Object proc) { if (!PROCESSP (proc)) abort (); @@ -1828,8 +1721,7 @@ start_process_unwind (proc) } static void -create_process_1 (timer) - struct atimer *timer; +create_process_1 (struct atimer *timer) { /* Nothing to do. */ } @@ -1855,10 +1747,7 @@ create_process_sigchld () #endif void -create_process (process, new_argv, current_dir) - Lisp_Object process; - char **new_argv; - Lisp_Object current_dir; +create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) { int inchannel, outchannel; pid_t pid; @@ -2038,7 +1927,7 @@ create_process (process, new_argv, current_dir) process_set_signal to fail on SGI when using a pipe. */ setsid (); /* Make the pty's terminal the controlling terminal. */ - if (pty_flag) + if (pty_flag && xforkin >= 0) { #ifdef TIOCSCTTY /* We ignore the return value @@ -2081,8 +1970,11 @@ create_process (process, new_argv, current_dir) /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here? I can't test it since I don't have 4.3. */ int j = emacs_open ("/dev/tty", O_RDWR, 0); - ioctl (j, TIOCNOTTY, 0); - emacs_close (j); + if (j >= 0) + { + ioctl (j, TIOCNOTTY, 0); + emacs_close (j); + } #ifndef USG /* In order to get a controlling terminal on some versions of BSD, it is necessary to put the process in pgrp 0 @@ -2242,8 +2134,7 @@ create_process (process, new_argv, current_dir) } void -create_pty (process) - Lisp_Object process; +create_pty (Lisp_Object process) { int inchannel, outchannel; @@ -2330,9 +2221,7 @@ create_pty (process) The address family of sa is not included in the result. */ static Lisp_Object -conv_sockaddr_to_lisp (sa, len) - struct sockaddr *sa; - int len; +conv_sockaddr_to_lisp (struct sockaddr *sa, int len) { Lisp_Object address; int i; @@ -2342,7 +2231,7 @@ conv_sockaddr_to_lisp (sa, len) /* Workaround for a bug in getsockname on BSD: Names bound to sockets in the UNIX domain are inaccessible; getsockname returns a zero length name. */ - if (len < OFFSETOF (struct sockaddr, sa_family) + sizeof (sa->sa_family)) + if (len < offsetof (struct sockaddr, sa_family) + sizeof (sa->sa_family)) return empty_unibyte_string; switch (sa->sa_family) @@ -2382,7 +2271,7 @@ conv_sockaddr_to_lisp (sa, len) } #endif default: - len -= OFFSETOF (struct sockaddr, sa_family) + sizeof (sa->sa_family); + len -= offsetof (struct sockaddr, sa_family) + sizeof (sa->sa_family); address = Fcons (make_number (sa->sa_family), Fmake_vector (make_number (len), Qnil)); p = XVECTOR (XCDR (address)); @@ -2401,9 +2290,7 @@ conv_sockaddr_to_lisp (sa, len) /* Get family and required size for sockaddr structure to hold ADDRESS. */ static int -get_lisp_to_sockaddr_size (address, familyp) - Lisp_Object address; - int *familyp; +get_lisp_to_sockaddr_size (Lisp_Object address, int *familyp) { register struct Lisp_Vector *p; @@ -2448,17 +2335,13 @@ get_lisp_to_sockaddr_size (address, familyp) we return after zeroing *SA. */ static void -conv_lisp_to_sockaddr (family, address, sa, len) - int family; - Lisp_Object address; - struct sockaddr *sa; - int len; +conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int len) { register struct Lisp_Vector *p; register unsigned char *cp = NULL; register int i; - bzero (sa, len); + memset (sa, 0, len); if (VECTORP (address)) { @@ -2522,8 +2405,7 @@ conv_lisp_to_sockaddr (family, address, sa, len) DEFUN ("process-datagram-address", Fprocess_datagram_address, Sprocess_datagram_address, 1, 1, 0, doc: /* Get the current datagram address associated with PROCESS. */) - (process) - Lisp_Object process; + (Lisp_Object process) { int channel; @@ -2541,8 +2423,7 @@ DEFUN ("set-process-datagram-address", Fset_process_datagram_address, Sset_proce 2, 2, 0, doc: /* Set the datagram address for PROCESS to ADDRESS. Returns nil upon error setting address, ADDRESS otherwise. */) - (process, address) - Lisp_Object process, address; + (Lisp_Object process, Lisp_Object address) { int channel; int family, len; @@ -2609,9 +2490,7 @@ static const struct socket_options { */ static int -set_socket_option (s, opt, val) - int s; - Lisp_Object opt, val; +set_socket_option (int s, Lisp_Object opt, Lisp_Object val) { char *name; const struct socket_options *sopt; @@ -2655,12 +2534,12 @@ set_socket_option (s, opt, val) /* This is broken, at least in the Linux 2.4 kernel. To unbind, the arg must be a zero integer, not the empty string. This should work on all systems. KFS. 2003-09-23. */ - bzero (devname, sizeof devname); + memset (devname, 0, sizeof devname); if (STRINGP (val)) { char *arg = (char *) SDATA (val); int len = min (strlen (arg), IFNAMSIZ); - bcopy (arg, devname, len); + memcpy (devname, arg, len); } else if (!NILP (val)) error ("Bad option value for %s", name); @@ -2705,9 +2584,7 @@ DEFUN ("set-network-process-option", See `make-network-process' for a list of options and values. If optional fourth arg NO-ERROR is non-nil, don't signal an error if OPTION is not a supported option, return nil instead; otherwise return t. */) - (process, option, value, no_error) - Lisp_Object process, option, value; - Lisp_Object no_error; + (Lisp_Object process, Lisp_Object option, Lisp_Object value, Lisp_Object no_error) { int s; struct Lisp_Process *p; @@ -2794,9 +2671,7 @@ initial configuration of the serial port. \(serial-process-configure :port "\\\\.\\COM13" :bytesize 7) usage: (serial-process-configure &rest ARGS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { struct Lisp_Process *p; Lisp_Object contact = Qnil; @@ -2913,9 +2788,7 @@ is available via the function `process-contact'. \(make-serial-process :port "/dev/tty.BlueConsole-SPP-1" :speed nil) usage: (make-serial-process &rest ARGS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { int fd = -1; Lisp_Object proc, contact, port; @@ -3027,7 +2900,7 @@ usage: (make-serial-process &rest ARGS) */) p->inherit_coding_system_flag = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); - Fserial_process_configure(nargs, args); + Fserial_process_configure (nargs, args); specpdl_ptr = specpdl + specpdl_count; @@ -3194,9 +3067,7 @@ The original argument list, modified with the actual connection information, is available via the `process-contact' function. usage: (make-network-process &rest ARGS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { Lisp_Object proc; Lisp_Object contact; @@ -3369,7 +3240,7 @@ usage: (make-network-process &rest ARGS) */) host = Qnil; } CHECK_STRING (service); - bzero (&address_un, sizeof address_un); + memset (&address_un, 0, sizeof address_un); address_un.sun_family = AF_LOCAL; strncpy (address_un.sun_path, SDATA (service), sizeof address_un.sun_path); ai.ai_addr = (struct sockaddr *) &address_un; @@ -3425,7 +3296,7 @@ usage: (make-network-process &rest ARGS) */) ret = getaddrinfo (SDATA (host), portstring, &hints, &res); if (ret) #ifdef HAVE_GAI_STRERROR - error ("%s/%s %s", SDATA (host), portstring, gai_strerror(ret)); + error ("%s/%s %s", SDATA (host), portstring, gai_strerror (ret)); #else error ("%s/%s getaddrinfo error %d", SDATA (host), portstring, ret); #endif @@ -3453,7 +3324,7 @@ usage: (make-network-process &rest ARGS) */) port = svc_info->s_port; } - bzero (&address_in, sizeof address_in); + memset (&address_in, 0, sizeof address_in); address_in.sin_family = family; address_in.sin_addr.s_addr = INADDR_ANY; address_in.sin_port = port; @@ -3477,8 +3348,8 @@ usage: (make-network-process &rest ARGS) */) if (host_info_ptr) { - bcopy (host_info_ptr->h_addr, (char *) &address_in.sin_addr, - host_info_ptr->h_length); + memcpy (&address_in.sin_addr, host_info_ptr->h_addr, + host_info_ptr->h_length); family = host_info_ptr->h_addrtype; address_in.sin_family = family; } @@ -3490,8 +3361,8 @@ usage: (make-network-process &rest ARGS) */) if (numeric_addr == -1) error ("Unknown host \"%s\"", SDATA (host)); - bcopy ((char *)&numeric_addr, (char *) &address_in.sin_addr, - sizeof (address_in.sin_addr)); + memcpy (&address_in.sin_addr, &numeric_addr, + sizeof (address_in.sin_addr)); } } @@ -3675,7 +3546,7 @@ usage: (make-network-process &rest ARGS) */) if (is_server) { Lisp_Object remote; - bzero (datagram_address[s].sa, lres->ai_addrlen); + memset (datagram_address[s].sa, 0, lres->ai_addrlen); if (remote = Fplist_get (contact, QCremote), !NILP (remote)) { int rfamily, rlen; @@ -3686,7 +3557,7 @@ usage: (make-network-process &rest ARGS) */) } } else - bcopy (lres->ai_addr, datagram_address[s].sa, lres->ai_addrlen); + memcpy (datagram_address[s].sa, lres->ai_addr, lres->ai_addrlen); } #endif contact = Fplist_put (contact, QCaddress, @@ -3698,7 +3569,7 @@ usage: (make-network-process &rest ARGS) */) int len1 = sizeof (sa1); if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) contact = Fplist_put (contact, QClocal, - conv_sockaddr_to_lisp (&sa1, len1)); + conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1)); } #endif } @@ -3910,7 +3781,7 @@ DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_lis Each element is a cons, the car of which is a string containing the interface name, and the cdr is the network address in internal format; see the description of ADDRESS in `make-network-process'. */) - () + (void) { struct ifconf ifconf; struct ifreq *ifreqs = NULL; @@ -3924,7 +3795,7 @@ format; see the description of ADDRESS in `make-network-process'. */) again: ifaces += 25; - buf_size = ifaces * sizeof(ifreqs[0]); + buf_size = ifaces * sizeof (ifreqs[0]); ifreqs = (struct ifreq *)xrealloc(ifreqs, buf_size); if (!ifreqs) { @@ -3953,7 +3824,7 @@ format; see the description of ADDRESS in `make-network-process'. */) char namebuf[sizeof (ifq->ifr_name) + 1]; if (ifq->ifr_addr.sa_family != AF_INET) continue; - bcopy (ifq->ifr_name, namebuf, sizeof (ifq->ifr_name)); + memcpy (namebuf, ifq->ifr_name, sizeof (ifq->ifr_name)); namebuf[sizeof (ifq->ifr_name)] = 0; res = Fcons (Fcons (build_string (namebuf), conv_sockaddr_to_lisp (&ifq->ifr_addr, @@ -4045,8 +3916,7 @@ The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS), where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address, NETMASK is the layer 3 network mask, HWADDR is the layer 2 addres, and FLAGS is the current flags of the interface. */) - (ifname) - Lisp_Object ifname; + (Lisp_Object ifname) { struct ifreq rq; Lisp_Object res = Qnil; @@ -4056,7 +3926,7 @@ FLAGS is the current flags of the interface. */) CHECK_STRING (ifname); - bzero (rq.ifr_name, sizeof rq.ifr_name); + memset (rq.ifr_name, 0, sizeof rq.ifr_name); strncpy (rq.ifr_name, SDATA (ifname), sizeof (rq.ifr_name)); s = socket (AF_INET, SOCK_STREAM, 0); @@ -4151,8 +4021,7 @@ FLAGS is the current flags of the interface. */) /* Turn off input and output for process PROC. */ void -deactivate_process (proc) - Lisp_Object proc; +deactivate_process (Lisp_Object proc) { register int inchannel, outchannel; register struct Lisp_Process *p = XPROCESS (proc); @@ -4212,31 +4081,6 @@ deactivate_process (proc) } } -/* Close all descriptors currently in use for communication - with subprocess. This is used in a newly-forked subprocess - to get rid of irrelevant descriptors. */ - -void -close_process_descs () -{ -#ifndef WINDOWSNT - int i; - for (i = 0; i < MAXDESC; i++) - { - Lisp_Object process; - process = chan_process[i]; - if (!NILP (process)) - { - int in = XPROCESS (process)->infd; - int out = XPROCESS (process)->outfd; - if (in >= 0) - emacs_close (in); - if (out >= 0 && in != out) - emacs_close (out); - } - } -#endif -} DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output, 0, 4, 0, @@ -4255,8 +4099,7 @@ If optional fourth arg JUST-THIS-ONE is non-nil, only accept output from PROCESS, suspending reading output from other processes. If JUST-THIS-ONE is an integer, don't run any timers either. Return non-nil if we received any output before the timeout expired. */) - (process, seconds, millisec, just_this_one) - register Lisp_Object process, seconds, millisec, just_this_one; + (register Lisp_Object process, Lisp_Object seconds, Lisp_Object millisec, Lisp_Object just_this_one) { int secs, usecs = 0; @@ -4310,9 +4153,7 @@ Return non-nil if we received any output before the timeout expired. */) static int connect_counter = 0; static void -server_accept_connection (server, channel) - Lisp_Object server; - int channel; +server_accept_connection (Lisp_Object server, int channel) { Lisp_Object proc, caller, name, buffer; Lisp_Object contact, host, service; @@ -4389,7 +4230,7 @@ server_accept_connection (server, channel) int i; args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x"); for (i = 0; i < 8; i++) - args[i+1] = make_number (ntohs(ip6[i])); + args[i+1] = make_number (ntohs (ip6[i])); host = Fformat (9, args); service = make_number (ntohs (saddr.in.sin_port)); @@ -4528,8 +4369,7 @@ server_accept_connection (server, channel) static int waiting_for_user_input_p; static Lisp_Object -wait_reading_process_output_unwind (data) - Lisp_Object data; +wait_reading_process_output_unwind (Lisp_Object data) { waiting_for_user_input_p = XINT (data); return Qnil; @@ -4537,7 +4377,7 @@ wait_reading_process_output_unwind (data) /* This is here so breakpoints can be put on it. */ static void -wait_reading_process_output_1 () +wait_reading_process_output_1 (void) { } @@ -4550,10 +4390,7 @@ wait_reading_process_output_1 () #ifndef select static INLINE int -select_wrapper (n, rfd, wfd, xfd, tmo) - int n; - SELECT_TYPE *rfd, *wfd, *xfd; - EMACS_TIME *tmo; +select_wrapper (int n, fd_set *rfd, fd_set *wfd, fd_set *xfd, struct timeval *tmo) { return select (n, rfd, wfd, xfd, tmo); } @@ -4598,12 +4435,10 @@ select_wrapper (n, rfd, wfd, xfd, tmo) Otherwise, return true if we received input from any process. */ int -wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, - wait_for_cell, wait_proc, just_wait_proc) - int time_limit, microsecs, read_kbd, do_display; - Lisp_Object wait_for_cell; - struct Lisp_Process *wait_proc; - int just_wait_proc; +wait_reading_process_output (int time_limit, int microsecs, int read_kbd, + int do_display, + Lisp_Object wait_for_cell, + struct Lisp_Process *wait_proc, int just_wait_proc) { register int channel, nfds; SELECT_TYPE Available; @@ -4762,7 +4597,10 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, SELECT_TYPE Ctemp; #endif - Atemp = input_wait_mask; + if (kbd_on_hold_p ()) + FD_ZERO (&Atemp); + else + Atemp = input_wait_mask; IF_NON_BLOCKING_CONNECT (Ctemp = connect_wait_mask); EMACS_SET_SECS_USECS (timeout, 0, 0); @@ -5195,23 +5033,23 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, /* getsockopt(,,SO_ERROR,,) is said to hang on some systems. So only use it on systems where it is known to work. */ { - int xlen = sizeof(xerrno); - if (getsockopt(channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) + int xlen = sizeof (xerrno); + if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) xerrno = errno; } #else { struct sockaddr pname; - int pnamelen = sizeof(pname); + int pnamelen = sizeof (pname); /* If connection failed, getpeername will fail. */ xerrno = 0; - if (getpeername(channel, &pname, &pnamelen) < 0) + if (getpeername (channel, &pname, &pnamelen) < 0) { /* Obtain connect failure code through error slippage. */ char dummy; xerrno = errno; - if (errno == ENOTCONN && read(channel, &dummy, 1) < 0) + if (errno == ENOTCONN && read (channel, &dummy, 1) < 0) xerrno = errno; } } @@ -5258,15 +5096,13 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, /* Given a list (FUNCTION ARGS...), apply FUNCTION to the ARGS. */ static Lisp_Object -read_process_output_call (fun_and_args) - Lisp_Object fun_and_args; +read_process_output_call (Lisp_Object fun_and_args) { return apply1 (XCAR (fun_and_args), XCDR (fun_and_args)); } static Lisp_Object -read_process_output_error_handler (error) - Lisp_Object error; +read_process_output_error_handler (Lisp_Object error) { cmd_error_internal (error, "error in process filter: "); Vinhibit_quit = Qt; @@ -5287,9 +5123,7 @@ read_process_output_error_handler (error) for decoding. */ static int -read_process_output (proc, channel) - Lisp_Object proc; - register int channel; +read_process_output (Lisp_Object proc, register int channel) { register int nbytes; char *chars; @@ -5305,7 +5139,7 @@ read_process_output (proc, channel) chars = (char *) alloca (carryover + readmax); if (carryover) /* See the comment above. */ - bcopy (SDATA (p->decoding_buf), chars, carryover); + memcpy (chars, SDATA (p->decoding_buf), carryover); #ifdef DATAGRAM_SOCKETS /* We have a working select, so proc_buffered_char is always -1. */ @@ -5449,8 +5283,8 @@ read_process_output (proc, channel) { if (SCHARS (p->decoding_buf) < coding->carryover_bytes) p->decoding_buf = make_uninit_string (coding->carryover_bytes); - bcopy (coding->carryover, SDATA (p->decoding_buf), - coding->carryover_bytes); + memcpy (SDATA (p->decoding_buf), coding->carryover, + coding->carryover_bytes); p->decoding_carryover = coding->carryover_bytes; } if (SBYTES (text) > 0) @@ -5541,8 +5375,8 @@ read_process_output (proc, channel) { if (SCHARS (p->decoding_buf) < coding->carryover_bytes) p->decoding_buf = make_uninit_string (coding->carryover_bytes); - bcopy (coding->carryover, SDATA (p->decoding_buf), - coding->carryover_bytes); + memcpy (SDATA (p->decoding_buf), coding->carryover, + coding->carryover_bytes); p->decoding_carryover = coding->carryover_bytes; } /* Adjust the multibyteness of TEXT to that of the buffer. */ @@ -5599,15 +5433,6 @@ read_process_output (proc, channel) unbind_to (count, Qnil); return nbytes; } - -DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, Swaiting_for_user_input_p, - 0, 0, 0, - doc: /* Returns non-nil if Emacs is waiting for input from the user. -This is intended for use by asynchronous process output filters and sentinels. */) - () -{ - return (waiting_for_user_input_p ? Qt : Qnil); -} /* Sending data to subprocess */ @@ -5615,7 +5440,7 @@ jmp_buf send_process_frame; Lisp_Object process_sent_to; SIGTYPE -send_process_trap () +send_process_trap (int ignore) { SIGNAL_THREAD_CHECK (SIGPIPE); sigunblock (sigmask (SIGPIPE)); @@ -5633,18 +5458,15 @@ send_process_trap () This function can evaluate Lisp code and can garbage collect. */ static void -send_process (proc, buf, len, object) - volatile Lisp_Object proc; - unsigned char *volatile buf; - volatile int len; - volatile Lisp_Object object; +send_process (volatile Lisp_Object proc, unsigned char *volatile buf, + volatile int len, volatile Lisp_Object object) { /* Use volatile to protect variables from being clobbered by longjmp. */ struct Lisp_Process *p = XPROCESS (proc); int rv; struct coding_system *coding; struct gcpro gcpro1; - SIGTYPE (*volatile old_sigpipe) (); + SIGTYPE (*volatile old_sigpipe) (int); GCPRO1 (object); @@ -5757,7 +5579,7 @@ send_process (proc, buf, len, object) while (this > 0) { int outfd = p->outfd; - old_sigpipe = (SIGTYPE (*) ()) signal (SIGPIPE, send_process_trap); + old_sigpipe = (SIGTYPE (*) (int)) signal (SIGPIPE, send_process_trap); #ifdef DATAGRAM_SOCKETS if (DATAGRAM_CHAN_P (outfd)) { @@ -5882,8 +5704,7 @@ Called from program, takes three arguments, PROCESS, START and END. If the region is more than 500 characters long, it is sent in several bunches. This may happen even for shorter regions. Output from processes can arrive in between bunches. */) - (process, start, end) - Lisp_Object process, start, end; + (Lisp_Object process, Lisp_Object start, Lisp_Object end) { Lisp_Object proc; int start1, end1; @@ -5910,8 +5731,7 @@ nil, indicating the current buffer's process. If STRING is more than 500 characters long, it is sent in several bunches. This may happen even for shorter strings. Output from processes can arrive in between bunches. */) - (process, string) - Lisp_Object process, string; + (Lisp_Object process, Lisp_Object string) { Lisp_Object proc; CHECK_STRING (string); @@ -5924,8 +5744,7 @@ Output from processes can arrive in between bunches. */) /* Return the foreground process group for the tty/pty that the process P uses. */ static int -emacs_get_tty_pgrp (p) - struct Lisp_Process *p; +emacs_get_tty_pgrp (struct Lisp_Process *p) { int gid = -1; @@ -5953,8 +5772,7 @@ DEFUN ("process-running-child-p", Fprocess_running_child_p, doc: /* Return t if PROCESS has given the terminal to a child. If the operating system does not make it possible to find out, return t unconditionally. */) - (process) - Lisp_Object process; + (Lisp_Object process) { /* Initialize in case ioctl doesn't exist or gives an error, in a way that will cause returning t. */ @@ -5994,11 +5812,8 @@ return t unconditionally. */) their uid, for which killpg would return an EPERM error. */ static void -process_send_signal (process, signo, current_group, nomsg) - Lisp_Object process; - int signo; - Lisp_Object current_group; - int nomsg; +process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, + int nomsg) { Lisp_Object proc; register struct Lisp_Process *p; @@ -6218,8 +6033,7 @@ rather than the shell. If CURRENT-GROUP is `lambda', and if the shell owns the terminal, don't send the signal. */) - (process, current_group) - Lisp_Object process, current_group; + (Lisp_Object process, Lisp_Object current_group) { process_send_signal (process, SIGINT, current_group, 0); return process; @@ -6228,8 +6042,7 @@ don't send the signal. */) DEFUN ("kill-process", Fkill_process, Skill_process, 0, 2, 0, doc: /* Kill process PROCESS. May be process or name of one. See function `interrupt-process' for more details on usage. */) - (process, current_group) - Lisp_Object process, current_group; + (Lisp_Object process, Lisp_Object current_group) { process_send_signal (process, SIGKILL, current_group, 0); return process; @@ -6238,8 +6051,7 @@ See function `interrupt-process' for more details on usage. */) DEFUN ("quit-process", Fquit_process, Squit_process, 0, 2, 0, doc: /* Send QUIT signal to process PROCESS. May be process or name of one. See function `interrupt-process' for more details on usage. */) - (process, current_group) - Lisp_Object process, current_group; + (Lisp_Object process, Lisp_Object current_group) { process_send_signal (process, SIGQUIT, current_group, 0); return process; @@ -6250,8 +6062,7 @@ DEFUN ("stop-process", Fstop_process, Sstop_process, 0, 2, 0, See function `interrupt-process' for more details on usage. If PROCESS is a network or serial process, inhibit handling of incoming traffic. */) - (process, current_group) - Lisp_Object process, current_group; + (Lisp_Object process, Lisp_Object current_group) { #ifdef HAVE_SOCKETS if (PROCESSP (process) && (NETCONN_P (process) || SERIALCONN_P (process))) @@ -6282,8 +6093,7 @@ DEFUN ("continue-process", Fcontinue_process, Scontinue_process, 0, 2, 0, See function `interrupt-process' for more details on usage. If PROCESS is a network or serial process, resume handling of incoming traffic. */) - (process, current_group) - Lisp_Object process, current_group; + (Lisp_Object process, Lisp_Object current_group) { #ifdef HAVE_SOCKETS if (PROCESSP (process) && (NETCONN_P (process) || SERIALCONN_P (process))) @@ -6324,8 +6134,7 @@ PROCESS may also be a number specifying the process id of the process to signal; in this case, the process need not be a child of this Emacs. SIGCODE may be an integer, or a symbol whose name is a signal name. */) - (process, sigcode) - Lisp_Object process, sigcode; + (Lisp_Object process, Lisp_Object sigcode) { pid_t pid; @@ -6378,7 +6187,7 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */) CHECK_SYMBOL (sigcode); name = SDATA (SYMBOL_NAME (sigcode)); - if (!strncmp(name, "SIG", 3) || !strncmp(name, "sig", 3)) + if (!strncmp (name, "SIG", 3) || !strncmp (name, "sig", 3)) name += 3; if (0) @@ -6492,8 +6301,7 @@ through a pipe (as opposed to a pty), then you cannot send any more text to PROCESS after you call this function. If PROCESS is a serial process, wait until all output written to the process has been transmitted to the serial port. */) - (process) - Lisp_Object process; + (Lisp_Object process) { Lisp_Object proc; struct coding_system *coding; @@ -6552,39 +6360,16 @@ process has been transmitted to the serial port. */) if (!proc_encode_coding_system[new_outfd]) proc_encode_coding_system[new_outfd] = (struct coding_system *) xmalloc (sizeof (struct coding_system)); - bcopy (proc_encode_coding_system[old_outfd], - proc_encode_coding_system[new_outfd], - sizeof (struct coding_system)); - bzero (proc_encode_coding_system[old_outfd], - sizeof (struct coding_system)); + memcpy (proc_encode_coding_system[new_outfd], + proc_encode_coding_system[old_outfd], + sizeof (struct coding_system)); + memset (proc_encode_coding_system[old_outfd], 0, + sizeof (struct coding_system)); XPROCESS (proc)->outfd = new_outfd; } return process; } - -/* Kill all processes associated with `buffer'. - If `buffer' is nil, kill all processes */ - -void -kill_buffer_processes (buffer) - Lisp_Object buffer; -{ - Lisp_Object tail, proc; - - for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) - { - proc = XCDR (XCAR (tail)); - if (PROCESSP (proc) - && (NILP (buffer) || EQ (XPROCESS (proc)->buffer, buffer))) - { - if (NETCONN_P (proc) || SERIALCONN_P (proc)) - Fdelete_process (proc); - else if (XPROCESS (proc)->infd >= 0) - process_send_signal (proc, SIGHUP, Qnil, 1); - } - } -} /* On receipt of a signal that a child status has changed, loop asking about children with changed statuses until the system says there @@ -6613,8 +6398,7 @@ kill_buffer_processes (buffer) #ifdef SIGCHLD SIGTYPE -sigchld_handler (signo) - int signo; +sigchld_handler (int signo) { int old_errno = errno; Lisp_Object proc; @@ -6755,16 +6539,14 @@ sigchld_handler (signo) static Lisp_Object -exec_sentinel_unwind (data) - Lisp_Object data; +exec_sentinel_unwind (Lisp_Object data) { XPROCESS (XCAR (data))->sentinel = XCDR (data); return Qnil; } static Lisp_Object -exec_sentinel_error_handler (error) - Lisp_Object error; +exec_sentinel_error_handler (Lisp_Object error) { cmd_error_internal (error, "error in process sentinel: "); Vinhibit_quit = Qt; @@ -6774,8 +6556,7 @@ exec_sentinel_error_handler (error) } static void -exec_sentinel (proc, reason) - Lisp_Object proc, reason; +exec_sentinel (Lisp_Object proc, Lisp_Object reason) { Lisp_Object sentinel, obuffer, odeactivate, okeymap; register struct Lisp_Process *p = XPROCESS (proc); @@ -6860,8 +6641,7 @@ exec_sentinel (proc, reason) but can be done at other times. */ static void -status_notify (deleting_process) - struct Lisp_Process *deleting_process; +status_notify (struct Lisp_Process *deleting_process) { register Lisp_Object proc, buffer; Lisp_Object tail, msg; @@ -6988,8 +6768,7 @@ DEFUN ("set-process-coding-system", Fset_process_coding_system, doc: /* Set coding systems of PROCESS to DECODING and ENCODING. DECODING will be used to decode subprocess output and ENCODING to encode subprocess input. */) - (process, decoding, encoding) - register Lisp_Object process, decoding, encoding; + (register Lisp_Object process, Lisp_Object decoding, Lisp_Object encoding) { register struct Lisp_Process *p; @@ -7012,8 +6791,7 @@ encode subprocess input. */) DEFUN ("process-coding-system", Fprocess_coding_system, Sprocess_coding_system, 1, 1, 0, doc: /* Return a cons of coding systems for decoding and encoding of PROCESS. */) - (process) - register Lisp_Object process; + (register Lisp_Object process) { CHECK_PROCESS (process); return Fcons (XPROCESS (process)->decode_coding_system, @@ -7027,8 +6805,7 @@ If FLAG is non-nil, the filter is given multibyte strings. If FLAG is nil, the filter is given unibyte strings. In this case, all character code conversion except for end-of-line conversion is suppressed. */) - (process, flag) - Lisp_Object process, flag; + (Lisp_Object process, Lisp_Object flag) { register struct Lisp_Process *p; @@ -7044,8 +6821,7 @@ suppressed. */) DEFUN ("process-filter-multibyte-p", Fprocess_filter_multibyte_p, Sprocess_filter_multibyte_p, 1, 1, 0, doc: /* Return t if a multibyte string is given to PROCESS's filter.*/) - (process) - Lisp_Object process; + (Lisp_Object process) { register struct Lisp_Process *p; struct coding_system *coding; @@ -7058,23 +6834,11 @@ DEFUN ("process-filter-multibyte-p", Fprocess_filter_multibyte_p, -/* Add DESC to the set of keyboard input descriptors. */ - -void -add_keyboard_wait_descriptor (desc) - int desc; -{ - FD_SET (desc, &input_wait_mask); - FD_SET (desc, &non_process_wait_mask); - if (desc > max_keyboard_desc) - max_keyboard_desc = desc; -} static int add_gpm_wait_descriptor_called_flag; void -add_gpm_wait_descriptor (desc) - int desc; +add_gpm_wait_descriptor (int desc) { if (! add_gpm_wait_descriptor_called_flag) FD_CLR (0, &input_wait_mask); @@ -7085,29 +6849,8 @@ add_gpm_wait_descriptor (desc) max_gpm_desc = desc; } -/* From now on, do not expect DESC to give keyboard input. */ - void -delete_keyboard_wait_descriptor (desc) - int desc; -{ - int fd; - int lim = max_keyboard_desc; - - FD_CLR (desc, &input_wait_mask); - FD_CLR (desc, &non_process_wait_mask); - - if (desc == max_keyboard_desc) - for (fd = 0; fd < lim; fd++) - if (FD_ISSET (fd, &input_wait_mask) - && !FD_ISSET (fd, &non_keyboard_wait_mask) - && !FD_ISSET (fd, &gpm_wait_mask)) - max_keyboard_desc = fd; -} - -void -delete_gpm_wait_descriptor (desc) - int desc; +delete_gpm_wait_descriptor (int desc) { int fd; int lim = max_gpm_desc; @@ -7127,8 +6870,7 @@ delete_gpm_wait_descriptor (desc) that corresponds to one of the keyboard input descriptors. */ static int -keyboard_bit_set (mask) - SELECT_TYPE *mask; +keyboard_bit_set (fd_set *mask) { int fd; @@ -7139,490 +6881,15 @@ keyboard_bit_set (mask) return 0; } - -/* Enumeration of and access to system processes a-la ps(1). */ -DEFUN ("list-system-processes", Flist_system_processes, Slist_system_processes, - 0, 0, 0, - doc: /* Return a list of numerical process IDs of all running processes. -If this functionality is unsupported, return nil. +#else /* not subprocesses */ -See `process-attributes' for getting attributes of a process given its ID. */) - () -{ - return list_system_processes (); -} +/* Defined on msdos.c. */ +extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, + EMACS_TIME *); -DEFUN ("process-attributes", Fprocess_attributes, - Sprocess_attributes, 1, 1, 0, - doc: /* Return attributes of the process given by its PID, a number. - -Value is an alist where each element is a cons cell of the form - - \(KEY . VALUE) - -If this functionality is unsupported, the value is nil. - -See `list-system-processes' for getting a list of all process IDs. - -The KEYs of the attributes that this function may return are listed -below, together with the type of the associated VALUE (in parentheses). -Not all platforms support all of these attributes; unsupported -attributes will not appear in the returned alist. -Unless explicitly indicated otherwise, numbers can have either -integer or floating point values. - - euid -- Effective user User ID of the process (number) - user -- User name corresponding to euid (string) - egid -- Effective user Group ID of the process (number) - group -- Group name corresponding to egid (string) - comm -- Command name (executable name only) (string) - state -- Process state code, such as "S", "R", or "T" (string) - ppid -- Parent process ID (number) - pgrp -- Process group ID (number) - sess -- Session ID, i.e. process ID of session leader (number) - ttname -- Controlling tty name (string) - tpgid -- ID of foreground process group on the process's tty (number) - minflt -- number of minor page faults (number) - majflt -- number of major page faults (number) - cminflt -- cumulative number of minor page faults (number) - cmajflt -- cumulative number of major page faults (number) - utime -- user time used by the process, in the (HIGH LOW USEC) format - stime -- system time used by the process, in the (HIGH LOW USEC) format - time -- sum of utime and stime, in the (HIGH LOW USEC) format - cutime -- user time used by the process and its children, (HIGH LOW USEC) - cstime -- system time used by the process and its children, (HIGH LOW USEC) - ctime -- sum of cutime and cstime, in the (HIGH LOW USEC) format - pri -- priority of the process (number) - nice -- nice value of the process (number) - thcount -- process thread count (number) - start -- time the process started, in the (HIGH LOW USEC) format - vsize -- virtual memory size of the process in KB's (number) - rss -- resident set size of the process in KB's (number) - etime -- elapsed time the process is running, in (HIGH LOW USEC) format - pcpu -- percents of CPU time used by the process (floating-point number) - pmem -- percents of total physical memory used by process's resident set - (floating-point number) - args -- command line which invoked the process (string). */) - (pid) - - Lisp_Object pid; -{ - return system_process_attributes (pid); -} - -void -init_process () -{ - register int i; - - inhibit_sentinels = 0; - -#ifdef SIGCHLD -#ifndef CANNOT_DUMP - if (! noninteractive || initialized) -#endif - signal (SIGCHLD, sigchld_handler); -#endif - - FD_ZERO (&input_wait_mask); - FD_ZERO (&non_keyboard_wait_mask); - FD_ZERO (&non_process_wait_mask); - max_process_desc = 0; - -#ifdef NON_BLOCKING_CONNECT - FD_ZERO (&connect_wait_mask); - num_pending_connects = 0; -#endif - -#ifdef ADAPTIVE_READ_BUFFERING - process_output_delay_count = 0; - process_output_skip = 0; -#endif - - /* Don't do this, it caused infinite select loops. The display - method should call add_keyboard_wait_descriptor on stdin if it - needs that. */ -#if 0 - FD_SET (0, &input_wait_mask); -#endif - - Vprocess_alist = Qnil; -#ifdef SIGCHLD - deleted_pid_list = Qnil; -#endif - for (i = 0; i < MAXDESC; i++) - { - chan_process[i] = Qnil; - proc_buffered_char[i] = -1; - } - bzero (proc_decode_coding_system, sizeof proc_decode_coding_system); - bzero (proc_encode_coding_system, sizeof proc_encode_coding_system); -#ifdef DATAGRAM_SOCKETS - bzero (datagram_address, sizeof datagram_address); -#endif - -#ifdef HAVE_SOCKETS - { - Lisp_Object subfeatures = Qnil; - const struct socket_options *sopt; - -#define ADD_SUBFEATURE(key, val) \ - subfeatures = pure_cons (pure_cons (key, pure_cons (val, Qnil)), subfeatures) - -#ifdef NON_BLOCKING_CONNECT - ADD_SUBFEATURE (QCnowait, Qt); -#endif -#ifdef DATAGRAM_SOCKETS - ADD_SUBFEATURE (QCtype, Qdatagram); -#endif -#ifdef HAVE_SEQPACKET - ADD_SUBFEATURE (QCtype, Qseqpacket); -#endif -#ifdef HAVE_LOCAL_SOCKETS - ADD_SUBFEATURE (QCfamily, Qlocal); -#endif - ADD_SUBFEATURE (QCfamily, Qipv4); -#ifdef AF_INET6 - ADD_SUBFEATURE (QCfamily, Qipv6); -#endif -#ifdef HAVE_GETSOCKNAME - ADD_SUBFEATURE (QCservice, Qt); -#endif -#if defined(O_NONBLOCK) || defined(O_NDELAY) - ADD_SUBFEATURE (QCserver, Qt); -#endif - - for (sopt = socket_options; sopt->name; sopt++) - subfeatures = pure_cons (intern_c_string (sopt->name), subfeatures); - - Fprovide (intern_c_string ("make-network-process"), subfeatures); - } -#endif /* HAVE_SOCKETS */ - -#if defined (DARWIN_OS) - /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive - processes. As such, we only change the default value. */ - if (initialized) - { - char *release = get_operating_system_release(); - if (!release || !release[0] || (release[0] < MIN_PTY_KERNEL_VERSION - && release[1] == '.')) { - Vprocess_connection_type = Qnil; - } - } -#endif -} - -void -syms_of_process () -{ - Qprocessp = intern_c_string ("processp"); - staticpro (&Qprocessp); - Qrun = intern_c_string ("run"); - staticpro (&Qrun); - Qstop = intern_c_string ("stop"); - staticpro (&Qstop); - Qsignal = intern_c_string ("signal"); - staticpro (&Qsignal); - - /* Qexit is already staticpro'd by syms_of_eval; don't staticpro it - here again. - - Qexit = intern_c_string ("exit"); - staticpro (&Qexit); */ - - Qopen = intern_c_string ("open"); - staticpro (&Qopen); - Qclosed = intern_c_string ("closed"); - staticpro (&Qclosed); - Qconnect = intern_c_string ("connect"); - staticpro (&Qconnect); - Qfailed = intern_c_string ("failed"); - staticpro (&Qfailed); - Qlisten = intern_c_string ("listen"); - staticpro (&Qlisten); - Qlocal = intern_c_string ("local"); - staticpro (&Qlocal); - Qipv4 = intern_c_string ("ipv4"); - staticpro (&Qipv4); -#ifdef AF_INET6 - Qipv6 = intern_c_string ("ipv6"); - staticpro (&Qipv6); -#endif - Qdatagram = intern_c_string ("datagram"); - staticpro (&Qdatagram); - Qseqpacket = intern_c_string ("seqpacket"); - staticpro (&Qseqpacket); - - QCport = intern_c_string (":port"); - staticpro (&QCport); - QCspeed = intern_c_string (":speed"); - staticpro (&QCspeed); - QCprocess = intern_c_string (":process"); - staticpro (&QCprocess); - - QCbytesize = intern_c_string (":bytesize"); - staticpro (&QCbytesize); - QCstopbits = intern_c_string (":stopbits"); - staticpro (&QCstopbits); - QCparity = intern_c_string (":parity"); - staticpro (&QCparity); - Qodd = intern_c_string ("odd"); - staticpro (&Qodd); - Qeven = intern_c_string ("even"); - staticpro (&Qeven); - QCflowcontrol = intern_c_string (":flowcontrol"); - staticpro (&QCflowcontrol); - Qhw = intern_c_string ("hw"); - staticpro (&Qhw); - Qsw = intern_c_string ("sw"); - staticpro (&Qsw); - QCsummary = intern_c_string (":summary"); - staticpro (&QCsummary); - - Qreal = intern_c_string ("real"); - staticpro (&Qreal); - Qnetwork = intern_c_string ("network"); - staticpro (&Qnetwork); - Qserial = intern_c_string ("serial"); - staticpro (&Qserial); - - QCname = intern_c_string (":name"); - staticpro (&QCname); - QCbuffer = intern_c_string (":buffer"); - staticpro (&QCbuffer); - QChost = intern_c_string (":host"); - staticpro (&QChost); - QCservice = intern_c_string (":service"); - staticpro (&QCservice); - QCtype = intern_c_string (":type"); - staticpro (&QCtype); - QClocal = intern_c_string (":local"); - staticpro (&QClocal); - QCremote = intern_c_string (":remote"); - staticpro (&QCremote); - QCcoding = intern_c_string (":coding"); - staticpro (&QCcoding); - QCserver = intern_c_string (":server"); - staticpro (&QCserver); - QCnowait = intern_c_string (":nowait"); - staticpro (&QCnowait); - QCsentinel = intern_c_string (":sentinel"); - staticpro (&QCsentinel); - QClog = intern_c_string (":log"); - staticpro (&QClog); - QCnoquery = intern_c_string (":noquery"); - staticpro (&QCnoquery); - QCstop = intern_c_string (":stop"); - staticpro (&QCstop); - QCoptions = intern_c_string (":options"); - staticpro (&QCoptions); - QCplist = intern_c_string (":plist"); - staticpro (&QCplist); - - Qlast_nonmenu_event = intern_c_string ("last-nonmenu-event"); - staticpro (&Qlast_nonmenu_event); - - staticpro (&Vprocess_alist); -#ifdef SIGCHLD - staticpro (&deleted_pid_list); -#endif - - Qeuid = intern_c_string ("euid"); - staticpro (&Qeuid); - Qegid = intern_c_string ("egid"); - staticpro (&Qegid); - Quser = intern_c_string ("user"); - staticpro (&Quser); - Qgroup = intern_c_string ("group"); - staticpro (&Qgroup); - Qcomm = intern_c_string ("comm"); - staticpro (&Qcomm); - Qstate = intern_c_string ("state"); - staticpro (&Qstate); - Qppid = intern_c_string ("ppid"); - staticpro (&Qppid); - Qpgrp = intern_c_string ("pgrp"); - staticpro (&Qpgrp); - Qsess = intern_c_string ("sess"); - staticpro (&Qsess); - Qttname = intern_c_string ("ttname"); - staticpro (&Qttname); - Qtpgid = intern_c_string ("tpgid"); - staticpro (&Qtpgid); - Qminflt = intern_c_string ("minflt"); - staticpro (&Qminflt); - Qmajflt = intern_c_string ("majflt"); - staticpro (&Qmajflt); - Qcminflt = intern_c_string ("cminflt"); - staticpro (&Qcminflt); - Qcmajflt = intern_c_string ("cmajflt"); - staticpro (&Qcmajflt); - Qutime = intern_c_string ("utime"); - staticpro (&Qutime); - Qstime = intern_c_string ("stime"); - staticpro (&Qstime); - Qtime = intern_c_string ("time"); - staticpro (&Qtime); - Qcutime = intern_c_string ("cutime"); - staticpro (&Qcutime); - Qcstime = intern_c_string ("cstime"); - staticpro (&Qcstime); - Qctime = intern_c_string ("ctime"); - staticpro (&Qctime); - Qpri = intern_c_string ("pri"); - staticpro (&Qpri); - Qnice = intern_c_string ("nice"); - staticpro (&Qnice); - Qthcount = intern_c_string ("thcount"); - staticpro (&Qthcount); - Qstart = intern_c_string ("start"); - staticpro (&Qstart); - Qvsize = intern_c_string ("vsize"); - staticpro (&Qvsize); - Qrss = intern_c_string ("rss"); - staticpro (&Qrss); - Qetime = intern_c_string ("etime"); - staticpro (&Qetime); - Qpcpu = intern_c_string ("pcpu"); - staticpro (&Qpcpu); - Qpmem = intern_c_string ("pmem"); - staticpro (&Qpmem); - Qargs = intern_c_string ("args"); - staticpro (&Qargs); - - DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes, - doc: /* *Non-nil means delete processes immediately when they exit. -A value of nil means don't delete them until `list-processes' is run. */); - - delete_exited_processes = 1; - - DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type, - doc: /* Control type of device used to communicate with subprocesses. -Values are nil to use a pipe, or t or `pty' to use a pty. -The value has no effect if the system has no ptys or if all ptys are busy: -then a pipe is used in any case. -The value takes effect when `start-process' is called. */); - Vprocess_connection_type = Qt; - -#ifdef ADAPTIVE_READ_BUFFERING - DEFVAR_LISP ("process-adaptive-read-buffering", &Vprocess_adaptive_read_buffering, - doc: /* If non-nil, improve receive buffering by delaying after short reads. -On some systems, when Emacs reads the output from a subprocess, the output data -is read in very small blocks, potentially resulting in very poor performance. -This behavior can be remedied to some extent by setting this variable to a -non-nil value, as it will automatically delay reading from such processes, to -allow them to produce more output before Emacs tries to read it. -If the value is t, the delay is reset after each write to the process; any other -non-nil value means that the delay is not reset on write. -The variable takes effect when `start-process' is called. */); - Vprocess_adaptive_read_buffering = Qt; -#endif - - defsubr (&Sprocessp); - defsubr (&Sget_process); - defsubr (&Sget_buffer_process); - defsubr (&Sdelete_process); - defsubr (&Sprocess_status); - defsubr (&Sprocess_exit_status); - defsubr (&Sprocess_id); - defsubr (&Sprocess_name); - defsubr (&Sprocess_tty_name); - defsubr (&Sprocess_command); - defsubr (&Sset_process_buffer); - defsubr (&Sprocess_buffer); - defsubr (&Sprocess_mark); - defsubr (&Sset_process_filter); - defsubr (&Sprocess_filter); - defsubr (&Sset_process_sentinel); - defsubr (&Sprocess_sentinel); - defsubr (&Sset_process_window_size); - defsubr (&Sset_process_inherit_coding_system_flag); - defsubr (&Sprocess_inherit_coding_system_flag); - defsubr (&Sset_process_query_on_exit_flag); - defsubr (&Sprocess_query_on_exit_flag); - defsubr (&Sprocess_contact); - defsubr (&Sprocess_plist); - defsubr (&Sset_process_plist); - defsubr (&Slist_processes); - defsubr (&Sprocess_list); - defsubr (&Sstart_process); -#ifdef HAVE_SERIAL - defsubr (&Sserial_process_configure); - defsubr (&Smake_serial_process); -#endif /* HAVE_SERIAL */ -#ifdef HAVE_SOCKETS - defsubr (&Sset_network_process_option); - defsubr (&Smake_network_process); - defsubr (&Sformat_network_address); -#endif /* HAVE_SOCKETS */ -#if defined(HAVE_SOCKETS) && defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) -#ifdef SIOCGIFCONF - defsubr (&Snetwork_interface_list); -#endif -#if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS) - defsubr (&Snetwork_interface_info); -#endif -#endif /* HAVE_SOCKETS ... */ -#ifdef DATAGRAM_SOCKETS - defsubr (&Sprocess_datagram_address); - defsubr (&Sset_process_datagram_address); -#endif - defsubr (&Saccept_process_output); - defsubr (&Sprocess_send_region); - defsubr (&Sprocess_send_string); - defsubr (&Sinterrupt_process); - defsubr (&Skill_process); - defsubr (&Squit_process); - defsubr (&Sstop_process); - defsubr (&Scontinue_process); - defsubr (&Sprocess_running_child_p); - defsubr (&Sprocess_send_eof); - defsubr (&Ssignal_process); - defsubr (&Swaiting_for_user_input_p); - defsubr (&Sprocess_type); - defsubr (&Sset_process_coding_system); - defsubr (&Sprocess_coding_system); - defsubr (&Sset_process_filter_multibyte); - defsubr (&Sprocess_filter_multibyte_p); - defsubr (&Slist_system_processes); - defsubr (&Sprocess_attributes); -} - - -#else /* not subprocesses */ - -#include <sys/types.h> -#include <errno.h> -#include <sys/stat.h> -#include <stdlib.h> -#include <fcntl.h> -#include <setjmp.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -#include "lisp.h" -#include "systime.h" -#include "character.h" -#include "coding.h" -#include "termopts.h" -#include "sysselect.h" - -extern int frame_garbaged; - -extern EMACS_TIME timer_check (); -extern int timers_run; - -Lisp_Object QCtype, QCname; - -Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid; -Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime; -Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs; -Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime; - -/* As described above, except assuming that there are no subprocesses: +/* Implementation of wait_reading_process_output, assuming that there + are no subprocesses. Used only by the MS-DOS build. Wait for timeout to elapse and/or keyboard input to be available. @@ -7646,12 +6913,10 @@ Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime; Return true if we received input from any process. */ int -wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, - wait_for_cell, wait_proc, just_wait_proc) - int time_limit, microsecs, read_kbd, do_display; - Lisp_Object wait_for_cell; - struct Lisp_Process *wait_proc; - int just_wait_proc; +wait_reading_process_output (int time_limit, int microsecs, int read_kbd, + int do_display, + Lisp_Object wait_for_cell, + struct Lisp_Process *wait_proc, int just_wait_proc) { register int nfds; EMACS_TIME end_time, timeout; @@ -7798,15 +7063,6 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, else error ("select error: %s", emacs_strerror (xerrno)); } -#ifdef SOLARIS2 - else if (nfds > 0 && (waitchannels & 1) && interrupt_input) - /* System sometimes fails to deliver SIGIO. */ - kill (getpid (), SIGIO); -#endif -#ifdef SIGIO - if (read_kbd && interrupt_input && (waitchannels & 1)) - kill (getpid (), SIGIO); -#endif /* Check for keyboard input */ @@ -7847,48 +7103,220 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, return 0; } +#endif /* not subprocesses */ -/* Don't confuse make-docfile by having two doc strings for this function. - make-docfile does not pay attention to #if, for good reason! */ -DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0, - 0) - (name) - register Lisp_Object name; +/* The following functions are needed even if async subprocesses are + not supported. Some of them are no-op stubs in that case. */ + +/* Add DESC to the set of keyboard input descriptors. */ + +void +add_keyboard_wait_descriptor (int desc) { +#ifdef subprocesses + FD_SET (desc, &input_wait_mask); + FD_SET (desc, &non_process_wait_mask); + if (desc > max_keyboard_desc) + max_keyboard_desc = desc; +#endif +} + +/* From now on, do not expect DESC to give keyboard input. */ + +void +delete_keyboard_wait_descriptor (int desc) +{ +#ifdef subprocesses + int fd; + int lim = max_keyboard_desc; + + FD_CLR (desc, &input_wait_mask); + FD_CLR (desc, &non_process_wait_mask); + + if (desc == max_keyboard_desc) + for (fd = 0; fd < lim; fd++) + if (FD_ISSET (fd, &input_wait_mask) + && !FD_ISSET (fd, &non_keyboard_wait_mask) + && !FD_ISSET (fd, &gpm_wait_mask)) + max_keyboard_desc = fd; +#endif /* subprocesses */ +} + +/* Setup coding systems of PROCESS. */ + +void +setup_process_coding_systems (Lisp_Object process) +{ +#ifdef subprocesses + struct Lisp_Process *p = XPROCESS (process); + int inch = p->infd; + int outch = p->outfd; + Lisp_Object coding_system; + + if (inch < 0 || outch < 0) + return; + + if (!proc_decode_coding_system[inch]) + proc_decode_coding_system[inch] + = (struct coding_system *) xmalloc (sizeof (struct coding_system)); + coding_system = p->decode_coding_system; + if (! NILP (p->filter)) + ; + else if (BUFFERP (p->buffer)) + { + if (NILP (XBUFFER (p->buffer)->enable_multibyte_characters)) + coding_system = raw_text_coding_system (coding_system); + } + setup_coding_system (coding_system, proc_decode_coding_system[inch]); + + if (!proc_encode_coding_system[outch]) + proc_encode_coding_system[outch] + = (struct coding_system *) xmalloc (sizeof (struct coding_system)); + setup_coding_system (p->encode_coding_system, + proc_encode_coding_system[outch]); +#endif +} + +/* Close all descriptors currently in use for communication + with subprocess. This is used in a newly-forked subprocess + to get rid of irrelevant descriptors. */ + +void +close_process_descs (void) +{ +#ifndef DOS_NT + int i; + for (i = 0; i < MAXDESC; i++) + { + Lisp_Object process; + process = chan_process[i]; + if (!NILP (process)) + { + int in = XPROCESS (process)->infd; + int out = XPROCESS (process)->outfd; + if (in >= 0) + emacs_close (in); + if (out >= 0 && in != out) + emacs_close (out); + } + } +#endif +} + +DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0, + doc: /* Return the (or a) process associated with BUFFER. +BUFFER may be a buffer or the name of one. */) + (register Lisp_Object buffer) +{ +#ifdef subprocesses + register Lisp_Object buf, tail, proc; + + if (NILP (buffer)) return Qnil; + buf = Fget_buffer (buffer); + if (NILP (buf)) return Qnil; + + for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) + { + proc = Fcdr (XCAR (tail)); + if (PROCESSP (proc) && EQ (XPROCESS (proc)->buffer, buf)) + return proc; + } +#endif /* subprocesses */ return Qnil; } - /* Don't confuse make-docfile by having two doc strings for this function. - make-docfile does not pay attention to #if, for good reason! */ DEFUN ("process-inherit-coding-system-flag", Fprocess_inherit_coding_system_flag, Sprocess_inherit_coding_system_flag, 1, 1, 0, - 0) - (process) - register Lisp_Object process; + doc: /* Return the value of inherit-coding-system flag for PROCESS. +If this flag is t, `buffer-file-coding-system' of the buffer +associated with PROCESS will inherit the coding system used to decode +the process output. */) + (register Lisp_Object process) { +#ifdef subprocesses + CHECK_PROCESS (process); + return XPROCESS (process)->inherit_coding_system_flag ? Qt : Qnil; +#else /* Ignore the argument and return the value of inherit-process-coding-system. */ return inherit_process_coding_system ? Qt : Qnil; +#endif } /* Kill all processes associated with `buffer'. - If `buffer' is nil, kill all processes. - Since we have no subprocesses, this does nothing. */ + If `buffer' is nil, kill all processes */ void -kill_buffer_processes (buffer) - Lisp_Object buffer; +kill_buffer_processes (Lisp_Object buffer) { +#ifdef subprocesses + Lisp_Object tail, proc; + + for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) + { + proc = XCDR (XCAR (tail)); + if (PROCESSP (proc) + && (NILP (buffer) || EQ (XPROCESS (proc)->buffer, buffer))) + { + if (NETCONN_P (proc) || SERIALCONN_P (proc)) + Fdelete_process (proc); + else if (XPROCESS (proc)->infd >= 0) + process_send_signal (proc, SIGHUP, Qnil, 1); + } + } +#else /* subprocesses */ + /* Since we have no subprocesses, this does nothing. */ +#endif /* subprocesses */ } +DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, Swaiting_for_user_input_p, + 0, 0, 0, + doc: /* Returns non-nil if Emacs is waiting for input from the user. +This is intended for use by asynchronous process output filters and sentinels. */) + (void) +{ +#ifdef subprocesses + return (waiting_for_user_input_p ? Qt : Qnil); +#else + return Qnil; +#endif +} + +/* Stop reading input from keyboard sources. */ + +void +hold_keyboard_input (void) +{ + kbd_is_on_hold = 1; +} + +/* Resume reading input from keyboard sources. */ + +void +unhold_keyboard_input (void) +{ + kbd_is_on_hold = 0; +} + +/* Return non-zero if keyboard input is on hold, zero otherwise. */ + +int +kbd_on_hold_p (void) +{ + return kbd_is_on_hold; +} + + +/* Enumeration of and access to system processes a-la ps(1). */ + DEFUN ("list-system-processes", Flist_system_processes, Slist_system_processes, 0, 0, 0, doc: /* Return a list of numerical process IDs of all running processes. If this functionality is unsupported, return nil. See `process-attributes' for getting attributes of a process given its ID. */) - () + (void) { return list_system_processes (); } @@ -7943,30 +7371,238 @@ integer or floating point values. pcpu -- percents of CPU time used by the process (floating-point number) pmem -- percents of total physical memory used by process's resident set (floating-point number) - args -- command line which invoked the process (string). */) - (pid) - - Lisp_Object pid; + args -- command line which invoked the process (string). */) + ( Lisp_Object pid) { return system_process_attributes (pid); } + void -init_process () +init_process (void) { +#ifdef subprocesses + register int i; + + inhibit_sentinels = 0; + +#ifdef SIGCHLD +#ifndef CANNOT_DUMP + if (! noninteractive || initialized) +#endif + signal (SIGCHLD, sigchld_handler); +#endif + + FD_ZERO (&input_wait_mask); + FD_ZERO (&non_keyboard_wait_mask); + FD_ZERO (&non_process_wait_mask); + max_process_desc = 0; + +#ifdef NON_BLOCKING_CONNECT + FD_ZERO (&connect_wait_mask); + num_pending_connects = 0; +#endif + +#ifdef ADAPTIVE_READ_BUFFERING + process_output_delay_count = 0; + process_output_skip = 0; +#endif + + /* Don't do this, it caused infinite select loops. The display + method should call add_keyboard_wait_descriptor on stdin if it + needs that. */ +#if 0 + FD_SET (0, &input_wait_mask); +#endif + + Vprocess_alist = Qnil; +#ifdef SIGCHLD + deleted_pid_list = Qnil; +#endif + for (i = 0; i < MAXDESC; i++) + { + chan_process[i] = Qnil; + proc_buffered_char[i] = -1; + } + memset (proc_decode_coding_system, 0, sizeof proc_decode_coding_system); + memset (proc_encode_coding_system, 0, sizeof proc_encode_coding_system); +#ifdef DATAGRAM_SOCKETS + memset (datagram_address, 0, sizeof datagram_address); +#endif + +#ifdef HAVE_SOCKETS + { + Lisp_Object subfeatures = Qnil; + const struct socket_options *sopt; + +#define ADD_SUBFEATURE(key, val) \ + subfeatures = pure_cons (pure_cons (key, pure_cons (val, Qnil)), subfeatures) + +#ifdef NON_BLOCKING_CONNECT + ADD_SUBFEATURE (QCnowait, Qt); +#endif +#ifdef DATAGRAM_SOCKETS + ADD_SUBFEATURE (QCtype, Qdatagram); +#endif +#ifdef HAVE_SEQPACKET + ADD_SUBFEATURE (QCtype, Qseqpacket); +#endif +#ifdef HAVE_LOCAL_SOCKETS + ADD_SUBFEATURE (QCfamily, Qlocal); +#endif + ADD_SUBFEATURE (QCfamily, Qipv4); +#ifdef AF_INET6 + ADD_SUBFEATURE (QCfamily, Qipv6); +#endif +#ifdef HAVE_GETSOCKNAME + ADD_SUBFEATURE (QCservice, Qt); +#endif +#if defined(O_NONBLOCK) || defined(O_NDELAY) + ADD_SUBFEATURE (QCserver, Qt); +#endif + + for (sopt = socket_options; sopt->name; sopt++) + subfeatures = pure_cons (intern_c_string (sopt->name), subfeatures); + + Fprovide (intern_c_string ("make-network-process"), subfeatures); + } +#endif /* HAVE_SOCKETS */ + +#if defined (DARWIN_OS) + /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive + processes. As such, we only change the default value. */ + if (initialized) + { + char *release = get_operating_system_release (); + if (!release || !release[0] || (release[0] < MIN_PTY_KERNEL_VERSION + && release[1] == '.')) { + Vprocess_connection_type = Qnil; + } + } +#endif +#endif /* subprocesses */ + kbd_is_on_hold = 0; } void -syms_of_process () +syms_of_process (void) { - QCtype = intern_c_string (":type"); - staticpro (&QCtype); +#ifdef subprocesses + + Qprocessp = intern_c_string ("processp"); + staticpro (&Qprocessp); + Qrun = intern_c_string ("run"); + staticpro (&Qrun); + Qstop = intern_c_string ("stop"); + staticpro (&Qstop); + Qsignal = intern_c_string ("signal"); + staticpro (&Qsignal); + + /* Qexit is already staticpro'd by syms_of_eval; don't staticpro it + here again. + + Qexit = intern_c_string ("exit"); + staticpro (&Qexit); */ + + Qopen = intern_c_string ("open"); + staticpro (&Qopen); + Qclosed = intern_c_string ("closed"); + staticpro (&Qclosed); + Qconnect = intern_c_string ("connect"); + staticpro (&Qconnect); + Qfailed = intern_c_string ("failed"); + staticpro (&Qfailed); + Qlisten = intern_c_string ("listen"); + staticpro (&Qlisten); + Qlocal = intern_c_string ("local"); + staticpro (&Qlocal); + Qipv4 = intern_c_string ("ipv4"); + staticpro (&Qipv4); +#ifdef AF_INET6 + Qipv6 = intern_c_string ("ipv6"); + staticpro (&Qipv6); +#endif + Qdatagram = intern_c_string ("datagram"); + staticpro (&Qdatagram); + Qseqpacket = intern_c_string ("seqpacket"); + staticpro (&Qseqpacket); + + QCport = intern_c_string (":port"); + staticpro (&QCport); + QCspeed = intern_c_string (":speed"); + staticpro (&QCspeed); + QCprocess = intern_c_string (":process"); + staticpro (&QCprocess); + + QCbytesize = intern_c_string (":bytesize"); + staticpro (&QCbytesize); + QCstopbits = intern_c_string (":stopbits"); + staticpro (&QCstopbits); + QCparity = intern_c_string (":parity"); + staticpro (&QCparity); + Qodd = intern_c_string ("odd"); + staticpro (&Qodd); + Qeven = intern_c_string ("even"); + staticpro (&Qeven); + QCflowcontrol = intern_c_string (":flowcontrol"); + staticpro (&QCflowcontrol); + Qhw = intern_c_string ("hw"); + staticpro (&Qhw); + Qsw = intern_c_string ("sw"); + staticpro (&Qsw); + QCsummary = intern_c_string (":summary"); + staticpro (&QCsummary); + + Qreal = intern_c_string ("real"); + staticpro (&Qreal); + Qnetwork = intern_c_string ("network"); + staticpro (&Qnetwork); + Qserial = intern_c_string ("serial"); + staticpro (&Qserial); + QCbuffer = intern_c_string (":buffer"); + staticpro (&QCbuffer); + QChost = intern_c_string (":host"); + staticpro (&QChost); + QCservice = intern_c_string (":service"); + staticpro (&QCservice); + QClocal = intern_c_string (":local"); + staticpro (&QClocal); + QCremote = intern_c_string (":remote"); + staticpro (&QCremote); + QCcoding = intern_c_string (":coding"); + staticpro (&QCcoding); + QCserver = intern_c_string (":server"); + staticpro (&QCserver); + QCnowait = intern_c_string (":nowait"); + staticpro (&QCnowait); + QCsentinel = intern_c_string (":sentinel"); + staticpro (&QCsentinel); + QClog = intern_c_string (":log"); + staticpro (&QClog); + QCnoquery = intern_c_string (":noquery"); + staticpro (&QCnoquery); + QCstop = intern_c_string (":stop"); + staticpro (&QCstop); + QCoptions = intern_c_string (":options"); + staticpro (&QCoptions); + QCplist = intern_c_string (":plist"); + staticpro (&QCplist); + + Qlast_nonmenu_event = intern_c_string ("last-nonmenu-event"); + staticpro (&Qlast_nonmenu_event); + + staticpro (&Vprocess_alist); +#ifdef SIGCHLD + staticpro (&deleted_pid_list); +#endif + +#endif /* subprocesses */ + QCname = intern_c_string (":name"); staticpro (&QCname); QCtype = intern_c_string (":type"); staticpro (&QCtype); - QCname = intern_c_string (":name"); - staticpro (&QCname); + Qeuid = intern_c_string ("euid"); staticpro (&Qeuid); Qegid = intern_c_string ("egid"); @@ -8030,14 +7666,107 @@ syms_of_process () Qargs = intern_c_string ("args"); staticpro (&Qargs); + DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes, + doc: /* *Non-nil means delete processes immediately when they exit. +A value of nil means don't delete them until `list-processes' is run. */); + + delete_exited_processes = 1; + +#ifdef subprocesses + DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type, + doc: /* Control type of device used to communicate with subprocesses. +Values are nil to use a pipe, or t or `pty' to use a pty. +The value has no effect if the system has no ptys or if all ptys are busy: +then a pipe is used in any case. +The value takes effect when `start-process' is called. */); + Vprocess_connection_type = Qt; + +#ifdef ADAPTIVE_READ_BUFFERING + DEFVAR_LISP ("process-adaptive-read-buffering", &Vprocess_adaptive_read_buffering, + doc: /* If non-nil, improve receive buffering by delaying after short reads. +On some systems, when Emacs reads the output from a subprocess, the output data +is read in very small blocks, potentially resulting in very poor performance. +This behavior can be remedied to some extent by setting this variable to a +non-nil value, as it will automatically delay reading from such processes, to +allow them to produce more output before Emacs tries to read it. +If the value is t, the delay is reset after each write to the process; any other +non-nil value means that the delay is not reset on write. +The variable takes effect when `start-process' is called. */); + Vprocess_adaptive_read_buffering = Qt; +#endif + + defsubr (&Sprocessp); + defsubr (&Sget_process); + defsubr (&Sdelete_process); + defsubr (&Sprocess_status); + defsubr (&Sprocess_exit_status); + defsubr (&Sprocess_id); + defsubr (&Sprocess_name); + defsubr (&Sprocess_tty_name); + defsubr (&Sprocess_command); + defsubr (&Sset_process_buffer); + defsubr (&Sprocess_buffer); + defsubr (&Sprocess_mark); + defsubr (&Sset_process_filter); + defsubr (&Sprocess_filter); + defsubr (&Sset_process_sentinel); + defsubr (&Sprocess_sentinel); + defsubr (&Sset_process_window_size); + defsubr (&Sset_process_inherit_coding_system_flag); + defsubr (&Sset_process_query_on_exit_flag); + defsubr (&Sprocess_query_on_exit_flag); + defsubr (&Sprocess_contact); + defsubr (&Sprocess_plist); + defsubr (&Sset_process_plist); + defsubr (&Slist_processes); + defsubr (&Sprocess_list); + defsubr (&Sstart_process); +#ifdef HAVE_SERIAL + defsubr (&Sserial_process_configure); + defsubr (&Smake_serial_process); +#endif /* HAVE_SERIAL */ +#ifdef HAVE_SOCKETS + defsubr (&Sset_network_process_option); + defsubr (&Smake_network_process); + defsubr (&Sformat_network_address); +#endif /* HAVE_SOCKETS */ +#if defined(HAVE_SOCKETS) && defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) +#ifdef SIOCGIFCONF + defsubr (&Snetwork_interface_list); +#endif +#if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS) + defsubr (&Snetwork_interface_info); +#endif +#endif /* HAVE_SOCKETS ... */ +#ifdef DATAGRAM_SOCKETS + defsubr (&Sprocess_datagram_address); + defsubr (&Sset_process_datagram_address); +#endif + defsubr (&Saccept_process_output); + defsubr (&Sprocess_send_region); + defsubr (&Sprocess_send_string); + defsubr (&Sinterrupt_process); + defsubr (&Skill_process); + defsubr (&Squit_process); + defsubr (&Sstop_process); + defsubr (&Scontinue_process); + defsubr (&Sprocess_running_child_p); + defsubr (&Sprocess_send_eof); + defsubr (&Ssignal_process); + defsubr (&Swaiting_for_user_input_p); + defsubr (&Sprocess_type); + defsubr (&Sset_process_coding_system); + defsubr (&Sprocess_coding_system); + defsubr (&Sset_process_filter_multibyte); + defsubr (&Sprocess_filter_multibyte_p); + +#endif /* subprocesses */ + defsubr (&Sget_buffer_process); defsubr (&Sprocess_inherit_coding_system_flag); defsubr (&Slist_system_processes); defsubr (&Sprocess_attributes); } - -#endif /* not subprocesses */ - /* arch-tag: 3706c011-7b9a-4117-bd4f-59e7f701a4c4 (do not change this comment) */ diff --git a/src/process.h b/src/process.h index a8cd0a02da6..12b91d697b9 100644 --- a/src/process.h +++ b/src/process.h @@ -170,5 +170,9 @@ extern Lisp_Object Qtime, Qctime; extern Lisp_Object list_system_processes (void); extern Lisp_Object system_process_attributes (Lisp_Object); +extern void hold_keyboard_input (void); +extern void unhold_keyboard_input (void); +extern int kbd_on_hold_p (void); + /* arch-tag: dffedfc4-d7bc-4b58-a26f-c16155449c72 (do not change this comment) */ diff --git a/src/puresize.h b/src/puresize.h index 4e97e3731b7..682e8926135 100644 --- a/src/puresize.h +++ b/src/puresize.h @@ -72,7 +72,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ { if (PURE_P (obj)) \ pure_write_error (); } -extern void pure_write_error P_ ((void)) NO_RETURN; +extern void pure_write_error (void) NO_RETURN; /* Define PURE_P. */ diff --git a/src/ralloc.c b/src/ralloc.c index 7ccbdc7daf7..0a2b156e393 100644 --- a/src/ralloc.c +++ b/src/ralloc.c @@ -37,14 +37,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ typedef POINTER_TYPE *POINTER; typedef size_t SIZE; -/* Declared in dispnew.c, this version doesn't screw up if regions - overlap. */ - -extern void safe_bcopy (); - #ifdef DOUG_LEA_MALLOC #define M_TOP_PAD -2 -extern int mallopt (); +extern int mallopt (int, int); #else /* not DOUG_LEA_MALLOC */ #ifndef SYSTEM_MALLOC extern size_t __malloc_extra_blocks; @@ -61,9 +56,6 @@ typedef void *POINTER; #include <unistd.h> #include <malloc.h> -#define safe_bcopy(x, y, z) memmove (y, x, z) -#define bzero(x, len) memset (x, 0, len) - #endif /* not emacs */ @@ -81,7 +73,7 @@ typedef void *POINTER; static int r_alloc_initialized = 0; -static void r_alloc_init (); +static void r_alloc_init (void); /* Declarations for working with the malloc, ralloc, and system breaks. */ @@ -210,8 +202,7 @@ static int r_alloc_freeze_level; /* Find the heap that ADDRESS falls within. */ static heap_ptr -find_heap (address) - POINTER address; +find_heap (POINTER address) { heap_ptr heap; @@ -243,9 +234,7 @@ find_heap (address) allocate the memory. */ static POINTER -obtain (address, size) - POINTER address; - SIZE size; +obtain (POINTER address, SIZE size) { heap_ptr heap; SIZE already_available; @@ -326,7 +315,7 @@ obtain (address, size) it can also eliminate the last heap entirely. */ static void -relinquish () +relinquish (void) { register heap_ptr h; long excess = 0; @@ -385,7 +374,7 @@ relinquish () above where malloc gets space. */ long -r_alloc_size_in_use () +r_alloc_size_in_use (void) { return (char *) break_value - (char *) virtual_break_value; } @@ -396,8 +385,7 @@ r_alloc_size_in_use () to that block. */ static bloc_ptr -find_bloc (ptr) - POINTER *ptr; +find_bloc (POINTER *ptr) { register bloc_ptr p = first_bloc; @@ -422,8 +410,7 @@ find_bloc (ptr) memory for the new block. */ static bloc_ptr -get_bloc (size) - SIZE size; +get_bloc (SIZE size) { register bloc_ptr new_bloc; register heap_ptr heap; @@ -478,10 +465,7 @@ get_bloc (size) Do not touch the contents of blocs or break_value. */ static int -relocate_blocs (bloc, heap, address) - bloc_ptr bloc; - heap_ptr heap; - POINTER address; +relocate_blocs (bloc_ptr bloc, heap_ptr heap, POINTER address) { register bloc_ptr b = bloc; @@ -541,8 +525,7 @@ relocate_blocs (bloc, heap, address) before that of BEFORE. */ static void -reorder_bloc (bloc, before) - bloc_ptr bloc, before; +reorder_bloc (bloc_ptr bloc, bloc_ptr before) { bloc_ptr prev, next; @@ -570,9 +553,7 @@ reorder_bloc (bloc, before) with heap HEAP and bloc BLOC. */ static void -update_heap_bloc_correspondence (bloc, heap) - bloc_ptr bloc; - heap_ptr heap; +update_heap_bloc_correspondence (bloc_ptr bloc, heap_ptr heap) { register bloc_ptr b; @@ -634,9 +615,7 @@ update_heap_bloc_correspondence (bloc, heap) that come after BLOC in memory. */ static int -resize_bloc (bloc, size) - bloc_ptr bloc; - SIZE size; +resize_bloc (bloc_ptr bloc, SIZE size) { register bloc_ptr b; heap_ptr heap; @@ -689,7 +668,7 @@ resize_bloc (bloc, size) } else { - safe_bcopy (b->data, b->new_data, b->size); + memmove (b->new_data, b->data, b->size); *b->variable = b->data = b->new_data; } } @@ -700,8 +679,8 @@ resize_bloc (bloc, size) } else { - safe_bcopy (bloc->data, bloc->new_data, old_size); - bzero ((char *) bloc->new_data + old_size, size - old_size); + memmove (bloc->new_data, bloc->data, old_size); + memset (bloc->new_data + old_size, 0, size - old_size); *bloc->variable = bloc->data = bloc->new_data; } } @@ -716,7 +695,7 @@ resize_bloc (bloc, size) } else { - safe_bcopy (b->data, b->new_data, b->size); + memmove (b->new_data, b->data, b->size); *b->variable = b->data = b->new_data; } } @@ -733,8 +712,7 @@ resize_bloc (bloc, size) This may return space to the system. */ static void -free_bloc (bloc) - bloc_ptr bloc; +free_bloc (bloc_ptr bloc) { heap_ptr heap = bloc->heap; @@ -800,8 +778,7 @@ free_bloc (bloc) GNU malloc package. */ POINTER -r_alloc_sbrk (size) - long size; +r_alloc_sbrk (long int size) { register bloc_ptr b; POINTER address; @@ -871,7 +848,7 @@ r_alloc_sbrk (size) header. */ for (b = last_bloc; b != NIL_BLOC; b = b->prev) { - safe_bcopy (b->data, b->new_data, b->size); + memmove (b->new_data, b->data, b->size); *b->variable = b->data = b->new_data; } @@ -898,7 +875,7 @@ r_alloc_sbrk (size) last_heap = first_heap; } - bzero (address, size); + memset (address, 0, size); } else /* size < 0 */ { @@ -917,7 +894,7 @@ r_alloc_sbrk (size) for (b = first_bloc; b != NIL_BLOC; b = b->next) { - safe_bcopy (b->data, b->new_data, b->size); + memmove (b->new_data, b->data, b->size); *b->variable = b->data = b->new_data; } } @@ -952,9 +929,7 @@ r_alloc_sbrk (size) return zero. */ POINTER -r_alloc (ptr, size) - POINTER *ptr; - SIZE size; +r_alloc (POINTER *ptr, SIZE size) { register bloc_ptr new_bloc; @@ -977,8 +952,7 @@ r_alloc (ptr, size) Store 0 in *PTR to show there's no block allocated. */ void -r_alloc_free (ptr) - register POINTER *ptr; +r_alloc_free (register POINTER *ptr) { register bloc_ptr dead_bloc; @@ -1012,9 +986,7 @@ r_alloc_free (ptr) return zero. */ POINTER -r_re_alloc (ptr, size) - POINTER *ptr; - SIZE size; +r_re_alloc (POINTER *ptr, SIZE size) { register bloc_ptr bloc; @@ -1075,8 +1047,7 @@ r_re_alloc (ptr, size) malloc must return a null pointer. */ void -r_alloc_freeze (size) - long size; +r_alloc_freeze (long int size) { if (! r_alloc_initialized) r_alloc_init (); @@ -1093,7 +1064,7 @@ r_alloc_freeze (size) } void -r_alloc_thaw () +r_alloc_thaw (void) { if (! r_alloc_initialized) @@ -1103,7 +1074,7 @@ r_alloc_thaw () abort (); /* This frees all unused blocs. It is not too inefficient, as the resize - and bcopy is done only once. Afterwards, all unreferenced blocs are + and memcpy is done only once. Afterwards, all unreferenced blocs are already shrunk to zero size. */ if (!r_alloc_freeze_level) { @@ -1122,7 +1093,7 @@ r_alloc_thaw () /* Reinitialize the morecore hook variables after restarting a dumped Emacs. This is needed when using Doug Lea's malloc from GNU libc. */ void -r_alloc_reinit () +r_alloc_reinit (void) { /* Only do this if the hook has been reset, so that we don't get an infinite loop, in case Emacs was linked statically. */ @@ -1235,8 +1206,7 @@ r_alloc_check () is checked to ensure that memory corruption does not occur due to misuse. */ void -r_alloc_reset_variable (old, new) - POINTER *old, *new; +r_alloc_reset_variable (POINTER *old, POINTER *new) { bloc_ptr bloc = first_bloc; @@ -1266,7 +1236,7 @@ r_alloc_reset_variable (old, new) /* Initialize various things for memory allocation. */ static void -r_alloc_init () +r_alloc_init (void) { if (r_alloc_initialized) return; @@ -1314,8 +1284,8 @@ r_alloc_init () even though it is after the sbrk value. */ /* Doubly true, with the additional call that explicitly adds the rest of that page to the address space. */ - bzero (first_heap->start, - (char *) first_heap->end - (char *) first_heap->start); + memset (first_heap->start, 0, + (char *) first_heap->end - (char *) first_heap->start); virtual_break_value = break_value = first_heap->bloc_start = first_heap->end; #endif diff --git a/src/regex.c b/src/regex.c index 46065dda9e6..b563d93fe29 100644 --- a/src/regex.c +++ b/src/regex.c @@ -248,37 +248,16 @@ xrealloc (block, size) # endif # define realloc xrealloc -/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow. - If nothing else has been done, use the method below. */ -# ifdef INHIBIT_STRING_HEADER -# if !(defined HAVE_BZERO && defined HAVE_BCOPY) -# if !defined bzero && !defined bcopy -# undef INHIBIT_STRING_HEADER -# endif +/* This is the normal way of making sure we have memcpy, memcmp and memset. */ +# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC +# include <string.h> +# else +# include <strings.h> +# ifndef memcmp +# define memcmp(s1, s2, n) bcmp (s1, s2, n) # endif -# endif - -/* This is the normal way of making sure we have memcpy, memcmp and bzero. - This is used in most programs--a few other programs avoid this - by defining INHIBIT_STRING_HEADER. */ -# ifndef INHIBIT_STRING_HEADER -# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC -# include <string.h> -# ifndef bzero -# ifndef _LIBC -# define bzero(s, n) (memset (s, '\0', n), (s)) -# else -# define bzero(s, n) __bzero (s, n) -# endif -# endif -# else -# include <strings.h> -# ifndef memcmp -# define memcmp(s1, s2, n) bcmp (s1, s2, n) -# endif -# ifndef memcpy -# define memcpy(d, s, n) (bcopy (s, d, n), (d)) -# endif +# ifndef memcpy +# define memcpy(d, s, n) (bcopy (s, d, n), (d)) # endif # endif @@ -464,7 +443,7 @@ init_syntax_once () if (done) return; - bzero (re_syntax_table, sizeof re_syntax_table); + memset (re_syntax_table, 0, sizeof re_syntax_table); for (c = 0; c < CHAR_SET_SIZE; ++c) if (ISALNUM (c)) @@ -1321,8 +1300,7 @@ reg_syntax_t re_syntax_options; defined in regex.h. We return the old syntax. */ reg_syntax_t -re_set_syntax (syntax) - reg_syntax_t syntax; +re_set_syntax (reg_syntax_t syntax) { reg_syntax_t ret = re_syntax_options; @@ -1335,8 +1313,7 @@ WEAK_ALIAS (__re_set_syntax, re_set_syntax) static re_char *whitespace_regexp; void -re_set_whitespace_regexp (regexp) - const char *regexp; +re_set_whitespace_regexp (const char *regexp) { whitespace_regexp = (re_char *) regexp; } @@ -2149,8 +2126,7 @@ struct range_table_work_area /* Map a string to the char class it names (if any). */ re_wctype_t -re_wctype (str) - re_char *str; +re_wctype (const re_char *str) { const char *string = str; if (STREQ (string, "alnum")) return RECC_ALNUM; @@ -2175,9 +2151,7 @@ re_wctype (str) /* True if CH is in the char class CC. */ boolean -re_iswctype (ch, cc) - int ch; - re_wctype_t cc; +re_iswctype (int ch, re_wctype_t cc) { switch (cc) { @@ -2207,8 +2181,7 @@ re_iswctype (ch, cc) /* Return a bit-pattern to use in the range-table bits to match multibyte chars of class CC. */ static int -re_wctype_to_bit (cc) - re_wctype_t cc; +re_wctype_to_bit (re_wctype_t cc) { switch (cc) { @@ -2232,8 +2205,7 @@ re_wctype_to_bit (cc) /* Actually extend the space in WORK_AREA. */ static void -extend_range_table_work_area (work_area) - struct range_table_work_area *work_area; +extend_range_table_work_area (struct range_table_work_area *work_area) { work_area->allocated += 16 * sizeof (int); if (work_area->table) @@ -2557,11 +2529,7 @@ do { \ } while (0) static reg_errcode_t -regex_compile (pattern, size, syntax, bufp) - re_char *pattern; - size_t size; - reg_syntax_t syntax; - struct re_pattern_buffer *bufp; +regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct re_pattern_buffer *bufp) { /* We fetch characters from PATTERN here. */ register re_wchar_t c, c1; @@ -2959,7 +2927,7 @@ regex_compile (pattern, size, syntax, bufp) BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH); /* Clear the whole map. */ - bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH); + memset (b, 0, (1 << BYTEWIDTH) / BYTEWIDTH); /* charset_not matches newline according to a syntax bit. */ if ((re_opcode_t) b[-2] == charset_not @@ -3875,10 +3843,7 @@ regex_compile (pattern, size, syntax, bufp) /* Store OP at LOC followed by two-byte integer parameter ARG. */ static void -store_op1 (op, loc, arg) - re_opcode_t op; - unsigned char *loc; - int arg; +store_op1 (re_opcode_t op, unsigned char *loc, int arg) { *loc = (unsigned char) op; STORE_NUMBER (loc + 1, arg); @@ -3888,10 +3853,7 @@ store_op1 (op, loc, arg) /* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */ static void -store_op2 (op, loc, arg1, arg2) - re_opcode_t op; - unsigned char *loc; - int arg1, arg2; +store_op2 (re_opcode_t op, unsigned char *loc, int arg1, int arg2) { *loc = (unsigned char) op; STORE_NUMBER (loc + 1, arg1); @@ -3903,11 +3865,7 @@ store_op2 (op, loc, arg1, arg2) for OP followed by two-byte integer parameter ARG. */ static void -insert_op1 (op, loc, arg, end) - re_opcode_t op; - unsigned char *loc; - int arg; - unsigned char *end; +insert_op1 (re_opcode_t op, unsigned char *loc, int arg, unsigned char *end) { register unsigned char *pfrom = end; register unsigned char *pto = end + 3; @@ -3922,11 +3880,7 @@ insert_op1 (op, loc, arg, end) /* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */ static void -insert_op2 (op, loc, arg1, arg2, end) - re_opcode_t op; - unsigned char *loc; - int arg1, arg2; - unsigned char *end; +insert_op2 (re_opcode_t op, unsigned char *loc, int arg1, int arg2, unsigned char *end) { register unsigned char *pfrom = end; register unsigned char *pto = end + 5; @@ -3943,9 +3897,7 @@ insert_op2 (op, loc, arg1, arg2, end) least one character before the ^. */ static boolean -at_begline_loc_p (pattern, p, syntax) - re_char *pattern, *p; - reg_syntax_t syntax; +at_begline_loc_p (const re_char *pattern, const re_char *p, reg_syntax_t syntax) { re_char *prev = p - 2; boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\'; @@ -3967,9 +3919,7 @@ at_begline_loc_p (pattern, p, syntax) at least one character after the $, i.e., `P < PEND'. */ static boolean -at_endline_loc_p (p, pend, syntax) - re_char *p, *pend; - reg_syntax_t syntax; +at_endline_loc_p (const re_char *p, const re_char *pend, reg_syntax_t syntax) { re_char *next = p; boolean next_backslash = *next == '\\'; @@ -3989,9 +3939,7 @@ at_endline_loc_p (p, pend, syntax) false if it's not. */ static boolean -group_in_compile_stack (compile_stack, regnum) - compile_stack_type compile_stack; - regnum_t regnum; +group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum) { int this_element; @@ -4015,10 +3963,7 @@ group_in_compile_stack (compile_stack, regnum) Return -1 if fastmap was not updated accurately. */ static int -analyse_first (p, pend, fastmap, multibyte) - re_char *p, *pend; - char *fastmap; - const int multibyte; +analyse_first (const re_char *p, const re_char *pend, char *fastmap, const int multibyte) { int j, k; boolean not; @@ -4330,15 +4275,14 @@ analyse_first (p, pend, fastmap, multibyte) Returns 0 if we succeed, -2 if an internal error. */ int -re_compile_fastmap (bufp) - struct re_pattern_buffer *bufp; +re_compile_fastmap (struct re_pattern_buffer *bufp) { char *fastmap = bufp->fastmap; int analysis; assert (fastmap && bufp->buffer); - bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */ + memset (fastmap, 0, 1 << BYTEWIDTH); /* Assume nothing's valid. */ bufp->fastmap_accurate = 1; /* It will be when we're done. */ analysis = analyse_first (bufp->buffer, bufp->buffer + bufp->used, @@ -4361,11 +4305,7 @@ re_compile_fastmap (bufp) freeing the old data. */ void -re_set_registers (bufp, regs, num_regs, starts, ends) - struct re_pattern_buffer *bufp; - struct re_registers *regs; - unsigned num_regs; - regoff_t *starts, *ends; +re_set_registers (struct re_pattern_buffer *bufp, struct re_registers *regs, unsigned int num_regs, regoff_t *starts, regoff_t *ends) { if (num_regs) { @@ -4389,11 +4329,7 @@ WEAK_ALIAS (__re_set_registers, re_set_registers) doesn't let you say where to stop matching. */ int -re_search (bufp, string, size, startpos, range, regs) - struct re_pattern_buffer *bufp; - const char *string; - int size, startpos, range; - struct re_registers *regs; +re_search (struct re_pattern_buffer *bufp, const char *string, int size, int startpos, int range, struct re_registers *regs) { return re_search_2 (bufp, NULL, 0, string, size, startpos, range, regs, size); @@ -4434,14 +4370,7 @@ WEAK_ALIAS (__re_search, re_search) stack overflow). */ int -re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop) - struct re_pattern_buffer *bufp; - const char *str1, *str2; - int size1, size2; - int startpos; - int range; - struct re_registers *regs; - int stop; +re_search_2 (struct re_pattern_buffer *bufp, const char *str1, int size1, const char *str2, int size2, int startpos, int range, struct re_registers *regs, int stop) { int val; re_char *string1 = (re_char*) str1; @@ -4775,8 +4704,7 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2, /* If the operation is a match against one or more chars, return a pointer to the next operation, else return NULL. */ static re_char * -skip_one_char (p) - re_char *p; +skip_one_char (const re_char *p) { switch (SWITCH_ENUM_CAST (*p++)) { @@ -4818,8 +4746,7 @@ skip_one_char (p) /* Jump over non-matching operations. */ static re_char * -skip_noops (p, pend) - re_char *p, *pend; +skip_noops (const re_char *p, const re_char *pend) { int mcnt; while (p < pend) @@ -4846,9 +4773,7 @@ skip_noops (p, pend) /* Non-zero if "p1 matches something" implies "p2 fails". */ static int -mutually_exclusive_p (bufp, p1, p2) - struct re_pattern_buffer *bufp; - re_char *p1, *p2; +mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const re_char *p2) { re_opcode_t op2; const boolean multibyte = RE_MULTIBYTE_P (bufp); @@ -5086,13 +5011,7 @@ Lisp_Object re_match_object; matched substring. */ int -re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - int size1, size2; - int pos; - struct re_registers *regs; - int stop; +re_match_2 (struct re_pattern_buffer *bufp, const char *string1, int size1, const char *string2, int size2, int pos, struct re_registers *regs, int stop) { int result; @@ -5114,13 +5033,7 @@ WEAK_ALIAS (__re_match_2, re_match_2) /* This is a separate function so that we can force an alloca cleanup afterwards. */ static int -re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) - struct re_pattern_buffer *bufp; - re_char *string1, *string2; - int size1, size2; - int pos; - struct re_registers *regs; - int stop; +re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int size1, const re_char *string2, int size2, int pos, struct re_registers *regs, int stop) { /* General temporaries. */ int mcnt; @@ -6451,11 +6364,8 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) bytes; nonzero otherwise. */ static int -bcmp_translate (s1, s2, len, translate, target_multibyte) - re_char *s1, *s2; - register int len; - RE_TRANSLATE_TYPE translate; - const int target_multibyte; +bcmp_translate (const re_char *s1, const re_char *s2, register int len, + RE_TRANSLATE_TYPE translate, const int target_multibyte) { register re_char *p1 = s1, *p2 = s2; re_char *p1_end = s1 + len; @@ -6496,10 +6406,7 @@ bcmp_translate (s1, s2, len, translate, target_multibyte) We call regex_compile to do the actual compilation. */ const char * -re_compile_pattern (pattern, length, bufp) - const char *pattern; - size_t length; - struct re_pattern_buffer *bufp; +re_compile_pattern (const char *pattern, size_t length, struct re_pattern_buffer *bufp) { reg_errcode_t ret; diff --git a/src/region-cache.c b/src/region-cache.c index d03d7df0bda..45eb723c885 100644 --- a/src/region-cache.c +++ b/src/region-cache.c @@ -122,13 +122,13 @@ struct region_cache { preserve that information, instead of throwing it away. */ #define PRESERVE_THRESHOLD (500) -static void revalidate_region_cache (); +static void revalidate_region_cache (struct buffer *buf, struct region_cache *c); /* Interface: Allocating, initializing, and disposing of region caches. */ struct region_cache * -new_region_cache () +new_region_cache (void) { struct region_cache *c = (struct region_cache *) xmalloc (sizeof (struct region_cache)); @@ -156,8 +156,7 @@ new_region_cache () } void -free_region_cache (c) - struct region_cache *c; +free_region_cache (struct region_cache *c) { xfree (c->boundaries); xfree (c); @@ -174,9 +173,7 @@ free_region_cache (c) entries. It would be nice if it took advantage of locality of reference, too, by searching entries near the last entry found. */ static int -find_cache_boundary (c, pos) - struct region_cache *c; - int pos; +find_cache_boundary (struct region_cache *c, int pos) { int low = 0, high = c->cache_len; @@ -210,10 +207,7 @@ find_cache_boundary (c, pos) /* Move the gap of cache C to index POS, and make sure it has space for at least MIN_SIZE boundaries. */ static void -move_cache_gap (c, pos, min_size) - struct region_cache *c; - int pos; - int min_size; +move_cache_gap (struct region_cache *c, int pos, int min_size) { /* Copy these out of the cache and into registers. */ int gap_start = c->gap_start; @@ -298,10 +292,7 @@ move_cache_gap (c, pos, min_size) /* Insert a new boundary in cache C; it will have cache index INDEX, and have the specified POS and VALUE. */ static void -insert_cache_boundary (c, index, pos, value) - struct region_cache *c; - int index; - int pos, value; +insert_cache_boundary (struct region_cache *c, int index, int pos, int value) { /* index must be a valid cache index. */ if (index < 0 || index > c->cache_len) @@ -337,9 +328,7 @@ insert_cache_boundary (c, index, pos, value) /* Delete the i'th entry from cache C if START <= i < END. */ static void -delete_cache_boundaries (c, start, end) - struct region_cache *c; - int start, end; +delete_cache_boundaries (struct region_cache *c, int start, int end) { int len = end - start; @@ -391,10 +380,7 @@ delete_cache_boundaries (c, start, end) /* Set the value in cache C for the region START..END to VALUE. */ static void -set_cache_region (c, start, end, value) - struct region_cache *c; - int start, end; - int value; +set_cache_region (struct region_cache *c, int start, int end, int value) { if (start > end) abort (); @@ -495,10 +481,7 @@ set_cache_region (c, start, end, value) buffer positions in the presence of insertions and deletions; the args to pass are the same before and after such an operation.) */ void -invalidate_region_cache (buf, c, head, tail) - struct buffer *buf; - struct region_cache *c; - int head, tail; +invalidate_region_cache (struct buffer *buf, struct region_cache *c, int head, int tail) { /* Let chead = c->beg_unchanged, and ctail = c->end_unchanged. @@ -576,9 +559,7 @@ invalidate_region_cache (buf, c, head, tail) the cache, and causes cache gap motion. */ static void -revalidate_region_cache (buf, c) - struct buffer *buf; - struct region_cache *c; +revalidate_region_cache (struct buffer *buf, struct region_cache *c) { /* The boundaries now in the cache are expressed relative to the buffer_beg and buffer_end values stored in the cache. Now, @@ -706,10 +687,7 @@ revalidate_region_cache (buf, c) buffer positions) is "known," for the purposes of CACHE (e.g. "has no newlines", in the case of the line cache). */ void -know_region_cache (buf, c, start, end) - struct buffer *buf; - struct region_cache *c; - int start, end; +know_region_cache (struct buffer *buf, struct region_cache *c, int start, int end) { revalidate_region_cache (buf, c); @@ -723,11 +701,7 @@ know_region_cache (buf, c, start, end) the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest position after POS where the knownness changes. */ int -region_cache_forward (buf, c, pos, next) - struct buffer *buf; - struct region_cache *c; - int pos; - int *next; +region_cache_forward (struct buffer *buf, struct region_cache *c, int pos, int *next) { revalidate_region_cache (buf, c); @@ -762,11 +736,7 @@ region_cache_forward (buf, c, pos, next) /* Return true if the text immediately before POS in BUF is known, for the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest position before POS where the knownness changes. */ -int region_cache_backward (buf, c, pos, next) - struct buffer *buf; - struct region_cache *c; - int pos; - int *next; +int region_cache_backward (struct buffer *buf, struct region_cache *c, int pos, int *next) { revalidate_region_cache (buf, c); @@ -804,8 +774,7 @@ int region_cache_backward (buf, c, pos, next) /* Debugging: pretty-print a cache to the standard error output. */ void -pp_cache (c) - struct region_cache *c; +pp_cache (struct region_cache *c) { int i; int beg_u = c->buffer_beg + c->beg_unchanged; diff --git a/src/region-cache.h b/src/region-cache.h index 4a717d66081..e2972f2ea0a 100644 --- a/src/region-cache.h +++ b/src/region-cache.h @@ -61,17 +61,17 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Allocate, initialize and return a new, empty region cache. */ -struct region_cache *new_region_cache P_ ((void)); +struct region_cache *new_region_cache (void); /* Free a region cache. */ -void free_region_cache P_ ((struct region_cache *)); +void free_region_cache (struct region_cache *); /* Assert that the region of BUF between START and END (absolute buffer positions) is "known," for the purposes of CACHE (e.g. "has no newlines", in the case of the line cache). */ -extern void know_region_cache P_ ((struct buffer *BUF, - struct region_cache *CACHE, - int START, int END)); +extern void know_region_cache (struct buffer *BUF, + struct region_cache *CACHE, + int START, int END); /* Indicate that a section of BUF has changed, to invalidate CACHE. HEAD is the number of chars unchanged at the beginning of the buffer. @@ -81,9 +81,9 @@ extern void know_region_cache P_ ((struct buffer *BUF, (This way of specifying regions makes more sense than absolute buffer positions in the presence of insertions and deletions; the args to pass are the same before and after such an operation.) */ -extern void invalidate_region_cache P_ ((struct buffer *BUF, - struct region_cache *CACHE, - int HEAD, int TAIL)); +extern void invalidate_region_cache (struct buffer *BUF, + struct region_cache *CACHE, + int HEAD, int TAIL); /* The scanning functions. @@ -97,18 +97,18 @@ extern void invalidate_region_cache P_ ((struct buffer *BUF, /* Return true if the text immediately after POS in BUF is known, for the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest position after POS where the knownness changes. */ -extern int region_cache_forward P_ ((struct buffer *BUF, - struct region_cache *CACHE, - int POS, - int *NEXT)); +extern int region_cache_forward (struct buffer *BUF, + struct region_cache *CACHE, + int POS, + int *NEXT); /* Return true if the text immediately before POS in BUF is known, for the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest position before POS where the knownness changes. */ -extern int region_cache_backward P_ ((struct buffer *BUF, - struct region_cache *CACHE, - int POS, - int *NEXT)); +extern int region_cache_backward (struct buffer *BUF, + struct region_cache *CACHE, + int POS, + int *NEXT); /* arch-tag: 70f79125-ef22-4f58-9aec-a48ca2791435 (do not change this comment) */ diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h index 48f43126fd9..cf06f9befe0 100644 --- a/src/s/aix4-2.h +++ b/src/s/aix4-2.h @@ -89,8 +89,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ memory use the libc malloc implementation. Calling xfree or xrealloc on the results of such functions results in a crash. - One solution for this could be to define SYSTEM_MALLOC here, but - that does not currently work on this system. + One solution for this could be to define SYSTEM_MALLOC in configure, + but that does not currently work on this system. It is possible to completely override the malloc implementation on AIX, but that involves putting the malloc functions in a shared diff --git a/src/s/darwin.h b/src/s/darwin.h index 5c8db1242e1..146bfd693a2 100644 --- a/src/s/darwin.h +++ b/src/s/darwin.h @@ -114,15 +114,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* System uses OXTABS instead of the expected TAB3. (Copied from bsd386.h.) */ #define TAB3 OXTABS -/* Darwin ld insists on the use of malloc routines in the System framework. */ -#define SYSTEM_MALLOC - /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ #define HAVE_SOCKETS -/* start_of_text isn't actually used, so make it compile without error. */ -#define TEXT_START (0) - /* Definitions for how to compile & link. */ #ifdef HAVE_NS #define SYSTEM_PURESIZE_EXTRA 200000 diff --git a/src/s/freebsd.h b/src/s/freebsd.h index 2b53ec0413f..9082935db07 100644 --- a/src/s/freebsd.h +++ b/src/s/freebsd.h @@ -25,9 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Get most of the stuff from bsd-common */ #include "bsd-common.h" -/* For mem-limits.h. */ -#define BSD4_2 - #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) #define HAVE_GETLOADAVG 1 @@ -70,9 +67,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack. */ #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS -/* Define USE_MMAP_FOR_BUFFERS to let Emacs use mmap(2) to allocate - buffer text. This overrides REL_ALLOC. */ -#define USE_MMAP_FOR_BUFFERS 1 - /* arch-tag: 426529ca-b7c4-448f-b10a-d4dcdc9c78eb (do not change this comment) */ diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h index 8d9c73e2368..ee841041edb 100644 --- a/src/s/hpux10-20.h +++ b/src/s/hpux10-20.h @@ -131,7 +131,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define DATA_SEG_BITS 0x40000000 #define DATA_START 0x40000000 -#define TEXT_START 0x00000000 /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE double @@ -147,9 +146,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* No underscore please. */ #define LDAV_SYMBOL "avenrun" -/* On USG systems these have different names. */ -#define index strchr -#define rindex strrchr - /* arch-tag: 8d8dcbf1-ca9b-48a1-94be-b750de18a5c6 (do not change this comment) */ diff --git a/src/s/irix6-5.h b/src/s/irix6-5.h index 1691daa6615..e2b18b2ec2b 100644 --- a/src/s/irix6-5.h +++ b/src/s/irix6-5.h @@ -85,8 +85,6 @@ char *_getpty(); #define NARROWPROTO 1 -#define USE_MMAP_FOR_BUFFERS 1 - #if _MIPS_SZLONG == 64 /* -mabi=64 (gcc) or -64 (MIPSpro) */ #define _LP64 /* lisp.h takes care of the rest */ #endif /* _MIPS_SZLONG */ diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h index ea32373e02b..b3e9db8be8a 100644 --- a/src/s/ms-w32.h +++ b/src/s/ms-w32.h @@ -40,7 +40,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* SYSTEM_TYPE should indicate the kind of system you are using. It sets the Lisp variable system-type. */ #define SYSTEM_TYPE "windows-nt" -#define SYMS_SYSTEM syms_of_ntterm () #define NO_MATHERR 1 @@ -63,15 +62,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ for received packets, so datagrams are broken too. */ #define BROKEN_DATAGRAM_SOCKETS 1 -#define bzero(b, l) memset(b, 0, l) -#define bcopy(s, d, l) memmove(d, s, l) -#define bcmp(a, b, l) memcmp(a, b, l) - -/* bcopy (aka memmove aka memcpy at least on x86) under MSVC is quite safe. */ -#define GAP_USE_BCOPY 1 -#define BCOPY_UPWARD_SAFE 1 -#define BCOPY_DOWNWARD_SAFE 1 - /* If your system uses COFF (Common Object File Format) then define the preprocessor symbol "COFF". */ #define COFF 1 @@ -153,8 +143,10 @@ struct sigaction { #define HAVE_RANDOM 1 #undef HAVE_SYSINFO #undef HAVE_LRAND48 -#define HAVE_BCOPY 1 -#define HAVE_BCMP 1 +#define HAVE_MEMCMP 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMSET 1 #define HAVE_LOGB 1 #define HAVE_FREXP 1 #define HAVE_FMOD 1 @@ -281,8 +273,6 @@ typedef int pid_t; #define pclose _pclose #define umask _umask #define utimbuf _utimbuf -#define index strchr -#define rindex strrchr #define strdup _strdup #define strupr _strupr #define strnicmp _strnicmp diff --git a/src/s/msdos.h b/src/s/msdos.h index af272635968..b76b583250c 100644 --- a/src/s/msdos.h +++ b/src/s/msdos.h @@ -38,14 +38,8 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */ It sets the Lisp variable system-type. */ #define SYSTEM_TYPE "ms-dos" -#define SYMS_SYSTEM syms_of_dosfns();syms_of_msdos();syms_of_win16select() - #define SYSV_SYSTEM_DIR -/* Define this is the compiler understands `volatile'. */ -#define HAVE_VOLATILE - - /* subprocesses should be defined if you want to have code for asynchronous subprocesses (as used in M-x compile and M-x shell). This is the only system that needs this. */ @@ -75,7 +69,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */ #define _longjmp longjmp #define DATA_START (&etext + 1) -#define TEXT_START &start #define _NAIVE_DOS_REGS @@ -104,10 +97,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */ #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\') #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_)) -/* bcopy under djgpp is quite safe. */ -#define GAP_USE_BCOPY -#define BCOPY_UPWARD_SAFE 1 -#define BCOPY_DOWNWARD_SAFE 1 /* Mode line description of a buffer's type. */ #define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B") diff --git a/src/s/sol2-10.h b/src/s/sol2-10.h index 7441eaa0210..fd7f30021ea 100644 --- a/src/s/sol2-10.h +++ b/src/s/sol2-10.h @@ -2,8 +2,6 @@ #include "sol2-6.h" -#define SYSTEM_MALLOC - /* This is used in list_system_processes. */ #define HAVE_PROCFS 1 diff --git a/src/s/sol2-6.h b/src/s/sol2-6.h index 0c30b3d81f0..f4719093d4a 100644 --- a/src/s/sol2-6.h +++ b/src/s/sol2-6.h @@ -34,10 +34,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define HAVE_LIBKSTAT #endif -/* inoue@ainet.or.jp says Solaris has a bug related to X11R6-style - XIM support. */ -#define INHIBIT_X11R6_XIM - /* This is the same definition as in usg5-4.h, but with sigblock/sigunblock rather than sighold/sigrelse, which appear to be BSD4.1 specific. It may also be appropriate for SVR4.x diff --git a/src/s/template.h b/src/s/template.h index 694a1046566..67ed13e6180 100644 --- a/src/s/template.h +++ b/src/s/template.h @@ -108,9 +108,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ is not ':', #define this to be the appropriate character constant. */ /* #define SEPCHAR ':' */ -/* Define this if the system can use mmap for buffer text allocation. */ -/* #define USE_MMAP_FOR_BUFFERS 1 */ - /* ============================================================ */ /* Here, add any special hacks needed to make Emacs work on this diff --git a/src/s/usg5-4.h b/src/s/usg5-4.h index e667ffdc106..b92a5bbb450 100644 --- a/src/s/usg5-4.h +++ b/src/s/usg5-4.h @@ -50,14 +50,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define _setjmp setjmp #define _longjmp longjmp -/* On USG systems these have different names. */ -#ifndef HAVE_INDEX -#define index strchr -#endif /* ! defined (HAVE_INDEX) */ -#ifndef HAVE_RINDEX -#define rindex strrchr -#endif /* ! defined (HAVE_RINDEX) */ - /* The docs for system V/386 suggest v.3 has sigpause, so let's try it. */ #define HAVE_SYSV_SIGPAUSE diff --git a/src/scroll.c b/src/scroll.c index e2d3656dc43..bdb7f691ee7 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -58,14 +58,14 @@ struct matrix_elt unsigned char writecount; }; -static void do_direct_scrolling P_ ((struct frame *, - struct glyph_matrix *, - struct matrix_elt *, - int, int)); -static void do_scrolling P_ ((struct frame *, - struct glyph_matrix *, - struct matrix_elt *, - int, int)); +static void do_direct_scrolling (struct frame *, + struct glyph_matrix *, + struct matrix_elt *, + int, int); +static void do_scrolling (struct frame *, + struct glyph_matrix *, + struct matrix_elt *, + int, int); /* Determine, in matrix[i,j], the cost of updating the first j old @@ -86,17 +86,12 @@ static void do_scrolling P_ ((struct frame *, new contents appears. */ static void -calculate_scrolling (frame, matrix, window_size, lines_below, - draw_cost, old_hash, new_hash, - free_at_end) - FRAME_PTR frame; - /* matrix is of size window_size + 1 on each side. */ - struct matrix_elt *matrix; - int window_size, lines_below; - int *draw_cost; - int *old_hash; - int *new_hash; - int free_at_end; +calculate_scrolling (FRAME_PTR frame, + /* matrix is of size window_size + 1 on each side. */ + struct matrix_elt *matrix, + int window_size, int lines_below, + int *draw_cost, int *old_hash, int *new_hash, + int free_at_end) { register int i, j; int frame_lines = FRAME_LINES (frame); @@ -244,12 +239,7 @@ calculate_scrolling (frame, matrix, window_size, lines_below, of lines. */ static void -do_scrolling (frame, current_matrix, matrix, window_size, unchanged_at_top) - struct frame *frame; - struct glyph_matrix *current_matrix; - struct matrix_elt *matrix; - int window_size; - int unchanged_at_top; +do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct matrix_elt *matrix, int window_size, int unchanged_at_top) { struct matrix_elt *p; int i, j, k; @@ -268,7 +258,7 @@ do_scrolling (frame, current_matrix, matrix, window_size, unchanged_at_top) int *copy_from = (int *) alloca (window_size * sizeof (int)); /* Zero means line is empty. */ - bzero (retained_p, window_size * sizeof (char)); + memset (retained_p, 0, window_size * sizeof (char)); for (k = 0; k < window_size; ++k) copy_from[k] = -1; @@ -429,18 +419,13 @@ do_scrolling (frame, current_matrix, matrix, window_size, unchanged_at_top) is the equivalent of draw_cost for the old line contents */ static void -calculate_direct_scrolling (frame, matrix, window_size, lines_below, - draw_cost, old_draw_cost, old_hash, new_hash, - free_at_end) - FRAME_PTR frame; - /* matrix is of size window_size + 1 on each side. */ - struct matrix_elt *matrix; - int window_size, lines_below; - int *draw_cost; - int *old_draw_cost; - int *old_hash; - int *new_hash; - int free_at_end; +calculate_direct_scrolling (FRAME_PTR frame, + /* matrix is of size window_size + 1 on each side. */ + struct matrix_elt *matrix, + int window_size, int lines_below, + int *draw_cost, int *old_draw_cost, + int *old_hash, int *new_hash, + int free_at_end) { register int i, j; int frame_lines = FRAME_LINES (frame); @@ -655,13 +640,9 @@ calculate_direct_scrolling (frame, matrix, window_size, lines_below, the cost matrix for this approach is constructed. */ static void -do_direct_scrolling (frame, current_matrix, cost_matrix, - window_size, unchanged_at_top) - struct frame *frame; - struct glyph_matrix *current_matrix; - struct matrix_elt *cost_matrix; - int window_size; - int unchanged_at_top; +do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, + struct matrix_elt *cost_matrix, int window_size, + int unchanged_at_top) { struct matrix_elt *p; int i, j; @@ -692,7 +673,7 @@ do_direct_scrolling (frame, current_matrix, cost_matrix, old matrix. Lines not retained are empty. */ char *retained_p = (char *) alloca (window_size * sizeof (char)); - bzero (retained_p, window_size * sizeof (char)); + memset (retained_p, 0, window_size * sizeof (char)); /* Perform some sanity checks when GLYPH_DEBUG is on. */ CHECK_MATRIX (current_matrix); @@ -811,15 +792,9 @@ do_direct_scrolling (frame, current_matrix, cost_matrix, void -scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom, - draw_cost, old_draw_cost, old_hash, new_hash, free_at_end) - FRAME_PTR frame; - int window_size, unchanged_at_top, unchanged_at_bottom; - int *draw_cost; - int *old_draw_cost; - int *old_hash; - int *new_hash; - int free_at_end; +scrolling_1 (FRAME_PTR frame, int window_size, int unchanged_at_top, + int unchanged_at_bottom, int *draw_cost, int *old_draw_cost, + int *old_hash, int *new_hash, int free_at_end) { struct matrix_elt *matrix; matrix = ((struct matrix_elt *) @@ -854,9 +829,7 @@ scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom, such a line will have little weight. */ int -scrolling_max_lines_saved (start, end, oldhash, newhash, cost) - int start, end; - int *oldhash, *newhash, *cost; +scrolling_max_lines_saved (int start, int end, int *oldhash, int *newhash, int *cost) { struct { int hash; int count; } lines[01000]; register int i, h; @@ -872,7 +845,7 @@ scrolling_max_lines_saved (start, end, oldhash, newhash, cost) avg_length /= end - start; threshold = avg_length / 4; - bzero (lines, sizeof lines); + memset (lines, 0, sizeof lines); /* Put new lines' hash codes in hash table. Ignore lines shorter than the threshold. Thus, if the lines that are in common are @@ -909,9 +882,7 @@ scrolling_max_lines_saved (start, end, oldhash, newhash, cost) to scroll_frame_lines to perform this scrolling. */ int -scroll_cost (frame, from, to, amount) - FRAME_PTR frame; - int from, to, amount; +scroll_cost (FRAME_PTR frame, int from, int to, int amount) { /* Compute how many lines, at bottom of frame, will not be involved in actual motion. */ @@ -948,11 +919,7 @@ scroll_cost (frame, from, to, amount) overhead and multiply factor values */ static void -line_ins_del (frame, ov1, pf1, ovn, pfn, ov, mf) - FRAME_PTR frame; - int ov1, ovn; - int pf1, pfn; - register int *ov, *mf; +line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, register int *ov, register int *mf) { register int i; register int frame_lines = FRAME_LINES (frame); @@ -969,15 +936,11 @@ line_ins_del (frame, ov1, pf1, ovn, pfn, ov, mf) } static void -ins_del_costs (frame, - one_line_string, multi_string, - setup_string, cleanup_string, - costvec, ncostvec, coefficient) - FRAME_PTR frame; - char *one_line_string, *multi_string; - char *setup_string, *cleanup_string; - int *costvec, *ncostvec; - int coefficient; +ins_del_costs (FRAME_PTR frame, + char *one_line_string, char *multi_string, + char *setup_string, char *cleanup_string, + int *costvec, int *ncostvec, + int coefficient) { if (multi_string) line_ins_del (frame, @@ -1029,15 +992,11 @@ ins_del_costs (frame, */ void -do_line_insertion_deletion_costs (frame, - ins_line_string, multi_ins_string, - del_line_string, multi_del_string, - setup_string, cleanup_string, coefficient) - FRAME_PTR frame; - char *ins_line_string, *multi_ins_string; - char *del_line_string, *multi_del_string; - char *setup_string, *cleanup_string; - int coefficient; +do_line_insertion_deletion_costs (FRAME_PTR frame, + char *ins_line_string, char *multi_ins_string, + char *del_line_string, char *multi_del_string, + char *setup_string, char *cleanup_string, + int coefficient) { if (FRAME_INSERT_COST (frame) != 0) { diff --git a/src/search.c b/src/search.c index 736a89258f5..602a50c0abe 100644 --- a/src/search.c +++ b/src/search.c @@ -98,22 +98,22 @@ Lisp_Object Vsearch_spaces_regexp; only. */ Lisp_Object Vinhibit_changing_match_data; -static void set_search_regs P_ ((EMACS_INT, EMACS_INT)); -static void save_search_regs P_ ((void)); -static EMACS_INT simple_search P_ ((int, unsigned char *, int, int, - Lisp_Object, EMACS_INT, EMACS_INT, - EMACS_INT, EMACS_INT)); -static EMACS_INT boyer_moore P_ ((int, unsigned char *, int, int, - Lisp_Object, Lisp_Object, - EMACS_INT, EMACS_INT, - EMACS_INT, EMACS_INT, int)); -static EMACS_INT search_buffer P_ ((Lisp_Object, EMACS_INT, EMACS_INT, - EMACS_INT, EMACS_INT, int, int, - Lisp_Object, Lisp_Object, int)); -static void matcher_overflow () NO_RETURN; +static void set_search_regs (EMACS_INT, EMACS_INT); +static void save_search_regs (void); +static EMACS_INT simple_search (int, unsigned char *, int, int, + Lisp_Object, EMACS_INT, EMACS_INT, + EMACS_INT, EMACS_INT); +static EMACS_INT boyer_moore (int, unsigned char *, int, int, + Lisp_Object, Lisp_Object, + EMACS_INT, EMACS_INT, + EMACS_INT, EMACS_INT, int); +static EMACS_INT search_buffer (Lisp_Object, EMACS_INT, EMACS_INT, + EMACS_INT, EMACS_INT, int, int, + Lisp_Object, Lisp_Object, int); +static void matcher_overflow (void) NO_RETURN; static void -matcher_overflow () +matcher_overflow (void) { error ("Stack overflow in regexp matcher"); } @@ -132,12 +132,7 @@ matcher_overflow () The behavior also depends on Vsearch_spaces_regexp. */ static void -compile_pattern_1 (cp, pattern, translate, regp, posix) - struct regexp_cache *cp; - Lisp_Object pattern; - Lisp_Object translate; - struct re_registers *regp; - int posix; +compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object translate, struct re_registers *regp, int posix) { char *val; reg_syntax_t old; @@ -187,7 +182,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix) This is called from garbage collection. */ void -shrink_regexp_cache () +shrink_regexp_cache (void) { struct regexp_cache *cp; @@ -205,7 +200,7 @@ shrink_regexp_cache () automagically manages the memory in each re_pattern_buffer struct, based on its `allocated' and `buffer' values. */ void -clear_regexp_cache () +clear_regexp_cache (void) { int i; @@ -229,11 +224,7 @@ clear_regexp_cache () for this pattern. 0 means backtrack only enough to get a valid match. */ struct re_pattern_buffer * -compile_pattern (pattern, regp, translate, posix, multibyte) - Lisp_Object pattern; - struct re_registers *regp; - Lisp_Object translate; - int posix, multibyte; +compile_pattern (Lisp_Object pattern, struct re_registers *regp, Lisp_Object translate, int posix, int multibyte) { struct regexp_cache *cp, **cpp; @@ -290,9 +281,7 @@ compile_pattern (pattern, regp, translate, posix, multibyte) static Lisp_Object -looking_at_1 (string, posix) - Lisp_Object string; - int posix; +looking_at_1 (Lisp_Object string, int posix) { Lisp_Object val; unsigned char *p1, *p2; @@ -373,8 +362,7 @@ DEFUN ("looking-at", Flooking_at, Slooking_at, 1, 1, 0, This function modifies the match data that `match-beginning', `match-end' and `match-data' access; save and restore the match data if you want to preserve them. */) - (regexp) - Lisp_Object regexp; + (Lisp_Object regexp) { return looking_at_1 (regexp, 0); } @@ -385,16 +373,13 @@ Find the longest match, in accord with Posix regular expression rules. This function modifies the match data that `match-beginning', `match-end' and `match-data' access; save and restore the match data if you want to preserve them. */) - (regexp) - Lisp_Object regexp; + (Lisp_Object regexp) { return looking_at_1 (regexp, 1); } static Lisp_Object -string_match_1 (regexp, string, start, posix) - Lisp_Object regexp, string, start; - int posix; +string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int posix) { int val; struct re_pattern_buffer *bufp; @@ -474,8 +459,7 @@ matched by parenthesis constructs in the pattern. You can use the function `match-string' to extract the substrings matched by the parenthesis constructions in REGEXP. */) - (regexp, string, start) - Lisp_Object regexp, string, start; + (Lisp_Object regexp, Lisp_Object string, Lisp_Object start) { return string_match_1 (regexp, string, start, 0); } @@ -488,8 +472,7 @@ If third arg START is non-nil, start search at that index in STRING. For index of first char beyond the match, do (match-end 0). `match-end' and `match-beginning' also give indices of substrings matched by parenthesis constructs in the pattern. */) - (regexp, string, start) - Lisp_Object regexp, string, start; + (Lisp_Object regexp, Lisp_Object string, Lisp_Object start) { return string_match_1 (regexp, string, start, 1); } @@ -499,8 +482,7 @@ matched by parenthesis constructs in the pattern. */) This does not clobber the match data. */ int -fast_string_match (regexp, string) - Lisp_Object regexp, string; +fast_string_match (Lisp_Object regexp, Lisp_Object string) { int val; struct re_pattern_buffer *bufp; @@ -525,9 +507,7 @@ fast_string_match (regexp, string) extern Lisp_Object Vascii_downcase_table; int -fast_c_string_match_ignore_case (regexp, string) - Lisp_Object regexp; - const char *string; +fast_c_string_match_ignore_case (Lisp_Object regexp, const char *string) { int val; struct re_pattern_buffer *bufp; @@ -547,8 +527,7 @@ fast_c_string_match_ignore_case (regexp, string) /* Like fast_string_match but ignore case. */ int -fast_string_match_ignore_case (regexp, string) - Lisp_Object regexp, string; +fast_string_match_ignore_case (Lisp_Object regexp, Lisp_Object string) { int val; struct re_pattern_buffer *bufp; @@ -572,10 +551,7 @@ fast_string_match_ignore_case (regexp, string) data. */ EMACS_INT -fast_looking_at (regexp, pos, pos_byte, limit, limit_byte, string) - Lisp_Object regexp; - EMACS_INT pos, pos_byte, limit, limit_byte; - Lisp_Object string; +fast_looking_at (Lisp_Object regexp, EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT limit, EMACS_INT limit_byte, Lisp_Object string) { int multibyte; struct re_pattern_buffer *buf; @@ -640,8 +616,7 @@ fast_looking_at (regexp, pos, pos_byte, limit, limit_byte, string) This is our cheezy way of associating an action with the change of state of a buffer-local variable. */ static void -newline_cache_on_off (buf) - struct buffer *buf; +newline_cache_on_off (struct buffer *buf) { if (NILP (buf->cache_long_line_scans)) { @@ -682,12 +657,7 @@ newline_cache_on_off (buf) except when inside redisplay. */ int -scan_buffer (target, start, end, count, shortage, allow_quit) - register int target; - EMACS_INT start, end; - int count; - int *shortage; - int allow_quit; +scan_buffer (register int target, EMACS_INT start, EMACS_INT end, int count, int *shortage, int allow_quit) { struct region_cache *newline_cache; int direction; @@ -879,11 +849,7 @@ scan_buffer (target, start, end, count, shortage, allow_quit) except in special cases. */ int -scan_newline (start, start_byte, limit, limit_byte, count, allow_quit) - EMACS_INT start, start_byte; - EMACS_INT limit, limit_byte; - register int count; - int allow_quit; +scan_newline (EMACS_INT start, EMACS_INT start_byte, EMACS_INT limit, EMACS_INT limit_byte, register int count, int allow_quit) { int direction = ((count > 0) ? 1 : -1); @@ -977,9 +943,7 @@ scan_newline (start, start_byte, limit, limit_byte, count, allow_quit) } int -find_next_newline_no_quit (from, cnt) - EMACS_INT from; - int cnt; +find_next_newline_no_quit (EMACS_INT from, int cnt) { return scan_buffer ('\n', from, 0, cnt, (int *) 0, 0); } @@ -989,9 +953,7 @@ find_next_newline_no_quit (from, cnt) find_next_newline (...)-1, because you might hit TO. */ int -find_before_next_newline (from, to, cnt) - EMACS_INT from, to; - int cnt; +find_before_next_newline (EMACS_INT from, EMACS_INT to, int cnt) { int shortage; int pos = scan_buffer ('\n', from, to, cnt, &shortage, 1); @@ -1005,11 +967,7 @@ find_before_next_newline (from, to, cnt) /* Subroutines of Lisp buffer search functions. */ static Lisp_Object -search_command (string, bound, noerror, count, direction, RE, posix) - Lisp_Object string, bound, noerror, count; - int direction; - int RE; - int posix; +search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count, int direction, int RE, int posix) { register int np; int lim, lim_byte; @@ -1086,8 +1044,7 @@ search_command (string, bound, noerror, count, direction, RE, posix) /* Return 1 if REGEXP it matches just one constant string. */ static int -trivial_regexp_p (regexp) - Lisp_Object regexp; +trivial_regexp_p (Lisp_Object regexp) { int len = SBYTES (regexp); unsigned char *s = SDATA (regexp); @@ -1153,18 +1110,9 @@ while (0) static struct re_registers search_regs_1; static EMACS_INT -search_buffer (string, pos, pos_byte, lim, lim_byte, n, - RE, trt, inverse_trt, posix) - Lisp_Object string; - EMACS_INT pos; - EMACS_INT pos_byte; - EMACS_INT lim; - EMACS_INT lim_byte; - int n; - int RE; - Lisp_Object trt; - Lisp_Object inverse_trt; - int posix; +search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, + EMACS_INT lim, EMACS_INT lim_byte, int n, + int RE, Lisp_Object trt, Lisp_Object inverse_trt, int posix) { int len = SCHARS (string); int len_byte = SBYTES (string); @@ -1443,7 +1391,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, } /* Store this character into the translated pattern. */ - bcopy (str, pat, charlen); + memcpy (pat, str, charlen); pat += charlen; base_pat += in_charlen; len_byte -= in_charlen; @@ -1504,13 +1452,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, boyer_moore cannot work. */ static EMACS_INT -simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte) - int n; - unsigned char *pat; - int len, len_byte; - Lisp_Object trt; - EMACS_INT pos, pos_byte; - EMACS_INT lim, lim_byte; +simple_search (int n, unsigned char *pat, int len, int len_byte, Lisp_Object trt, EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT lim, EMACS_INT lim_byte) { int multibyte = ! NILP (current_buffer->enable_multibyte_characters); int forward = n > 0; @@ -1717,16 +1659,10 @@ simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte) If that criterion is not satisfied, do not call this function. */ static EMACS_INT -boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt, - pos, pos_byte, lim, lim_byte, char_base) - int n; - unsigned char *base_pat; - int len, len_byte; - Lisp_Object trt; - Lisp_Object inverse_trt; - EMACS_INT pos, pos_byte; - EMACS_INT lim, lim_byte; - int char_base; +boyer_moore (int n, unsigned char *base_pat, int len, int len_byte, + Lisp_Object trt, Lisp_Object inverse_trt, + EMACS_INT pos, EMACS_INT pos_byte, + EMACS_INT lim, EMACS_INT lim_byte, int char_base) { int direction = ((n > 0) ? 1 : -1); register int dirlen; @@ -2127,8 +2063,7 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt, Also clear out the match data for registers 1 and up. */ static void -set_search_regs (beg_byte, nbytes) - EMACS_INT beg_byte, nbytes; +set_search_regs (EMACS_INT beg_byte, EMACS_INT nbytes) { int i; @@ -2162,9 +2097,7 @@ set_search_regs (beg_byte, nbytes) need not match a word boundary unless it ends in whitespace. */ static Lisp_Object -wordify (string, lax) - Lisp_Object string; - int lax; +wordify (Lisp_Object string, int lax) { register unsigned char *p, *o; register int i, i_byte, len, punct_count = 0, word_count = 0; @@ -2226,8 +2159,7 @@ wordify (string, lax) if (SYNTAX (c) == Sword) { - bcopy (SDATA (string) + i_byte_orig, o, - i_byte - i_byte_orig); + memcpy (o, SDATA (string) + i_byte_orig, i_byte - i_byte_orig); o += i_byte - i_byte_orig; } else if (i > 0 && SYNTAX (prev_c) == Sword && --word_count) @@ -2265,8 +2197,7 @@ Search case-sensitivity is determined by the value of the variable `case-fold-search', which see. See also the functions `match-beginning', `match-end' and `replace-match'. */) - (string, bound, noerror, count) - Lisp_Object string, bound, noerror, count; + (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) { return search_command (string, bound, noerror, count, -1, 0, 0); } @@ -2285,8 +2216,7 @@ Search case-sensitivity is determined by the value of the variable `case-fold-search', which see. See also the functions `match-beginning', `match-end' and `replace-match'. */) - (string, bound, noerror, count) - Lisp_Object string, bound, noerror, count; + (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) { return search_command (string, bound, noerror, count, 1, 0, 0); } @@ -2300,8 +2230,7 @@ The match found must not extend before that position. Optional third argument, if t, means if fail just return nil (no error). If not nil and not t, move to limit of search and return nil. Optional fourth argument is repeat count--search for successive occurrences. */) - (string, bound, noerror, count) - Lisp_Object string, bound, noerror, count; + (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) { return search_command (wordify (string, 0), bound, noerror, count, -1, 1, 0); } @@ -2315,8 +2244,7 @@ The match found must not extend after that position. Optional third argument, if t, means if fail just return nil (no error). If not nil and not t, move to limit of search and return nil. Optional fourth argument is repeat count--search for successive occurrences. */) - (string, bound, noerror, count) - Lisp_Object string, bound, noerror, count; + (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) { return search_command (wordify (string, 0), bound, noerror, count, 1, 1, 0); } @@ -2334,8 +2262,7 @@ The match found must not extend before that position. Optional third argument, if t, means if fail just return nil (no error). If not nil and not t, move to limit of search and return nil. Optional fourth argument is repeat count--search for successive occurrences. */) - (string, bound, noerror, count) - Lisp_Object string, bound, noerror, count; + (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) { return search_command (wordify (string, 1), bound, noerror, count, -1, 1, 0); } @@ -2353,8 +2280,7 @@ The match found must not extend after that position. Optional third argument, if t, means if fail just return nil (no error). If not nil and not t, move to limit of search and return nil. Optional fourth argument is repeat count--search for successive occurrences. */) - (string, bound, noerror, count) - Lisp_Object string, bound, noerror, count; + (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) { return search_command (wordify (string, 1), bound, noerror, count, 1, 1, 0); } @@ -2372,8 +2298,7 @@ Optional third argument, if t, means if fail just return nil (no error). Optional fourth argument is repeat count--search for successive occurrences. See also the functions `match-beginning', `match-end', `match-string', and `replace-match'. */) - (regexp, bound, noerror, count) - Lisp_Object regexp, bound, noerror, count; + (Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) { return search_command (regexp, bound, noerror, count, -1, 1, 0); } @@ -2389,8 +2314,7 @@ Optional third argument, if t, means if fail just return nil (no error). Optional fourth argument is repeat count--search for successive occurrences. See also the functions `match-beginning', `match-end', `match-string', and `replace-match'. */) - (regexp, bound, noerror, count) - Lisp_Object regexp, bound, noerror, count; + (Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) { return search_command (regexp, bound, noerror, count, 1, 1, 0); } @@ -2409,8 +2333,7 @@ Optional third argument, if t, means if fail just return nil (no error). Optional fourth argument is repeat count--search for successive occurrences. See also the functions `match-beginning', `match-end', `match-string', and `replace-match'. */) - (regexp, bound, noerror, count) - Lisp_Object regexp, bound, noerror, count; + (Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) { return search_command (regexp, bound, noerror, count, -1, 1, 1); } @@ -2427,8 +2350,7 @@ Optional third argument, if t, means if fail just return nil (no error). Optional fourth argument is repeat count--search for successive occurrences. See also the functions `match-beginning', `match-end', `match-string', and `replace-match'. */) - (regexp, bound, noerror, count) - Lisp_Object regexp, bound, noerror, count; + (Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) { return search_command (regexp, bound, noerror, count, 1, 1, 1); } @@ -2469,8 +2391,7 @@ This is, in a vague sense, the inverse of using `\\N' in NEWTEXT; NEWTEXT in place of subexp N. This is useful only after a regular expression search or match, since only regular expressions have distinguished subexpressions. */) - (newtext, fixedcase, literal, string, subexp) - Lisp_Object newtext, fixedcase, literal, string, subexp; + (Lisp_Object newtext, Lisp_Object fixedcase, Lisp_Object literal, Lisp_Object string, Lisp_Object subexp) { enum { nochange, all_caps, cap_initial } case_action; register int pos, pos_byte; @@ -2822,7 +2743,7 @@ since only regular expressions have distinguished subexpressions. */) /* Now add to the end of SUBSTED. */ if (add_stuff) { - bcopy (add_stuff, substed + substed_len, add_len); + memcpy (substed + substed_len, add_stuff, add_len); substed_len += add_len; } } @@ -2886,9 +2807,7 @@ since only regular expressions have distinguished subexpressions. */) } static Lisp_Object -match_limit (num, beginningp) - Lisp_Object num; - int beginningp; +match_limit (Lisp_Object num, int beginningp) { register int n; @@ -2912,8 +2831,7 @@ SUBEXP, a number, specifies which parenthesized expression in the last Value is nil if SUBEXPth pair didn't match, or there were less than SUBEXP pairs. Zero means the entire text matched by the whole regexp or whole string. */) - (subexp) - Lisp_Object subexp; + (Lisp_Object subexp) { return match_limit (subexp, 1); } @@ -2925,8 +2843,7 @@ SUBEXP, a number, specifies which parenthesized expression in the last Value is nil if SUBEXPth pair didn't match, or there were less than SUBEXP pairs. Zero means the entire text matched by the whole regexp or whole string. */) - (subexp) - Lisp_Object subexp; + (Lisp_Object subexp) { return match_limit (subexp, 0); } @@ -2951,8 +2868,7 @@ If optional third arg RESEAT is non-nil, any previous markers on the REUSE list will be modified to point to nowhere. Return value is undefined if the last search failed. */) - (integers, reuse, reseat) - Lisp_Object integers, reuse, reseat; + (Lisp_Object integers, Lisp_Object reuse, Lisp_Object reseat) { Lisp_Object tail, prev; Lisp_Object *data; @@ -3052,8 +2968,7 @@ DEFUN ("set-match-data", Fset_match_data, Sset_match_data, 1, 2, 0, LIST should have been created by calling `match-data' previously. If optional arg RESEAT is non-nil, make markers on LIST point nowhere. */) - (list, reseat) - register Lisp_Object list, reseat; + (register Lisp_Object list, Lisp_Object reseat) { register int i; register Lisp_Object marker; @@ -3171,7 +3086,7 @@ static Lisp_Object saved_last_thing_searched; /* Called from Flooking_at, Fstring_match, search_buffer, Fstore_match_data if asynchronous code (filter or sentinel) is running. */ static void -save_search_regs () +save_search_regs (void) { if (!search_regs_saved) { @@ -3190,7 +3105,7 @@ save_search_regs () /* Called upon exit from filters and sentinels. */ void -restore_search_regs () +restore_search_regs (void) { if (search_regs_saved) { @@ -3209,8 +3124,7 @@ restore_search_regs () } static Lisp_Object -unwind_set_match_data (list) - Lisp_Object list; +unwind_set_match_data (Lisp_Object list) { /* It is NOT ALWAYS safe to free (evaporate) the markers immediately. */ return Fset_match_data (list, Qt); @@ -3218,7 +3132,7 @@ unwind_set_match_data (list) /* Called to unwind protect the match data. */ void -record_unwind_save_match_data () +record_unwind_save_match_data (void) { record_unwind_protect (unwind_set_match_data, Fmatch_data (Qnil, Qnil, Qnil)); @@ -3228,8 +3142,7 @@ record_unwind_save_match_data () DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0, doc: /* Return a regexp string which matches exactly STRING and nothing else. */) - (string) - Lisp_Object string; + (Lisp_Object string) { register unsigned char *in, *out, *end; register unsigned char *temp; @@ -3262,7 +3175,7 @@ DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0, } void -syms_of_search () +syms_of_search (void) { register int i; diff --git a/src/sound.c b/src/sound.c index af6daf2e268..e0ebd565151 100644 --- a/src/sound.c +++ b/src/sound.c @@ -115,10 +115,10 @@ enum sound_attr SOUND_ATTR_SENTINEL }; -static void alsa_sound_perror P_ ((char *, int)) NO_RETURN; -static void sound_perror P_ ((char *)) NO_RETURN; -static void sound_warning P_ ((char *)); -static int parse_sound P_ ((Lisp_Object, Lisp_Object *)); +static void alsa_sound_perror (char *, int) NO_RETURN; +static void sound_perror (char *) NO_RETURN; +static void sound_warning (char *); +static int parse_sound (Lisp_Object, Lisp_Object *); /* END: Common Definitions */ @@ -225,25 +225,25 @@ struct sound_device int channels; /* Open device SD. */ - void (* open) P_ ((struct sound_device *sd)); + void (* open) (struct sound_device *sd); /* Close device SD. */ - void (* close) P_ ((struct sound_device *sd)); + void (* close) (struct sound_device *sd); /* Configure SD accoring to device-dependent parameters. */ - void (* configure) P_ ((struct sound_device *device)); + void (* configure) (struct sound_device *device); /* Choose a device-dependent format for outputting sound S. */ - void (* choose_format) P_ ((struct sound_device *sd, - struct sound *s)); + void (* choose_format) (struct sound_device *sd, + struct sound *s); /* Return a preferred data size in bytes to be sent to write (below) each time. 2048 is used if this is NULL. */ - int (* period_size) P_ ((struct sound_device *sd)); + int (* period_size) (struct sound_device *sd); /* Write NYBTES bytes from BUFFER to device SD. */ - void (* write) P_ ((struct sound_device *sd, const char *buffer, - int nbytes)); + void (* write) (struct sound_device *sd, const char *buffer, + int nbytes); /* A place for devices to store additional data. */ void *data; @@ -279,7 +279,7 @@ struct sound Lisp_Object data; /* Play sound file S on device SD. */ - void (* play) P_ ((struct sound *s, struct sound_device *sd)); + void (* play) (struct sound *s, struct sound_device *sd); }; /* These are set during `play-sound-internal' so that sound_cleanup has @@ -290,30 +290,30 @@ struct sound *current_sound; /* Function prototypes. */ -static void vox_open P_ ((struct sound_device *)); -static void vox_configure P_ ((struct sound_device *)); -static void vox_close P_ ((struct sound_device *sd)); -static void vox_choose_format P_ ((struct sound_device *, struct sound *)); -static int vox_init P_ ((struct sound_device *)); -static void vox_write P_ ((struct sound_device *, const char *, int)); -static void find_sound_type P_ ((struct sound *)); -static u_int32_t le2hl P_ ((u_int32_t)); -static u_int16_t le2hs P_ ((u_int16_t)); -static u_int32_t be2hl P_ ((u_int32_t)); -static int wav_init P_ ((struct sound *)); -static void wav_play P_ ((struct sound *, struct sound_device *)); -static int au_init P_ ((struct sound *)); -static void au_play P_ ((struct sound *, struct sound_device *)); +static void vox_open (struct sound_device *); +static void vox_configure (struct sound_device *); +static void vox_close (struct sound_device *sd); +static void vox_choose_format (struct sound_device *, struct sound *); +static int vox_init (struct sound_device *); +static void vox_write (struct sound_device *, const char *, int); +static void find_sound_type (struct sound *); +static u_int32_t le2hl (u_int32_t); +static u_int16_t le2hs (u_int16_t); +static u_int32_t be2hl (u_int32_t); +static int wav_init (struct sound *); +static void wav_play (struct sound *, struct sound_device *); +static int au_init (struct sound *); +static void au_play (struct sound *, struct sound_device *); #if 0 /* Currently not used. */ -static u_int16_t be2hs P_ ((u_int16_t)); +static u_int16_t be2hs (u_int16_t); #endif /* END: Non Windows Definitions */ #else /* WINDOWSNT */ /* BEGIN: Windows Specific Definitions */ -static int do_play_sound P_ ((const char *, unsigned long)); +static int do_play_sound (const char *, unsigned long); /* END: Windows Specific Definitions */ #endif /* WINDOWSNT */ @@ -328,8 +328,7 @@ static int do_play_sound P_ ((const char *, unsigned long)); /* Like perror, but signals an error. */ static void -sound_perror (msg) - char *msg; +sound_perror (char *msg) { int saved_errno = errno; @@ -347,8 +346,7 @@ sound_perror (msg) /* Display a warning message. */ static void -sound_warning (msg) - char *msg; +sound_warning (char *msg) { message (msg); } @@ -381,9 +379,7 @@ sound_warning (msg) range [0, 1]. */ static int -parse_sound (sound, attrs) - Lisp_Object sound; - Lisp_Object *attrs; +parse_sound (Lisp_Object sound, Lisp_Object *attrs) { /* SOUND must be a list starting with the symbol `sound'. */ if (!CONSP (sound) || !EQ (XCAR (sound), Qsound)) @@ -452,8 +448,7 @@ parse_sound (sound, attrs) S is the sound file structure to fill in. */ static void -find_sound_type (s) - struct sound *s; +find_sound_type (struct sound *s) { if (!wav_init (s) && !au_init (s)) error ("Unknown sound format"); @@ -463,8 +458,7 @@ find_sound_type (s) /* Function installed by play-sound-internal with record_unwind_protect. */ static Lisp_Object -sound_cleanup (arg) - Lisp_Object arg; +sound_cleanup (Lisp_Object arg) { if (current_sound_device->close) current_sound_device->close (current_sound_device); @@ -484,8 +478,7 @@ sound_cleanup (arg) to host byte-order. */ static u_int32_t -le2hl (value) - u_int32_t value; +le2hl (u_int32_t value) { #ifdef WORDS_BIG_ENDIAN unsigned char *p = (unsigned char *) &value; @@ -499,8 +492,7 @@ le2hl (value) to host byte-order. */ static u_int16_t -le2hs (value) - u_int16_t value; +le2hs (u_int16_t value) { #ifdef WORDS_BIG_ENDIAN unsigned char *p = (unsigned char *) &value; @@ -514,8 +506,7 @@ le2hs (value) to host byte-order. */ static u_int32_t -be2hl (value) - u_int32_t value; +be2hl (u_int32_t value) { #ifndef WORDS_BIG_ENDIAN unsigned char *p = (unsigned char *) &value; @@ -531,8 +522,7 @@ be2hl (value) to host byte-order. */ static u_int16_t -be2hs (value) - u_int16_t value; +be2hs (u_int16_t value) { #ifndef WORDS_BIG_ENDIAN unsigned char *p = (unsigned char *) &value; @@ -554,13 +544,12 @@ be2hs (value) Value is non-zero if the file is a WAV file. */ static int -wav_init (s) - struct sound *s; +wav_init (struct sound *s) { struct wav_header *header = (struct wav_header *) s->header; if (s->header_size < sizeof *header - || bcmp (s->header, "RIFF", 4) != 0) + || memcmp (s->header, "RIFF", 4) != 0) return 0; /* WAV files are in little-endian order. Convert the header @@ -590,9 +579,7 @@ wav_init (s) /* Play RIFF-WAVE audio file S on sound device SD. */ static void -wav_play (s, sd) - struct sound *s; - struct sound_device *sd; +wav_play (struct sound *s, struct sound_device *sd) { struct wav_header *header = (struct wav_header *) s->header; @@ -665,13 +652,12 @@ enum au_encoding Value is non-zero if the file is an AU file. */ static int -au_init (s) - struct sound *s; +au_init (struct sound *s) { struct au_header *header = (struct au_header *) s->header; if (s->header_size < sizeof *header - || bcmp (s->header, ".snd", 4) != 0) + || memcmp (s->header, ".snd", 4) != 0) return 0; header->magic_number = be2hl (header->magic_number); @@ -692,9 +678,7 @@ au_init (s) /* Play Sun audio file S on sound device SD. */ static void -au_play (s, sd) - struct sound *s; - struct sound_device *sd; +au_play (struct sound *s, struct sound_device *sd) { struct au_header *header = (struct au_header *) s->header; @@ -740,8 +724,7 @@ au_play (s, sd) otherwise use a default device name. */ static void -vox_open (sd) - struct sound_device *sd; +vox_open (struct sound_device *sd) { char *file; @@ -760,8 +743,7 @@ vox_open (sd) /* Configure device SD from parameters in it. */ static void -vox_configure (sd) - struct sound_device *sd; +vox_configure (struct sound_device *sd) { int val; @@ -814,8 +796,7 @@ vox_configure (sd) /* Close device SD if it is open. */ static void -vox_close (sd) - struct sound_device *sd; +vox_close (struct sound_device *sd) { if (sd->fd >= 0) { @@ -845,9 +826,7 @@ vox_close (sd) /* Choose device-dependent format for device SD from sound file S. */ static void -vox_choose_format (sd, s) - struct sound_device *sd; - struct sound *s; +vox_choose_format (struct sound_device *sd, struct sound *s) { if (s->type == RIFF) { @@ -890,8 +869,7 @@ vox_choose_format (sd, s) structure. */ static int -vox_init (sd) - struct sound_device *sd; +vox_init (struct sound_device *sd) { char *file; int fd; @@ -921,10 +899,7 @@ vox_init (sd) /* Write NBYTES bytes from BUFFER to device SD. */ static void -vox_write (sd, buffer, nbytes) - struct sound_device *sd; - const char *buffer; - int nbytes; +vox_write (struct sound_device *sd, const char *buffer, int nbytes) { int nwritten = emacs_write (sd->fd, buffer, nbytes); if (nwritten < 0) @@ -939,9 +914,7 @@ vox_write (sd, buffer, nbytes) /* This driver is available on GNU/Linux. */ static void -alsa_sound_perror (msg, err) - char *msg; - int err; +alsa_sound_perror (char *msg, int err) { error ("%s: %s", msg, snd_strerror (err)); } @@ -958,8 +931,7 @@ struct alsa_params otherwise use a default device name. */ static void -alsa_open (sd) - struct sound_device *sd; +alsa_open (struct sound_device *sd) { char *file; struct alsa_params *p; @@ -986,8 +958,7 @@ alsa_open (sd) } static int -alsa_period_size (sd) - struct sound_device *sd; +alsa_period_size (struct sound_device *sd) { struct alsa_params *p = (struct alsa_params *) sd->data; int fact = snd_pcm_format_size (sd->format, 1) * sd->channels; @@ -995,8 +966,7 @@ alsa_period_size (sd) } static void -alsa_configure (sd) - struct sound_device *sd; +alsa_configure (struct sound_device *sd) { int val, err, dir; unsigned uval; @@ -1115,8 +1085,7 @@ alsa_configure (sd) /* Close device SD if it is open. */ static void -alsa_close (sd) - struct sound_device *sd; +alsa_close (struct sound_device *sd) { struct alsa_params *p = (struct alsa_params *) sd->data; if (p) @@ -1137,9 +1106,7 @@ alsa_close (sd) /* Choose device-dependent format for device SD from sound file S. */ static void -alsa_choose_format (sd, s) - struct sound_device *sd; - struct sound *s; +alsa_choose_format (struct sound_device *sd, struct sound *s) { struct alsa_params *p = (struct alsa_params *) sd->data; if (s->type == RIFF) @@ -1194,10 +1161,7 @@ alsa_choose_format (sd, s) /* Write NBYTES bytes from BUFFER to device SD. */ static void -alsa_write (sd, buffer, nbytes) - struct sound_device *sd; - const char *buffer; - int nbytes; +alsa_write (struct sound_device *sd, const char *buffer, int nbytes) { struct alsa_params *p = (struct alsa_params *) sd->data; @@ -1244,12 +1208,8 @@ alsa_write (sd, buffer, nbytes) } static void -snd_error_quiet (file, line, function, err, fmt) - const char *file; - int line; - const char *function; - int err; - const char *fmt; +snd_error_quiet (const char *file, int line, const char *function, int err, + const char *fmt) { } @@ -1257,8 +1217,7 @@ snd_error_quiet (file, line, function, err, fmt) structure. */ static int -alsa_init (sd) - struct sound_device *sd; +alsa_init (struct sound_device *sd) { char *file; snd_pcm_t *handle; @@ -1307,9 +1266,7 @@ alsa_init (sd) } static int -do_play_sound (psz_file, ui_volume) - const char *psz_file; - unsigned long ui_volume; +do_play_sound (const char *psz_file, unsigned long ui_volume) { int i_result = 0; MCIERROR mci_error = 0; @@ -1394,8 +1351,7 @@ DEFUN ("play-sound-internal", Fplay_sound_internal, Splay_sound_internal, 1, 1, doc: /* Play sound SOUND. Internal use only, use `play-sound' instead. */) - (sound) - Lisp_Object sound; + (Lisp_Object sound) { Lisp_Object attrs[SOUND_ATTR_SENTINEL]; int count = SPECPDL_INDEX (); @@ -1421,9 +1377,9 @@ Internal use only, use `play-sound' instead. */) file = Qnil; GCPRO2 (sound, file); current_sound_device = (struct sound_device *) xmalloc (sizeof (struct sound_device)); - bzero (current_sound_device, sizeof (struct sound_device)); + memset (current_sound_device, 0, sizeof (struct sound_device)); current_sound = (struct sound *) xmalloc (sizeof (struct sound)); - bzero (current_sound, sizeof (struct sound)); + memset (current_sound, 0, sizeof (struct sound)); record_unwind_protect (sound_cleanup, Qnil); current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES); @@ -1446,7 +1402,8 @@ Internal use only, use `play-sound' instead. */) { current_sound->data = attrs[SOUND_DATA]; current_sound->header_size = min (MAX_SOUND_HEADER_BYTES, SBYTES (current_sound->data)); - bcopy (SDATA (current_sound->data), current_sound->header, current_sound->header_size); + memcpy (current_sound->header, SDATA (current_sound->data), + current_sound->header_size); } /* Find out the type of sound. Give up if we can't tell. */ @@ -1524,7 +1481,7 @@ Internal use only, use `play-sound' instead. */) ***********************************************************************/ void -syms_of_sound () +syms_of_sound (void) { QCdevice = intern_c_string(":device"); staticpro (&QCdevice); @@ -1540,7 +1497,7 @@ syms_of_sound () void -init_sound () +init_sound (void) { } diff --git a/src/strftime.c b/src/strftime.c index 7a9506e55d3..a7617427793 100644 --- a/src/strftime.c +++ b/src/strftime.c @@ -131,14 +131,6 @@ extern char *tzname[]; # endif #endif -#ifndef __P -# if defined __GNUC__ || (defined __STDC__ && __STDC__) || defined (PROTOTYPES) -# define __P(args) args -# else -# define __P(args) () -# endif /* GCC. */ -#endif /* Not __P. */ - #ifndef PTR # ifdef __STDC__ # define PTR void * @@ -187,7 +179,7 @@ extern char *tzname[]; Similarly for localtime_r. */ # if ! HAVE_TM_GMTOFF -static struct tm *my_strftime_gmtime_r __P ((const time_t *, struct tm *)); +static struct tm *my_strftime_gmtime_r (const time_t *, struct tm *); static struct tm * my_strftime_gmtime_r (t, tp) const time_t *t; @@ -200,7 +192,7 @@ my_strftime_gmtime_r (t, tp) return tp; } -static struct tm *my_strftime_localtime_r __P ((const time_t *, struct tm *)); +static struct tm *my_strftime_localtime_r (const time_t *, struct tm *); static struct tm * my_strftime_localtime_r (t, tp) const time_t *t; @@ -371,8 +363,8 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */ more reliable way to accept other sets of digits. */ #define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9) -static CHAR_T *memcpy_lowcase __P ((CHAR_T *dest, const CHAR_T *src, - size_t len LOCALE_PARAM_PROTO)); +static CHAR_T *memcpy_lowcase (CHAR_T *dest, const CHAR_T *src, + size_t len LOCALE_PARAM_PROTO); static CHAR_T * memcpy_lowcase (dest, src, len LOCALE_PARAM) @@ -386,8 +378,8 @@ memcpy_lowcase (dest, src, len LOCALE_PARAM) return dest; } -static CHAR_T *memcpy_uppcase __P ((CHAR_T *dest, const CHAR_T *src, - size_t len LOCALE_PARAM_PROTO)); +static CHAR_T *memcpy_uppcase (CHAR_T *dest, const CHAR_T *src, + size_t len LOCALE_PARAM_PROTO); static CHAR_T * memcpy_uppcase (dest, src, len LOCALE_PARAM) @@ -406,7 +398,7 @@ memcpy_uppcase (dest, src, len LOCALE_PARAM) /* Yield the difference between *A and *B, measured in seconds, ignoring leap seconds. */ # define tm_diff ftime_tm_diff -static int tm_diff __P ((const struct tm *, const struct tm *)); +static int tm_diff (const struct tm *, const struct tm *); static int tm_diff (a, b) const struct tm *a; @@ -440,7 +432,7 @@ tm_diff (a, b) #define ISO_WEEK_START_WDAY 1 /* Monday */ #define ISO_WEEK1_WDAY 4 /* Thursday */ #define YDAY_MINIMUM (-366) -static int iso_week_days __P ((int, int)); +static int iso_week_days (int, int); #ifdef __GNUC__ __inline__ #endif @@ -499,8 +491,8 @@ static CHAR_T const month_name[][10] = #if !defined _LIBC && !defined(WINDOWSNT) && HAVE_TZNAME && HAVE_TZSET /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime. Work around this bug by copying *tp before it might be munged. */ - size_t _strftime_copytm __P ((char *, size_t, const char *, - const struct tm * extra_args_spec_iso)); + size_t _strftime_copytm (char *, size_t, const char *, + const struct tm * extra_args_spec_iso); size_t my_strftime (s, maxsize, format, tp extra_args) CHAR_T *s; diff --git a/src/syntax.c b/src/syntax.c index 4741fa260d2..9b707c6c3b7 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -98,18 +98,18 @@ static EMACS_INT find_start_begv; static int find_start_modiff; -static Lisp_Object skip_chars P_ ((int, Lisp_Object, Lisp_Object, int)); -static Lisp_Object skip_syntaxes P_ ((int, Lisp_Object, Lisp_Object)); -static Lisp_Object scan_lists P_ ((EMACS_INT, EMACS_INT, EMACS_INT, int)); -static void scan_sexps_forward P_ ((struct lisp_parse_state *, - EMACS_INT, EMACS_INT, EMACS_INT, int, - int, Lisp_Object, int)); -static int in_classes P_ ((int, Lisp_Object)); +static Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int); +static Lisp_Object skip_syntaxes (int, Lisp_Object, Lisp_Object); +static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, int); +static void scan_sexps_forward (struct lisp_parse_state *, + EMACS_INT, EMACS_INT, EMACS_INT, int, + int, Lisp_Object, int); +static int in_classes (int, Lisp_Object); struct gl_state_s gl_state; /* Global state of syntax parser. */ -INTERVAL interval_of (); +INTERVAL interval_of (int, Lisp_Object); #define INTERVALS_AT_ONCE 10 /* 1 + max-number of intervals to scan to property-change. */ @@ -127,9 +127,7 @@ INTERVAL interval_of (); start/end of OBJECT. */ void -update_syntax_table (charpos, count, init, object) - int charpos, count, init; - Lisp_Object object; +update_syntax_table (int charpos, int count, int init, Lisp_Object object) { Lisp_Object tmp_table; int cnt = 0, invalidate = 1; @@ -318,8 +316,7 @@ char_quoted (EMACS_INT charpos, EMACS_INT bytepos) We assume that BYTEPOS is not at the end of the buffer. */ INLINE EMACS_INT -inc_bytepos (bytepos) - EMACS_INT bytepos; +inc_bytepos (EMACS_INT bytepos) { if (NILP (current_buffer->enable_multibyte_characters)) return bytepos + 1; @@ -332,8 +329,7 @@ inc_bytepos (bytepos) We assume that BYTEPOS is not at the start of the buffer. */ INLINE EMACS_INT -dec_bytepos (bytepos) - EMACS_INT bytepos; +dec_bytepos (EMACS_INT bytepos) { if (NILP (current_buffer->enable_multibyte_characters)) return bytepos - 1; @@ -357,8 +353,7 @@ dec_bytepos (bytepos) update the global data. */ static EMACS_INT -find_defun_start (pos, pos_byte) - EMACS_INT pos, pos_byte; +find_defun_start (EMACS_INT pos, EMACS_INT pos_byte) { EMACS_INT opoint = PT, opoint_byte = PT_BYTE; @@ -422,8 +417,7 @@ find_defun_start (pos, pos_byte) /* Return the SYNTAX_COMEND_FIRST of the character before POS, POS_BYTE. */ static int -prev_char_comend_first (pos, pos_byte) - int pos, pos_byte; +prev_char_comend_first (int pos, int pos_byte) { int c, val; @@ -465,10 +459,7 @@ prev_char_comend_first (pos, pos_byte) the returned value (or at FROM, if the search was not successful). */ static int -back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_ptr) - EMACS_INT from, from_byte, stop; - int comnested, comstyle; - EMACS_INT *charpos_ptr, *bytepos_ptr; +back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested, int comstyle, EMACS_INT *charpos_ptr, EMACS_INT *bytepos_ptr) { /* Look back, counting the parity of string-quotes, and recording the comment-starters seen. @@ -730,8 +721,7 @@ back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_p DEFUN ("syntax-table-p", Fsyntax_table_p, Ssyntax_table_p, 1, 1, 0, doc: /* Return t if OBJECT is a syntax table. Currently, any char-table counts as a syntax table. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (CHAR_TABLE_P (object) && EQ (XCHAR_TABLE (object)->purpose, Qsyntax_table)) @@ -740,8 +730,7 @@ Currently, any char-table counts as a syntax table. */) } static void -check_syntax_table (obj) - Lisp_Object obj; +check_syntax_table (Lisp_Object obj) { CHECK_TYPE (CHAR_TABLE_P (obj) && EQ (XCHAR_TABLE (obj)->purpose, Qsyntax_table), Qsyntax_table_p, obj); @@ -750,7 +739,7 @@ check_syntax_table (obj) DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0, doc: /* Return the current syntax table. This is the one specified by the current buffer. */) - () + (void) { return current_buffer->syntax_table; } @@ -759,7 +748,7 @@ DEFUN ("standard-syntax-table", Fstandard_syntax_table, Sstandard_syntax_table, 0, 0, 0, doc: /* Return the standard syntax table. This is the one used for new buffers. */) - () + (void) { return Vstandard_syntax_table; } @@ -767,8 +756,7 @@ This is the one used for new buffers. */) DEFUN ("copy-syntax-table", Fcopy_syntax_table, Scopy_syntax_table, 0, 1, 0, doc: /* Construct a new syntax table and return it. It is a copy of the TABLE, which defaults to the standard syntax table. */) - (table) - Lisp_Object table; + (Lisp_Object table) { Lisp_Object copy; @@ -794,8 +782,7 @@ It is a copy of the TABLE, which defaults to the standard syntax table. */) DEFUN ("set-syntax-table", Fset_syntax_table, Sset_syntax_table, 1, 1, 0, doc: /* Select a new syntax table for the current buffer. One argument, a syntax table. */) - (table) - Lisp_Object table; + (Lisp_Object table) { int idx; check_syntax_table (table); @@ -854,8 +841,7 @@ For example, if CHARACTER is a word constituent, the character `w' (119) is returned. The characters that correspond to various syntax codes are listed in the documentation of `modify-syntax-entry'. */) - (character) - Lisp_Object character; + (Lisp_Object character) { int char_int; CHECK_CHARACTER (character); @@ -866,8 +852,7 @@ are listed in the documentation of `modify-syntax-entry'. */) DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0, doc: /* Return the matching parenthesis of CHARACTER, or nil if none. */) - (character) - Lisp_Object character; + (Lisp_Object character) { int char_int, code; CHECK_NUMBER (character); @@ -885,8 +870,7 @@ STRING should be a string as it is allowed as argument of `modify-syntax-entry'. Value is the equivalent cons cell \(CODE . MATCHING-CHAR) that can be used as value of a `syntax-table' text property. */) - (string) - Lisp_Object string; + (Lisp_Object string) { register const unsigned char *p; register enum syntaxcode code; @@ -997,8 +981,7 @@ this flag: such characters are treated as whitespace when they occur between expressions. usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) */) - (c, newentry, syntax_table) - Lisp_Object c, newentry, syntax_table; + (Lisp_Object c, Lisp_Object newentry, Lisp_Object syntax_table) { if (CONSP (c)) { @@ -1031,8 +1014,7 @@ usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) */) DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value, Sinternal_describe_syntax_value, 1, 1, 0, doc: /* Insert a description of the internal syntax description SYNTAX at point. */) - (syntax) - Lisp_Object syntax; + (Lisp_Object syntax) { register enum syntaxcode code; char desc, start1, start2, end1, end2, prefix, comstyle, comnested; @@ -1185,8 +1167,7 @@ Lisp_Object Vfind_word_boundary_function_table; COUNT negative means scan backward and stop at word beginning. */ int -scan_words (from, count) - register int from, count; +scan_words (register int from, register int count) { register int beg = BEGV; register int end = ZV; @@ -1318,8 +1299,7 @@ Normally returns t. If an edge of the buffer or a field boundary is reached, point is left there and the function returns nil. Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */) - (arg) - Lisp_Object arg; + (Lisp_Object arg) { Lisp_Object tmp; int orig_val, val; @@ -1342,7 +1322,7 @@ and the function returns nil. Field boundaries are not noticed if return val == orig_val ? Qt : Qnil; } -Lisp_Object skip_chars (); +Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int); DEFUN ("skip-chars-forward", Fskip_chars_forward, Sskip_chars_forward, 1, 2, 0, doc: /* Move point forward, stopping before a char not in STRING, or at pos LIM. @@ -1354,8 +1334,7 @@ With arg "^a-zA-Z", skips nonletters stopping before first letter. Char classes, e.g. `[:alpha:]', are supported. Returns the distance traveled, either zero or positive. */) - (string, lim) - Lisp_Object string, lim; + (Lisp_Object string, Lisp_Object lim) { return skip_chars (1, string, lim, 1); } @@ -1364,8 +1343,7 @@ DEFUN ("skip-chars-backward", Fskip_chars_backward, Sskip_chars_backward, 1, 2, doc: /* Move point backward, stopping after a char not in STRING, or at pos LIM. See `skip-chars-forward' for details. Returns the distance traveled, either zero or negative. */) - (string, lim) - Lisp_Object string, lim; + (Lisp_Object string, Lisp_Object lim) { return skip_chars (0, string, lim, 1); } @@ -1376,8 +1354,7 @@ SYNTAX is a string of syntax code characters. Stop before a char whose syntax is not in SYNTAX, or at position LIM. If SYNTAX starts with ^, skip characters whose syntax is NOT in SYNTAX. This function returns the distance traveled, either zero or positive. */) - (syntax, lim) - Lisp_Object syntax, lim; + (Lisp_Object syntax, Lisp_Object lim) { return skip_syntaxes (1, syntax, lim); } @@ -1388,17 +1365,13 @@ SYNTAX is a string of syntax code characters. Stop on reaching a char whose syntax is not in SYNTAX, or at position LIM. If SYNTAX starts with ^, skip characters whose syntax is NOT in SYNTAX. This function returns the distance traveled, either zero or negative. */) - (syntax, lim) - Lisp_Object syntax, lim; + (Lisp_Object syntax, Lisp_Object lim) { return skip_syntaxes (0, syntax, lim); } static Lisp_Object -skip_chars (forwardp, string, lim, handle_iso_classes) - int forwardp; - Lisp_Object string, lim; - int handle_iso_classes; +skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_classes) { register unsigned int c; unsigned char fastmap[0400]; @@ -1436,7 +1409,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes) && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); string_multibyte = SBYTES (string) > SCHARS (string); - bzero (fastmap, sizeof fastmap); + memset (fastmap, 0, sizeof fastmap); str = SDATA (string); size_byte = SBYTES (string); @@ -1485,7 +1458,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes) || *class_end != ':' || class_end[1] != ']') goto not_a_class_name; - bcopy (class_beg, class_name, class_end - class_beg); + memcpy (class_name, class_beg, class_end - class_beg); class_name[class_end - class_beg] = 0; cc = re_wctype (class_name); @@ -1546,8 +1519,8 @@ skip_chars (forwardp, string, lim, handle_iso_classes) unsigned char fastmap2[0400]; int range_start_byte, range_start_char; - bcopy (fastmap2 + 0200, fastmap + 0200, 0200); - bzero (fastmap + 0200, 0200); + memcpy (fastmap + 0200, fastmap2 + 0200, 0200); + memset (fastmap + 0200, 0, 0200); /* We are sure that this loop stops. */ for (i = 0200; ! fastmap2[i]; i++); c = BYTE8_TO_CHAR (i); @@ -1607,7 +1580,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes) || *class_end != ':' || class_end[1] != ']') goto not_a_class_name_multibyte; - bcopy (class_beg, class_name, class_end - class_beg); + memcpy (class_name, class_beg, class_end - class_beg); class_name[class_end - class_beg] = 0; cc = re_wctype (class_name); @@ -1692,7 +1665,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes) if (! multibyte && n_char_ranges > 0) { - bzero (fastmap + 0200, 0200); + memset (fastmap + 0200, 0, 0200); for (i = 0; i < n_char_ranges; i += 2) { int c1 = char_ranges[i]; @@ -1892,9 +1865,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes) static Lisp_Object -skip_syntaxes (forwardp, string, lim) - int forwardp; - Lisp_Object string, lim; +skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim) { register unsigned int c; unsigned char fastmap[0400]; @@ -1923,7 +1894,7 @@ skip_syntaxes (forwardp, string, lim) multibyte = (!NILP (current_buffer->enable_multibyte_characters) && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); - bzero (fastmap, sizeof fastmap); + memset (fastmap, 0, sizeof fastmap); if (SBYTES (string) > SCHARS (string)) /* As this is very rare case (syntax spec is ASCII only), don't @@ -2067,9 +2038,7 @@ skip_syntaxes (forwardp, string, lim) integer which is its type according to re_wctype. */ static int -in_classes (c, iso_classes) - int c; - Lisp_Object iso_classes; +in_classes (int c, Lisp_Object iso_classes) { int fits_class = 0; @@ -2111,12 +2080,10 @@ in_classes (c, iso_classes) remains valid for forward search starting at the returned position. */ static int -forw_comment (from, from_byte, stop, nesting, style, prev_syntax, - charpos_ptr, bytepos_ptr, incomment_ptr) - EMACS_INT from, from_byte, stop; - int nesting, style, prev_syntax; - EMACS_INT *charpos_ptr, *bytepos_ptr; - int *incomment_ptr; +forw_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, + int nesting, int style, int prev_syntax, + EMACS_INT *charpos_ptr, EMACS_INT *bytepos_ptr, + int *incomment_ptr) { register int c, c1; register enum syntaxcode code; @@ -2213,8 +2180,7 @@ Stop scanning if we find something other than a comment or whitespace. Set point to where scanning stops. If COUNT comments are found as expected, with nothing except whitespace between them, return t; otherwise return nil. */) - (count) - Lisp_Object count; + (Lisp_Object count) { register EMACS_INT from; EMACS_INT from_byte; @@ -2422,10 +2388,7 @@ between them, return t; otherwise return nil. */) ? SYNTAX (c) : Ssymbol) static Lisp_Object -scan_lists (from, count, depth, sexpflag) - register EMACS_INT from; - EMACS_INT count, depth; - int sexpflag; +scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpflag) { Lisp_Object val; register EMACS_INT stop = count > 0 ? ZV : BEGV; @@ -2820,8 +2783,7 @@ Comments are ignored if `parse-sexp-ignore-comments' is non-nil. If the beginning or end of (the accessible part of) the buffer is reached and the depth is wrong, an error is signaled. If the depth is right but the count is not used up, nil is returned. */) - (from, count, depth) - Lisp_Object from, count, depth; + (Lisp_Object from, Lisp_Object count, Lisp_Object depth) { CHECK_NUMBER (from); CHECK_NUMBER (count); @@ -2841,8 +2803,7 @@ If the beginning or end of (the accessible part of) the buffer is reached in the middle of a parenthetical grouping, an error is signaled. If the beginning or end is reached between groupings but before count is used up, nil is returned. */) - (from, count) - Lisp_Object from, count; + (Lisp_Object from, Lisp_Object count) { CHECK_NUMBER (from); CHECK_NUMBER (count); @@ -2854,7 +2815,7 @@ DEFUN ("backward-prefix-chars", Fbackward_prefix_chars, Sbackward_prefix_chars, 0, 0, 0, doc: /* Move point backward over any number of chars with prefix syntax. This includes chars with "quote" or "prefix" syntax (' or p). */) - () + (void) { int beg = BEGV; int opoint = PT; @@ -2900,14 +2861,10 @@ This includes chars with "quote" or "prefix" syntax (' or p). */) after the beginning of a string, or after the end of a string. */ static void -scan_sexps_forward (stateptr, from, from_byte, end, targetdepth, - stopbefore, oldstate, commentstop) - struct lisp_parse_state *stateptr; - register EMACS_INT from; - EMACS_INT from_byte, end; - int targetdepth, stopbefore; - Lisp_Object oldstate; - int commentstop; +scan_sexps_forward (struct lisp_parse_state *stateptr, + EMACS_INT from, EMACS_INT from_byte, EMACS_INT end, + int targetdepth, int stopbefore, + Lisp_Object oldstate, int commentstop) { struct lisp_parse_state state; @@ -3278,8 +3235,7 @@ Fifth arg OLDSTATE is a list like what this function returns. Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. If it is symbol `syntax-table', stop after the start of a comment or a string, or after end of a comment or a string. */) - (from, to, targetdepth, stopbefore, oldstate, commentstop) - Lisp_Object from, to, targetdepth, stopbefore, oldstate, commentstop; + (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth, Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop) { struct lisp_parse_state state; int target; @@ -3324,7 +3280,7 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. } void -init_syntax_once () +init_syntax_once (void) { register int i, c; Lisp_Object temp; @@ -3414,7 +3370,7 @@ init_syntax_once () } void -syms_of_syntax () +syms_of_syntax (void) { Qsyntax_table_p = intern_c_string ("syntax-table-p"); staticpro (&Qsyntax_table_p); diff --git a/src/syntax.h b/src/syntax.h index ec8fab0166c..9eaf553f2e5 100644 --- a/src/syntax.h +++ b/src/syntax.h @@ -19,7 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ extern Lisp_Object Qsyntax_table_p; -extern void update_syntax_table P_ ((int, int, int, Lisp_Object)); +extern void update_syntax_table (int, int, int, Lisp_Object); /* The standard syntax table is stored where it will automatically be used in all new buffers. */ @@ -346,9 +346,9 @@ struct gl_state_s extern struct gl_state_s gl_state; extern int parse_sexp_lookup_properties; -extern INTERVAL interval_of P_ ((int, Lisp_Object)); +extern INTERVAL interval_of (int, Lisp_Object); -extern int scan_words P_ ((int, int)); +extern int scan_words (int, int); /* arch-tag: 28833cca-cd73-4741-8c85-a3111166a0e0 (do not change this comment) */ diff --git a/src/sysdep.c b/src/sysdep.c index e311d181c9c..d720c7c5811 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -18,10 +18,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ -#ifdef HAVE_CONFIG_H #include <config.h> -#endif - #include <ctype.h> #include <signal.h> #include <stdio.h> @@ -79,9 +76,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "dosfns.h" #include "msdos.h" #include <sys/param.h> - -extern int etext; -extern unsigned start __asm__ ("start"); #endif #include <sys/file.h> @@ -169,7 +163,7 @@ static const int baud_convert[] = int emacs_ospeed; -void croak P_ ((char *)) NO_RETURN; +void croak (char *) NO_RETURN; /* Temporary used by `sigblock' when defined in terms of signprocmask. */ @@ -182,7 +176,7 @@ SIGMASKTYPE sigprocmask_set; Any other returned value must be freed with free. This is used only when get_current_dir_name is not defined on the system. */ char* -get_current_dir_name () +get_current_dir_name (void) { char *buf; char *pwd; @@ -254,7 +248,7 @@ get_current_dir_name () /* Discard pending input on all input descriptors. */ void -discard_tty_input () +discard_tty_input (void) { #ifndef WINDOWSNT struct emacs_tty buf; @@ -353,8 +347,7 @@ init_baud_rate (int fd) /*ARGSUSED*/ void -set_exclusive_use (fd) - int fd; +set_exclusive_use (int fd) { #ifdef FIOCLEX ioctl (fd, FIOCLEX, 0); @@ -362,33 +355,23 @@ set_exclusive_use (fd) /* Ok to do nothing if this feature does not exist */ } -#ifndef subprocesses - -wait_without_blocking () -{ - croak ("wait_without_blocking"); - synch_process_alive = 0; -} - -#endif /* not subprocesses */ int wait_debugging; /* Set nonzero to make following function work under dbx (at least for bsd). */ SIGTYPE -wait_for_termination_signal () +wait_for_termination_signal (void) {} +#ifndef MSDOS /* Wait for subprocess with process id `pid' to terminate and make sure it will get eliminated (not remain forever as a zombie) */ void -wait_for_termination (pid) - int pid; +wait_for_termination (int pid) { while (1) { -#ifdef subprocesses #if defined (BSD_SYSTEM) || defined (HPUX) /* Note that kill returns -1 even if the process is just a zombie now. But inevitably a SIGCHLD interrupt should be generated @@ -424,22 +407,16 @@ wait_for_termination (pid) sigsuspend (&empty_mask); #endif /* not WINDOWSNT */ #endif /* not BSD_SYSTEM, and not HPUX version >= 6 */ -#else /* not subprocesses */ - break; -#endif /* not subprocesses */ } } -#ifdef subprocesses - /* * flush any pending output * (may flush input as well; it does not matter the way we use it) */ void -flush_pending_output (channel) - int channel; +flush_pending_output (int channel) { #ifdef HAVE_TERMIOS /* If we try this, we get hit with SIGTTIN, because @@ -465,10 +442,9 @@ flush_pending_output (channel) in Emacs. No padding needed for insertion into an Emacs buffer. */ void -child_setup_tty (out) - int out; +child_setup_tty (int out) { -#ifndef DOS_NT +#ifndef WINDOWSNT struct emacs_tty s; EMACS_GET_TTY (out, &s); @@ -552,25 +528,25 @@ child_setup_tty (out) EMACS_SET_TTY (out, &s, 0); -#endif /* not DOS_NT */ +#endif /* not WINDOWSNT */ } +#endif /* MSDOS */ -#endif /* subprocesses */ /* Record a signal code and the handler for it. */ struct save_signal { int code; - SIGTYPE (*handler) P_ ((int)); + SIGTYPE (*handler) (int); }; -static void save_signal_handlers P_ ((struct save_signal *)); -static void restore_signal_handlers P_ ((struct save_signal *)); +static void save_signal_handlers (struct save_signal *); +static void restore_signal_handlers (struct save_signal *); /* Suspend the Emacs process; give terminal to its superior. */ void -sys_suspend () +sys_suspend (void) { #if defined (SIGTSTP) && !defined (MSDOS) @@ -591,7 +567,7 @@ sys_suspend () /* Fork a subshell. */ void -sys_subshell () +sys_subshell (void) { #ifdef DOS_NT /* Demacs 1.1.2 91/10/20 Manabu Higashida */ int st; @@ -626,7 +602,7 @@ sys_subshell () dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil); str = (unsigned char *) alloca (SCHARS (dir) + 2); len = SCHARS (dir); - bcopy (SDATA (dir), str, len); + memcpy (str, SDATA (dir), len); if (str[len - 1] != '/') str[len++] = '/'; str[len] = 0; xyzzy: @@ -659,9 +635,7 @@ sys_subshell () if (str) chdir ((char *) str); -#ifdef subprocesses close_process_descs (); /* Close Emacs's pipes/ptys */ -#endif #ifdef SET_EMACS_PRIORITY { @@ -719,20 +693,18 @@ sys_subshell () } static void -save_signal_handlers (saved_handlers) - struct save_signal *saved_handlers; +save_signal_handlers (struct save_signal *saved_handlers) { while (saved_handlers->code) { saved_handlers->handler - = (SIGTYPE (*) P_ ((int))) signal (saved_handlers->code, SIG_IGN); + = (SIGTYPE (*) (int)) signal (saved_handlers->code, SIG_IGN); saved_handlers++; } } static void -restore_signal_handlers (saved_handlers) - struct save_signal *saved_handlers; +restore_signal_handlers (struct save_signal *saved_handlers) { while (saved_handlers->code) { @@ -769,8 +741,7 @@ unrequest_sigio (void) int old_fcntl_flags[MAXDESC]; void -init_sigio (fd) - int fd; +init_sigio (int fd) { #ifdef FASYNC old_fcntl_flags[fd] = fcntl (fd, F_GETFL, 0) & ~FASYNC; @@ -780,8 +751,7 @@ init_sigio (fd) } void -reset_sigio (fd) - int fd; +reset_sigio (int fd) { #ifdef FASYNC fcntl (fd, F_SETFL, old_fcntl_flags[fd]); @@ -793,7 +763,7 @@ reset_sigio (fd) /* XXX Yeah, but you need it for SIGIO, don't you? */ void -request_sigio () +request_sigio (void) { if (noninteractive) return; @@ -808,7 +778,7 @@ request_sigio () void unrequest_sigio (void) -{ +{ if (noninteractive) return; @@ -828,7 +798,7 @@ unrequest_sigio (void) #ifndef MSDOS void -request_sigio () +request_sigio (void) { if (noninteractive || read_socket_hook) return; @@ -837,7 +807,7 @@ request_sigio () } void -unrequest_sigio () +unrequest_sigio (void) { if (noninteractive || read_socket_hook) return; @@ -857,14 +827,12 @@ unrequest_sigio () Return zero if all's well, or -1 if we ran into an error we couldn't deal with. */ int -emacs_get_tty (fd, settings) - int fd; - struct emacs_tty *settings; +emacs_get_tty (int fd, struct emacs_tty *settings) { /* Retrieve the primary parameters - baud rate, character size, etcetera. */ #ifdef HAVE_TCATTR /* We have those nifty POSIX tcmumbleattr functions. */ - bzero (&settings->main, sizeof (settings->main)); + memset (&settings->main, 0, sizeof (settings->main)); if (tcgetattr (fd, &settings->main) < 0) return -1; @@ -906,10 +874,7 @@ emacs_get_tty (fd, settings) Return 0 if all went well, and -1 if anything failed. */ int -emacs_set_tty (fd, settings, flushp) - int fd; - struct emacs_tty *settings; - int flushp; +emacs_set_tty (int fd, struct emacs_tty *settings, int flushp) { /* Set the primary parameters - baud rate, character size, etcetera. */ #ifdef HAVE_TCATTR @@ -934,7 +899,7 @@ emacs_set_tty (fd, settings, flushp) { struct termios new; - bzero (&new, sizeof (new)); + memset (&new, 0, sizeof (new)); /* Get the current settings, and see if they're what we asked for. */ tcgetattr (fd, &new); /* We cannot use memcmp on the whole structure here because under @@ -1021,8 +986,7 @@ init_all_sys_modes (void) /* Initialize the terminal mode on the given tty device. */ void -init_sys_modes (tty_out) - struct tty_display_info *tty_out; +init_sys_modes (struct tty_display_info *tty_out) { struct emacs_tty tty; @@ -1033,10 +997,10 @@ init_sys_modes (tty_out) if (!tty_out->output) return; /* The tty is suspended. */ - + if (! tty_out->old_tty) tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); - + EMACS_GET_TTY (fileno (tty_out->input), tty_out->old_tty); tty = *tty_out->old_tty; @@ -1094,7 +1058,7 @@ init_sys_modes (tty_out) means that the interrupt and quit feature must be disabled on secondary ttys, or we would not even see the keypress. - + Note that even though emacsclient could have special code to pass SIGINT to Emacs, we should _not_ enable interrupt/quit keys for emacsclient frames. This means @@ -1112,7 +1076,7 @@ init_sys_modes (tty_out) tty.main.c_cc[VSWTCH] = CDISABLE; /* Turn off shell layering use 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. */ @@ -1203,9 +1167,9 @@ init_sys_modes (tty_out) 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 */ @@ -1365,8 +1329,7 @@ get_tty_size (int fd, int *widthp, int *heightp) to HEIGHT and WIDTH. This is used mainly with ptys. */ int -set_window_size (fd, height, width) - int fd, height, width; +set_window_size (int fd, int height, int width) { #ifdef TIOCSWINSZ @@ -1414,8 +1377,7 @@ reset_all_sys_modes (void) bottom of the frame, turn off interrupt-driven I/O, etc. */ void -reset_sys_modes (tty_out) - struct tty_display_info *tty_out; +reset_sys_modes (struct tty_display_info *tty_out) { if (noninteractive) { @@ -1427,11 +1389,11 @@ reset_sys_modes (tty_out) if (!tty_out->output) return; /* The tty is suspended. */ - + /* Go to and clear the last line of the terminal. */ cmgoto (tty_out, FrameRows (tty_out) - 1, 0); - + /* Code adapted from tty_clear_end_of_line. */ if (tty_out->TS_clr_line) { @@ -1441,16 +1403,16 @@ reset_sys_modes (tty_out) { /* have to do it the hard way */ int i; tty_turn_off_insert (tty_out); - + for (i = curX (tty_out); i < FrameCols (tty_out) - 1; i++) { fputc (' ', tty_out->output); } } - + cmgoto (tty_out, FrameRows (tty_out) - 1, 0); fflush (tty_out->output); - + if (tty_out->terminal->reset_terminal_modes_hook) tty_out->terminal->reset_terminal_modes_hook (tty_out->terminal); @@ -1490,8 +1452,7 @@ reset_sys_modes (tty_out) /* Set up the proper status flags for use of a pty. */ void -setup_pty (fd) - int fd; +setup_pty (int fd) { /* I'm told that TOICREMOTE does not mean control chars "can't be sent" but rather that they don't have @@ -1527,83 +1488,6 @@ setup_pty (fd) } #endif /* HAVE_PTYS */ -#if !defined(CANNOT_DUMP) || !defined(SYSTEM_MALLOC) -/* Some systems that cannot dump also cannot implement these. */ - -/* - * Return the address of the start of the text segment prior to - * doing an unexec. After unexec the return value is undefined. - * See crt0.c for further explanation and _start. - * - */ - -#if !(defined (__NetBSD__) && defined (__ELF__)) -#ifndef HAVE_TEXT_START -char * -start_of_text () -{ -#ifdef TEXT_START - return ((char *) TEXT_START); -#else - extern int _start (); - return ((char *) _start); -#endif /* TEXT_START */ -} -#endif /* not HAVE_TEXT_START */ -#endif - -/* - * Return the address of the start of the data segment prior to - * doing an unexec. After unexec the return value is undefined. - * See crt0.c for further information and definition of data_start. - * - * Apparently, on BSD systems this is etext at startup. On - * USG systems (swapping) this is highly mmu dependent and - * is also dependent on whether or not the program is running - * with shared text. Generally there is a (possibly large) - * gap between end of text and start of data with shared text. - * - * On Uniplus+ systems with shared text, data starts at a - * fixed address. Each port (from a given oem) is generally - * different, and the specific value of the start of data can - * be obtained via the UniPlus+ specific "uvar" system call, - * however the method outlined in crt0.c seems to be more portable. - * - * Probably what will have to happen when a USG unexec is available, - * at least on UniPlus, is temacs will have to be made unshared so - * that text and data are contiguous. Then once loadup is complete, - * unexec will produce a shared executable where the data can be - * at the normal shared text boundary and the startofdata variable - * will be patched by unexec to the correct value. - * - */ - -#ifndef start_of_data -char * -start_of_data () -{ -#ifdef DATA_START - return ((char *) DATA_START); -#else -#ifdef ORDINARY_LINK - /* - * This is a hack. Since we're not linking crt0.c or pre_crt0.c, - * data_start isn't defined. We take the address of environ, which - * is known to live at or near the start of the system crt0.c, and - * we don't sweat the handful of bytes that might lose. - */ - extern char **environ; - - return ((char *) &environ); -#else - extern int data_start; - return ((char *) &data_start); -#endif /* ORDINARY_LINK */ -#endif /* DATA_START */ -} -#endif /* start_of_data */ -#endif /* NEED_STARTS (not CANNOT_DUMP or not SYSTEM_MALLOC) */ - /* init_system_name sets up the string for the Lisp function system-name to return. */ @@ -1621,7 +1505,7 @@ extern int h_errno; #endif /* TRY_AGAIN */ void -init_system_name () +init_system_name (void) { #ifndef HAVE_GETHOSTNAME struct utsname uts; @@ -1654,7 +1538,7 @@ init_system_name () #ifndef CANNOT_DUMP if (initialized) #endif /* not CANNOT_DUMP */ - if (! index (hostname, '.')) + if (! strchr (hostname, '.')) { int count; #ifdef HAVE_GETADDRINFO @@ -1662,7 +1546,7 @@ init_system_name () struct addrinfo hints; int ret; - memset (&hints, 0, sizeof(hints)); + memset (&hints, 0, sizeof (hints)); hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_CANONNAME; @@ -1683,7 +1567,7 @@ init_system_name () while (it) { char *fqdn = it->ai_canonname; - if (fqdn && index (fqdn, '.') + if (fqdn && strchr (fqdn, '.') && strcmp (fqdn, "localhost.localdomain") != 0) break; it = it->ai_next; @@ -1719,13 +1603,13 @@ init_system_name () { char *fqdn = (char *) hp->h_name; - if (!index (fqdn, '.')) + if (!strchr (fqdn, '.')) { /* We still don't have a fully qualified domain name. Try to find one in the list of alternate names */ char **alias = hp->h_aliases; while (*alias - && (!index (*alias, '.') + && (!strchr (*alias, '.') || !strcmp (*alias, "localhost.localdomain"))) alias++; if (*alias) @@ -1774,8 +1658,8 @@ jmp_buf read_alarm_throw; int read_alarm_should_throw; -SIGTYPE -select_alarm () +void +select_alarm (int ignore) { select_alarmed = 1; signal (SIGALRM, SIG_IGN); @@ -1787,23 +1671,18 @@ select_alarm () #ifndef WINDOWSNT /* Only rfds are checked. */ int -sys_select (nfds, rfds, wfds, efds, timeout) - int nfds; - SELECT_TYPE *rfds, *wfds, *efds; - EMACS_TIME *timeout; +sys_select (int nfds, + SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, + EMACS_TIME *timeout) { /* XXX This needs to be updated for multi-tty support. Is there - anybody who needs to emulate select these days? */ + anybody who needs to emulate select these days? */ int ravail = 0; SELECT_TYPE orfds; int timeoutval; int *local_timeout; extern int proc_buffered_char[]; -#ifndef subprocesses - int process_tick = 0, update_tick = 0; -#else extern int process_tick, update_tick; -#endif unsigned char buf; #if defined (HAVE_SELECT) && defined (HAVE_X_WINDOWS) @@ -1924,12 +1803,11 @@ sys_select (nfds, rfds, wfds, efds, timeout) waiting for at least one character. */ void -read_input_waiting () +read_input_waiting (void) { /* XXX This needs to be updated for multi-tty support. Is there anybody who needs to emulate select these days? */ int nread, i; - extern int quit_char; if (read_socket_hook) { @@ -2077,7 +1955,7 @@ static char *my_sys_siglist[NSIG]; #endif void -init_signals () +init_signals (void) { sigemptyset (&empty_mask); sigfillset (&full_mask); @@ -2283,8 +2161,7 @@ init_signals () #endif /* !RAND_BITS */ void -seed_random (arg) - long arg; +seed_random (long int arg) { #ifdef HAVE_RANDOM srandom ((unsigned int)arg); @@ -2302,7 +2179,7 @@ seed_random (arg) * This suffices even for a 64-bit architecture with a 15-bit rand. */ long -get_random () +get_random (void) { long val = random (); #if VALBITS > RAND_BITS @@ -2337,9 +2214,7 @@ strerror (errnum) #endif /* ! HAVE_STRERROR */ int -emacs_open (path, oflag, mode) - const char *path; - int oflag, mode; +emacs_open (const char *path, int oflag, int mode) { register int rtnval; @@ -2350,8 +2225,7 @@ emacs_open (path, oflag, mode) } int -emacs_close (fd) - int fd; +emacs_close (int fd) { int did_retry = 0; register int rtnval; @@ -2370,10 +2244,7 @@ emacs_close (fd) } int -emacs_read (fildes, buf, nbyte) - int fildes; - char *buf; - unsigned int nbyte; +emacs_read (int fildes, char *buf, unsigned int nbyte) { register int rtnval; @@ -2384,10 +2255,7 @@ emacs_read (fildes, buf, nbyte) } int -emacs_write (fildes, buf, nbyte) - int fildes; - const char *buf; - unsigned int nbyte; +emacs_write (int fildes, const char *buf, unsigned int nbyte) { register int rtnval, bytes_written; @@ -2448,11 +2316,10 @@ emacs_write (fildes, buf, nbyte) #ifndef HAVE_GETWD char * -getwd (pathname) - char *pathname; +getwd (char *pathname) { char *npath, *spath; - extern char *getcwd (); + extern char *getcwd (char *, size_t); BLOCK_INPUT; /* getcwd uses malloc */ spath = npath = getcwd ((char *) 0, MAXPATHLEN); @@ -2481,9 +2348,8 @@ getwd (pathname) #ifndef HAVE_RENAME -rename (from, to) - const char *from; - const char *to; +int +rename (const char *from, const char *to) { if (access (from, 0) == 0) { @@ -2503,7 +2369,8 @@ rename (from, to) /* HPUX curses library references perror, but as far as we know it won't be called. Anyway this definition will do for now. */ -perror () +void +perror (void) { } #endif /* HPUX and not HAVE_PERROR */ @@ -2516,9 +2383,8 @@ perror () * until we are, then close the unsuccessful ones. */ -dup2 (oldd, newd) - int oldd; - int newd; +int +dup2 (int oldd, int newd) { register int fd, ret; @@ -2546,17 +2412,14 @@ dup2 (oldd, newd) * Only needed when subprocesses are defined. */ -#ifdef subprocesses #ifndef HAVE_GETTIMEOFDAY #ifdef HAVE_TIMEVAL /* ARGSUSED */ int -gettimeofday (tp, tzp) - struct timeval *tp; - struct timezone *tzp; +gettimeofday (struct timeval *tp, struct timezone *tzp) { - extern long time (); + extern long time (long); tp->tv_sec = time ((long *)0); tp->tv_usec = 0; @@ -2566,16 +2429,14 @@ gettimeofday (tp, tzp) } #endif -#endif -#endif /* subprocess && !HAVE_GETTIMEOFDAY && HAVE_TIMEVAL */ +#endif /* !HAVE_GETTIMEOFDAY && HAVE_TIMEVAL */ /* * This function will go away as soon as all the stubs fixed. (fnf) */ void -croak (badfunc) - char *badfunc; +croak (char *badfunc) { printf ("%s not yet implemented\r\n", badfunc); reset_all_sys_modes (); @@ -2607,9 +2468,7 @@ closedir (DIR *dirp /* stream from opendir */) int -set_file_times (filename, atime, mtime) - const char *filename; - EMACS_TIME atime, mtime; +set_file_times (const char *filename, EMACS_TIME atime, EMACS_TIME mtime) { #ifdef HAVE_UTIMES struct timeval tv[2]; @@ -2646,9 +2505,7 @@ set_file_times (filename, atime, mtime) * Make a directory. */ int -mkdir (dpath, dmode) - char *dpath; - int dmode; +mkdir (char *dpath, int dmode) { int cpid, status, fd; struct stat statbuf; @@ -2706,8 +2563,7 @@ mkdir (dpath, dmode) #ifndef HAVE_RMDIR int -rmdir (dpath) - char *dpath; +rmdir (char *dpath) { int cpid, status, fd; struct stat statbuf; @@ -2751,11 +2607,63 @@ rmdir (dpath) } #endif /* !HAVE_RMDIR */ + +#ifndef HAVE_MEMSET +void * +memset (void *b, int n, size_t length) +{ + unsigned char *p = b; + while (length-- > 0) + *p++ = n; + return b; +} +#endif /* !HAVE_MEMSET */ + +#ifndef HAVE_MEMCPY +void * +memcpy (void *b1, void *b2, size_t length) +{ + unsigned char *p1 = b1, *p2 = b2; + while (length-- > 0) + *p1++ = *p2++; + return b1; +} +#endif /* !HAVE_MEMCPY */ + +#ifndef HAVE_MEMMOVE +void * +memmove (void *b1, void *b2, size_t length) +{ + unsigned char *p1 = b1, *p2 = b2; + if (p1 < p2 || p1 >= p2 + length) + while (length-- > 0) + *p1++ = *p2++; + else + { + p1 += length; + p2 += length; + while (length-- > 0) + *--p1 = *--p2; + } + return b1; +} +#endif /* !HAVE_MEMCPY */ + +#ifndef HAVE_MEMCMP +int +memcmp (void *b1, void *b2, size_t length) +{ + unsigned char *p1 = b1, *p2 = b2; + while (length-- > 0) + if (*p1++ != *p2++) + return p1[-1] < p2[-1] ? -1 : 1; + return 0; +} +#endif /* !HAVE_MEMCMP */ #ifndef HAVE_STRSIGNAL char * -strsignal (code) - int code; +strsignal (int code) { char *signame = 0; @@ -2771,7 +2679,8 @@ strsignal (code) #ifdef HAVE_TERMIOS /* For make-serial-process */ -int serial_open (char *port) +int +serial_open (char *port) { int fd = -1; @@ -2804,7 +2713,8 @@ int serial_open (char *port) #if !defined (HAVE_CFMAKERAW) /* Workaround for targets which are missing cfmakeraw. */ /* Pasted from man page. */ -static void cfmakeraw (struct termios *termios_p) +static void +cfmakeraw (struct termios *termios_p) { termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); termios_p->c_oflag &= ~OPOST; @@ -2816,7 +2726,8 @@ static void cfmakeraw (struct termios *termios_p) #if !defined (HAVE_CFSETSPEED) /* Workaround for targets which are missing cfsetspeed. */ -static int cfsetspeed (struct termios *termios_p, speed_t vitesse) +static int +cfsetspeed (struct termios *termios_p, speed_t vitesse) { return (cfsetispeed (termios_p, vitesse) + cfsetospeed (termios_p, vitesse)); @@ -2826,7 +2737,7 @@ static int cfsetspeed (struct termios *termios_p, speed_t vitesse) /* For serial-process-configure */ void serial_configure (struct Lisp_Process *p, - Lisp_Object contact) + Lisp_Object contact) { Lisp_Object childp2 = Qnil; Lisp_Object tem = Qnil; @@ -2869,7 +2780,7 @@ serial_configure (struct Lisp_Process *p, CHECK_NUMBER (tem); if (XINT (tem) != 7 && XINT (tem) != 8) error (":bytesize must be nil (8), 7, or 8"); - summary[0] = XINT(tem) + '0'; + summary[0] = XINT (tem) + '0'; #if defined (CSIZE) && defined (CS7) && defined (CS8) attr.c_cflag &= ~CSIZE; attr.c_cflag |= ((XINT (tem) == 7) ? CS7 : CS8); @@ -2993,7 +2904,7 @@ serial_configure (struct Lisp_Process *p, /* Process enumeration and access via /proc. */ Lisp_Object -list_system_processes () +list_system_processes (void) { Lisp_Object procdir, match, proclist, next; struct gcpro gcpro1, gcpro2; @@ -3027,7 +2938,7 @@ list_system_processes () #elif !defined (WINDOWSNT) && !defined (MSDOS) Lisp_Object -list_system_processes () +list_system_processes (void) { return Qnil; } @@ -3226,7 +3137,7 @@ system_process_attributes (Lisp_Object pid) procfn_end = fn + strlen (fn); strcpy (procfn_end, "/stat"); fd = emacs_open (fn, O_RDONLY, 0); - if (fd >= 0 && (nread = emacs_read (fd, procbuf, sizeof(procbuf) - 1)) > 0) + if (fd >= 0 && (nread = emacs_read (fd, procbuf, sizeof (procbuf) - 1)) > 0) { procbuf[nread] = '\0'; p = procbuf; @@ -3487,7 +3398,7 @@ system_process_attributes (Lisp_Object pid) strcpy (procfn_end, "/psinfo"); fd = emacs_open (fn, O_RDONLY, 0); if (fd >= 0 - && (nread = read (fd, (char*)&pinfo, sizeof(struct psinfo)) > 0)) + && (nread = read (fd, (char*)&pinfo, sizeof (struct psinfo)) > 0)) { attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (pinfo.pr_ppid)), attrs); attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pinfo.pr_pgid)), attrs); diff --git a/src/syssignal.h b/src/syssignal.h index 9a145b78cb1..e3765add425 100644 --- a/src/syssignal.h +++ b/src/syssignal.h @@ -17,7 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ -extern void init_signals P_ ((void)); +extern void init_signals (void); #if defined (HAVE_GTK_AND_PTHREAD) || defined (HAVE_NS) #include <pthread.h> @@ -76,12 +76,12 @@ extern sigset_t sys_sigmask (); /* Whether this is what all systems want or not, this is what appears to be assumed in the source, for example data.c:arith_error. */ -typedef RETSIGTYPE (*signal_handler_t) (/*int*/); +typedef RETSIGTYPE (*signal_handler_t) (int); -signal_handler_t sys_signal P_ ((int signal_number, signal_handler_t action)); -sigset_t sys_sigblock P_ ((sigset_t new_mask)); -sigset_t sys_sigunblock P_ ((sigset_t new_mask)); -sigset_t sys_sigsetmask P_ ((sigset_t new_mask)); +signal_handler_t sys_signal (int signal_number, signal_handler_t action); +sigset_t sys_sigblock (sigset_t new_mask); +sigset_t sys_sigunblock (sigset_t new_mask); +sigset_t sys_sigsetmask (sigset_t new_mask); #define sys_sigdel(MASK,SIG) sigdelset (&MASK,SIG) @@ -113,9 +113,6 @@ sigset_t sys_sigsetmask P_ ((sigset_t new_mask)); #endif #if defined (SIGIO) && defined (BROKEN_SIGIO) # undef SIGIO -# if defined (__Lynx__) -# undef SIGPOLL /* Defined as SIGIO on LynxOS */ -# endif #endif #if defined (SIGPOLL) && defined (BROKEN_SIGPOLL) #undef SIGPOLL diff --git a/src/systime.h b/src/systime.h index 2f8d35805a4..bd789e9bd32 100644 --- a/src/systime.h +++ b/src/systime.h @@ -136,17 +136,17 @@ extern time_t timezone; #define EMACS_SET_SECS_USECS(time, secs, usecs) \ (EMACS_SET_SECS (time, secs), EMACS_SET_USECS (time, usecs)) -extern int set_file_times __P ((const char *, EMACS_TIME, EMACS_TIME)); +extern int set_file_times (const char *, EMACS_TIME, EMACS_TIME); /* defined in keyboard.c */ -extern void set_waiting_for_input __P ((EMACS_TIME *)); +extern void set_waiting_for_input (EMACS_TIME *); /* When lisp.h is not included Lisp_Object is not defined (this can happen when this files is used outside the src directory). Use GCPRO1 to determine if lisp.h was included. */ #ifdef GCPRO1 /* defined in dired.c */ -extern Lisp_Object make_time __P ((time_t)); +extern Lisp_Object make_time (time_t); #endif /* Compare times T1 and T2. Value is 0 if T1 and T2 are the same. diff --git a/src/term.c b/src/term.c index fad6e3c80d7..3233db84cf7 100644 --- a/src/term.c +++ b/src/term.c @@ -66,10 +66,10 @@ static int been_here = -1; /* For now, don't try to include termcap.h. On some systems, configure finds a non-standard termcap.h that the main build won't find. */ -extern void tputs P_ ((const char *, int, int (*)(int))); -extern int tgetent P_ ((char *, const char *)); -extern int tgetflag P_ ((char *id)); -extern int tgetnum P_ ((char *id)); +extern void tputs (const char *, int, int (*)(int)); +extern int tgetent (char *, const char *); +extern int tgetflag (char *id); +extern int tgetnum (char *id); #include "cm.h" #ifdef HAVE_X_WINDOWS @@ -91,16 +91,20 @@ extern int tgetnum P_ ((char *id)); #define DEV_TTY "/dev/tty" #endif -static void tty_set_scroll_region P_ ((struct frame *f, int start, int stop)); -static void turn_on_face P_ ((struct frame *, int face_id)); -static void turn_off_face P_ ((struct frame *, int face_id)); -static void tty_show_cursor P_ ((struct tty_display_info *)); -static void tty_hide_cursor P_ ((struct tty_display_info *)); -static void tty_background_highlight P_ ((struct tty_display_info *tty)); -static void clear_tty_hooks P_ ((struct terminal *terminal)); -static void set_tty_hooks P_ ((struct terminal *terminal)); -static void dissociate_if_controlling_tty P_ ((int fd)); -static void delete_tty P_ ((struct terminal *)); +static void tty_set_scroll_region (struct frame *f, int start, int stop); +static void turn_on_face (struct frame *, int face_id); +static void turn_off_face (struct frame *, int face_id); +static void tty_show_cursor (struct tty_display_info *); +static void tty_hide_cursor (struct tty_display_info *); +static void tty_background_highlight (struct tty_display_info *tty); +static void clear_tty_hooks (struct terminal *terminal); +static void set_tty_hooks (struct terminal *terminal); +static void dissociate_if_controlling_tty (int fd); +static void delete_tty (struct terminal *); +static void maybe_fatal (int must_succeed, struct terminal *terminal, + const char *str1, const char *str2, ...) NO_RETURN; +static void vfatal (const char *str, va_list ap) NO_RETURN; + #define OUTPUT(tty, a) \ emacs_tputs ((tty), a, \ @@ -181,13 +185,13 @@ static int system_uses_terminfo; char *tparam (); -extern char *tgetstr (); +extern char *tgetstr (char *, char **); #ifdef HAVE_GPM #include <sys/fcntl.h> -static void term_clear_mouse_face (); +static void term_clear_mouse_face (void); static void term_mouse_highlight (struct frame *f, int x, int y); /* The device for which we have enabled gpm support (or NULL). */ @@ -558,10 +562,7 @@ static int encode_terminal_dst_size; sequence, and return a pointer to that byte sequence. */ unsigned char * -encode_terminal_code (src, src_len, coding) - struct glyph *src; - int src_len; - struct coding_system *coding; +encode_terminal_code (struct glyph *src, int src_len, struct coding_system *coding) { struct glyph *src_end = src + src_len; unsigned char *buf; @@ -723,7 +724,7 @@ encode_terminal_code (src, src_len, coding) encode_terminal_src_size); buf = encode_terminal_src + nbytes; } - bcopy (SDATA (string), buf, SBYTES (string)); + memcpy (buf, SDATA (string), SBYTES (string)); buf += SBYTES (string); nchars += SCHARS (string); } @@ -836,10 +837,8 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) #ifdef HAVE_GPM /* Only used by GPM code. */ static void -tty_write_glyphs_with_face (f, string, len, face_id) - register struct frame *f; - register struct glyph *string; - register int len, face_id; +tty_write_glyphs_with_face (register struct frame *f, register struct glyph *string, + register int len, register int face_id) { unsigned char *conversion_buffer; struct coding_system *coding; @@ -1230,8 +1229,8 @@ calculate_costs (struct frame *frame) = (int *) xmalloc (sizeof (int) + 2 * max_frame_cols * sizeof (int)); - bzero (char_ins_del_vector, (sizeof (int) - + 2 * max_frame_cols * sizeof (int))); + memset (char_ins_del_vector, 0, + (sizeof (int) + 2 * max_frame_cols * sizeof (int))); if (f && (!tty->TS_ins_line && !tty->TS_del_line)) @@ -1366,16 +1365,14 @@ static struct fkey_table keys[] = static char **term_get_fkeys_address; static KBOARD *term_get_fkeys_kboard; -static Lisp_Object term_get_fkeys_1 (); +static Lisp_Object term_get_fkeys_1 (void); /* Find the escape codes sent by the function keys for Vinput_decode_map. This function scans the termcap function key sequence entries, and adds entries to Vinput_decode_map for each function key it finds. */ static void -term_get_fkeys (address, kboard) - char **address; - KBOARD *kboard; +term_get_fkeys (char **address, KBOARD *kboard) { /* We run the body of the function (term_get_fkeys_1) and ignore all Lisp errors during the call. The only errors should be from Fdefine_key @@ -1385,14 +1382,14 @@ term_get_fkeys (address, kboard) function key specification, rather than giving the user an error and refusing to run at all on such a terminal. */ - extern Lisp_Object Fidentity (); + extern Lisp_Object Fidentity (Lisp_Object); term_get_fkeys_address = address; term_get_fkeys_kboard = kboard; internal_condition_case (term_get_fkeys_1, Qerror, Fidentity); } static Lisp_Object -term_get_fkeys_1 () +term_get_fkeys_1 (void) { int i; @@ -1517,10 +1514,10 @@ term_get_fkeys_1 () #define produce_composite_glyph produce_composite_glyph_term #endif -static void append_glyph P_ ((struct it *)); -static void produce_stretch_glyph P_ ((struct it *)); -static void append_composite_glyph P_ ((struct it *)); -static void produce_composite_glyph P_ ((struct it *)); +static void append_glyph (struct it *); +static void produce_stretch_glyph (struct it *); +static void append_composite_glyph (struct it *); +static void produce_composite_glyph (struct it *); /* Append glyphs to IT's glyph_row. Called from produce_glyphs for terminal frames if IT->glyph_row != NULL. IT->char_to_display is @@ -1529,8 +1526,7 @@ static void produce_composite_glyph P_ ((struct it *)); IT->pixel_width > 1. */ static void -append_glyph (it) - struct it *it; +append_glyph (struct it *it) { struct glyph *glyph, *end; int i; @@ -1609,8 +1605,7 @@ append_glyph (it) instead they use the macro PRODUCE_GLYPHS. */ void -produce_glyphs (it) - struct it *it; +produce_glyphs (struct it *it) { /* If a hook is installed, let it do the work. */ @@ -1728,8 +1723,7 @@ produce_glyphs (it) to reach HPOS, a value in canonical character units. */ static void -produce_stretch_glyph (it) - struct it *it; +produce_stretch_glyph (struct it *it) { /* (space :width WIDTH ...) */ Lisp_Object prop, plist; @@ -1798,8 +1792,7 @@ produce_stretch_glyph (it) face. */ static void -append_composite_glyph (it) - struct it *it; +append_composite_glyph (struct it *it) { struct glyph *glyph; @@ -1863,8 +1856,7 @@ append_composite_glyph (it) correctly. */ static void -produce_composite_glyph (it) - struct it *it; +produce_composite_glyph (struct it *it) { int c; @@ -1894,9 +1886,7 @@ produce_composite_glyph (it) face_id, c, len of IT are left untouched. */ void -produce_special_glyphs (it, what) - struct it *it; - enum display_element_type what; +produce_special_glyphs (struct it *it, enum display_element_type what) { struct it temp_it; Lisp_Object gc; @@ -1907,7 +1897,7 @@ produce_special_glyphs (it, what) temp_it.what = IT_CHARACTER; temp_it.len = 1; temp_it.object = make_number (0); - bzero (&temp_it.current, sizeof temp_it.current); + memset (&temp_it.current, 0, sizeof temp_it.current); if (what == IT_CONTINUATION) { @@ -1970,9 +1960,7 @@ produce_special_glyphs (it, what) FACE_ID is a realized face ID number, in the face cache. */ static void -turn_on_face (f, face_id) - struct frame *f; - int face_id; +turn_on_face (struct frame *f, int face_id) { struct face *face = FACE_FROM_ID (f, face_id); long fg = face->foreground; @@ -2069,9 +2057,7 @@ turn_on_face (f, face_id) /* Turn off appearances of face FACE_ID on tty frame F. */ static void -turn_off_face (f, face_id) - struct frame *f; - int face_id; +turn_off_face (struct frame *f, int face_id) { struct face *face = FACE_FROM_ID (f, face_id); struct tty_display_info *tty = FRAME_TTY (f); @@ -2124,10 +2110,8 @@ turn_off_face (f, face_id) colors FG and BG. */ int -tty_capable_p (tty, caps, fg, bg) - struct tty_display_info *tty; - unsigned caps; - unsigned long fg, bg; +tty_capable_p (struct tty_display_info *tty, unsigned int caps, + unsigned long fg, unsigned long bg) { #define TTY_CAPABLE_P_TRY(tty, cap, TS, NC_bit) \ if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P(tty, NC_bit))) \ @@ -2153,8 +2137,7 @@ DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p, TERMINAL can be a terminal object, a frame, or nil (meaning the selected frame's terminal). This function always returns nil if TERMINAL does not refer to a text-only terminal. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct terminal *t = get_tty_terminal (terminal, 0); if (!t) @@ -2171,8 +2154,7 @@ DEFUN ("tty-display-color-cells", Ftty_display_color_cells, TERMINAL can be a terminal object, a frame, or nil (meaning the selected frame's terminal). This function always returns 0 if TERMINAL does not refer to a text-only terminal. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct terminal *t = get_tty_terminal (terminal, 0); if (!t) @@ -2267,9 +2249,7 @@ tty_setup_colors (struct tty_display_info *tty, int mode) } void -set_tty_color_mode (tty, f) - struct tty_display_info *tty; - struct frame *f; +set_tty_color_mode (struct tty_display_info *tty, struct frame *f) { Lisp_Object tem, val; Lisp_Object color_mode; @@ -2333,8 +2313,7 @@ get_tty_terminal (Lisp_Object terminal, int throw) Returns NULL if the named terminal device is not opened. */ struct terminal * -get_named_tty (name) - char *name; +get_named_tty (char *name) { struct terminal *t; @@ -2359,8 +2338,7 @@ Returns nil if TERMINAL is not on a tty device. TERMINAL can be a terminal object, a frame, or nil (meaning the selected frame's terminal). */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct terminal *t = get_terminal (terminal, 1); @@ -2379,8 +2357,7 @@ DEFUN ("controlling-tty-p", Fcontrolling_tty_p, Scontrolling_tty_p, 0, 1, 0, TERMINAL can be a terminal object, a frame, or nil (meaning the selected frame's terminal). This function always returns nil if TERMINAL is not on a tty device. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct terminal *t = get_terminal (terminal, 1); @@ -2400,8 +2377,7 @@ no effect if used on a non-tty terminal. TERMINAL can be a terminal object, a frame or nil (meaning the selected frame's terminal). This function always returns nil if TERMINAL does not refer to a text-only terminal. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct terminal *t = get_terminal (terminal, 1); @@ -2431,8 +2407,7 @@ terminal device. suspended. A suspended tty may be resumed by calling `resume-tty' on it. */) - (tty) - Lisp_Object tty; + (Lisp_Object tty) { struct terminal *t = get_tty_terminal (tty, 1); FILE *f; @@ -2456,10 +2431,7 @@ A suspended tty may be resumed by calling `resume-tty' on it. */) } reset_sys_modes (t->display_info.tty); - -#ifdef subprocesses delete_keyboard_wait_descriptor (fileno (f)); -#endif #ifndef MSDOS fclose (f); @@ -2498,8 +2470,7 @@ suspended. TTY may be a terminal object, a frame, or nil (meaning the selected frame's terminal). */) - (tty) - Lisp_Object tty; + (Lisp_Object tty) { struct terminal *t = get_tty_terminal (tty, 1); int fd; @@ -2528,9 +2499,7 @@ frame's terminal). */) t->display_info.tty->input = t->display_info.tty->output; #endif -#ifdef subprocesses add_keyboard_wait_descriptor (fd); -#endif if (FRAMEP (t->display_info.tty->top_frame)) { @@ -2664,7 +2633,7 @@ term_show_mouse_face (enum draw_glyphs_face draw) } static void -term_clear_mouse_face () +term_clear_mouse_face (void) { if (!NILP (mouse_face_window)) term_show_mouse_face (DRAW_NORMAL_TEXT); @@ -3171,7 +3140,7 @@ DEFUN ("gpm-mouse-start", Fgpm_mouse_start, Sgpm_mouse_start, 0, 0, 0, doc: /* Open a connection to Gpm. Gpm-mouse can only be activated for one tty at a time. */) - () + (void) { struct frame *f = SELECTED_FRAME (); struct tty_display_info *tty @@ -3219,7 +3188,7 @@ close_gpm (int fd) DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop, 0, 0, 0, doc: /* Close a connection to Gpm. */) - () + (void) { struct frame *f = SELECTED_FRAME (); struct tty_display_info *tty @@ -3252,7 +3221,7 @@ create_tty_output (struct frame *f) abort (); t = xmalloc (sizeof (struct tty_output)); - bzero (t, sizeof (struct tty_output)); + memset (t, 0, sizeof (struct tty_output)); t->display_info = FRAME_TERMINAL (f)->display_info.tty; @@ -3405,8 +3374,6 @@ dissociate_if_controlling_tty (int fd) #endif /* !DOS_NT */ } -static void maybe_fatal(); - /* Create a termcap display on the tty device with the given name and type. @@ -3459,7 +3426,7 @@ init_tty (char *name, char *terminal_type, int must_succeed) #else tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info)); #endif - bzero (tty, sizeof (struct tty_display_info)); + memset (tty, 0, sizeof (struct tty_display_info)); tty->next = tty_list; tty_list = tty; @@ -3551,9 +3518,7 @@ init_tty (char *name, char *terminal_type, int must_succeed) terminal->name = xstrdup (name); tty->type = xstrdup (terminal_type); -#ifdef subprocesses add_keyboard_wait_descriptor (0); -#endif Wcm_clear (tty); @@ -3778,7 +3743,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ if (FrameRows (tty) < 3 || FrameCols (tty) < 3) maybe_fatal (must_succeed, terminal, - "Screen size %dx%d is too small" + "Screen size %dx%d is too small", "Screen size %dx%d is too small", FrameCols (tty), FrameRows (tty)); @@ -3954,24 +3919,39 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ return terminal; } + +static void +vfatal (const char *str, va_list ap) +{ + fprintf (stderr, "emacs: "); + vfprintf (stderr, str, ap); + if (!(strlen (str) > 0 && str[strlen (str) - 1] == '\n')) + fprintf (stderr, "\n"); + va_end (ap); + fflush (stderr); + exit (1); +} + + /* Auxiliary error-handling function for init_tty. Delete TERMINAL, then call error or fatal with str1 or str2, respectively, according to MUST_SUCCEED. */ static void -maybe_fatal (must_succeed, terminal, str1, str2, arg1, arg2) - int must_succeed; - struct terminal *terminal; - char *str1, *str2, *arg1, *arg2; +maybe_fatal (int must_succeed, struct terminal *terminal, + const char *str1, const char *str2, ...) { + va_list ap; + va_start (ap, str2); if (terminal) delete_tty (terminal); if (must_succeed) - fatal (str2, arg1, arg2); + vfatal (str2, ap); else - error (str1, arg1, arg2); + verror (str1, ap); + va_end (ap); abort (); } @@ -3980,13 +3960,8 @@ fatal (const char *str, ...) { va_list ap; va_start (ap, str); - fprintf (stderr, "emacs: "); - vfprintf (stderr, str, ap); - if (!(strlen (str) > 0 && str[strlen (str) - 1] == '\n')) - fprintf (stderr, "\n"); + vfatal (str, ap); va_end (ap); - fflush (stderr); - exit (1); } @@ -4035,9 +4010,7 @@ delete_tty (struct terminal *terminal) if (tty->input) { -#ifdef subprocesses delete_keyboard_wait_descriptor (fileno (tty->input)); -#endif if (tty->input != stdin) fclose (tty->input); } @@ -4051,7 +4024,7 @@ delete_tty (struct terminal *terminal) xfree (tty->termcap_strings_buffer); xfree (tty->termcap_term_buffer); - bzero (tty, sizeof (struct tty_display_info)); + memset (tty, 0, sizeof (struct tty_display_info)); xfree (tty); } @@ -4072,7 +4045,7 @@ mark_ttys (void) void -syms_of_term () +syms_of_term (void) { DEFVAR_BOOL ("system-uses-terminfo", &system_uses_terminfo, doc: /* Non-nil means the system uses terminfo rather than termcap. diff --git a/src/termcap.c b/src/termcap.c index 9b4a7f657f6..ea4ef244f64 100644 --- a/src/termcap.c +++ b/src/termcap.c @@ -18,12 +18,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Emacs config.h may rename various library functions such as malloc. */ -#ifdef HAVE_CONFIG_H #include <config.h> -#endif - -#ifdef emacs - #include <setjmp.h> #include <lisp.h> /* xmalloc is here */ /* Get the O_* definitions for open et al. */ @@ -35,31 +30,6 @@ Boston, MA 02110-1301, USA. */ #include <unistd.h> #endif -#else /* not emacs */ - -#ifdef STDC_HEADERS -#include <stdlib.h> -#include <string.h> -#else -char *getenv (); -char *malloc (); -char *realloc (); -#endif - -/* Do this after the include, in case string.h prototypes bcopy. */ -#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy) -#define bcopy(s, d, n) memcpy ((d), (s), (n)) -#endif - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_FCNTL_H -#include <fcntl.h> -#endif - -#endif /* not emacs */ - #ifndef NULL #define NULL (char *) 0 #endif @@ -89,37 +59,6 @@ int bufsize = 128; #define TERMCAP_FILE "/etc/termcap" #endif -#ifndef emacs -static void -memory_out () -{ - write (2, "virtual memory exhausted\n", 25); - exit (1); -} - -static char * -xmalloc (size) - unsigned size; -{ - register char *tem = malloc (size); - - if (!tem) - memory_out (); - return tem; -} - -static char * -xrealloc (ptr, size) - char *ptr; - unsigned size; -{ - register char *tem = realloc (ptr, size); - - if (!tem) - memory_out (); - return tem; -} -#endif /* not emacs */ /* Looking up capabilities in the entry already found. */ @@ -127,15 +66,14 @@ xrealloc (ptr, size) for tgetnum, tgetflag and tgetstr to find. */ static char *term_entry; -static char *tgetst1 (); +static char *tgetst1 (char *ptr, char **area); /* Search entry BP for capability CAP. Return a pointer to the capability (in BP) if found, 0 if not found. */ static char * -find_capability (bp, cap) - register char *bp, *cap; +find_capability (register char *bp, register char *cap) { for (; *bp; bp++) if (bp[0] == ':' @@ -146,8 +84,7 @@ find_capability (bp, cap) } int -tgetnum (cap) - char *cap; +tgetnum (char *cap) { register char *ptr = find_capability (term_entry, cap); if (!ptr || ptr[-1] != '#') @@ -156,8 +93,7 @@ tgetnum (cap) } int -tgetflag (cap) - char *cap; +tgetflag (char *cap) { register char *ptr = find_capability (term_entry, cap); return ptr && ptr[-1] == ':'; @@ -169,9 +105,7 @@ tgetflag (cap) If AREA is null, space is allocated with `malloc'. */ char * -tgetstr (cap, area) - char *cap; - char **area; +tgetstr (char *cap, char **area) { register char *ptr = find_capability (term_entry, cap); if (!ptr || (ptr[-1] != '=' && ptr[-1] != '~')) @@ -209,9 +143,7 @@ static const char esctab[] or NULL if PTR is NULL. */ static char * -tgetst1 (ptr, area) - char *ptr; - char **area; +tgetst1 (char *ptr, char **area) { register char *p, *r; register int c; @@ -322,7 +254,7 @@ tgetst1 (ptr, area) cut[last_p_param].len = r - cut[last_p_param].beg; for (i = 0, wp = ret; i <= last_p_param; wp += cut[i++].len) - bcopy (cut[i].beg, wp, cut[i].len); + memcpy (wp, cut[i].beg, cut[i].len); r = wp; } } @@ -357,10 +289,7 @@ static const int speeds[] = #endif /* not emacs */ void -tputs (str, nlines, outfun) - register char *str; - int nlines; - register int (*outfun) (); +tputs (register char *str, int nlines, register int (*outfun) (/* ??? */)) { register int padcount = 0; register int speed; @@ -432,10 +361,10 @@ struct termcap_buffer /* Forward declarations of static functions. */ -static int scan_file (); -static char *gobble_line (); -static int compare_contin (); -static int name_match (); +static int scan_file (char *str, int fd, register struct termcap_buffer *bufp); +static char *gobble_line (int fd, register struct termcap_buffer *bufp, char *append_end); +static int compare_contin (register char *str1, register char *str2); +static int name_match (char *line, char *name); #ifdef MSDOS /* MW, May 1993 */ static int @@ -460,8 +389,7 @@ valid_filename_p (fn) in it, and some other value otherwise. */ int -tgetent (bp, name) - char *bp, *name; +tgetent (char *bp, char *name) { register char *termcap_name; register int fd; @@ -625,10 +553,7 @@ tgetent (bp, name) or 0 if no entry is found in the file. */ static int -scan_file (str, fd, bufp) - char *str; - int fd; - register struct termcap_buffer *bufp; +scan_file (char *str, int fd, register struct termcap_buffer *bufp) { register char *end; @@ -665,8 +590,7 @@ scan_file (str, fd, bufp) by termcap entry LINE. */ static int -name_match (line, name) - char *line, *name; +name_match (char *line, char *name) { register char *tem; @@ -681,8 +605,7 @@ name_match (line, name) } static int -compare_contin (str1, str2) - register char *str1, *str2; +compare_contin (register char *str1, register char *str2) { register int c1, c2; while (1) @@ -722,10 +645,7 @@ compare_contin (str1, str2) thing as one line. The caller decides when a line is continued. */ static char * -gobble_line (fd, bufp, append_end) - int fd; - register struct termcap_buffer *bufp; - char *append_end; +gobble_line (int fd, register struct termcap_buffer *bufp, char *append_end) { register char *end; register int nread; @@ -758,7 +678,7 @@ gobble_line (fd, bufp, append_end) else { append_end -= bufp->ptr - buf; - bcopy (bufp->ptr, buf, bufp->full -= bufp->ptr - buf); + memcpy (buf, bufp->ptr, bufp->full -= bufp->ptr - buf); bufp->ptr = buf; } if (!(nread = read (fd, buf + bufp->full, bufp->size - bufp->full))) diff --git a/src/termhooks.h b/src/termhooks.h index 2b4011627c8..7762dd15efe 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -39,7 +39,7 @@ enum scroll_bar_part { /* If the value of the frame parameter changed, whis hook is called. For example, if going from fullscreen to not fullscreen this hook may do something OS dependent, like extended window manager hints on X11. */ -extern void (*fullscreen_hook) P_ ((struct frame *f)); +extern void (*fullscreen_hook) (struct frame *f); /* Input queue declarations and hooks. */ @@ -255,7 +255,7 @@ struct input_event Lisp_Object arg; }; -#define EVENT_INIT(event) bzero (&(event), sizeof (struct input_event)) +#define EVENT_INIT(event) memset (&(event), 0, sizeof (struct input_event)) /* Bits in the modifiers member of the input_event structure. Note that reorder_modifiers assumes that the bits are in canonical @@ -415,28 +415,28 @@ struct terminal /* Text display hooks. */ - void (*cursor_to_hook) P_ ((struct frame *f, int vpos, int hpos)); - void (*raw_cursor_to_hook) P_ ((struct frame *, int, int)); + void (*cursor_to_hook) (struct frame *f, int vpos, int hpos); + void (*raw_cursor_to_hook) (struct frame *, int, int); - void (*clear_to_end_hook) P_ ((struct frame *)); - void (*clear_frame_hook) P_ ((struct frame *)); - void (*clear_end_of_line_hook) P_ ((struct frame *, int)); + void (*clear_to_end_hook) (struct frame *); + void (*clear_frame_hook) (struct frame *); + void (*clear_end_of_line_hook) (struct frame *, int); - void (*ins_del_lines_hook) P_ ((struct frame *f, int, int)); + void (*ins_del_lines_hook) (struct frame *f, int, int); - void (*insert_glyphs_hook) P_ ((struct frame *f, struct glyph *s, int n)); - void (*write_glyphs_hook) P_ ((struct frame *f, struct glyph *s, int n)); - void (*delete_glyphs_hook) P_ ((struct frame *, int)); + void (*insert_glyphs_hook) (struct frame *f, struct glyph *s, int n); + void (*write_glyphs_hook) (struct frame *f, struct glyph *s, int n); + void (*delete_glyphs_hook) (struct frame *, int); - void (*ring_bell_hook) P_ ((struct frame *f)); - void (*toggle_invisible_pointer_hook) P_ ((struct frame *f, int invisible)); + void (*ring_bell_hook) (struct frame *f); + void (*toggle_invisible_pointer_hook) (struct frame *f, int invisible); - void (*reset_terminal_modes_hook) P_ ((struct terminal *)); - void (*set_terminal_modes_hook) P_ ((struct terminal *)); + void (*reset_terminal_modes_hook) (struct terminal *); + void (*set_terminal_modes_hook) (struct terminal *); - void (*update_begin_hook) P_ ((struct frame *)); - void (*update_end_hook) P_ ((struct frame *)); - void (*set_terminal_window_hook) P_ ((struct frame *, int)); + void (*update_begin_hook) (struct frame *); + void (*update_end_hook) (struct frame *); + void (*set_terminal_window_hook) (struct frame *, int); /* Multi-frame and mouse support hooks. */ @@ -458,12 +458,12 @@ struct terminal This should clear mouse_moved until the next motion event arrives. */ - void (*mouse_position_hook) P_ ((struct frame **f, int, - Lisp_Object *bar_window, - enum scroll_bar_part *part, - Lisp_Object *x, - Lisp_Object *y, - unsigned long *time)); + void (*mouse_position_hook) (struct frame **f, int, + Lisp_Object *bar_window, + enum scroll_bar_part *part, + Lisp_Object *x, + Lisp_Object *y, + unsigned long *time); /* The window system handling code should set this if the mouse has moved since the last call to the mouse_position_hook. Calling that @@ -473,7 +473,7 @@ struct terminal /* When a frame's focus redirection is changed, this hook tells the window system code to re-decide where to put the highlight. Under X, this means that Emacs lies about where the focus is. */ - void (*frame_rehighlight_hook) P_ ((struct frame *)); + void (*frame_rehighlight_hook) (struct frame *); /* If we're displaying frames using a window system that can stack frames on top of each other, this hook allows you to bring a frame @@ -485,12 +485,12 @@ struct terminal If RAISE is non-zero, F is brought to the front, before all other windows. If RAISE is zero, F is sent to the back, behind all other windows. */ - void (*frame_raise_lower_hook) P_ ((struct frame *f, int raise)); + void (*frame_raise_lower_hook) (struct frame *f, int raise); /* If the value of the frame parameter changed, whis hook is called. For example, if going from fullscreen to not fullscreen this hook may do something OS dependent, like extended window manager hints on X11. */ - void (*fullscreen_hook) P_ ((struct frame *f)); + void (*fullscreen_hook) (struct frame *f); /* Scroll bar hooks. */ @@ -520,9 +520,9 @@ struct terminal indicate that we are displaying PORTION characters out of a total of WHOLE characters, starting at POSITION. If WINDOW doesn't yet have a scroll bar, create one for it. */ - void (*set_vertical_scroll_bar_hook) P_ ((struct window *window, - int portion, int whole, - int position)); + void (*set_vertical_scroll_bar_hook) (struct window *window, + int portion, int whole, + int position); /* The following three hooks are used when we're doing a thorough @@ -545,11 +545,11 @@ struct terminal If non-zero, this hook should be safe to apply to any frame, whether or not it can support scroll bars, and whether or not it is currently displaying them. */ - void (*condemn_scroll_bars_hook) P_ ((struct frame *frame)); + void (*condemn_scroll_bars_hook) (struct frame *frame); /* Unmark WINDOW's scroll bar for deletion in this judgement cycle. Note that it's okay to redeem a scroll bar that is not condemned. */ - void (*redeem_scroll_bar_hook) P_ ((struct window *window)); + void (*redeem_scroll_bar_hook) (struct window *window); /* Remove all scroll bars on FRAME that haven't been saved since the last call to `*condemn_scroll_bars_hook'. @@ -562,7 +562,7 @@ struct terminal If non-zero, this hook should be safe to apply to any frame, whether or not it can support scroll bars, and whether or not it is currently displaying them. */ - void (*judge_scroll_bars_hook) P_ ((struct frame *FRAME)); + void (*judge_scroll_bars_hook) (struct frame *FRAME); /* Called to read input events. @@ -584,17 +584,17 @@ struct terminal Therefore, in most cases EXPECTED should be simply ignored. XXX This documentation needs to be updated. */ - int (*read_socket_hook) P_ ((struct terminal *terminal, - int expected, - struct input_event *hold_quit)); + int (*read_socket_hook) (struct terminal *terminal, + int expected, + struct input_event *hold_quit); /* Called when a frame's display becomes entirely up to date. */ - void (*frame_up_to_date_hook) P_ ((struct frame *)); + void (*frame_up_to_date_hook) (struct frame *); /* Called to delete the device-specific portions of a frame that is on this terminal device. */ - void (*delete_frame_hook) P_ ((struct frame *)); + void (*delete_frame_hook) (struct frame *); /* Called after the last frame on this terminal is deleted, or when the display device was closed (hangup). @@ -606,7 +606,7 @@ struct terminal on the terminal. delete_frame ensures that there are no live frames on the terminal when it calls this hook, so infinite recursion is prevented. */ - void (*delete_terminal_hook) P_ ((struct terminal *)); + void (*delete_terminal_hook) (struct terminal *); }; @@ -647,10 +647,10 @@ extern struct terminal *terminal_list; /* Return true if the terminal device is not suspended. */ #define TERMINAL_ACTIVE_P(d) (((d)->type != output_termcap && (d)->type !=output_msdos_raw) || (d)->display_info.tty->input) -extern Lisp_Object get_terminal_param P_ ((struct terminal *, Lisp_Object)); -extern struct terminal *get_terminal P_ ((Lisp_Object terminal, int)); -extern struct terminal *create_terminal P_ ((void)); -extern void delete_terminal P_ ((struct terminal *)); +extern Lisp_Object get_terminal_param (struct terminal *, Lisp_Object); +extern struct terminal *get_terminal (Lisp_Object terminal, int); +extern struct terminal *create_terminal (void); +extern void delete_terminal (struct terminal *); /* The initial terminal device, created by initial_term_init. */ extern struct terminal *initial_terminal; diff --git a/src/terminal.c b/src/terminal.c index 45d918a2bd4..bda6c307a10 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -40,7 +40,7 @@ struct terminal *initial_terminal; /* Function to use to ring the bell. */ Lisp_Object Vring_bell_function; -static void delete_initial_terminal P_ ((struct terminal *)); +static void delete_initial_terminal (struct terminal *); @@ -300,8 +300,7 @@ selected frame's terminal). Normally, you may not delete a display if all other displays are suspended, but if the second argument FORCE is non-nil, you may do so. */) - (terminal, force) - Lisp_Object terminal, force; + (Lisp_Object terminal, Lisp_Object force) { struct terminal *t = get_terminal (terminal, 0); @@ -342,8 +341,7 @@ DEFUN ("frame-terminal", Fframe_terminal, Sframe_terminal, 0, 1, 0, If FRAME is nil, the selected frame is used. The terminal device is represented by its integer identifier. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { struct terminal *t; @@ -370,8 +368,7 @@ Value is nil if OBJECT is not a live display terminal. If object is a live display terminal, the return value indicates what sort of output terminal it uses. See the documentation of `framep' for possible return values. */) - (object) - Lisp_Object object; + (Lisp_Object object) { struct terminal *t; @@ -402,7 +399,7 @@ possible return values. */) DEFUN ("terminal-list", Fterminal_list, Sterminal_list, 0, 0, 0, doc: /* Return a list of all terminal devices. */) - () + (void) { Lisp_Object terminal, terminals = Qnil; struct terminal *t; @@ -422,8 +419,7 @@ It is not guaranteed that the returned value is unique among opened devices. TERMINAL may be a terminal object, a frame, or nil (meaning the selected frame's terminal). */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct terminal *t = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1); @@ -435,9 +431,7 @@ selected frame's terminal). */) /* Return the value of terminal parameter PARAM in terminal T. */ Lisp_Object -get_terminal_param (t, param) - struct terminal *t; - Lisp_Object param; +get_terminal_param (struct terminal *t, Lisp_Object param) { Lisp_Object tem = Fassq (param, t->param_alist); if (EQ (tem, Qnil)) @@ -449,10 +443,7 @@ get_terminal_param (t, param) Return the previous value. */ Lisp_Object -store_terminal_param (t, parameter, value) - struct terminal *t; - Lisp_Object parameter; - Lisp_Object value; +store_terminal_param (struct terminal *t, Lisp_Object parameter, Lisp_Object value) { Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist); if (EQ (old_alist_elt, Qnil)) @@ -476,8 +467,7 @@ is a symbol. TERMINAL can be a terminal object, a frame, or nil (meaning the selected frame's terminal). */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct terminal *t = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1); @@ -488,9 +478,7 @@ DEFUN ("terminal-parameter", Fterminal_parameter, Sterminal_parameter, 2, 2, 0, doc: /* Return TERMINAL's value for parameter PARAMETER. TERMINAL can be a terminal object, a frame, or nil (meaning the selected frame's terminal). */) - (terminal, parameter) - Lisp_Object terminal; - Lisp_Object parameter; + (Lisp_Object terminal, Lisp_Object parameter) { Lisp_Object value; struct terminal *t @@ -507,10 +495,7 @@ Return the previous value of PARAMETER. TERMINAL can be a terminal object, a frame or nil (meaning the selected frame's terminal). */) - (terminal, parameter, value) - Lisp_Object terminal; - Lisp_Object parameter; - Lisp_Object value; + (Lisp_Object terminal, Lisp_Object parameter, Lisp_Object value) { struct terminal *t = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1); @@ -552,7 +537,7 @@ delete_initial_terminal (struct terminal *terminal) } void -syms_of_terminal () +syms_of_terminal (void) { DEFVAR_LISP ("ring-bell-function", &Vring_bell_function, diff --git a/src/terminfo.c b/src/terminfo.c index 55508196fae..89d7426e8f4 100644 --- a/src/terminfo.c +++ b/src/terminfo.c @@ -35,13 +35,10 @@ char *UP, *BC, PC; */ char * -tparam (string, outstring, len, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) - char *string; - char *outstring; - int len, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9; +tparam (char *string, char *outstring, int len, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9) { char *temp; - extern char *tparm(); + extern char *tparm(/* ??? */); temp = tparm (string, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); if (outstring == 0) diff --git a/src/textprop.c b/src/textprop.c index 83d09cce558..0e398e41e4a 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -78,15 +78,14 @@ Lisp_Object Vtext_property_default_nonsticky; Lisp_Object interval_insert_behind_hooks; Lisp_Object interval_insert_in_front_hooks; -static void text_read_only P_ ((Lisp_Object)) NO_RETURN; +static void text_read_only (Lisp_Object) NO_RETURN; /* Signal a `text-read-only' error. This function makes it easier to capture that error in GDB by putting a breakpoint on it. */ static void -text_read_only (propval) - Lisp_Object propval; +text_read_only (Lisp_Object propval) { if (STRINGP (propval)) xsignal1 (Qtext_read_only, propval); @@ -123,9 +122,7 @@ text_read_only (propval) #define hard 1 INTERVAL -validate_interval_range (object, begin, end, force) - Lisp_Object object, *begin, *end; - int force; +validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *end, int force) { register INTERVAL i; int searchpos; @@ -191,8 +188,7 @@ validate_interval_range (object, begin, end, force) is even numbered and thus suitable as a plist. */ static Lisp_Object -validate_plist (list) - Lisp_Object list; +validate_plist (Lisp_Object list) { if (NILP (list)) return Qnil; @@ -218,9 +214,7 @@ validate_plist (list) with the same values, of list PLIST. */ static int -interval_has_all_properties (plist, i) - Lisp_Object plist; - INTERVAL i; +interval_has_all_properties (Lisp_Object plist, INTERVAL i) { register Lisp_Object tail1, tail2, sym1; register int found; @@ -256,9 +250,7 @@ interval_has_all_properties (plist, i) properties of PLIST, regardless of their values. */ static INLINE int -interval_has_some_properties (plist, i) - Lisp_Object plist; - INTERVAL i; +interval_has_some_properties (Lisp_Object plist, INTERVAL i) { register Lisp_Object tail1, tail2, sym; @@ -280,9 +272,7 @@ interval_has_some_properties (plist, i) property names in LIST, regardless of their values. */ static INLINE int -interval_has_some_properties_list (list, i) - Lisp_Object list; - INTERVAL i; +interval_has_some_properties_list (Lisp_Object list, INTERVAL i) { register Lisp_Object tail1, tail2, sym; @@ -305,8 +295,7 @@ interval_has_some_properties_list (list, i) /* Return the value of PROP in property-list PLIST, or Qunbound if it has none. */ static Lisp_Object -property_value (plist, prop) - Lisp_Object plist, prop; +property_value (Lisp_Object plist, Lisp_Object prop) { Lisp_Object value; @@ -324,9 +313,7 @@ property_value (plist, prop) OBJECT is the string or buffer that INTERVAL belongs to. */ static void -set_properties (properties, interval, object) - Lisp_Object properties, object; - INTERVAL interval; +set_properties (Lisp_Object properties, INTERVAL interval, Lisp_Object object) { Lisp_Object sym, value; @@ -372,10 +359,7 @@ set_properties (properties, interval, object) are actually added to I's plist) */ static int -add_properties (plist, i, object) - Lisp_Object plist; - INTERVAL i; - Lisp_Object object; +add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object) { Lisp_Object tail1, tail2, sym1, val1; register int changed = 0; @@ -451,10 +435,7 @@ add_properties (plist, i, object) OBJECT is the string or buffer containing I. */ static int -remove_properties (plist, list, i, object) - Lisp_Object plist, list; - INTERVAL i; - Lisp_Object object; +remove_properties (Lisp_Object plist, Lisp_Object list, INTERVAL i, Lisp_Object object) { register Lisp_Object tail1, tail2, sym, current_plist; register int changed = 0; @@ -535,9 +516,7 @@ erase_properties (i) POSITION is BEG-based. */ INTERVAL -interval_of (position, object) - int position; - Lisp_Object object; +interval_of (int position, Lisp_Object object) { register INTERVAL i; int beg, end; @@ -579,8 +558,7 @@ If the optional second argument OBJECT is a buffer (or nil, which means the current buffer), POSITION is a buffer position (integer or marker). If OBJECT is a string, POSITION is a 0-based index into it. If POSITION is at the end of OBJECT, the value is nil. */) - (position, object) - Lisp_Object position, object; + (Lisp_Object position, Lisp_Object object) { register INTERVAL i; @@ -604,9 +582,7 @@ DEFUN ("get-text-property", Fget_text_property, Sget_text_property, 2, 3, 0, doc: /* Return the value of POSITION's property PROP, in OBJECT. OBJECT is optional and defaults to the current buffer. If POSITION is at the end of OBJECT, the value is nil. */) - (position, prop, object) - Lisp_Object position, object; - Lisp_Object prop; + (Lisp_Object position, Lisp_Object prop, Lisp_Object object) { return textget (Ftext_properties_at (position, object), prop); } @@ -623,10 +599,7 @@ If POSITION is at the end of OBJECT, the value is nil. */) window-specific overlays are considered only if they are associated with OBJECT. */ Lisp_Object -get_char_property_and_overlay (position, prop, object, overlay) - Lisp_Object position, object; - register Lisp_Object prop; - Lisp_Object *overlay; +get_char_property_and_overlay (Lisp_Object position, register Lisp_Object prop, Lisp_Object object, Lisp_Object *overlay) { struct window *w = 0; @@ -689,9 +662,7 @@ If OBJECT is a buffer, then overlay properties are considered as well as text properties. If OBJECT is a window, then that window's buffer is used, but window-specific overlays are considered only if they are associated with OBJECT. */) - (position, prop, object) - Lisp_Object position, object; - register Lisp_Object prop; + (Lisp_Object position, Lisp_Object prop, Lisp_Object object) { return get_char_property_and_overlay (position, prop, object, 0); } @@ -710,9 +681,7 @@ value is always nil, since strings do not have overlays. If OBJECT is a window, then that window's buffer is used, but window-specific overlays are considered only if they are associated with OBJECT. If POSITION is at the end of OBJECT, both car and cdr are nil. */) - (position, prop, object) - Lisp_Object position, object; - register Lisp_Object prop; + (Lisp_Object position, Lisp_Object prop, Lisp_Object object) { Lisp_Object overlay; Lisp_Object val @@ -732,8 +701,7 @@ If none is found up to (point-max), the function returns (point-max). If the optional second argument LIMIT is non-nil, don't search past position LIMIT; return LIMIT if nothing is found before LIMIT. LIMIT is a no-op if it is greater than (point-max). */) - (position, limit) - Lisp_Object position, limit; + (Lisp_Object position, Lisp_Object limit) { Lisp_Object temp; @@ -758,8 +726,7 @@ If none is found since (point-min), the function returns (point-min). If the optional second argument LIMIT is non-nil, don't search past position LIMIT; return LIMIT if nothing is found before LIMIT. LIMIT is a no-op if it is less than (point-min). */) - (position, limit) - Lisp_Object position, limit; + (Lisp_Object position, Lisp_Object limit) { Lisp_Object temp; @@ -791,8 +758,7 @@ If the property is constant all the way to the end of OBJECT, return the last valid position in OBJECT. If the optional fourth argument LIMIT is non-nil, don't search past position LIMIT; return LIMIT if nothing is found before LIMIT. */) - (position, prop, object, limit) - Lisp_Object prop, position, object, limit; + (Lisp_Object position, Lisp_Object prop, Lisp_Object object, Lisp_Object limit) { if (STRINGP (object)) { @@ -876,8 +842,7 @@ If the property is constant all the way to the start of OBJECT, return the first valid position in OBJECT. If the optional fourth argument LIMIT is non-nil, don't search back past position LIMIT; return LIMIT if nothing is found before LIMIT. */) - (position, prop, object, limit) - Lisp_Object prop, position, object, limit; + (Lisp_Object position, Lisp_Object prop, Lisp_Object object, Lisp_Object limit) { if (STRINGP (object)) { @@ -965,8 +930,7 @@ If the value is non-nil, it is a position greater than POSITION, never equal. If the optional third argument LIMIT is non-nil, don't search past position LIMIT; return LIMIT if nothing is found before LIMIT. */) - (position, object, limit) - Lisp_Object position, object, limit; + (Lisp_Object position, Lisp_Object object, Lisp_Object limit) { register INTERVAL i, next; @@ -1020,8 +984,7 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) /* Return 1 if there's a change in some property between BEG and END. */ int -property_change_between_p (beg, end) - int beg, end; +property_change_between_p (int beg, int end) { register INTERVAL i, next; Lisp_Object object, pos; @@ -1063,8 +1026,7 @@ If the value is non-nil, it is a position greater than POSITION, never equal. If the optional fourth argument LIMIT is non-nil, don't search past position LIMIT; return LIMIT if nothing is found before LIMIT. */) - (position, prop, object, limit) - Lisp_Object position, prop, object, limit; + (Lisp_Object position, Lisp_Object prop, Lisp_Object object, Lisp_Object limit) { register INTERVAL i, next; register Lisp_Object here_val; @@ -1111,8 +1073,7 @@ If the value is non-nil, it is a position less than POSITION, never equal. If the optional third argument LIMIT is non-nil, don't search back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) - (position, object, limit) - Lisp_Object position, object, limit; + (Lisp_Object position, Lisp_Object object, Lisp_Object limit) { register INTERVAL i, previous; @@ -1160,8 +1121,7 @@ If the value is non-nil, it is a position less than POSITION, never equal. If the optional fourth argument LIMIT is non-nil, don't search back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) - (position, prop, object, limit) - Lisp_Object position, prop, object, limit; + (Lisp_Object position, Lisp_Object prop, Lisp_Object object, Lisp_Object limit) { register INTERVAL i, previous; register Lisp_Object here_val; @@ -1210,8 +1170,7 @@ OBJECT is a buffer (or nil, which means the current buffer), START and END are buffer positions (integers or markers). If OBJECT is a string, START and END are 0-based indices into it. Return t if any property value actually changed, nil otherwise. */) - (start, end, properties, object) - Lisp_Object start, end, properties, object; + (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) { register INTERVAL i, unchanged; register int s, len, modified = 0; @@ -1318,8 +1277,7 @@ specify the property to add. If the optional fifth argument OBJECT is a buffer (or nil, which means the current buffer), START and END are buffer positions (integers or markers). If OBJECT is a string, START and END are 0-based indices into it. */) - (start, end, property, value, object) - Lisp_Object start, end, property, value, object; + (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) { Fadd_text_properties (start, end, Fcons (property, Fcons (value, Qnil)), @@ -1336,8 +1294,7 @@ the current buffer), START and END are buffer positions (integers or markers). If OBJECT is a string, START and END are 0-based indices into it. If PROPERTIES is nil, the effect is to remove all properties from the designated part of OBJECT. */) - (start, end, properties, object) - Lisp_Object start, end, properties, object; + (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) { return set_text_properties (start, end, properties, object, Qt); } @@ -1353,8 +1310,7 @@ the designated part of OBJECT. */) otherwise. */ Lisp_Object -set_text_properties (start, end, properties, object, coherent_change_p) - Lisp_Object start, end, properties, object, coherent_change_p; +set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object, Lisp_Object coherent_change_p) { register INTERVAL i; Lisp_Object ostart, oend; @@ -1418,9 +1374,7 @@ set_text_properties (start, end, properties, object, coherent_change_p) START and END can be in any order. */ void -set_text_properties_1 (start, end, properties, buffer, i) - Lisp_Object start, end, properties, buffer; - INTERVAL i; +set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object buffer, INTERVAL i) { register INTERVAL prev_changed = NULL_INTERVAL; register int s, len; @@ -1509,8 +1463,7 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. Return t if any property was actually removed, nil otherwise. Use `set-text-properties' if you want to remove all text properties. */) - (start, end, properties, object) - Lisp_Object start, end, properties, object; + (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) { register INTERVAL i, unchanged; register int s, len, modified = 0; @@ -1595,8 +1548,7 @@ If the optional fourth argument OBJECT is a buffer (or nil, which means the current buffer), START and END are buffer positions (integers or markers). If OBJECT is a string, START and END are 0-based indices into it. Return t if any property was actually removed, nil otherwise. */) - (start, end, list_of_properties, object) - Lisp_Object start, end, list_of_properties, object; + (Lisp_Object start, Lisp_Object end, Lisp_Object list_of_properties, Lisp_Object object) { register INTERVAL i, unchanged; register int s, len, modified = 0; @@ -1703,8 +1655,7 @@ is `eq' to VALUE. Otherwise return nil. If the optional fifth argument OBJECT is a buffer (or nil, which means the current buffer), START and END are buffer positions (integers or markers). If OBJECT is a string, START and END are 0-based indices into it. */) - (start, end, property, value, object) - Lisp_Object start, end, property, value, object; + (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) { register INTERVAL i; register int e, pos; @@ -1740,8 +1691,7 @@ is not `eq' to VALUE. Otherwise, return nil. If the optional fifth argument OBJECT is a buffer (or nil, which means the current buffer), START and END are buffer positions (integers or markers). If OBJECT is a string, START and END are 0-based indices into it. */) - (start, end, property, value, object) - Lisp_Object start, end, property, value, object; + (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) { register INTERVAL i; register int s, e; @@ -1777,8 +1727,7 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */ BUFFER can be either a buffer or nil (meaning current buffer). */ int -text_property_stickiness (prop, pos, buffer) - Lisp_Object prop, pos, buffer; +text_property_stickiness (Lisp_Object prop, Lisp_Object pos, Lisp_Object buffer) { Lisp_Object prev_pos, front_sticky; int is_rear_sticky = 1, is_front_sticky = 0; /* defaults */ @@ -1851,8 +1800,7 @@ text_property_stickiness (prop, pos, buffer) /* Note this can GC when DEST is a buffer. */ Lisp_Object -copy_text_properties (start, end, src, pos, dest, prop) - Lisp_Object start, end, src, pos, dest, prop; +copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_Object pos, Lisp_Object dest, Lisp_Object prop) { INTERVAL i; Lisp_Object res; @@ -1944,8 +1892,7 @@ copy_text_properties (start, end, src, pos, dest, prop) doesn't contain text properties between START and END. */ Lisp_Object -text_property_list (object, start, end, prop) - Lisp_Object object, start, end, prop; +text_property_list (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp_Object prop) { struct interval *i; Lisp_Object result; @@ -2002,8 +1949,7 @@ text_property_list (object, start, end, prop) non-zero if OBJECT was modified. */ int -add_text_properties_from_list (object, list, delta) - Lisp_Object object, list, delta; +add_text_properties_from_list (Lisp_Object object, Lisp_Object list, Lisp_Object delta) { struct gcpro gcpro1, gcpro2; int modified_p = 0; @@ -2036,8 +1982,7 @@ add_text_properties_from_list (object, list, delta) end-points to NEW_END. */ Lisp_Object -extend_property_ranges (list, new_end) - Lisp_Object list, new_end; +extend_property_ranges (Lisp_Object list, Lisp_Object new_end) { Lisp_Object prev = Qnil, head = list; int max = XINT (new_end); @@ -2072,8 +2017,7 @@ extend_property_ranges (list, new_end) /* Call the modification hook functions in LIST, each with START and END. */ static void -call_mod_hooks (list, start, end) - Lisp_Object list, start, end; +call_mod_hooks (Lisp_Object list, Lisp_Object start, Lisp_Object end) { struct gcpro gcpro1; GCPRO1 (list); @@ -2094,9 +2038,7 @@ call_mod_hooks (list, start, end) those hooks in order, with START and END - 1 as arguments. */ void -verify_interval_modification (buf, start, end) - struct buffer *buf; - int start, end; +verify_interval_modification (struct buffer *buf, int start, int end) { register INTERVAL intervals = BUF_INTERVALS (buf); register INTERVAL i; @@ -2274,8 +2216,7 @@ verify_interval_modification (buf, start, end) so it can indicate the range of inserted text. */ void -report_interval_modification (start, end) - Lisp_Object start, end; +report_interval_modification (Lisp_Object start, Lisp_Object end) { if (! NILP (interval_insert_behind_hooks)) call_mod_hooks (interval_insert_behind_hooks, start, end); @@ -2286,7 +2227,7 @@ report_interval_modification (start, end) } void -syms_of_textprop () +syms_of_textprop (void) { DEFVAR_LISP ("default-text-properties", &Vdefault_text_properties, doc: /* Property-list used as default values. diff --git a/src/tparam.c b/src/tparam.c index dcf79a3b617..d8a8f0260f0 100644 --- a/src/tparam.c +++ b/src/tparam.c @@ -18,66 +18,14 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Emacs config.h may rename various library functions such as malloc. */ -#ifdef HAVE_CONFIG_H #include <config.h> -#endif - -#ifdef emacs #include <setjmp.h> #include "lisp.h" /* for xmalloc */ -#else - -#ifdef STDC_HEADERS -#include <stdlib.h> -#include <string.h> -#else -char *malloc (); -char *realloc (); -#endif - -/* Do this after the include, in case string.h prototypes bcopy. */ -#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy) -#define bcopy(s, d, n) memcpy ((d), (s), (n)) -#endif - -#endif /* not emacs */ #ifndef NULL #define NULL (char *) 0 #endif -#ifndef emacs -static void -memory_out () -{ - write (2, "virtual memory exhausted\n", 25); - exit (1); -} - -static char * -xmalloc (size) - unsigned size; -{ - register char *tem = malloc (size); - - if (!tem) - memory_out (); - return tem; -} - -static char * -xrealloc (ptr, size) - char *ptr; - unsigned size; -{ - register char *tem = realloc (ptr, size); - - if (!tem) - memory_out (); - return tem; -} -#endif /* not emacs */ - /* Assuming STRING is the value of a termcap string entry containing `%' constructs to expand parameters, merge in parameter values and store result in block OUTSTRING points to. @@ -90,15 +38,11 @@ xrealloc (ptr, size) The fourth and following args to tparam serve as the parameter values. */ -static char *tparam1 (); +static char *tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp); /* VARARGS 2 */ char * -tparam (string, outstring, len, arg0, arg1, arg2, arg3) - char *string; - char *outstring; - int len; - int arg0, arg1, arg2, arg3; +tparam (char *string, char *outstring, int len, int arg0, int arg1, int arg2, int arg3) { int arg[4]; @@ -115,9 +59,7 @@ char *UP; static char tgoto_buf[50]; char * -tgoto (cm, hpos, vpos) - char *cm; - int hpos, vpos; +tgoto (char *cm, int hpos, int vpos) { int args[2]; if (!cm) @@ -128,12 +70,7 @@ tgoto (cm, hpos, vpos) } static char * -tparam1 (string, outstring, len, up, left, argp) - char *string; - char *outstring; - int len; - char *up, *left; - register int *argp; +tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp) { register int c; register char *p = string; @@ -162,7 +99,7 @@ tparam1 (string, outstring, len, up, left, argp) { outlen = len + 40; new = (char *) xmalloc (outlen); - bcopy (outstring, new, offset); + memcpy (new, outstring, offset); } else { diff --git a/src/undo.c b/src/undo.c index b678c5c58ba..14a8268394a 100644 --- a/src/undo.c +++ b/src/undo.c @@ -67,8 +67,7 @@ int undo_inhibit_record_point; undo record that will be added just after this command terminates. */ static void -record_point (pt) - int pt; +record_point (int pt) { int at_boundary; @@ -130,8 +129,7 @@ record_point (pt) because we don't need to record the contents.) */ void -record_insert (beg, length) - int beg, length; +record_insert (int beg, int length) { Lisp_Object lbeg, lend; @@ -166,9 +164,7 @@ record_insert (beg, length) of the characters in STRING, at location BEG. */ void -record_delete (beg, string) - int beg; - Lisp_Object string; +record_delete (int beg, Lisp_Object string) { Lisp_Object sbeg; @@ -196,9 +192,7 @@ record_delete (beg, string) won't be inverted automatically by undoing the buffer modification. */ void -record_marker_adjustment (marker, adjustment) - Lisp_Object marker; - int adjustment; +record_marker_adjustment (Lisp_Object marker, int adjustment) { if (EQ (current_buffer->undo_list, Qt)) return; @@ -221,8 +215,7 @@ record_marker_adjustment (marker, adjustment) The replacement must not change the number of characters. */ void -record_change (beg, length) - int beg, length; +record_change (int beg, int length) { record_delete (beg, make_buffer_string (beg, beg + length, 1)); record_insert (beg, length); @@ -233,7 +226,7 @@ record_change (beg, length) we can tell whether it is obsolete because the file was saved again. */ void -record_first_change () +record_first_change (void) { Lisp_Object high, low; struct buffer *base_buffer = current_buffer; @@ -257,9 +250,7 @@ record_first_change () for LENGTH characters starting at position BEG in BUFFER. */ void -record_property_change (beg, length, prop, value, buffer) - int beg, length; - Lisp_Object prop, value, buffer; +record_property_change (int beg, int length, Lisp_Object prop, Lisp_Object value, Lisp_Object buffer) { Lisp_Object lbeg, lend, entry; struct buffer *obuf = current_buffer, *buf = XBUFFER (buffer); @@ -297,7 +288,7 @@ DEFUN ("undo-boundary", Fundo_boundary, Sundo_boundary, 0, 0, 0, doc: /* Mark a boundary between units of undo. An undo command will stop at this point, but another undo command will undo to the previous boundary. */) - () + (void) { Lisp_Object tem; if (EQ (current_buffer->undo_list, Qt)) @@ -328,8 +319,7 @@ but another undo command will undo to the previous boundary. */) In some cases this works by calling undo-outer-limit-function. */ void -truncate_undo_list (b) - struct buffer *b; +truncate_undo_list (struct buffer *b) { Lisp_Object list; Lisp_Object prev, next, last_boundary; @@ -465,8 +455,7 @@ truncate_undo_list (b) DEFUN ("primitive-undo", Fprimitive_undo, Sprimitive_undo, 2, 2, 0, doc: /* Undo N records from the front of the list LIST. Return what remains of the list. */) - (n, list) - Lisp_Object n, list; + (Lisp_Object n, Lisp_Object list) { struct gcpro gcpro1, gcpro2; Lisp_Object next; @@ -665,7 +654,7 @@ Return what remains of the list. */) } void -syms_of_undo () +syms_of_undo (void) { Qinhibit_read_only = intern_c_string ("inhibit-read-only"); staticpro (&Qinhibit_read_only); diff --git a/src/unexaix.c b/src/unexaix.c index 2657d144296..949616d5e31 100644 --- a/src/unexaix.c +++ b/src/unexaix.c @@ -71,7 +71,7 @@ what you give them. Help stamp out software-hoarding! */ #include <unistd.h> #include <fcntl.h> -extern char *start_of_text (void); /* Start of text */ +char *start_of_text (void); /* Start of text */ extern char *start_of_data (void); /* Start of initialized data */ extern int _data; @@ -669,5 +669,18 @@ unrelocate_symbols (int new, int a_out, char *a_name, char *new_name) return 0; } +/* + * Return the address of the start of the text segment prior to + * doing an unexec. After unexec the return value is undefined. + * See crt0.c for further explanation and _start. + * + */ + +char * +start_of_text (void) +{ + return ((char *) 0x10000000); +} + /* arch-tag: 0783857a-7c2d-456f-a426-58b722d69fd0 (do not change this comment) */ diff --git a/src/unexalpha.c b/src/unexalpha.c index 13c1def5714..d0faa179931 100644 --- a/src/unexalpha.c +++ b/src/unexalpha.c @@ -28,9 +28,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <sys/mman.h> #include <stdio.h> #include <errno.h> -#ifdef HAVE_STRING_H #include <string.h> -#endif #if !defined (__NetBSD__) && !defined (__OpenBSD__) #include <filehdr.h> #include <aouthdr.h> @@ -79,12 +77,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define _RDATA ".rdata" #define _SDATA ".sdata" #define _SBSS ".sbss" +#define TEXT_START 0x120000000 #endif /* __NetBSD__ || __OpenBSD__ */ -static void fatal_unexec __P ((char *, char *)); -static void mark_x __P ((char *)); -static void update_dynamic_symbols __P ((char *, char *, int, struct aouthdr)); +static void fatal_unexec (char *, char *); +static void mark_x (char *); + +static void update_dynamic_symbols (char *, char *, int, struct aouthdr); #define READ(_fd, _buffer, _size, _error_message, _error_arg) \ errno = EEOF; \ @@ -260,7 +260,7 @@ unexec (new_name, a_name, data_start, bss_start, entry_address) Brk = brk; - bcopy (data_section, &old_data_scnhdr, sizeof (old_data_scnhdr)); + memcpy (&old_data_scnhdr, data_section, sizeof (old_data_scnhdr)); nhdr.aout.dsize = brk - DATA_START; nhdr.aout.bsize = 0; @@ -328,7 +328,7 @@ unexec (new_name, a_name, data_start, bss_start, entry_address) #ifdef _GOT if (got_section != NULL) { - bcopy (got_section, buffer, sizeof (struct scnhdr)); + memcpy (buffer, got_section, sizeof (struct scnhdr)); got_section->s_vaddr = vaddr; got_section->s_paddr = vaddr; @@ -376,7 +376,7 @@ unexec (new_name, a_name, data_start, bss_start, entry_address) * Construct new symbol table header */ - bcopy (oldptr + nhdr.fhdr.f_symptr, buffer, cbHDRR); + memcpy (buffer, oldptr + nhdr.fhdr.f_symptr, cbHDRR); #define symhdr ((pHDRR)buffer) newsyms = nhdr.aout.tsize + nhdr.aout.dsize; diff --git a/src/unexec.c b/src/unexec.c index 1a27db1232d..8edd9e22b96 100644 --- a/src/unexec.c +++ b/src/unexec.c @@ -472,7 +472,7 @@ write_segment (new, ptr, end) int pagesize = getpagesize (); char zeros[1 << 13]; - bzero (zeros, sizeof (zeros)); + memset (zeros, 0, sizeof (zeros)); for (i = 0; ptr < end;) { @@ -687,6 +687,21 @@ adjust_lnnoptrs (writedesc, readdesc, new_name) return 0; } +extern unsigned start __asm__ ("start"); + +/* + * Return the address of the start of the text segment prior to + * doing an unexec. After unexec the return value is undefined. + * See crt0.c for further explanation and _start. + * + */ + +char * +start_of_text (void) +{ + return ((char *) &start); +} + /* **************************************************************** * unexec * diff --git a/src/unexelf.c b/src/unexelf.c index a91af9458eb..2ac6bbdc06e 100644 --- a/src/unexelf.c +++ b/src/unexelf.c @@ -594,8 +594,7 @@ typedef unsigned char byte; /* Round X up to a multiple of Y. */ static ElfW(Addr) -round_up (x, y) - ElfW(Addr) x, y; +round_up (ElfW(Addr) x, ElfW(Addr) y) { int rem = x % y; if (rem == 0) @@ -611,13 +610,8 @@ round_up (x, y) if NOERROR is 0; we return -1 if NOERROR is nonzero. */ static int -find_section (name, section_names, file_name, old_file_h, old_section_h, noerror) - char *name; - char *section_names; - char *file_name; - ElfW(Ehdr) *old_file_h; - ElfW(Shdr) *old_section_h; - int noerror; +find_section (char *name, char *section_names, char *file_name, + ElfW(Ehdr) *old_file_h, ElfW(Shdr) *old_section_h, int noerror) { int idx; @@ -652,9 +646,8 @@ find_section (name, section_names, file_name, old_file_h, old_section_h, noerror * */ void -unexec (new_name, old_name, data_start, bss_start, entry_address) - char *new_name, *old_name; - unsigned data_start, bss_start, entry_address; +unexec (char *new_name, char *old_name, unsigned int data_start, + unsigned int bss_start, unsigned int entry_address) { int new_file, old_file, new_file_size; diff --git a/src/unexmacosx.c b/src/unexmacosx.c index 3949e5f6e00..1acc009ba90 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c @@ -218,7 +218,7 @@ unexec_write_zero (off_t dest, size_t count) char buf[UNEXEC_COPY_BUFSZ]; ssize_t bytes; - bzero (buf, UNEXEC_COPY_BUFSZ); + memset (buf, 0, UNEXEC_COPY_BUFSZ); if (lseek (outfd, dest, SEEK_SET) != dest) return 0; diff --git a/src/vm-limit.c b/src/vm-limit.c index a5b07eb50da..b288276f394 100644 --- a/src/vm-limit.c +++ b/src/vm-limit.c @@ -23,13 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "lisp.h" #endif -#ifndef emacs -#include <stddef.h> -typedef size_t SIZE; -typedef void *POINTER; -#define EXCEEDS_LISP_PTR(x) 0 -#endif - #include "mem-limits.h" #ifdef HAVE_GETRLIMIT @@ -49,7 +42,7 @@ static enum warnlevel warnlevel; /* Function to call to issue a warning; 0 means don't issue them. */ -static void (*warn_function) (); +static void (*warn_function) (const char *); /* Start of data space; can be changed by calling malloc_init. */ static POINTER data_space_start; @@ -58,17 +51,9 @@ static POINTER data_space_start; static unsigned long lim_data; -#ifdef NO_LIM_DATA -static void -get_lim_data () -{ - lim_data = -1; -} -#else /* not NO_LIM_DATA */ - #if defined (HAVE_GETRLIMIT) && defined (RLIMIT_AS) static void -get_lim_data () +get_lim_data (void) { struct rlimit rlimit; @@ -84,7 +69,7 @@ get_lim_data () #ifdef USG static void -get_lim_data () +get_lim_data (void) { extern long ulimit (); @@ -108,7 +93,7 @@ get_lim_data () #ifdef WINDOWSNT static void -get_lim_data () +get_lim_data (void) { extern unsigned long reserved_heap_size; lim_data = reserved_heap_size; @@ -119,7 +104,7 @@ get_lim_data () #ifdef MSDOS void -get_lim_data () +get_lim_data (void) { _go32_dpmi_meminfo info; unsigned long lim1, lim2; @@ -150,14 +135,14 @@ get_lim_data () } unsigned long -ret_lim_data () +ret_lim_data (void) { get_lim_data (); return lim_data; } #else /* not MSDOS */ static void -get_lim_data () +get_lim_data (void) { lim_data = vlimit (LIM_DATA, -1); } @@ -166,7 +151,7 @@ get_lim_data () #else /* BSD4_2 */ static void -get_lim_data () +get_lim_data (void) { struct rlimit XXrlimit; @@ -181,12 +166,11 @@ get_lim_data () #endif /* not WINDOWSNT */ #endif /* not USG */ #endif /* not HAVE_GETRLIMIT */ -#endif /* not NO_LIM_DATA */ /* Verify amount of memory available, complaining if we're near the end. */ static void -check_memory_limits () +check_memory_limits (void) { #ifdef REL_ALLOC extern POINTER (*real_morecore) (); @@ -260,16 +244,54 @@ check_memory_limits () (*warn_function) ("Warning: memory in use exceeds lisp pointer size"); } +#if !defined(CANNOT_DUMP) || !defined(SYSTEM_MALLOC) +/* Some systems that cannot dump also cannot implement these. */ + +/* + * Return the address of the start of the data segment prior to + * doing an unexec. After unexec the return value is undefined. + * See crt0.c for further information and definition of data_start. + * + * Apparently, on BSD systems this is etext at startup. On + * USG systems (swapping) this is highly mmu dependent and + * is also dependent on whether or not the program is running + * with shared text. Generally there is a (possibly large) + * gap between end of text and start of data with shared text. + * + */ + +POINTER +start_of_data (void) +{ +#ifdef BSD_SYSTEM + extern char etext; + return (POINTER)(&etext); +#elif defined DATA_START + return ((POINTER) DATA_START); +#elif defined ORDINARY_LINK + /* + * This is a hack. Since we're not linking crt0.c or pre_crt0.c, + * data_start isn't defined. We take the address of environ, which + * is known to live at or near the start of the system crt0.c, and + * we don't sweat the handful of bytes that might lose. + */ + extern char **environ; + return ((POINTER) &environ); +#else + extern int data_start; + return ((POINTER) &data_start); +#endif +} +#endif /* (not CANNOT_DUMP or not SYSTEM_MALLOC) */ + /* Enable memory usage warnings. START says where the end of pure storage is. WARNFUN specifies the function to call to issue a warning. */ void -memory_warnings (start, warnfun) - POINTER start; - void (*warnfun) (); +memory_warnings (POINTER start, void (*warnfun) (const char *)) { - extern void (* __after_morecore_hook) (); /* From gmalloc.c */ + extern void (* __after_morecore_hook) (void); /* From gmalloc.c */ if (start) data_space_start = start; diff --git a/src/w16select.c b/src/w16select.c index 9ebf6de6250..384b82ceff1 100644 --- a/src/w16select.c +++ b/src/w16select.c @@ -109,7 +109,7 @@ static size_t clipboard_storage_size; /* Return the WinOldAp support version, or 0x1700 if not supported. */ unsigned -identify_winoldap_version () +identify_winoldap_version (void) { __dpmi_regs regs; @@ -124,7 +124,7 @@ identify_winoldap_version () /* Open the clipboard, return non-zero if successfull. */ unsigned -open_clipboard () +open_clipboard (void) { __dpmi_regs regs; @@ -147,7 +147,7 @@ open_clipboard () /* Empty clipboard, return non-zero if successfull. */ unsigned -empty_clipboard () +empty_clipboard (void) { __dpmi_regs regs; @@ -162,8 +162,7 @@ empty_clipboard () /* Ensure we have a buffer in low memory with enough memory for data of size WANT_SIZE. Return the linear address of the buffer. */ static unsigned long -alloc_xfer_buf (want_size) - unsigned want_size; +alloc_xfer_buf (unsigned want_size) { __dpmi_regs regs; @@ -200,7 +199,7 @@ alloc_xfer_buf (want_size) The clipboard buffer tends to be large in size, because for small clipboard data sizes we use the DJGPP transfer buffer. */ static void -free_xfer_buf () +free_xfer_buf (void) { /* If the size is 0, we used DJGPP transfer buffer, so don't free. */ if (clipboard_xfer_buf_info.size) @@ -218,11 +217,7 @@ free_xfer_buf () /* Copy data into the clipboard, return zero if successfull. */ unsigned -set_clipboard_data (Format, Data, Size, Raw) - unsigned Format; - void *Data; - unsigned Size; - int Raw; +set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw) { __dpmi_regs regs; unsigned truelen; @@ -321,8 +316,7 @@ set_clipboard_data (Format, Data, Size, Raw) /* Return the size of the clipboard data of format FORMAT. */ unsigned -get_clipboard_data_size (Format) - unsigned Format; +get_clipboard_data_size (unsigned Format) { __dpmi_regs regs; @@ -342,11 +336,7 @@ get_clipboard_data_size (Format) Warning: this doesn't check whether DATA has enough space to hold SIZE bytes. */ unsigned -get_clipboard_data (Format, Data, Size, Raw) - unsigned Format; - void *Data; - unsigned Size; - int Raw; +get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw) { __dpmi_regs regs; unsigned long xbuf_addr; @@ -425,7 +415,7 @@ get_clipboard_data (Format, Data, Size, Raw) /* Close clipboard, return non-zero if successfull. */ unsigned -close_clipboard () +close_clipboard (void) { __dpmi_regs regs; @@ -439,8 +429,7 @@ close_clipboard () /* Compact clipboard data so that at least SIZE bytes is available. */ unsigned -clipboard_compact (Size) - unsigned Size; +clipboard_compact (unsigned Size) { __dpmi_regs regs; @@ -464,8 +453,7 @@ static char system_error_msg[] = DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_data, 1, 2, 0, doc: /* This sets the clipboard data to the given text. */) - (string, frame) - Lisp_Object string, frame; + (Lisp_Object string, Lisp_Object frame) { unsigned ok = 1, put_status = 0; int nbytes, charset_info, no_crlf_conversion; @@ -574,8 +562,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_data, 0, 1, 0, doc: /* This gets the clipboard data in text format. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { unsigned data_size, truelen; unsigned char *htext = NULL; @@ -669,8 +656,7 @@ the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. \(Those are literal upper-case symbol names, since that's what X expects.) For convenience, the symbol nil is the same as `PRIMARY', and t is the same as `SECONDARY'. */) - (selection) - Lisp_Object selection; + (Lisp_Object selection) { CHECK_SYMBOL (selection); @@ -705,7 +691,7 @@ and t is the same as `SECONDARY'. */) } void -syms_of_win16select () +syms_of_win16select (void) { defsubr (&Sw16_set_clipboard_data); defsubr (&Sw16_get_clipboard_data); diff --git a/src/w32.c b/src/w32.c index 0560ce4a6b8..19335742347 100644 --- a/src/w32.c +++ b/src/w32.c @@ -148,7 +148,7 @@ extern Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary; typedef HRESULT (WINAPI * ShGetFolderPath_fn) (IN HWND, IN int, IN HANDLE, IN DWORD, OUT char *); -void globals_of_w32 (); +void globals_of_w32 (void); static DWORD get_rid (PSID); extern Lisp_Object Vw32_downcase_file_names; @@ -308,15 +308,15 @@ typedef BOOL (WINAPI * GetSystemTimes_Proc) ( /* ** A utility function ** */ static BOOL -is_windows_9x () +is_windows_9x (void) { static BOOL s_b_ret=0; OSVERSIONINFO os_ver; if (g_b_init_is_windows_9x == 0) { g_b_init_is_windows_9x = 1; - ZeroMemory(&os_ver, sizeof(OSVERSIONINFO)); - os_ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + ZeroMemory (&os_ver, sizeof (OSVERSIONINFO)); + os_ver.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); if (GetVersionEx (&os_ver)) { s_b_ret = (os_ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS); @@ -329,12 +329,12 @@ is_windows_9x () Returns a list of three integers if the times are provided by the OS (NT derivatives), otherwise it returns the result of current-time. */ Lisp_Object -w32_get_internal_run_time () +w32_get_internal_run_time (void) { if (get_process_times_fn) { FILETIME create, exit, kernel, user; - HANDLE proc = GetCurrentProcess(); + HANDLE proc = GetCurrentProcess (); if ((*get_process_times_fn) (proc, &create, &exit, &kernel, &user)) { LARGE_INTEGER user_int, kernel_int, total; @@ -753,7 +753,7 @@ void WINAPI get_native_system_info ( lpSystemInfo->dwNumberOfProcessors = -1; } -BOOL WINAPI get_system_times( +BOOL WINAPI get_system_times ( LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime) @@ -1035,13 +1035,13 @@ static struct group dflt_group = }; unsigned -getuid () +getuid (void) { return dflt_passwd.pw_uid; } unsigned -geteuid () +geteuid (void) { /* I could imagine arguing for checking to see whether the user is in the Administrators group and returning a UID of 0 for that @@ -1050,13 +1050,13 @@ geteuid () } unsigned -getgid () +getgid (void) { return dflt_passwd.pw_gid; } unsigned -getegid () +getegid (void) { return getgid (); } @@ -1091,7 +1091,7 @@ getpwnam (char *name) } void -init_user_info () +init_user_info (void) { /* Find the user's real name by opening the process token and looking up the name associated with the user-sid in that token. @@ -1207,7 +1207,7 @@ init_user_info () } int -random () +random (void) { /* rand () on NT gives us 15 random bits...hack together 30 bits. */ return ((rand () << 15) | rand ()); @@ -1225,9 +1225,7 @@ srandom (int seed) case path name components to lower case. */ static void -normalize_filename (fp, path_sep) - register char *fp; - char path_sep; +normalize_filename (register char *fp, char path_sep) { char sep; char *elem; @@ -1283,16 +1281,14 @@ normalize_filename (fp, path_sep) /* Destructively turn backslashes into slashes. */ void -dostounix_filename (p) - register char *p; +dostounix_filename (register char *p) { normalize_filename (p, '/'); } /* Destructively turn slashes into backslashes. */ void -unixtodos_filename (p) - register char *p; +unixtodos_filename (register char *p) { normalize_filename (p, '\\'); } @@ -1301,9 +1297,7 @@ unixtodos_filename (p) (From msdos.c...probably should figure out a way to share it, although this code isn't going to ever change.) */ int -crlf_to_lf (n, buf) - register int n; - register unsigned char *buf; +crlf_to_lf (register int n, register unsigned char *buf) { unsigned char *np = buf; unsigned char *startp = buf; @@ -1520,9 +1514,7 @@ alarm (int seconds) #define REG_ROOT "SOFTWARE\\GNU\\Emacs" LPBYTE -w32_get_resource (key, lpdwtype) - char *key; - LPDWORD lpdwtype; +w32_get_resource (char *key, LPDWORD lpdwtype) { LPBYTE lpvalue; HKEY hrootkey = NULL; @@ -1642,7 +1634,7 @@ init_environment (char ** argv) {"LANG", NULL}, }; -#define N_ENV_VARS sizeof(dflt_envvars)/sizeof(dflt_envvars[0]) +#define N_ENV_VARS sizeof (dflt_envvars)/sizeof (dflt_envvars[0]) /* We need to copy dflt_envvars[] and work on the copy because we don't want the dumped Emacs to inherit the values of @@ -1715,7 +1707,7 @@ init_environment (char ** argv) for (p = modname; *p; p++) if (*p == '\\') *p = '/'; - _snprintf (buf, sizeof(buf)-1, "emacs_dir=%s", modname); + _snprintf (buf, sizeof (buf)-1, "emacs_dir=%s", modname); _putenv (strdup (buf)); } /* Handle running emacs from the build directory: src/oo-spd/i386/ */ @@ -1739,7 +1731,7 @@ init_environment (char ** argv) for (p = modname; *p; p++) if (*p == '\\') *p = '/'; - _snprintf (buf, sizeof(buf)-1, "emacs_dir=%s", modname); + _snprintf (buf, sizeof (buf)-1, "emacs_dir=%s", modname); _putenv (strdup (buf)); } } @@ -1767,12 +1759,12 @@ init_environment (char ** argv) char buf1[SET_ENV_BUF_SIZE], buf2[SET_ENV_BUF_SIZE]; if (dwType == REG_EXPAND_SZ) - ExpandEnvironmentStrings ((LPSTR) lpval, buf1, sizeof(buf1)); + ExpandEnvironmentStrings ((LPSTR) lpval, buf1, sizeof (buf1)); else if (dwType == REG_SZ) strcpy (buf1, lpval); if (dwType == REG_EXPAND_SZ || dwType == REG_SZ) { - _snprintf (buf2, sizeof(buf2)-1, "%s=%s", env_vars[i].name, + _snprintf (buf2, sizeof (buf2)-1, "%s=%s", env_vars[i].name, buf1); _putenv (strdup (buf2)); } @@ -2115,7 +2107,7 @@ GetCachedVolumeInformation (char * root_dir) involve network access, and so is extremely quick). */ /* Map drive letter to UNC if remote. */ - if ( isalpha( root_dir[0] ) && !fixed[ DRIVE_INDEX( root_dir[0] ) ] ) + if (isalpha (root_dir[0]) && !fixed[DRIVE_INDEX (root_dir[0])]) { char remote_name[ 256 ]; char drive[3] = { root_dir[0], ':' }; @@ -2514,8 +2506,8 @@ open_unc_volume (const char *path) nr.lpComment = NULL; nr.lpProvider = NULL; - result = WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_DISK, - RESOURCEUSAGE_CONNECTABLE, &nr, &henum); + result = WNetOpenEnum (RESOURCE_GLOBALNET, RESOURCETYPE_DISK, + RESOURCEUSAGE_CONNECTABLE, &nr, &henum); if (result == NO_ERROR) return henum; @@ -2691,7 +2683,7 @@ sys_creat (const char * path, int mode) } FILE * -sys_fopen(const char * path, const char * mode) +sys_fopen (const char * path, const char * mode) { int fd; int oflag; @@ -2778,7 +2770,7 @@ sys_link (const char * old, const char * new) data.wid.dwStreamId = BACKUP_LINK; data.wid.dwStreamAttributes = 0; - data.wid.Size.LowPart = wlen * sizeof(WCHAR); + data.wid.Size.LowPart = wlen * sizeof (WCHAR); data.wid.Size.HighPart = 0; data.wid.dwStreamNameSize = 0; @@ -2980,7 +2972,7 @@ static int init = 0; } while (0) static void -initialize_utc_base () +initialize_utc_base (void) { /* Determine the delta between 1-Jan-1601 and 1-Jan-1970. */ SYSTEMTIME st; @@ -3191,7 +3183,7 @@ get_name_and_id (PSECURITY_DESCRIPTOR psd, const char *fname, char name[UNLEN+1]; DWORD name_len = sizeof (name); char domain[1024]; - DWORD domain_len = sizeof(domain); + DWORD domain_len = sizeof (domain); char *mp = NULL; int use_dflt = 0; int result; @@ -3666,7 +3658,7 @@ utime (const char *name, struct utimbuf *times) /* Helper wrapper functions. */ -HANDLE WINAPI create_toolhelp32_snapshot( +HANDLE WINAPI create_toolhelp32_snapshot ( DWORD Flags, DWORD Ignored) { @@ -3686,7 +3678,7 @@ HANDLE WINAPI create_toolhelp32_snapshot( return (s_pfn_Create_Toolhelp32_Snapshot (Flags, Ignored)); } -BOOL WINAPI process32_first( +BOOL WINAPI process32_first ( HANDLE hSnapshot, LPPROCESSENTRY32 lppe) { @@ -3706,7 +3698,7 @@ BOOL WINAPI process32_first( return (s_pfn_Process32_First (hSnapshot, lppe)); } -BOOL WINAPI process32_next( +BOOL WINAPI process32_next ( HANDLE hSnapshot, LPPROCESSENTRY32 lppe) { @@ -3904,7 +3896,7 @@ BOOL WINAPI global_memory_status_ex ( } Lisp_Object -list_system_processes () +list_system_processes (void) { struct gcpro gcpro1; Lisp_Object proclist = Qnil; @@ -3995,8 +3987,7 @@ restore_privilege (TOKEN_PRIVILEGES *priv) } static Lisp_Object -ltime (time_sec, time_usec) - long time_sec, time_usec; +ltime (long time_sec, long time_usec) { return list3 (make_number ((time_sec >> 16) & 0xffff), make_number (time_sec & 0xffff), @@ -4006,18 +3997,17 @@ ltime (time_sec, time_usec) #define U64_TO_LISP_TIME(time) ltime ((time) / 1000000L, (time) % 1000000L) static int -process_times (h_proc, ctime, etime, stime, utime, ttime, pcpu) - HANDLE h_proc; - Lisp_Object *ctime, *etime, *stime, *utime, *ttime; - double *pcpu; +process_times (HANDLE h_proc, Lisp_Object *ctime, Lisp_Object *etime, + Lisp_Object *stime, Lisp_Object *utime, Lisp_Object *ttime, + double *pcpu) { FILETIME ft_creation, ft_exit, ft_kernel, ft_user, ft_current; ULONGLONG tem1, tem2, tem3, tem; if (!h_proc || !get_process_times_fn - || !(*get_process_times_fn)(h_proc, &ft_creation, &ft_exit, - &ft_kernel, &ft_user)) + || !(*get_process_times_fn) (h_proc, &ft_creation, &ft_exit, + &ft_kernel, &ft_user)) return 0; GetSystemTimeAsFileTime (&ft_current); @@ -4059,8 +4049,7 @@ process_times (h_proc, ctime, etime, stime, utime, ttime, pcpu) } Lisp_Object -system_process_attributes (pid) - Lisp_Object pid; +system_process_attributes (Lisp_Object pid) { struct gcpro gcpro1, gcpro2, gcpro3; Lisp_Object attrs = Qnil; @@ -4459,34 +4448,34 @@ init_winsock (int load_now) if ((pfn_##fn = (void *) GetProcAddress (winsock_lib, #fn)) == NULL) \ goto fail; - LOAD_PROC( WSAStartup ); - LOAD_PROC( WSASetLastError ); - LOAD_PROC( WSAGetLastError ); - LOAD_PROC( WSAEventSelect ); - LOAD_PROC( WSACreateEvent ); - LOAD_PROC( WSACloseEvent ); - LOAD_PROC( socket ); - LOAD_PROC( bind ); - LOAD_PROC( connect ); - LOAD_PROC( ioctlsocket ); - LOAD_PROC( recv ); - LOAD_PROC( send ); - LOAD_PROC( closesocket ); - LOAD_PROC( shutdown ); - LOAD_PROC( htons ); - LOAD_PROC( ntohs ); - LOAD_PROC( inet_addr ); - LOAD_PROC( gethostname ); - LOAD_PROC( gethostbyname ); - LOAD_PROC( getservbyname ); - LOAD_PROC( getpeername ); - LOAD_PROC( WSACleanup ); - LOAD_PROC( setsockopt ); - LOAD_PROC( listen ); - LOAD_PROC( getsockname ); - LOAD_PROC( accept ); - LOAD_PROC( recvfrom ); - LOAD_PROC( sendto ); + LOAD_PROC (WSAStartup); + LOAD_PROC (WSASetLastError); + LOAD_PROC (WSAGetLastError); + LOAD_PROC (WSAEventSelect); + LOAD_PROC (WSACreateEvent); + LOAD_PROC (WSACloseEvent); + LOAD_PROC (socket); + LOAD_PROC (bind); + LOAD_PROC (connect); + LOAD_PROC (ioctlsocket); + LOAD_PROC (recv); + LOAD_PROC (send); + LOAD_PROC (closesocket); + LOAD_PROC (shutdown); + LOAD_PROC (htons); + LOAD_PROC (ntohs); + LOAD_PROC (inet_addr); + LOAD_PROC (gethostname); + LOAD_PROC (gethostbyname); + LOAD_PROC (getservbyname); + LOAD_PROC (getpeername); + LOAD_PROC (WSACleanup); + LOAD_PROC (setsockopt); + LOAD_PROC (listen); + LOAD_PROC (getsockname); + LOAD_PROC (accept); + LOAD_PROC (recvfrom); + LOAD_PROC (sendto); #undef LOAD_PROC /* specify version 1.1 of winsock */ @@ -4526,7 +4515,7 @@ int h_errno = 0; normal system codes where they overlap (non-overlapping definitions are already in <sys/socket.h> */ static void -set_errno () +set_errno (void) { if (winsock_lib == NULL) h_errno = EINVAL; @@ -4548,7 +4537,7 @@ set_errno () } static void -check_errno () +check_errno (void) { if (h_errno == 0 && winsock_lib != NULL) pfn_WSASetLastError (0); @@ -4631,7 +4620,7 @@ struct { }; char * -sys_strerror(int error_no) +sys_strerror (int error_no) { int i; static char unknown_msg[40]; @@ -4643,7 +4632,7 @@ sys_strerror(int error_no) if (_wsa_errlist[i].errnum == error_no) return _wsa_errlist[i].msg; - sprintf(unknown_msg, "Unidentified error: %d", error_no); + sprintf (unknown_msg, "Unidentified error: %d", error_no); return unknown_msg; } @@ -4662,7 +4651,7 @@ sys_strerror(int error_no) int socket_to_fd (SOCKET s); int -sys_socket(int af, int type, int protocol) +sys_socket (int af, int type, int protocol) { SOCKET s; @@ -4865,7 +4854,7 @@ sys_gethostname (char * name, int namelen) } struct hostent * -sys_gethostbyname(const char * name) +sys_gethostbyname (const char * name) { struct hostent * host; @@ -4883,7 +4872,7 @@ sys_gethostbyname(const char * name) } struct servent * -sys_getservbyname(const char * name, const char * proto) +sys_getservbyname (const char * name, const char * proto) { struct servent * serv; @@ -5038,7 +5027,7 @@ sys_accept (int s, struct sockaddr * addr, int * addrlen) int sys_recvfrom (int s, char * buf, int len, int flags, - struct sockaddr * from, int * fromlen) + struct sockaddr * from, int * fromlen) { if (winsock_lib == NULL) { @@ -5536,8 +5525,8 @@ sys_read (int fd, char * buffer, unsigned int count) int res = pfn_recv (SOCK_HANDLE (fd), buffer, count, 0); if (res == SOCKET_ERROR) { - DebPrint(("sys_read.recv failed with error %d on socket %ld\n", - pfn_WSAGetLastError (), SOCK_HANDLE (fd))); + DebPrint (("sys_read.recv failed with error %d on socket %ld\n", + pfn_WSAGetLastError (), SOCK_HANDLE (fd))); set_errno (); return -1; } @@ -5693,8 +5682,8 @@ sys_write (int fd, const void * buffer, unsigned int count) if (nchars == SOCKET_ERROR) { - DebPrint(("sys_write.send failed with error %d on socket %ld\n", - pfn_WSAGetLastError (), SOCK_HANDLE (fd))); + DebPrint (("sys_write.send failed with error %d on socket %ld\n", + pfn_WSAGetLastError (), SOCK_HANDLE (fd))); set_errno (); } } @@ -5733,7 +5722,7 @@ sys_write (int fd, const void * buffer, unsigned int count) } static void -check_windows_init_file () +check_windows_init_file (void) { extern int noninteractive, inhibit_window_system; @@ -5789,7 +5778,7 @@ check_windows_init_file () } void -term_ntproc () +term_ntproc (void) { #ifdef HAVE_SOCKETS /* shutdown the socket interface if necessary */ @@ -5800,7 +5789,7 @@ term_ntproc () } void -init_ntproc () +init_ntproc (void) { #ifdef HAVE_SOCKETS /* Initialise the socket interface now if available and requested by @@ -5908,7 +5897,8 @@ init_ntproc () shutdown_handler ensures that buffers' autosave files are up to date when the user logs off, or the system shuts down. */ -BOOL WINAPI shutdown_handler(DWORD type) +BOOL WINAPI +shutdown_handler (DWORD type) { /* Ctrl-C and Ctrl-Break are already suppressed, so don't handle them. */ if (type == CTRL_CLOSE_EVENT /* User closes console window. */ @@ -5929,7 +5919,7 @@ BOOL WINAPI shutdown_handler(DWORD type) initialized is non zero (see the function main in emacs.c). */ void -globals_of_w32 () +globals_of_w32 (void) { HMODULE kernel32 = GetModuleHandle ("kernel32.dll"); @@ -5967,14 +5957,15 @@ globals_of_w32 () console apps. This actually applies to Emacs in both console and GUI modes, since we had to fool windows into thinking emacs is a console application to get console mode to work. */ - SetConsoleCtrlHandler(shutdown_handler, TRUE); + SetConsoleCtrlHandler (shutdown_handler, TRUE); /* "None" is the default group name on standalone workstations. */ strcpy (dflt_group_name, "None"); } /* For make-serial-process */ -int serial_open (char *port) +int +serial_open (char *port) { HANDLE hnd; child_process *cp; @@ -6014,7 +6005,7 @@ int serial_open (char *port) /* For serial-process-configure */ void serial_configure (struct Lisp_Process *p, - Lisp_Object contact) + Lisp_Object contact) { Lisp_Object childp2 = Qnil; Lisp_Object tem = Qnil; diff --git a/src/w32console.c b/src/w32console.c index dcebe466e32..26fa544d670 100644 --- a/src/w32console.c +++ b/src/w32console.c @@ -42,13 +42,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "w32inevt.h" /* from window.c */ -extern Lisp_Object Frecenter (); +extern Lisp_Object Frecenter (Lisp_Object); /* from keyboard.c */ -extern int detect_input_pending (); +extern int detect_input_pending (void); /* from sysdep.c */ -extern int read_input_pending (); +extern int read_input_pending (void); static void w32con_move_cursor (struct frame *f, int row, int col); static void w32con_clear_to_end (struct frame *f); @@ -68,7 +68,7 @@ static WORD w32_face_attributes (struct frame *f, int face_id); static COORD cursor_coords; static HANDLE prev_screen, cur_screen; static WORD char_attr_normal; -static DWORD prev_console_mode; +static DWORD prev_console_mode; #ifndef USE_SEPARATE_SCREEN static CONSOLE_CURSOR_INFO prev_console_cursor; @@ -268,7 +268,8 @@ scroll_line (struct frame *f, int dist, int direction) /* If start is zero insert blanks instead of a string at start ?. */ static void -w32con_insert_glyphs (struct frame *f, register struct glyph *start, register int len) +w32con_insert_glyphs (struct frame *f, register struct glyph *start, + register int len) { scroll_line (f, len, RIGHT); @@ -286,8 +287,8 @@ w32con_insert_glyphs (struct frame *f, register struct glyph *start, register in } } -extern unsigned char *encode_terminal_code P_ ((struct glyph *, int, - struct coding_system *)); +extern unsigned char *encode_terminal_code (struct glyph *, int, + struct coding_system *); static void w32con_write_glyphs (struct frame *f, register struct glyph *string, @@ -392,8 +393,7 @@ SOUND is 'asterisk, 'exclamation, 'hand, 'question, 'ok, or 'silent to use the corresponding system sound for the bell. The 'silent sound prevents Emacs from making any sound at all. SOUND is nil to use the normal beep. */) - (sound) - Lisp_Object sound; + (Lisp_Object sound) { CHECK_SYMBOL (sound); @@ -438,7 +438,7 @@ w32con_reset_terminal_modes (struct terminal *t) FillConsoleOutputCharacter (cur_screen, ' ', n, dest, &r); /* Now that the screen is clear, put the cursor at the top. */ SetConsoleCursorPosition (cur_screen, dest); - + #ifdef USE_SEPARATE_SCREEN SetConsoleActiveScreenBuffer (prev_screen); #else @@ -492,7 +492,7 @@ w32con_set_terminal_window (struct frame *f, int size) ***********************************************************************/ void -sys_tputs (char *str, int nlines, int (*outfun)()) +sys_tputs (char *str, int nlines, int (*outfun) (int)) { } @@ -511,13 +511,13 @@ struct tty_display_info *current_tty = NULL; int cost = 0; int -evalcost (char c) +evalcost (int c) { return c; } int -cmputc (char c) +cmputc (int c) { return c; } @@ -551,9 +551,7 @@ Wcm_clear (struct tty_display_info *tty) /* Turn appearances of face FACE_ID on tty frame F on. */ static WORD -w32_face_attributes (f, face_id) - struct frame *f; - int face_id; +w32_face_attributes (struct frame *f, int face_id) { WORD char_attr; struct face *face = FACE_FROM_ID (f, face_id); @@ -609,8 +607,6 @@ vga_stdcolor_name (int idx) return Qunspecified; /* meaning the default */ } -typedef int (*term_hook) (); - void initialize_w32_display (struct terminal *term) { @@ -618,19 +614,19 @@ initialize_w32_display (struct terminal *term) term->rif = 0; /* No window based redisplay on the console. */ term->cursor_to_hook = w32con_move_cursor; - term->raw_cursor_to_hook = w32con_move_cursor; - term->clear_to_end_hook = w32con_clear_to_end; - term->clear_frame_hook = w32con_clear_frame; + term->raw_cursor_to_hook = w32con_move_cursor; + term->clear_to_end_hook = w32con_clear_to_end; + term->clear_frame_hook = w32con_clear_frame; term->clear_end_of_line_hook = w32con_clear_end_of_line; - term->ins_del_lines_hook = w32con_ins_del_lines; - term->insert_glyphs_hook = w32con_insert_glyphs; - term->write_glyphs_hook = w32con_write_glyphs; - term->delete_glyphs_hook = w32con_delete_glyphs; + term->ins_del_lines_hook = w32con_ins_del_lines; + term->insert_glyphs_hook = w32con_insert_glyphs; + term->write_glyphs_hook = w32con_write_glyphs; + term->delete_glyphs_hook = w32con_delete_glyphs; term->ring_bell_hook = w32_sys_ring_bell; - term->reset_terminal_modes_hook = w32con_reset_terminal_modes; + term->reset_terminal_modes_hook = w32con_reset_terminal_modes; term->set_terminal_modes_hook = w32con_set_terminal_modes; - term->set_terminal_window_hook = w32con_set_terminal_window; - term->update_begin_hook = w32con_update_begin; + term->set_terminal_window_hook = w32con_set_terminal_window; + term->update_begin_hook = w32con_update_begin; term->update_end_hook = w32con_update_end; term->read_socket_hook = w32_console_read_socket; @@ -674,8 +670,8 @@ initialize_w32_display (struct terminal *term) /* Respect setting of LINES and COLUMNS environment variables. */ { - char * lines = getenv("LINES"); - char * columns = getenv("COLUMNS"); + char * lines = getenv ("LINES"); + char * columns = getenv ("COLUMNS"); if (lines != NULL && columns != NULL) { @@ -751,9 +747,7 @@ initialize_w32_display (struct terminal *term) DEFUN ("set-screen-color", Fset_screen_color, Sset_screen_color, 2, 2, 0, doc: /* Set screen colors. */) - (foreground, background) - Lisp_Object foreground; - Lisp_Object background; + (Lisp_Object foreground, Lisp_Object background) { char_attr_normal = XFASTINT (foreground) + (XFASTINT (background) << 4); @@ -763,8 +757,7 @@ DEFUN ("set-screen-color", Fset_screen_color, Sset_screen_color, 2, 2, 0, DEFUN ("set-cursor-size", Fset_cursor_size, Sset_cursor_size, 1, 1, 0, doc: /* Set cursor size. */) - (size) - Lisp_Object size; + (Lisp_Object size) { CONSOLE_CURSOR_INFO cci; cci.dwSize = XFASTINT (size); @@ -775,7 +768,7 @@ DEFUN ("set-cursor-size", Fset_cursor_size, Sset_cursor_size, 1, 1, 0, } void -syms_of_ntterm () +syms_of_ntterm (void) { DEFVAR_BOOL ("w32-use-full-screen-buffer", &w32_use_full_screen_buffer, diff --git a/src/w32fns.c b/src/w32fns.c index bc310da0d2f..c5e555dc884 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -69,15 +69,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define FOF_NO_CONNECTED_ELEMENTS 0x2000 #endif -void syms_of_w32fns (); -void globals_of_w32fns (); +void syms_of_w32fns (void); +void globals_of_w32fns (void); -extern void free_frame_menubar (); -extern double atof (); -extern int w32_console_toggle_lock_key P_ ((int, Lisp_Object)); -extern void w32_menu_display_help P_ ((HWND, HMENU, UINT, UINT)); -extern void w32_free_menu_strings P_ ((HWND)); -extern const char *map_w32_filename P_ ((const char *, const char **)); +extern void free_frame_menubar (struct frame *); +extern double atof (const char *); +extern int w32_console_toggle_lock_key (int, Lisp_Object); +extern void w32_menu_display_help (HWND, HMENU, UINT, UINT); +extern void w32_free_menu_strings (HWND); +extern const char *map_w32_filename (const char *, const char **); extern int quit_char; @@ -288,10 +288,16 @@ unsigned int msh_mousewheel = 0; #define MENU_FREE_DELAY 1000 static unsigned menu_free_timer = 0; -/* The below are defined in frame.c. */ +/* In dispnew.c */ extern Lisp_Object Vwindow_system_version; +/* The below are defined in frame.c. */ + +extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode; +extern Lisp_Object Vwindow_system_version; +extern Lisp_Object Qtooltip; + #ifdef GLYPH_DEBUG int image_cache_refcount, dpyinfo_refcount; #endif @@ -315,18 +321,18 @@ extern HMENU current_popup_menu; static int menubar_in_use = 0; /* From w32uniscribe.c */ -extern void syms_of_w32uniscribe (); +extern void syms_of_w32uniscribe (void); extern int uniscribe_available; /* Function prototypes for hourglass support. */ -static void w32_show_hourglass P_ ((struct frame *)); -static void w32_hide_hourglass P_ ((void)); +static void w32_show_hourglass (struct frame *); +static void w32_hide_hourglass (void); /* Error if we are not connected to MS-Windows. */ void -check_w32 () +check_w32 (void) { if (! w32_in_use) error ("MS-Windows not in use or not initialized"); @@ -336,7 +342,7 @@ check_w32 () You should not call this unless HAVE_MENUS is defined. */ int -have_menus_p () +have_menus_p (void) { return w32_in_use; } @@ -345,8 +351,7 @@ have_menus_p () and checking validity for W32. */ FRAME_PTR -check_x_frame (frame) - Lisp_Object frame; +check_x_frame (Lisp_Object frame) { FRAME_PTR f; @@ -364,8 +369,7 @@ check_x_frame (frame) the first display on the list. */ struct w32_display_info * -check_x_display_info (frame) - Lisp_Object frame; +check_x_display_info (Lisp_Object frame) { if (NILP (frame)) { @@ -396,9 +400,7 @@ check_x_display_info (frame) /* This function can be called during GC, so use GC_xxx type test macros. */ struct frame * -x_window_to_frame (dpyinfo, wdesc) - struct w32_display_info *dpyinfo; - HWND wdesc; +x_window_to_frame (struct w32_display_info *dpyinfo, HWND wdesc) { Lisp_Object tail, frame; struct frame *f; @@ -419,26 +421,24 @@ x_window_to_frame (dpyinfo, wdesc) } -static Lisp_Object unwind_create_frame P_ ((Lisp_Object)); -static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object)); -static void my_create_window P_ ((struct frame *)); -static void my_create_tip_window P_ ((struct frame *)); +static Lisp_Object unwind_create_frame (Lisp_Object); +static Lisp_Object unwind_create_tip_frame (Lisp_Object); +static void my_create_window (struct frame *); +static void my_create_tip_window (struct frame *); /* TODO: Native Input Method support; see x_create_im. */ -void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_icon_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_icon_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_explicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); -static void x_edge_detection P_ ((struct frame *, struct image *, Lisp_Object, - Lisp_Object)); +void x_set_foreground_color (struct frame *, Lisp_Object, Lisp_Object); +void x_set_background_color (struct frame *, Lisp_Object, Lisp_Object); +void x_set_mouse_color (struct frame *, Lisp_Object, Lisp_Object); +void x_set_cursor_color (struct frame *, Lisp_Object, Lisp_Object); +void x_set_border_color (struct frame *, Lisp_Object, Lisp_Object); +void x_set_cursor_type (struct frame *, Lisp_Object, Lisp_Object); +void x_set_icon_type (struct frame *, Lisp_Object, Lisp_Object); +void x_set_icon_name (struct frame *, Lisp_Object, Lisp_Object); +void x_explicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); +void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); +void x_set_title (struct frame *, Lisp_Object, Lisp_Object); +void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object); @@ -448,9 +448,7 @@ static void x_edge_detection P_ ((struct frame *, struct image *, Lisp_Object, not Emacs's own window. */ void -x_real_positions (f, xptr, yptr) - FRAME_PTR f; - int *xptr, *yptr; +x_real_positions (FRAME_PTR f, int *xptr, int *yptr) { POINT pt; RECT rect; @@ -480,8 +478,7 @@ DEFUN ("w32-define-rgb-color", Fw32_define_rgb_color, This adds or updates a named color to `w32-color-map', making it available for use. The original entry's RGB ref is returned, or nil if the entry is new. */) - (red, green, blue, name) - Lisp_Object red, green, blue, name; + (Lisp_Object red, Lisp_Object green, Lisp_Object blue, Lisp_Object name) { Lisp_Object rgb; Lisp_Object oldrgb = Qnil; @@ -767,7 +764,7 @@ colormap_t w32_color_map[] = DEFUN ("w32-default-color-map", Fw32_default_color_map, Sw32_default_color_map, 0, 0, 0, doc: /* Return the default color map. */) - () + (void) { int i; colormap_t *pc = w32_color_map; @@ -789,8 +786,7 @@ DEFUN ("w32-default-color-map", Fw32_default_color_map, Sw32_default_color_map, } static Lisp_Object -w32_to_x_color (rgb) - Lisp_Object rgb; +w32_to_x_color (Lisp_Object rgb) { Lisp_Object color; @@ -809,8 +805,7 @@ w32_to_x_color (rgb) } static Lisp_Object -w32_color_map_lookup (colorname) - char *colorname; +w32_color_map_lookup (char *colorname) { Lisp_Object tail, ret = Qnil; @@ -842,8 +837,7 @@ w32_color_map_lookup (colorname) static void -add_system_logical_colors_to_map (system_colors) - Lisp_Object *system_colors; +add_system_logical_colors_to_map (Lisp_Object *system_colors) { HKEY colors_key; @@ -891,8 +885,7 @@ add_system_logical_colors_to_map (system_colors) static Lisp_Object -x_to_w32_color (colorname) - char * colorname; +x_to_w32_color (char * colorname) { register Lisp_Object ret = Qnil; @@ -1203,9 +1196,7 @@ w32_unmap_color (FRAME_PTR f, COLORREF color) /* Gamma-correct COLOR on frame F. */ void -gamma_correct (f, color) - struct frame *f; - COLORREF *color; +gamma_correct (struct frame *f, COLORREF *color) { if (f->gamma) { @@ -1222,11 +1213,7 @@ gamma_correct (f, color) If ALLOC is nonzero, allocate a new colormap cell. */ int -w32_defined_color (f, color, color_def, alloc) - FRAME_PTR f; - char *color; - XColor *color_def; - int alloc; +w32_defined_color (FRAME_PTR f, char *color, XColor *color_def, int alloc) { register Lisp_Object tem; COLORREF w32_color_ref; @@ -1298,10 +1285,7 @@ w32_defined_color (f, color, color_def, alloc) ARG says. */ int -x_decode_color (f, arg, def) - FRAME_PTR f; - Lisp_Object arg; - int def; +x_decode_color (FRAME_PTR f, Lisp_Object arg, int def) { XColor cdef; @@ -1335,9 +1319,7 @@ x_decode_color (f, arg, def) in the standard place; do not attempt to change the window. */ void -x_set_foreground_color (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { struct w32_output *x = f->output_data.w32; PIX_TYPE fg, old_fg; @@ -1349,7 +1331,10 @@ x_set_foreground_color (f, arg, oldval) if (FRAME_W32_WINDOW (f) != 0) { if (x->cursor_pixel == old_fg) - x->cursor_pixel = fg; + { + x->cursor_pixel = fg; + x->cursor_gc->background = fg; + } update_face_from_frame_parameter (f, Qforeground_color, arg); if (FRAME_VISIBLE_P (f)) @@ -1358,9 +1343,7 @@ x_set_foreground_color (f, arg, oldval) } void -x_set_background_color (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { FRAME_BACKGROUND_PIXEL (f) = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); @@ -1378,9 +1361,7 @@ x_set_background_color (f, arg, oldval) } void -x_set_mouse_color (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { Cursor cursor, nontext_cursor, mode_cursor, hand_cursor; int count; @@ -1527,9 +1508,7 @@ x_set_mouse_color (f, arg, oldval) } void -x_set_cursor_color (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { unsigned long fore_pixel, pixel; @@ -1576,9 +1555,7 @@ x_set_cursor_color (f, arg, oldval) F has a window. */ void -x_set_border_pixel (f, pix) - struct frame *f; - int pix; +x_set_border_pixel (struct frame *f, int pix) { f->output_data.w32->border_pixel = pix; @@ -1597,9 +1574,7 @@ x_set_border_pixel (f, pix) F has a window; it must be redone when the window is created. */ void -x_set_border_color (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_border_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { int pix; @@ -1611,9 +1586,7 @@ x_set_border_color (f, arg, oldval) void -x_set_cursor_type (f, arg, oldval) - FRAME_PTR f; - Lisp_Object arg, oldval; +x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) { set_frame_cursor_types (f, arg); @@ -1622,9 +1595,7 @@ x_set_cursor_type (f, arg, oldval) } void -x_set_icon_type (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { int result; @@ -1651,9 +1622,7 @@ x_set_icon_type (f, arg, oldval) } void -x_set_icon_name (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { if (STRINGP (arg)) { @@ -1701,9 +1670,7 @@ x_set_icon_name (f, arg, oldval) void -x_set_menu_bar_lines (f, value, oldval) - struct frame *f; - Lisp_Object value, oldval; +x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { int nlines; int olines = FRAME_MENU_BAR_LINES (f); @@ -1746,9 +1713,7 @@ x_set_menu_bar_lines (f, value, oldval) The frame's height doesn't change. */ void -x_set_tool_bar_lines (f, value, oldval) - struct frame *f; - Lisp_Object value, oldval; +x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { int delta, nlines, root_height; Lisp_Object root_window; @@ -1828,10 +1793,7 @@ x_set_tool_bar_lines (f, value, oldval) F->explicit_name is set, ignore the new name; otherwise, set it. */ void -x_set_name (f, name, explicit) - struct frame *f; - Lisp_Object name; - int explicit; +x_set_name (struct frame *f, Lisp_Object name, int explicit) { /* Make sure that requests from lisp code override requests from Emacs redisplay code. */ @@ -1886,9 +1848,7 @@ x_set_name (f, name, explicit) specified a name for the frame; the name will override any set by the redisplay code. */ void -x_explicitly_set_name (f, arg, oldval) - FRAME_PTR f; - Lisp_Object arg, oldval; +x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) { x_set_name (f, arg, 1); } @@ -1897,9 +1857,7 @@ x_explicitly_set_name (f, arg, oldval) name; names set this way will never override names set by the user's lisp code. */ void -x_implicitly_set_name (f, arg, oldval) - FRAME_PTR f; - Lisp_Object arg, oldval; +x_implicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) { x_set_name (f, arg, 0); } @@ -1908,9 +1866,7 @@ x_implicitly_set_name (f, arg, oldval) If NAME is nil, use the frame name as the title. */ void -x_set_title (f, name, old_name) - struct frame *f; - Lisp_Object name, old_name; +x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) { /* Don't change the title if it's already NAME. */ if (EQ (name, f->title)) @@ -1935,8 +1891,8 @@ x_set_title (f, name, old_name) } -void x_set_scroll_bar_default_width (f) - struct frame *f; +void +x_set_scroll_bar_default_width (struct frame *f) { int wid = FRAME_COLUMN_WIDTH (f); @@ -1964,11 +1920,10 @@ w32_load_cursor (LPCTSTR name) return cursor; } -extern LRESULT CALLBACK w32_wnd_proc (); +extern LRESULT CALLBACK w32_wnd_proc (HWND, UINT, WPARAM, LPARAM); static BOOL -w32_init_class (hinst) - HINSTANCE hinst; +w32_init_class (HINSTANCE hinst) { WNDCLASS wc; @@ -1987,9 +1942,7 @@ w32_init_class (hinst) } static HWND -w32_createscrollbar (f, bar) - struct frame *f; - struct scroll_bar * bar; +w32_createscrollbar (struct frame *f, struct scroll_bar * bar) { return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE, /* Position and size of scroll bar. */ @@ -2004,8 +1957,7 @@ w32_createscrollbar (f, bar) } static void -w32_createwindow (f) - struct frame *f; +w32_createwindow (struct frame *f) { HWND hwnd; RECT rect; @@ -2075,12 +2027,7 @@ w32_createwindow (f) } static void -my_post_msg (wmsg, hwnd, msg, wParam, lParam) - W32Msg * wmsg; - HWND hwnd; - UINT msg; - WPARAM wParam; - LPARAM lParam; +my_post_msg (W32Msg * wmsg, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { wmsg->msg.hwnd = hwnd; wmsg->msg.message = msg; @@ -2174,7 +2121,7 @@ record_keyup (unsigned int wparam, unsigned int lparam) it regains focus, be conservative and clear all modifiers since we cannot reconstruct the left and right modifier state. */ static void -reset_modifiers () +reset_modifiers (void) { SHORT ctrl, alt; @@ -2221,7 +2168,7 @@ reset_modifiers () modifier keys, we know that, if no modifiers are set, then neither the left or right modifier should be set. */ static void -sync_modifiers () +sync_modifiers (void) { if (!modifiers_recorded) return; @@ -2307,7 +2254,7 @@ w32_key_to_modifier (int key) } static unsigned int -w32_get_modifiers () +w32_get_modifiers (void) { return ((modifier_set (VK_SHIFT) ? shift_modifier : 0) | (modifier_set (VK_CONTROL) ? ctrl_modifier : 0) | @@ -2324,7 +2271,7 @@ w32_get_modifiers () and window input. */ static int -construct_console_modifiers () +construct_console_modifiers (void) { int mods; @@ -2396,8 +2343,7 @@ static Lisp_Object w32_grabbed_keys; combinations like Alt-Tab which are used by the system. */ static void -register_hot_keys (hwnd) - HWND hwnd; +register_hot_keys (HWND hwnd) { Lisp_Object keylist; @@ -2416,8 +2362,7 @@ register_hot_keys (hwnd) } static void -unregister_hot_keys (hwnd) - HWND hwnd; +unregister_hot_keys (HWND hwnd) { Lisp_Object keylist; @@ -2623,7 +2568,7 @@ complete_deferred_msg (HWND hwnd, UINT msg, LRESULT result) } static void -cancel_all_deferred_msgs () +cancel_all_deferred_msgs (void) { deferred_msg * item; @@ -2668,7 +2613,7 @@ w32_msg_worker (void *arg) } static void -signal_user_input () +signal_user_input (void) { /* Interrupt any lisp that wants to be interrupted by input. */ if (!NILP (Vthrow_on_input)) @@ -2686,13 +2631,9 @@ signal_user_input () static void -post_character_message (hwnd, msg, wParam, lParam, modifiers) - HWND hwnd; - UINT msg; - WPARAM wParam; - LPARAM lParam; - DWORD modifiers; - +post_character_message (HWND hwnd, UINT msg, + WPARAM wParam, LPARAM lParam, + DWORD modifiers) { W32Msg wmsg; @@ -2752,11 +2693,7 @@ post_character_message (hwnd, msg, wParam, lParam, modifiers) /* Main window procedure */ LRESULT CALLBACK -w32_wnd_proc (hwnd, msg, wParam, lParam) - HWND hwnd; - UINT msg; - WPARAM wParam; - LPARAM lParam; +w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { struct frame *f; struct w32_display_info *dpyinfo = &one_w32_display_info; @@ -2814,7 +2751,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) { PAINTSTRUCT paintStruct; RECT update_rect; - bzero (&update_rect, sizeof (update_rect)); + memset (&update_rect, 0, sizeof (update_rect)); f = x_window_to_frame (dpyinfo, hwnd); if (f == 0) @@ -3162,7 +3099,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) wmsg.dwModifiers = w32_get_key_modifiers (wParam, lParam); /* Get buffer size. */ size = get_composition_string_fn (context, GCS_RESULTSTR, buffer, 0); - buffer = alloca(size); + buffer = alloca (size); size = get_composition_string_fn (context, GCS_RESULTSTR, buffer, size); release_ime_context_fn (hwnd, context); @@ -4006,8 +3943,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) } static void -my_create_window (f) - struct frame * f; +my_create_window (struct frame * f) { MSG msg; @@ -4022,8 +3958,7 @@ my_create_window (f) messages for the tooltip. Creating tooltips indirectly also creates deadlocks when tooltips are created for menu items. */ static void -my_create_tip_window (f) - struct frame *f; +my_create_tip_window (struct frame *f) { RECT rect; @@ -4066,10 +4001,7 @@ my_create_tip_window (f) /* Create and set up the w32 window for frame F. */ static void -w32_window (f, window_prompting, minibuffer_only) - struct frame *f; - long window_prompting; - int minibuffer_only; +w32_window (struct frame *f, long window_prompting, int minibuffer_only) { BLOCK_INPUT; @@ -4117,9 +4049,7 @@ w32_window (f, window_prompting, minibuffer_only) well. */ static void -x_icon (f, parms) - struct frame *f; - Lisp_Object parms; +x_icon (struct frame *f, Lisp_Object parms) { Lisp_Object icon_x, icon_y; struct w32_display_info *dpyinfo = &one_w32_display_info; @@ -4158,8 +4088,7 @@ x_icon (f, parms) static void -x_make_gc (f) - struct frame *f; +x_make_gc (struct frame *f) { XGCValues gc_values; @@ -4192,8 +4121,7 @@ x_make_gc (f) constructed. */ static Lisp_Object -unwind_create_frame (frame) - Lisp_Object frame; +unwind_create_frame (Lisp_Object frame) { struct frame *f = XFRAME (frame); @@ -4218,9 +4146,7 @@ unwind_create_frame (frame) } static void -x_default_font_parameter (f, parms) - struct frame *f; - Lisp_Object parms; +x_default_font_parameter (struct frame *f, Lisp_Object parms) { struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); Lisp_Object font_param = x_get_arg (dpyinfo, parms, Qfont, NULL, NULL, @@ -4270,8 +4196,7 @@ then `default-minibuffer-frame' must be a frame whose minibuffer can be shared by the new frame. This function is an internal primitive--use `make-frame' instead. */) - (parameters) - Lisp_Object parameters; + (Lisp_Object parameters) { struct frame *f; Lisp_Object frame, tem; @@ -4354,7 +4279,7 @@ This function is an internal primitive--use `make-frame' instead. */) f->output_method = output_w32; f->output_data.w32 = (struct w32_output *) xmalloc (sizeof (struct w32_output)); - bzero (f->output_data.w32, sizeof (struct w32_output)); + memset (f->output_data.w32, 0, sizeof (struct w32_output)); FRAME_FONTSET (f) = -1; f->icon_name @@ -4462,10 +4387,17 @@ This function is an internal primitive--use `make-frame' instead. */) happen. */ init_frame_faces (f); - x_default_parameter (f, parameters, Qmenu_bar_lines, make_number (1), - "menuBar", "MenuBar", RES_TYPE_NUMBER); - x_default_parameter (f, parameters, Qtool_bar_lines, make_number (1), - "toolBar", "ToolBar", RES_TYPE_NUMBER); + /* The X resources controlling the menu-bar and tool-bar are + processed specially at startup, and reflected in the mode + variables; ignore them here. */ + x_default_parameter (f, parameters, Qmenu_bar_lines, + NILP (Vmenu_bar_mode) + ? make_number (0) : make_number (1), + NULL, NULL, RES_TYPE_NUMBER); + x_default_parameter (f, parameters, Qtool_bar_lines, + NILP (Vtool_bar_mode) + ? make_number (0) : make_number (1), + NULL, NULL, RES_TYPE_NUMBER); x_default_parameter (f, parameters, Qbuffer_predicate, Qnil, "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); @@ -4579,8 +4511,7 @@ This function is an internal primitive--use `make-frame' instead. */) display info directly because we're called from frame.c, which doesn't know about that structure. */ Lisp_Object -x_get_focus_frame (frame) - struct frame *frame; +x_get_focus_frame (struct frame *frame) { struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (frame); Lisp_Object xfocus; @@ -4593,8 +4524,7 @@ x_get_focus_frame (frame) DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, doc: /* Give FRAME input focus, raising to foreground if necessary. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { x_focus_on_frame (check_x_frame (frame)); return Qnil; @@ -4603,8 +4533,7 @@ DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, doc: /* Internal function called by `color-defined-p', which see. */) - (color, frame) - Lisp_Object color, frame; + (Lisp_Object color, Lisp_Object frame) { XColor foo; FRAME_PTR f = check_x_frame (frame); @@ -4619,8 +4548,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, doc: /* Internal function called by `color-values', which see. */) - (color, frame) - Lisp_Object color, frame; + (Lisp_Object color, Lisp_Object frame) { XColor foo; FRAME_PTR f = check_x_frame (frame); @@ -4640,8 +4568,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, doc: /* Internal function called by `display-color-p', which see. */) - (display) - Lisp_Object display; + (Lisp_Object display) { struct w32_display_info *dpyinfo = check_x_display_info (display); @@ -4658,8 +4585,7 @@ Note that color displays do support shades of gray. The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { struct w32_display_info *dpyinfo = check_x_display_info (display); @@ -4675,8 +4601,7 @@ DEFUN ("x-display-pixel-width", Fx_display_pixel_width, The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { struct w32_display_info *dpyinfo = check_x_display_info (display); @@ -4689,8 +4614,7 @@ DEFUN ("x-display-pixel-height", Fx_display_pixel_height, The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { struct w32_display_info *dpyinfo = check_x_display_info (display); @@ -4703,8 +4627,7 @@ DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes, The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { struct w32_display_info *dpyinfo = check_x_display_info (display); @@ -4717,8 +4640,7 @@ DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells, The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { struct w32_display_info *dpyinfo = check_x_display_info (display); HDC hdc; @@ -4747,8 +4669,7 @@ DEFUN ("x-server-max-request-size", Fx_server_max_request_size, The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { struct w32_display_info *dpyinfo = check_x_display_info (display); @@ -4760,8 +4681,7 @@ DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { return build_string ("Microsoft Corp."); } @@ -4775,8 +4695,7 @@ release number. See also the function `x-server-vendor'. The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { return Fcons (make_number (w32_major_version), Fcons (make_number (w32_minor_version), @@ -4788,8 +4707,7 @@ DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { return make_number (1); } @@ -4800,8 +4718,7 @@ DEFUN ("x-display-mm-height", Fx_display_mm_height, The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { struct w32_display_info *dpyinfo = check_x_display_info (display); HDC hdc; @@ -4821,8 +4738,7 @@ DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { struct w32_display_info *dpyinfo = check_x_display_info (display); @@ -4845,8 +4761,7 @@ The value may be `always', `when-mapped', or `not-useful'. The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { return intern ("not-useful"); } @@ -4860,8 +4775,7 @@ The value is one of the symbols `static-gray', `gray-scale', The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { struct w32_display_info *dpyinfo = check_x_display_info (display); Lisp_Object result = Qnil; @@ -4884,43 +4798,37 @@ DEFUN ("x-display-save-under", Fx_display_save_under, The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { return Qnil; } int -x_pixel_width (f) - register struct frame *f; +x_pixel_width (register struct frame *f) { return FRAME_PIXEL_WIDTH (f); } int -x_pixel_height (f) - register struct frame *f; +x_pixel_height (register struct frame *f) { return FRAME_PIXEL_HEIGHT (f); } int -x_char_width (f) - register struct frame *f; +x_char_width (register struct frame *f) { return FRAME_COLUMN_WIDTH (f); } int -x_char_height (f) - register struct frame *f; +x_char_height (register struct frame *f) { return FRAME_LINE_HEIGHT (f); } int -x_screen_planes (f) - register struct frame *f; +x_screen_planes (register struct frame *f) { return FRAME_W32_DISPLAY_INFO (f)->n_planes; } @@ -4929,8 +4837,7 @@ x_screen_planes (f) Open a new connection if necessary. */ struct w32_display_info * -x_display_info_for_name (name) - Lisp_Object name; +x_display_info_for_name (Lisp_Object name) { Lisp_Object names; struct w32_display_info *dpyinfo; @@ -4970,8 +4877,7 @@ DISPLAY is the name of the display to connect to. Optional second arg XRM-STRING is a string of resources in xrdb format. If the optional third arg MUST-SUCCEED is non-nil, terminate Emacs if we can't open the connection. */) - (display, xrm_string, must_succeed) - Lisp_Object display, xrm_string, must_succeed; + (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed) { unsigned char *xrm_option; struct w32_display_info *dpyinfo; @@ -5059,8 +4965,7 @@ DEFUN ("x-close-connection", Fx_close_connection, doc: /* Close the connection to DISPLAY's server. For DISPLAY, specify either a frame or a display name (a string). If DISPLAY is nil, that stands for the selected frame's display. */) - (display) - Lisp_Object display; + (Lisp_Object display) { struct w32_display_info *dpyinfo = check_x_display_info (display); int i; @@ -5079,7 +4984,7 @@ If DISPLAY is nil, that stands for the selected frame's display. */) DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, doc: /* Return the list of display names that Emacs has connections to. */) - () + (void) { Lisp_Object tail, result; @@ -5092,8 +4997,7 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, doc: /* This is a noop on W32 systems. */) - (on, display) - Lisp_Object display, on; + (Lisp_Object on, Lisp_Object display) { return Qnil; } @@ -5122,8 +5026,7 @@ If OUTER_P is non-nil, the property is changed for the outer X window of FRAME. Default is to change on the edit X window. Value is VALUE. */) - (prop, value, frame, type, format, outer_p) - Lisp_Object prop, value, frame, type, format, outer_p; + (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) { #if 0 /* TODO : port window properties to W32 */ struct frame *f = check_x_frame (frame); @@ -5152,8 +5055,7 @@ DEFUN ("x-delete-window-property", Fx_delete_window_property, Sx_delete_window_property, 1, 2, 0, doc: /* Remove window property PROP from X window of FRAME. FRAME nil or omitted means use the selected frame. Value is PROP. */) - (prop, frame) - Lisp_Object prop, frame; + (Lisp_Object prop, Lisp_Object frame) { #if 0 /* TODO : port window properties to W32 */ @@ -5180,8 +5082,7 @@ DEFUN ("x-window-property", Fx_window_property, Sx_window_property, If FRAME is nil or omitted, use the selected frame. Value is nil if FRAME hasn't a property with name PROP or if PROP has no string value. */) - (prop, frame) - Lisp_Object prop, frame; + (Lisp_Object prop, Lisp_Object frame) { #if 0 /* TODO : port window properties to W32 */ @@ -5245,7 +5146,7 @@ extern Lisp_Object Vhourglass_delay; xdisp.c could be used. */ int -hourglass_started () +hourglass_started (void) { return hourglass_shown_p || hourglass_timer; } @@ -5253,7 +5154,7 @@ hourglass_started () /* Cancel a currently active hourglass timer, and start a new one. */ void -start_hourglass () +start_hourglass (void) { DWORD delay; int secs, msecs = 0; @@ -5289,7 +5190,7 @@ start_hourglass () cursor if shown. */ void -cancel_hourglass () +cancel_hourglass (void) { if (hourglass_timer) { @@ -5308,8 +5209,7 @@ cancel_hourglass () to indicate that an hourglass cursor is shown. */ static void -w32_show_hourglass (f) - struct frame *f; +w32_show_hourglass (struct frame *f) { if (!hourglass_shown_p) { @@ -5324,7 +5224,7 @@ w32_show_hourglass (f) /* Hide the hourglass cursor on all frames, if it is currently shown. */ static void -w32_hide_hourglass () +w32_hide_hourglass (void) { if (hourglass_shown_p) { @@ -5352,10 +5252,10 @@ w32_hide_hourglass () Tool tips ***********************************************************************/ -static Lisp_Object x_create_tip_frame P_ ((struct w32_display_info *, - Lisp_Object, Lisp_Object)); -static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object, - Lisp_Object, int, int, int *, int *)); +static Lisp_Object x_create_tip_frame (struct w32_display_info *, + Lisp_Object, Lisp_Object); +static void compute_tip_xy (struct frame *, Lisp_Object, Lisp_Object, + Lisp_Object, int, int, int *, int *); /* The frame of a currently visible tooltip. */ @@ -5378,8 +5278,7 @@ Lisp_Object Vx_max_tooltip_size; static Lisp_Object -unwind_create_tip_frame (frame) - Lisp_Object frame; +unwind_create_tip_frame (Lisp_Object frame) { Lisp_Object deleted; @@ -5404,9 +5303,8 @@ unwind_create_tip_frame (frame) when this happens. */ static Lisp_Object -x_create_tip_frame (dpyinfo, parms, text) - struct w32_display_info *dpyinfo; - Lisp_Object parms, text; +x_create_tip_frame (struct w32_display_info *dpyinfo, + Lisp_Object parms, Lisp_Object text) { struct frame *f; Lisp_Object frame, tem; @@ -5470,7 +5368,7 @@ x_create_tip_frame (dpyinfo, parms, text) f->output_method = output_w32; f->output_data.w32 = (struct w32_output *) xmalloc (sizeof (struct w32_output)); - bzero (f->output_data.w32, sizeof (struct w32_output)); + memset (f->output_data.w32, 0, sizeof (struct w32_output)); FRAME_FONTSET (f) = -1; f->icon_name = Qnil; @@ -5584,9 +5482,8 @@ x_create_tip_frame (dpyinfo, parms, text) change_frame_size (f, height, width, 1, 0, 0); /* Add `tooltip' frame parameter's default value. */ - if (NILP (Fframe_parameter (frame, intern ("tooltip")))) - Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt), - Qnil)); + if (NILP (Fframe_parameter (frame, Qtooltip))) + Fmodify_frame_parameters (frame, Fcons (Fcons (Qtooltip, Qt), Qnil)); /* Set up faces after all frame parameters are known. This call also merges in face attributes specified for new frames. @@ -5646,11 +5543,9 @@ x_create_tip_frame (dpyinfo, parms, text) the display in *ROOT_X, and *ROOT_Y. */ static void -compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y) - struct frame *f; - Lisp_Object parms, dx, dy; - int width, height; - int *root_x, *root_y; +compute_tip_xy (struct frame *f, + Lisp_Object parms, Lisp_Object dx, Lisp_Object dy, + int width, int height, int *root_x, int *root_y) { Lisp_Object left, top; int min_x, min_y, max_x, max_y; @@ -5754,8 +5649,7 @@ DY added (default is -10). A tooltip's maximum size is specified by `x-max-tooltip-size'. Text larger than the specified size is clipped. */) - (string, frame, parms, timeout, dx, dy) - Lisp_Object string, frame, parms, timeout, dx, dy; + (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy) { struct frame *f; struct window *w; @@ -5984,7 +5878,7 @@ Text larger than the specified size is clipped. */) DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0, doc: /* Hide the current tooltip window, if there is any. Value is t if tooltip was open, nil otherwise. */) - () + (void) { int count; Lisp_Object deleted, frame, timer; @@ -6029,11 +5923,7 @@ extern Lisp_Object Qfile_name_history; allows us to work around the fact that the standard Open File dialog does not support directories. */ UINT CALLBACK -file_dialog_callback (hwnd, msg, wParam, lParam) - HWND hwnd; - UINT msg; - WPARAM wParam; - LPARAM lParam; +file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_NOTIFY) { @@ -6084,8 +5974,7 @@ Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file selection box, if specified. Ensure that file exists if MUSTMATCH is non-nil. If ONLY-DIR-P is non-nil, the user can only select directories. */) - (prompt, dir, default_filename, mustmatch, only_dir_p) - Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p; + (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) { struct frame *f = SELECTED_FRAME (); Lisp_Object file = Qnil; @@ -6134,7 +6023,7 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */) specbind (Qinhibit_redisplay, Qt); BLOCK_INPUT; - bzero (&new_file_details, sizeof (new_file_details)); + memset (&new_file_details, 0, sizeof (new_file_details)); /* Apparently NT4 crashes if you give it an unexpected size. I'm not sure about Windows 9x, so play it safe. */ if (w32_major_version > 4 && w32_major_version < 95) @@ -6213,8 +6102,7 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */) DEFUN ("system-move-file-to-trash", Fsystem_move_file_to_trash, Ssystem_move_file_to_trash, 1, 1, 0, doc: /* Move file or directory named FILENAME to the recycle bin. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { Lisp_Object handler; Lisp_Object encoded_file; @@ -6245,10 +6133,10 @@ DEFUN ("system-move-file-to-trash", Fsystem_move_file_to_trash, /* On Windows, write permission is required to delete/move files. */ _chmod (path, 0666); - bzero (tmp_path, sizeof (tmp_path)); + memset (tmp_path, 0, sizeof (tmp_path)); strcpy (tmp_path, path); - bzero (&file_op, sizeof (file_op)); + memset (&file_op, 0, sizeof (file_op)); file_op.hwnd = HWND_DESKTOP; file_op.wFunc = FO_DELETE; file_op.pFrom = tmp_path; @@ -6276,8 +6164,7 @@ to activate the menubar for keyboard access. #xf140 activates the screen saver if defined. If optional parameter FRAME is not specified, use selected frame. */) - (command, frame) - Lisp_Object command, frame; + (Lisp_Object command, Lisp_Object frame) { FRAME_PTR f = check_x_frame (frame); @@ -6330,8 +6217,7 @@ an integer representing a ShowWindow flag: 1 - start normally 3 - start maximized 6 - start minimized */) - (operation, document, parameters, show_flag) - Lisp_Object operation, document, parameters, show_flag; + (Lisp_Object operation, Lisp_Object document, Lisp_Object parameters, Lisp_Object show_flag) { Lisp_Object current_dir; char *errstr; @@ -6387,8 +6273,7 @@ lookup_vk_code (char *key) /* Convert a one-element vector style key sequence to a hot key definition. */ static Lisp_Object -w32_parse_hot_key (key) - Lisp_Object key; +w32_parse_hot_key (Lisp_Object key) { /* Copied from Fdefine_key and store_in_keymap. */ register Lisp_Object c; @@ -6469,8 +6354,7 @@ modifier is interpreted as Alt if `w32-alt-is-meta' is t, and hyper is always interpreted as the Windows modifier keys. The return value is the hotkey-id if registered, otherwise nil. */) - (key) - Lisp_Object key; + (Lisp_Object key) { key = w32_parse_hot_key (key); @@ -6502,8 +6386,7 @@ The return value is the hotkey-id if registered, otherwise nil. */) DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key, Sw32_unregister_hot_key, 1, 1, 0, doc: /* Unregister KEY as a hot-key combination. */) - (key) - Lisp_Object key; + (Lisp_Object key) { Lisp_Object item; @@ -6535,7 +6418,7 @@ DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key, DEFUN ("w32-registered-hot-keys", Fw32_registered_hot_keys, Sw32_registered_hot_keys, 0, 0, 0, doc: /* Return list of registered hot-key IDs. */) - () + (void) { return Fdelq (Qnil, Fcopy_sequence (w32_grabbed_keys)); } @@ -6544,8 +6427,7 @@ DEFUN ("w32-reconstruct-hot-key", Fw32_reconstruct_hot_key, Sw32_reconstruct_hot_key, 1, 1, 0, doc: /* Convert hot-key ID to a lisp key combination. usage: (w32-reconstruct-hot-key ID) */) - (hotkeyid) - Lisp_Object hotkeyid; + (Lisp_Object hotkeyid) { int vk_code, w32_modifiers; Lisp_Object key; @@ -6579,8 +6461,7 @@ DEFUN ("w32-toggle-lock-key", Fw32_toggle_lock_key, KEY can be `capslock', `kp-numlock', or `scroll'. If the optional parameter NEW-STATE is a number, then the state of KEY is set to off if the low bit of NEW-STATE is zero, otherwise on. */) - (key, new_state) - Lisp_Object key, new_state; + (Lisp_Object key, Lisp_Object new_state) { int vk_code; @@ -6616,8 +6497,7 @@ DEFUN ("w32-window-exists-p", Fw32_window_exists_p, Sw32_window_exists_p, doc: /* Return non-nil if a window exists with the specified CLASS and NAME. This is a direct interface to the Windows API FindWindow function. */) - (class, name) -Lisp_Object class, name; + (Lisp_Object class, Lisp_Object name) { HWND hnd; @@ -6646,7 +6526,7 @@ The following %-sequences are provided: %m Remaining time (to charge or discharge) in minutes %h Remaining time (to charge or discharge) in hours %t Remaining time (to charge or discharge) in the form `h:min' */) - () + (void) { Lisp_Object status = Qnil; @@ -6750,8 +6630,7 @@ Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total storage of the file system, FREE is the free storage, and AVAIL is the storage available to a non-superuser. All 3 numbers are in bytes. If the underlying system call fails, value is nil. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { Lisp_Object encoded, value; @@ -6843,7 +6722,7 @@ If the underlying system call fails, value is nil. */) DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name, 0, 0, 0, doc: /* Return the name of Windows default printer device. */) - () + (void) { static char pname_buf[256]; int err; @@ -6955,7 +6834,7 @@ frame_parm_handler w32_frame_parm_handlers[] = }; void -syms_of_w32fns () +syms_of_w32fns (void) { globals_of_w32fns (); /* This is zero if not using MS-Windows. */ @@ -7312,7 +7191,7 @@ only be necessary if the default setting causes problems. */); is non zero. */ void -globals_of_w32fns () +globals_of_w32fns (void) { HMODULE user32_lib = GetModuleHandle ("user32.dll"); /* @@ -7355,7 +7234,7 @@ globals_of_w32fns () #undef abort void -w32_abort () +w32_abort (void) { int button; button = MessageBox (NULL, @@ -7383,7 +7262,7 @@ w32_abort () /* For convenience when debugging. */ int -w32_last_error () +w32_last_error (void) { return GetLastError (); } diff --git a/src/w32font.c b/src/w32font.c index e93dbca2ddb..d1375d58507 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -106,28 +106,28 @@ static Lisp_Object Vw32_charset_info_alist; /* Font spacing symbols - defined in font.c. */ extern Lisp_Object Qc, Qp, Qm; -static void fill_in_logfont P_ ((FRAME_PTR, LOGFONT *, Lisp_Object)); +static void fill_in_logfont (FRAME_PTR, LOGFONT *, Lisp_Object); -static BYTE w32_antialias_type P_ ((Lisp_Object)); -static Lisp_Object lispy_antialias_type P_ ((BYTE)); +static BYTE w32_antialias_type (Lisp_Object); +static Lisp_Object lispy_antialias_type (BYTE); -static Lisp_Object font_supported_scripts P_ ((FONTSIGNATURE *)); -static int w32font_full_name P_ ((LOGFONT *, Lisp_Object, int, char *, int)); -static void compute_metrics P_ ((HDC, struct w32font_info *, unsigned int, - struct w32_metric_cache *)); +static Lisp_Object font_supported_scripts (FONTSIGNATURE *); +static int w32font_full_name (LOGFONT *, Lisp_Object, int, char *, int); +static void compute_metrics (HDC, struct w32font_info *, unsigned int, + struct w32_metric_cache *); -static Lisp_Object w32_registry P_ ((LONG, DWORD)); +static Lisp_Object w32_registry (LONG, DWORD); /* EnumFontFamiliesEx callbacks. */ -static int CALLBACK add_font_entity_to_list P_ ((ENUMLOGFONTEX *, +static int CALLBACK add_font_entity_to_list (ENUMLOGFONTEX *, + NEWTEXTMETRICEX *, + DWORD, LPARAM); +static int CALLBACK add_one_font_entity_to_list (ENUMLOGFONTEX *, NEWTEXTMETRICEX *, - DWORD, LPARAM)); -static int CALLBACK add_one_font_entity_to_list P_ ((ENUMLOGFONTEX *, - NEWTEXTMETRICEX *, - DWORD, LPARAM)); -static int CALLBACK add_font_name_to_list P_ ((ENUMLOGFONTEX *, - NEWTEXTMETRICEX *, - DWORD, LPARAM)); + DWORD, LPARAM); +static int CALLBACK add_font_name_to_list (ENUMLOGFONTEX *, + NEWTEXTMETRICEX *, + DWORD, LPARAM); /* struct passed in as LPARAM arg to EnumFontFamiliesEx, for keeping track of what we really want. */ @@ -149,12 +149,11 @@ struct font_callback_data /* Handles the problem that EnumFontFamiliesEx will not return all style variations if the font name is not specified. */ -static void list_all_matching_fonts P_ ((struct font_callback_data *)); +static void list_all_matching_fonts (struct font_callback_data *); static int -memq_no_quit (elt, list) - Lisp_Object elt, list; +memq_no_quit (Lisp_Object elt, Lisp_Object list) { while (CONSP (list) && ! EQ (XCAR (list), elt)) list = XCDR (list); @@ -162,8 +161,7 @@ memq_no_quit (elt, list) } Lisp_Object -intern_font_name (string) - char * string; +intern_font_name (char * string) { Lisp_Object obarray, tem, str; int len; @@ -185,8 +183,7 @@ intern_font_name (string) Return a cache of font-entities on FRAME. The cache must be a cons whose cdr part is the actual cache area. */ Lisp_Object -w32font_get_cache (f) - FRAME_PTR f; +w32font_get_cache (FRAME_PTR f) { struct w32_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); @@ -198,8 +195,7 @@ w32font_get_cache (f) is a vector of font-entities. This is the sole API that allocates font-entities. */ static Lisp_Object -w32font_list (frame, font_spec) - Lisp_Object frame, font_spec; +w32font_list (Lisp_Object frame, Lisp_Object font_spec) { Lisp_Object fonts = w32font_list_internal (frame, font_spec, 0); FONT_ADD_LOG ("w32font-list", font_spec, fonts); @@ -211,8 +207,7 @@ w32font_list (frame, font_spec) FRAME. The closeness is detemined by the font backend, thus `face-font-selection-order' is ignored here. */ static Lisp_Object -w32font_match (frame, font_spec) - Lisp_Object frame, font_spec; +w32font_match (Lisp_Object frame, Lisp_Object font_spec) { Lisp_Object entity = w32font_match_internal (frame, font_spec, 0); FONT_ADD_LOG ("w32font-match", font_spec, entity); @@ -223,15 +218,14 @@ w32font_match (frame, font_spec) List available families. The value is a list of family names (symbols). */ static Lisp_Object -w32font_list_family (frame) - Lisp_Object frame; +w32font_list_family (Lisp_Object frame) { Lisp_Object list = Qnil; LOGFONT font_match_pattern; HDC dc; FRAME_PTR f = XFRAME (frame); - bzero (&font_match_pattern, sizeof (font_match_pattern)); + memset (&font_match_pattern, 0, sizeof (font_match_pattern)); font_match_pattern.lfCharSet = DEFAULT_CHARSET; dc = get_frame_dc (f); @@ -248,10 +242,7 @@ w32font_list_family (frame) Open a font specified by FONT_ENTITY on frame F. If the font is scalable, open it with PIXEL_SIZE. */ static Lisp_Object -w32font_open (f, font_entity, pixel_size) - FRAME_PTR f; - Lisp_Object font_entity; - int pixel_size; +w32font_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) { Lisp_Object font_object = font_make_object (VECSIZE (struct w32font_info), @@ -275,9 +266,7 @@ w32font_open (f, font_entity, pixel_size) /* w32 implementation of close for font_backend. Close FONT on frame F. */ void -w32font_close (f, font) - FRAME_PTR f; - struct font *font; +w32font_close (FRAME_PTR f, struct font *font) { int i; struct w32font_info *w32_font = (struct w32font_info *) font; @@ -303,9 +292,7 @@ w32font_close (f, font) return 1. If not, return 0. If a font must be opened to check it, return -1. */ int -w32font_has_char (entity, c) - Lisp_Object entity; - int c; +w32font_has_char (Lisp_Object entity, int c) { /* We can't be certain about which characters a font will support until we open it. Checking the scripts that the font supports turns out @@ -354,9 +341,7 @@ w32font_has_char (entity, c) which characters are not supported by the font. */ static unsigned -w32font_encode_char (font, c) - struct font *font; - int c; +w32font_encode_char (struct font *font, int c) { struct w32font_info * w32_font = (struct w32font_info *)font; @@ -373,11 +358,8 @@ w32font_encode_char (font, c) CODE (length NGLYPHS). Apparently metrics can be NULL, in this case just return the overall width. */ int -w32font_text_extents (font, code, nglyphs, metrics) - struct font *font; - unsigned *code; - int nglyphs; - struct font_metrics *metrics; +w32font_text_extents (struct font *font, unsigned *code, + int nglyphs, struct font_metrics *metrics) { int i; HFONT old_font = NULL; @@ -391,7 +373,7 @@ w32font_text_extents (font, code, nglyphs, metrics) if (metrics) { - bzero (metrics, sizeof (struct font_metrics)); + memset (metrics, 0, sizeof (struct font_metrics)); metrics->ascent = font->ascent; metrics->descent = font->descent; @@ -412,9 +394,9 @@ w32font_text_extents (font, code, nglyphs, metrics) = xrealloc (w32_font->cached_metrics, (block + 1) * sizeof (struct w32_metric_cache *)); - bzero (w32_font->cached_metrics + w32_font->n_cache_blocks, - ((block + 1 - w32_font->n_cache_blocks) - * sizeof (struct w32_metric_cache *))); + memset (w32_font->cached_metrics + w32_font->n_cache_blocks, 0, + ((block + 1 - w32_font->n_cache_blocks) + * sizeof (struct w32_metric_cache *))); w32_font->n_cache_blocks = block + 1; } @@ -422,8 +404,8 @@ w32font_text_extents (font, code, nglyphs, metrics) { w32_font->cached_metrics[block] = xmalloc (CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache)); - bzero (w32_font->cached_metrics[block], - CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache)); + memset (w32_font->cached_metrics[block], 0, + CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache)); } char_metric = w32_font->cached_metrics[block] + pos_in_block; @@ -552,9 +534,8 @@ w32font_text_extents (font, code, nglyphs, metrics) */ int -w32font_draw (s, from, to, x, y, with_background) - struct glyph_string *s; - int from, to, x, y, with_background; +w32font_draw (struct glyph_string *s, int from, int to, + int x, int y, int with_background) { UINT options; HRGN orig_clip = NULL; @@ -568,7 +549,7 @@ w32font_draw (s, from, to, x, y, with_background) /* Save clip region for later restoration. */ orig_clip = CreateRectRgn (0, 0, 0, 0); - if (!GetClipRgn(s->hdc, orig_clip)) + if (!GetClipRgn (s->hdc, orig_clip)) { DeleteObject (orig_clip); orig_clip = NULL; @@ -715,9 +696,7 @@ w32font_otf_drive (struct font *font, Lisp_Object features, Additional parameter opentype_only restricts the returned fonts to opentype fonts, which can be used with the Uniscribe backend. */ Lisp_Object -w32font_list_internal (frame, font_spec, opentype_only) - Lisp_Object frame, font_spec; - int opentype_only; +w32font_list_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_only) { struct font_callback_data match_data; HDC dc; @@ -727,7 +706,7 @@ w32font_list_internal (frame, font_spec, opentype_only) match_data.list = Qnil; match_data.frame = frame; - bzero (&match_data.pattern, sizeof (LOGFONT)); + memset (&match_data.pattern, 0, sizeof (LOGFONT)); fill_in_logfont (f, &match_data.pattern, font_spec); /* If the charset is unrecognized, then we won't find a font, so don't @@ -770,9 +749,7 @@ w32font_list_internal (frame, font_spec, opentype_only) Additional parameter opentype_only restricts the returned fonts to opentype fonts, which can be used with the Uniscribe backend. */ Lisp_Object -w32font_match_internal (frame, font_spec, opentype_only) - Lisp_Object frame, font_spec; - int opentype_only; +w32font_match_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_only) { struct font_callback_data match_data; HDC dc; @@ -782,7 +759,7 @@ w32font_match_internal (frame, font_spec, opentype_only) match_data.frame = frame; match_data.list = Qnil; - bzero (&match_data.pattern, sizeof (LOGFONT)); + memset (&match_data.pattern, 0, sizeof (LOGFONT)); fill_in_logfont (f, &match_data.pattern, font_spec); match_data.opentype_only = opentype_only; @@ -800,11 +777,8 @@ w32font_match_internal (frame, font_spec, opentype_only) } int -w32font_open_internal (f, font_entity, pixel_size, font_object) - FRAME_PTR f; - Lisp_Object font_entity; - int pixel_size; - Lisp_Object font_object; +w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity, + int pixel_size, Lisp_Object font_object) { int len, size, i; LOGFONT logfont; @@ -821,7 +795,7 @@ w32font_open_internal (f, font_entity, pixel_size, font_object) if (!font) return 0; - bzero (&logfont, sizeof (logfont)); + memset (&logfont, 0, sizeof (logfont)); fill_in_logfont (f, &logfont, font_entity); /* Prefer truetype fonts, to avoid known problems with type1 fonts, and @@ -850,8 +824,8 @@ w32font_open_internal (f, font_entity, pixel_size, font_object) { metrics = (OUTLINETEXTMETRICW *) alloca (len); if (GetOutlineTextMetricsW (dc, len, metrics)) - bcopy (&metrics->otmTextMetrics, &w32_font->metrics, - sizeof (TEXTMETRICW)); + memcpy (&w32_font->metrics, &metrics->otmTextMetrics, + sizeof (TEXTMETRICW)); else metrics = NULL; } @@ -951,11 +925,9 @@ w32font_open_internal (f, font_entity, pixel_size, font_object) /* Callback function for EnumFontFamiliesEx. * Adds the name of a font to a Lisp list (passed in as the lParam arg). */ static int CALLBACK -add_font_name_to_list (logical_font, physical_font, font_type, list_object) - ENUMLOGFONTEX *logical_font; - NEWTEXTMETRICEX *physical_font; - DWORD font_type; - LPARAM list_object; +add_font_name_to_list (ENUMLOGFONTEX *logical_font, + NEWTEXTMETRICEX *physical_font, + DWORD font_type, LPARAM list_object) { Lisp_Object* list = (Lisp_Object *) list_object; Lisp_Object family; @@ -971,19 +943,17 @@ add_font_name_to_list (logical_font, physical_font, font_type, list_object) return 1; } -static int w32_decode_weight P_ ((int)); -static int w32_encode_weight P_ ((int)); +static int w32_decode_weight (int); +static int w32_encode_weight (int); /* Convert an enumerated Windows font to an Emacs font entity. */ static Lisp_Object -w32_enumfont_pattern_entity (frame, logical_font, physical_font, - font_type, requested_font, backend) - Lisp_Object frame; - ENUMLOGFONTEX *logical_font; - NEWTEXTMETRICEX *physical_font; - DWORD font_type; - LOGFONT *requested_font; - Lisp_Object backend; +w32_enumfont_pattern_entity (Lisp_Object frame, + ENUMLOGFONTEX *logical_font, + NEWTEXTMETRICEX *physical_font, + DWORD font_type, + LOGFONT *requested_font, + Lisp_Object backend) { Lisp_Object entity, tem; LOGFONT *lf = (LOGFONT*) logical_font; @@ -1107,8 +1077,7 @@ w32_generic_family (Lisp_Object name) } static int -logfonts_match (font, pattern) - LOGFONT *font, *pattern; +logfonts_match (LOGFONT *font, LOGFONT *pattern) { /* Only check height for raster fonts. */ if (pattern->lfHeight && font->lfOutPrecision == OUT_STRING_PRECIS @@ -1132,12 +1101,9 @@ logfonts_match (font, pattern) #define CSB_CHINESE ((1 << 18) | (1 << 20)) static int -font_matches_spec (type, font, spec, backend, logfont) - DWORD type; - NEWTEXTMETRICEX *font; - Lisp_Object spec; - Lisp_Object backend; - LOGFONT *logfont; +font_matches_spec (DWORD type, NEWTEXTMETRICEX *font, + Lisp_Object spec, Lisp_Object backend, + LOGFONT *logfont) { Lisp_Object extra, val; @@ -1322,9 +1288,7 @@ font_matches_spec (type, font, spec, backend, logfont) } static int -w32font_coverage_ok (coverage, charset) - FONTSIGNATURE * coverage; - BYTE charset; +w32font_coverage_ok (FONTSIGNATURE * coverage, BYTE charset) { DWORD subrange1 = coverage->fsUsb[1]; @@ -1350,9 +1314,7 @@ w32font_coverage_ok (coverage, charset) static int -check_face_name (font, full_name) - LOGFONT *font; - char *full_name; +check_face_name (LOGFONT *font, char *full_name) { char full_iname[LF_FULLFACESIZE+1]; @@ -1397,11 +1359,9 @@ check_face_name (font, full_name) * and the list to which the fonts are added are passed in via the * lparam argument, in the form of a font_callback_data struct. */ static int CALLBACK -add_font_entity_to_list (logical_font, physical_font, font_type, lParam) - ENUMLOGFONTEX *logical_font; - NEWTEXTMETRICEX *physical_font; - DWORD font_type; - LPARAM lParam; +add_font_entity_to_list (ENUMLOGFONTEX *logical_font, + NEWTEXTMETRICEX *physical_font, + DWORD font_type, LPARAM lParam) { struct font_callback_data *match_data = (struct font_callback_data *) lParam; @@ -1510,11 +1470,9 @@ add_font_entity_to_list (logical_font, physical_font, font_type, lParam) /* Callback function for EnumFontFamiliesEx. * Terminates the search once we have a match. */ static int CALLBACK -add_one_font_entity_to_list (logical_font, physical_font, font_type, lParam) - ENUMLOGFONTEX *logical_font; - NEWTEXTMETRICEX *physical_font; - DWORD font_type; - LPARAM lParam; +add_one_font_entity_to_list (ENUMLOGFONTEX *logical_font, + NEWTEXTMETRICEX *physical_font, + DWORD font_type, LPARAM lParam) { struct font_callback_data *match_data = (struct font_callback_data *) lParam; @@ -1526,8 +1484,7 @@ add_one_font_entity_to_list (logical_font, physical_font, font_type, lParam) /* Old function to convert from x to w32 charset, from w32fns.c. */ static LONG -x_to_w32_charset (lpcs) - char * lpcs; +x_to_w32_charset (char * lpcs) { Lisp_Object this_entry, w32_charset; char *charset; @@ -1609,8 +1566,7 @@ x_to_w32_charset (lpcs) /* Convert a Lisp font registry (symbol) to a windows charset. */ static LONG -registry_to_w32_charset (charset) - Lisp_Object charset; +registry_to_w32_charset (Lisp_Object charset) { if (EQ (charset, Qiso10646_1) || EQ (charset, Qunicode_bmp) || EQ (charset, Qunicode_sip)) @@ -1625,9 +1581,7 @@ registry_to_w32_charset (charset) /* Old function to convert from w32 to x charset, from w32fns.c. */ static char * -w32_to_x_charset (fncharset, matching) - int fncharset; - char *matching; +w32_to_x_charset (int fncharset, char *matching) { static char buf[32]; Lisp_Object charset_type; @@ -1821,9 +1775,7 @@ w32_to_x_charset (fncharset, matching) } static Lisp_Object -w32_registry (w32_charset, font_type) - LONG w32_charset; - DWORD font_type; +w32_registry (LONG w32_charset, DWORD font_type) { char *charset; @@ -1833,12 +1785,11 @@ w32_registry (w32_charset, font_type) return font_type == TRUETYPE_FONTTYPE ? Qiso10646_1 : Qunknown; charset = w32_to_x_charset (w32_charset, NULL); - return font_intern_prop (charset, strlen(charset), 1); + return font_intern_prop (charset, strlen (charset), 1); } static int -w32_decode_weight (fnweight) - int fnweight; +w32_decode_weight (int fnweight) { if (fnweight >= FW_HEAVY) return 210; if (fnweight >= FW_EXTRABOLD) return 205; @@ -1852,8 +1803,7 @@ w32_decode_weight (fnweight) } static int -w32_encode_weight (n) - int n; +w32_encode_weight (int n) { if (n >= 210) return FW_HEAVY; if (n >= 205) return FW_EXTRABOLD; @@ -1869,8 +1819,7 @@ w32_encode_weight (n) /* Convert a Windows font weight into one of the weights supported by fontconfig (see font.c:font_parse_fcname). */ static Lisp_Object -w32_to_fc_weight (n) - int n; +w32_to_fc_weight (int n) { if (n >= FW_EXTRABOLD) return intern ("black"); if (n >= FW_BOLD) return intern ("bold"); @@ -1881,10 +1830,7 @@ w32_to_fc_weight (n) /* Fill in all the available details of LOGFONT from FONT_SPEC. */ static void -fill_in_logfont (f, logfont, font_spec) - FRAME_PTR f; - LOGFONT *logfont; - Lisp_Object font_spec; +fill_in_logfont (FRAME_PTR f, LOGFONT *logfont, Lisp_Object font_spec) { Lisp_Object tmp, extra; int dpi = FRAME_W32_DISPLAY_INFO (f)->resy; @@ -2029,8 +1975,7 @@ fill_in_logfont (f, logfont, font_spec) } static void -list_all_matching_fonts (match_data) - struct font_callback_data *match_data; +list_all_matching_fonts (struct font_callback_data *match_data) { HDC dc; Lisp_Object families = w32font_list_family (match_data->frame); @@ -2066,8 +2011,7 @@ list_all_matching_fonts (match_data) } static Lisp_Object -lispy_antialias_type (type) - BYTE type; +lispy_antialias_type (BYTE type) { Lisp_Object lispy; @@ -2094,8 +2038,7 @@ lispy_antialias_type (type) /* Convert antialiasing symbols to lfQuality */ static BYTE -w32_antialias_type (type) - Lisp_Object type; +w32_antialias_type (Lisp_Object type) { if (EQ (type, Qnone)) return NONANTIALIASED_QUALITY; @@ -2241,12 +2184,8 @@ font_supported_scripts (FONTSIGNATURE * sig) The full name is in fcname format, with weight, slant and antialiasing specified if they are not "normal". */ static int -w32font_full_name (font, font_obj, pixel_size, name, nbytes) - LOGFONT * font; - Lisp_Object font_obj; - int pixel_size; - char *name; - int nbytes; +w32font_full_name (LOGFONT * font, Lisp_Object font_obj, + int pixel_size, char *name, int nbytes) { int len, height, outline; char *p; @@ -2317,11 +2256,8 @@ w32font_full_name (font, font_obj, pixel_size, name, nbytes) is written. If the buffer is not large enough to contain the name, the function returns -1, otherwise it returns the number of bytes written to FCNAME. */ -static int logfont_to_fcname(font, pointsize, fcname, size) - LOGFONT* font; - int pointsize; - char *fcname; - int size; +static int +logfont_to_fcname (LOGFONT* font, int pointsize, char *fcname, int size) { int len, height; char *p = fcname; @@ -2360,11 +2296,8 @@ static int logfont_to_fcname(font, pointsize, fcname, size) } static void -compute_metrics (dc, w32_font, code, metrics) - HDC dc; - struct w32font_info *w32_font; - unsigned int code; - struct w32_metric_cache *metrics; +compute_metrics (HDC dc, struct w32font_info *w32_font, unsigned int code, + struct w32_metric_cache *metrics) { GLYPHMETRICS gm; MAT2 transform; @@ -2373,7 +2306,7 @@ compute_metrics (dc, w32_font, code, metrics) if (w32_font->glyph_idx) options |= GGO_GLYPH_INDEX; - bzero (&transform, sizeof (transform)); + memset (&transform, 0, sizeof (transform)); transform.eM11.value = 1; transform.eM22.value = 1; @@ -2396,8 +2329,7 @@ Return fontconfig style font string corresponding to the selection. If FRAME is omitted or nil, it defaults to the selected frame. If EXCLUDE-PROPORTIONAL is non-nil, exclude proportional fonts in the font selection dialog. */) - (frame, exclude_proportional) - Lisp_Object frame, exclude_proportional; + (Lisp_Object frame, Lisp_Object exclude_proportional) { FRAME_PTR f = check_x_frame (frame); CHOOSEFONT cf; @@ -2407,8 +2339,8 @@ in the font selection dialog. */) HANDLE oldobj; char buf[100]; - bzero (&cf, sizeof (cf)); - bzero (&lf, sizeof (lf)); + memset (&cf, 0, sizeof (cf)); + memset (&lf, 0, sizeof (lf)); cf.lStructSize = sizeof (cf); cf.hwndOwner = FRAME_W32_WINDOW (f); @@ -2482,7 +2414,7 @@ struct font_driver w32font_driver = /* Initialize state that does not change between invocations. This is only called when Emacs is dumped. */ void -syms_of_w32font () +syms_of_w32font (void) { DEFSYM (Qgdi, "gdi"); DEFSYM (Quniscribe, "uniscribe"); diff --git a/src/w32font.h b/src/w32font.h index 3e2345589b5..6479f95faf5 100644 --- a/src/w32font.h +++ b/src/w32font.h @@ -62,26 +62,26 @@ struct w32font_info #define CACHE_BLOCKSIZE 128 -Lisp_Object w32font_get_cache P_ ((FRAME_PTR fe)); -Lisp_Object w32font_list_internal P_ ((Lisp_Object frame, - Lisp_Object font_spec, - int opentype_only)); -Lisp_Object w32font_match_internal P_ ((Lisp_Object frame, - Lisp_Object font_spec, - int opentype_only)); -int w32font_open_internal P_ ((FRAME_PTR f, Lisp_Object font_entity, - int pixel_size, Lisp_Object font_object)); -void w32font_close P_ ((FRAME_PTR f, struct font *font)); -int w32font_has_char P_ ((Lisp_Object entity, int c)); -int w32font_text_extents P_ ((struct font *font, unsigned *code, int nglyphs, - struct font_metrics *metrics)); -int w32font_draw P_ ((struct glyph_string *s, int from, int to, - int x, int y, int with_background)); +Lisp_Object w32font_get_cache (FRAME_PTR fe); +Lisp_Object w32font_list_internal (Lisp_Object frame, + Lisp_Object font_spec, + int opentype_only); +Lisp_Object w32font_match_internal (Lisp_Object frame, + Lisp_Object font_spec, + int opentype_only); +int w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity, + int pixel_size, Lisp_Object font_object); +void w32font_close (FRAME_PTR f, struct font *font); +int w32font_has_char (Lisp_Object entity, int c); +int w32font_text_extents (struct font *font, unsigned *code, int nglyphs, + struct font_metrics *metrics); +int w32font_draw (struct glyph_string *s, int from, int to, + int x, int y, int with_background); -int uniscribe_check_otf P_ ((LOGFONT *font, Lisp_Object otf_spec)); +int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec); -Lisp_Object intern_font_name P_ ((char *)); +Lisp_Object intern_font_name (char *); #endif diff --git a/src/w32heap.c b/src/w32heap.c index 440388c6eab..e307694a563 100644 --- a/src/w32heap.c +++ b/src/w32heap.c @@ -222,7 +222,7 @@ sbrk (unsigned long increment) was allocated by something else; GNU malloc detects when there is a jump in the sbrk values, and starts a new heap block. */ void -init_heap () +init_heap (void) { PIMAGE_DOS_HEADER dos_header; PIMAGE_NT_HEADERS nt_header; diff --git a/src/w32inevt.c b/src/w32inevt.c index 864b3b3f0bb..1ab0546d44f 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -582,8 +582,8 @@ w32_console_mouse_position (FRAME_PTR *f, *part = 0; SELECTED_FRAME ()->mouse_moved = 0; - XSETINT(*x, movement_pos.X); - XSETINT(*y, movement_pos.Y); + XSETINT (*x, movement_pos.X); + XSETINT (*y, movement_pos.Y); *time = movement_time; UNBLOCK_INPUT; @@ -684,7 +684,7 @@ resize_event (WINDOW_BUFFER_SIZE_RECORD *event) } static void -maybe_generate_resize_event () +maybe_generate_resize_event (void) { CONSOLE_SCREEN_BUFFER_INFO info; FRAME_PTR f = get_frame (); diff --git a/src/w32menu.c b/src/w32menu.c index 73fba8108c6..e96b70b59dc 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -59,8 +59,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ HMENU current_popup_menu; -void syms_of_w32menu (); -void globals_of_w32menu (); +void syms_of_w32menu (void); +void globals_of_w32menu (void); typedef BOOL (WINAPI * GetMenuItemInfoA_Proc) ( IN HMENU, @@ -90,16 +90,16 @@ extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map; extern Lisp_Object Qmenu_bar_update_hook; -void set_frame_menubar P_ ((FRAME_PTR, int, int)); +void set_frame_menubar (FRAME_PTR, int, int); #ifdef HAVE_DIALOGS -static Lisp_Object w32_dialog_show P_ ((FRAME_PTR, int, Lisp_Object, char**)); +static Lisp_Object w32_dialog_show (FRAME_PTR, int, Lisp_Object, char**); #else -static int is_simple_dialog P_ ((Lisp_Object)); -static Lisp_Object simple_dialog_show P_ ((FRAME_PTR, Lisp_Object, Lisp_Object)); +static int is_simple_dialog (Lisp_Object); +static Lisp_Object simple_dialog_show (FRAME_PTR, Lisp_Object, Lisp_Object); #endif -void w32_free_menu_strings P_((HWND)); +void w32_free_menu_strings (HWND); /* This is set nonzero after the user activates the menu bar, and set @@ -116,8 +116,7 @@ int pending_menu_activation; ID, or 0 if none. */ static struct frame * -menubar_id_to_frame (id) - HMENU id; +menubar_id_to_frame (HMENU id) { Lisp_Object tail, frame; FRAME_PTR f; @@ -157,8 +156,7 @@ on the left of the dialog box and all following items on the right. If HEADER is non-nil, the frame title for the box is "Information", otherwise it is "Question". */) - (position, contents, header) - Lisp_Object position, contents, header; + (Lisp_Object position, Lisp_Object contents, Lisp_Object header) { FRAME_PTR f = NULL; Lisp_Object window; @@ -276,8 +274,7 @@ otherwise it is "Question". */) This way we can safely execute Lisp code. */ void -x_activate_menubar (f) - FRAME_PTR f; +x_activate_menubar (FRAME_PTR f) { set_frame_menubar (f, 0, 1); @@ -386,10 +383,7 @@ menubar_selection_callback (FRAME_PTR f, void * client_data) it is set the first time this is called, from initialize_frame_menubar. */ void -set_frame_menubar (f, first_time, deep_p) - FRAME_PTR f; - int first_time; - int deep_p; +set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) { HMENU menubar_widget = f->output_data.w32->menubar_widget; Lisp_Object items; @@ -455,8 +449,8 @@ set_frame_menubar (f, first_time, deep_p) /* Save the frame's previous menu bar contents data. */ if (previous_menu_items_used) - bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items, - previous_menu_items_used * sizeof (Lisp_Object)); + memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents, + previous_menu_items_used * sizeof (Lisp_Object)); /* Fill in menu_items with the current menu bar contents. This can evaluate Lisp code. */ @@ -648,8 +642,7 @@ set_frame_menubar (f, first_time, deep_p) is visible. */ void -initialize_frame_menubar (f) - FRAME_PTR f; +initialize_frame_menubar (FRAME_PTR f) { /* This function is called before the first chance to redisplay the frame. It has to be, so the frame will have the right size. */ @@ -661,8 +654,7 @@ initialize_frame_menubar (f) This is used when deleting a frame, and when turning off the menu bar. */ void -free_frame_menubar (f) - FRAME_PTR f; +free_frame_menubar (FRAME_PTR f) { BLOCK_INPUT; @@ -1020,11 +1012,9 @@ static char * button_names [] = { "button6", "button7", "button8", "button9", "button10" }; static Lisp_Object -w32_dialog_show (f, keymaps, title, header, error) - FRAME_PTR f; - int keymaps; - Lisp_Object title, header; - char **error; +w32_dialog_show (FRAME_PTR f, int keymaps, + Lisp_Object title, Lisp_Object header, + char **error) { int i, nb_buttons=0; char dialog_name[6]; @@ -1127,7 +1117,7 @@ w32_dialog_show (f, keymaps, title, header, error) /* Frame title: 'Q' = Question, 'I' = Information. Can also have 'E' = Error if, one day, we want a popup for errors. */ - if (NILP(header)) + if (NILP (header)) dialog_name[0] = 'Q'; else dialog_name[0] = 'I'; @@ -1213,8 +1203,8 @@ w32_dialog_show (f, keymaps, title, header, error) anywhere in Emacs that uses the other specific dialog choices that MessageBox provides. */ -static int is_simple_dialog (contents) - Lisp_Object contents; +static int +is_simple_dialog (Lisp_Object contents) { Lisp_Object options = XCDR (contents); Lisp_Object name, yes, no, other; @@ -1249,9 +1239,8 @@ static int is_simple_dialog (contents) return !(CONSP (options)); } -static Lisp_Object simple_dialog_show (f, contents, header) - FRAME_PTR f; - Lisp_Object contents, header; +static Lisp_Object +simple_dialog_show (FRAME_PTR f, Lisp_Object contents, Lisp_Object header) { int answer; UINT type; @@ -1315,8 +1304,7 @@ static Lisp_Object simple_dialog_show (f, contents, header) /* Is this item a separator? */ static int -name_is_separator (name) - char *name; +name_is_separator (char *name) { char *start = name; @@ -1533,7 +1521,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item) if (set_menu_item_info) { MENUITEMINFO info; - bzero (&info, sizeof (info)); + memset (&info, 0, sizeof (info)); info.cbSize = sizeof (info); info.fMask = MIIM_DATA; @@ -1616,7 +1604,7 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags) { MENUITEMINFO info; - bzero (&info, sizeof (info)); + memset (&info, 0, sizeof (info)); info.cbSize = sizeof (info); info.fMask = MIIM_DATA; get_menu_item_info (menu, item, FALSE, &info); @@ -1647,14 +1635,13 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags) /* Free memory used by owner-drawn strings. */ static void -w32_free_submenu_strings (menu) - HMENU menu; +w32_free_submenu_strings (HMENU menu) { int i, num = GetMenuItemCount (menu); for (i = 0; i < num; i++) { MENUITEMINFO info; - bzero (&info, sizeof (info)); + memset (&info, 0, sizeof (info)); info.cbSize = sizeof (info); info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_SUBMENU; @@ -1676,8 +1663,7 @@ w32_free_submenu_strings (menu) } void -w32_free_menu_strings (hwnd) - HWND hwnd; +w32_free_menu_strings (HWND hwnd) { HMENU menu = current_popup_menu; @@ -1701,7 +1687,7 @@ w32_free_menu_strings (hwnd) DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0, doc: /* Return t if a menu or popup dialog is active on selected frame. */) - () + (void) { #ifdef HAVE_MENUS FRAME_PTR f; @@ -1712,7 +1698,8 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_ #endif /* HAVE_MENUS */ } -void syms_of_w32menu () +void +syms_of_w32menu (void) { globals_of_w32menu (); @@ -1734,7 +1721,8 @@ void syms_of_w32menu () variable initialized is 0 and directly from main when initialized is non zero. */ -void globals_of_w32menu () +void +globals_of_w32menu (void) { /* See if Get/SetMenuItemInfo functions are available. */ HMODULE user32 = GetModuleHandle ("user32.dll"); diff --git a/src/w32proc.c b/src/w32proc.c index b8443e5a75b..af923723709 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -46,7 +46,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <windows.h> #ifdef __GNUC__ /* This definition is missing from mingw32 headers. */ -extern BOOL WINAPI IsValidLocale(LCID, DWORD); +extern BOOL WINAPI IsValidLocale (LCID, DWORD); #endif #ifdef HAVE_LANGINFO_CODESET @@ -117,7 +117,8 @@ extern Lisp_Object Qlocal; Lisp_Object Qhigh, Qlow; #ifdef EMACSDEBUG -void _DebPrint (const char *fmt, ...) +void +_DebPrint (const char *fmt, ...) { char buf[1024]; va_list args; @@ -129,7 +130,7 @@ void _DebPrint (const char *fmt, ...) } #endif -typedef void (_CALLBACK_ *signal_handler)(int); +typedef void (_CALLBACK_ *signal_handler) (int); /* Signal handlers...SIG_DFL == 0 so this is initialized correctly. */ static signal_handler sig_handlers[NSIG]; @@ -175,7 +176,7 @@ new_child (void) cp = &child_procs[child_proc_count++]; Initialise: - memset (cp, 0, sizeof(*cp)); + memset (cp, 0, sizeof (*cp)); cp->fd = -1; cp->pid = -1; cp->procinfo.hProcess = NULL; @@ -398,7 +399,7 @@ create_child (char *exe, char *cmdline, char *env, int is_gui_app, return TRUE; EH_Fail: - DebPrint (("create_child.CreateProcess failed: %ld\n", GetLastError());); + DebPrint (("create_child.CreateProcess failed: %ld\n", GetLastError ());); return FALSE; } @@ -608,7 +609,10 @@ sys_wait (int *status) #endif void -w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app, int * is_gui_app) +w32_executable_type (char * filename, + int * is_dos_app, + int * is_cygnus_app, + int * is_gui_app) { file_data executable; char * p; @@ -1719,8 +1723,7 @@ also loaded immediately if not already loaded. If winsock is loaded, the winsock local hostname is returned (since this may be different from the value of `system-name' and should supplant it), otherwise t is returned to indicate winsock support is present. */) - (load_now) - Lisp_Object load_now; + (Lisp_Object load_now) { int have_winsock; @@ -1751,7 +1754,7 @@ DEFUN ("w32-unload-winsock", Fw32_unload_winsock, Sw32_unload_winsock, This is provided to allow dial-up socket connections to be disconnected when no longer needed. Returns nil without unloading winsock if any socket connections still exist. */) - () + (void) { return term_winsock () ? Qt : Qnil; } @@ -1766,8 +1769,7 @@ DEFUN ("w32-short-file-name", Fw32_short_file_name, Sw32_short_file_name, 1, 1, doc: /* Return the short file name version (8.3) of the full path of FILENAME. If FILENAME does not exist, return nil. All path elements in FILENAME are converted to their short names. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { char shortname[MAX_PATH]; @@ -1791,8 +1793,7 @@ DEFUN ("w32-long-file-name", Fw32_long_file_name, Sw32_long_file_name, doc: /* Return the long file name version of the full path of FILENAME. If FILENAME does not exist, return nil. All path elements in FILENAME are converted to their long names. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { char longname[ MAX_PATH ]; int drive_only = 0; @@ -1829,8 +1830,7 @@ PRIORITY should be one of the symbols high, normal, or low; any other symbol will be interpreted as normal. If successful, the return value is t, otherwise nil. */) - (process, priority) - Lisp_Object process, priority; + (Lisp_Object process, Lisp_Object priority) { HANDLE proc_handle = GetCurrentProcess (); DWORD priority_class = NORMAL_PRIORITY_CLASS; @@ -1875,7 +1875,8 @@ If successful, the return value is t, otherwise nil. */) #ifdef HAVE_LANGINFO_CODESET /* Emulation of nl_langinfo. Used in fns.c:Flocale_info. */ -char *nl_langinfo (nl_item item) +char * +nl_langinfo (nl_item item) { /* Conversion of Posix item numbers to their Windows equivalents. */ static const LCTYPE w32item[] = { @@ -1951,8 +1952,7 @@ is a number, it is interpreted as an LCTYPE constant and the corresponding locale information is returned. If LCID (a 16-bit number) is not a valid locale, the result is nil. */) - (lcid, longform) - Lisp_Object lcid, longform; + (Lisp_Object lcid, Lisp_Object longform) { int got_abbrev; int got_full; @@ -1998,18 +1998,19 @@ DEFUN ("w32-get-current-locale-id", Fw32_get_current_locale_id, doc: /* Return Windows locale id for current locale setting. This is a numerical value; use `w32-get-locale-info' to convert to a human-readable form. */) - () + (void) { return make_number (GetThreadLocale ()); } -DWORD int_from_hex (char * s) +DWORD +int_from_hex (char * s) { DWORD val = 0; static char hex[] = "0123456789abcdefABCDEF"; char * p; - while (*s && (p = strchr(hex, *s)) != NULL) + while (*s && (p = strchr (hex, *s)) != NULL) { unsigned digit = p - hex; if (digit > 15) @@ -2024,7 +2025,8 @@ DWORD int_from_hex (char * s) function isn't given a context pointer. */ Lisp_Object Vw32_valid_locale_ids; -BOOL CALLBACK enum_locale_fn (LPTSTR localeNum) +BOOL CALLBACK +enum_locale_fn (LPTSTR localeNum) { DWORD id = int_from_hex (localeNum); Vw32_valid_locale_ids = Fcons (make_number (id), Vw32_valid_locale_ids); @@ -2036,7 +2038,7 @@ DEFUN ("w32-get-valid-locale-ids", Fw32_get_valid_locale_ids, doc: /* Return list of all valid Windows locale ids. Each id is a numerical value; use `w32-get-locale-info' to convert to a human-readable form. */) - () + (void) { Vw32_valid_locale_ids = Qnil; @@ -2053,8 +2055,7 @@ By default, the system default locale setting is returned; if the optional parameter USERP is non-nil, the user default locale setting is returned. This is a numerical value; use `w32-get-locale-info' to convert to a human-readable form. */) - (userp) - Lisp_Object userp; + (Lisp_Object userp) { if (NILP (userp)) return make_number (GetSystemDefaultLCID ()); @@ -2065,8 +2066,7 @@ human-readable form. */) DEFUN ("w32-set-current-locale", Fw32_set_current_locale, Sw32_set_current_locale, 1, 1, 0, doc: /* Make Windows locale LCID be the current locale setting for Emacs. If successful, the new locale id is returned, otherwise nil. */) - (lcid) - Lisp_Object lcid; + (Lisp_Object lcid) { CHECK_NUMBER (lcid); @@ -2089,7 +2089,8 @@ If successful, the new locale id is returned, otherwise nil. */) function isn't given a context pointer. */ Lisp_Object Vw32_valid_codepages; -BOOL CALLBACK enum_codepage_fn (LPTSTR codepageNum) +BOOL CALLBACK +enum_codepage_fn (LPTSTR codepageNum) { DWORD id = atoi (codepageNum); Vw32_valid_codepages = Fcons (make_number (id), Vw32_valid_codepages); @@ -2099,7 +2100,7 @@ BOOL CALLBACK enum_codepage_fn (LPTSTR codepageNum) DEFUN ("w32-get-valid-codepages", Fw32_get_valid_codepages, Sw32_get_valid_codepages, 0, 0, 0, doc: /* Return list of all valid Windows codepages. */) - () + (void) { Vw32_valid_codepages = Qnil; @@ -2113,7 +2114,7 @@ DEFUN ("w32-get-valid-codepages", Fw32_get_valid_codepages, DEFUN ("w32-get-console-codepage", Fw32_get_console_codepage, Sw32_get_console_codepage, 0, 0, 0, doc: /* Return current Windows codepage for console input. */) - () + (void) { return make_number (GetConsoleCP ()); } @@ -2124,8 +2125,7 @@ DEFUN ("w32-set-console-codepage", Fw32_set_console_codepage, doc: /* Make Windows codepage CP be the current codepage setting for Emacs. The codepage setting affects keyboard input and display in tty mode. If successful, the new CP is returned, otherwise nil. */) - (cp) - Lisp_Object cp; + (Lisp_Object cp) { CHECK_NUMBER (cp); @@ -2142,7 +2142,7 @@ If successful, the new CP is returned, otherwise nil. */) DEFUN ("w32-get-console-output-codepage", Fw32_get_console_output_codepage, Sw32_get_console_output_codepage, 0, 0, 0, doc: /* Return current Windows codepage for console output. */) - () + (void) { return make_number (GetConsoleOutputCP ()); } @@ -2153,8 +2153,7 @@ DEFUN ("w32-set-console-output-codepage", Fw32_set_console_output_codepage, doc: /* Make Windows codepage CP be the current codepage setting for Emacs. The codepage setting affects keyboard input and display in tty mode. If successful, the new CP is returned, otherwise nil. */) - (cp) - Lisp_Object cp; + (Lisp_Object cp) { CHECK_NUMBER (cp); @@ -2172,8 +2171,7 @@ DEFUN ("w32-get-codepage-charset", Fw32_get_codepage_charset, Sw32_get_codepage_charset, 1, 1, 0, doc: /* Return charset of codepage CP. Returns nil if the codepage is not valid. */) - (cp) - Lisp_Object cp; + (Lisp_Object cp) { CHARSETINFO info; @@ -2193,7 +2191,7 @@ DEFUN ("w32-get-valid-keyboard-layouts", Fw32_get_valid_keyboard_layouts, Sw32_get_valid_keyboard_layouts, 0, 0, 0, doc: /* Return list of Windows keyboard languages and layouts. The return value is a list of pairs of language id and layout id. */) - () + (void) { int num_layouts = GetKeyboardLayoutList (0, NULL); HKL * layouts = (HKL *) alloca (num_layouts * sizeof (HKL)); @@ -2219,7 +2217,7 @@ DEFUN ("w32-get-keyboard-layout", Fw32_get_keyboard_layout, Sw32_get_keyboard_layout, 0, 0, 0, doc: /* Return current Windows keyboard language and layout. The return value is the cons of the language id and the layout id. */) - () + (void) { DWORD kl = (DWORD) GetKeyboardLayout (dwWindowsThreadId); @@ -2233,8 +2231,7 @@ DEFUN ("w32-set-keyboard-layout", Fw32_set_keyboard_layout, doc: /* Make LAYOUT be the current keyboard layout for Emacs. The keyboard layout setting affects interpretation of keyboard input. If successful, the new layout id is returned, otherwise nil. */) - (layout) - Lisp_Object layout; + (Lisp_Object layout) { DWORD kl; @@ -2265,7 +2262,8 @@ If successful, the new layout id is returned, otherwise nil. */) } -syms_of_ntproc () +void +syms_of_ntproc (void) { DEFSYM (Qhigh, "high"); DEFSYM (Qlow, "low"); diff --git a/src/w32reg.c b/src/w32reg.c index f9687d1effe..77667eb7dc9 100644 --- a/src/w32reg.c +++ b/src/w32reg.c @@ -58,9 +58,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ */ static char * -w32_get_rdb_resource (rdb, resource) - char *rdb; - char *resource; +w32_get_rdb_resource (char *rdb, char *resource) { char *value = rdb; int len = strlen (resource); @@ -78,9 +76,7 @@ w32_get_rdb_resource (rdb, resource) } static LPBYTE -w32_get_string_resource (name, class, dwexptype) - char *name, *class; - DWORD dwexptype; +w32_get_string_resource (char *name, char *class, DWORD dwexptype) { LPBYTE lpvalue = NULL; HKEY hrootkey = NULL; @@ -147,9 +143,7 @@ w32_get_string_resource (name, class, dwexptype) database RDB. */ char * -x_get_string_resource (rdb, name, class) - XrmDatabase rdb; - char *name, *class; +x_get_string_resource (XrmDatabase rdb, char *name, char *class) { if (rdb) { diff --git a/src/w32select.c b/src/w32select.c index 2da4b333c2a..8482d3331ff 100644 --- a/src/w32select.c +++ b/src/w32select.c @@ -30,7 +30,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ * (CF_UNICODETEXT), when a well-known console codepage is given, they * apply to the console version of the clipboard data (CF_OEMTEXT), * else they apply to the normal 8-bit text clipboard (CF_TEXT). - * + * * When pasting (getting data from the OS), the clipboard format that * matches the {next-}selection-coding-system is retrieved. If * Unicode is requested, but not available, 8-bit text (CF_TEXT) is @@ -45,13 +45,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ * * Scenarios to use the facilities for customizing the selection * coding system are: - * + * * ;; Generally use KOI8-R instead of the russian MS codepage for * ;; the 8-bit clipboard. * (set-selection-coding-system 'koi8-r-dos) - * + * * Or - * + * * ;; Create a special clipboard copy function that uses codepage * ;; 1253 (Greek) to copy Greek text to a specific non-Unicode * ;; application. @@ -71,7 +71,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ * types should be supported is also moved to Lisp, functionality * could be expanded to CF_HTML, CF_RTF and maybe other types. */ - + #include <config.h> #include <setjmp.h> #include "lisp.h" @@ -89,8 +89,8 @@ static HGLOBAL convert_to_handle_as_ascii (void); static HGLOBAL convert_to_handle_as_coded (Lisp_Object coding_system); static Lisp_Object render (Lisp_Object oformat); static Lisp_Object render_locale (void); -static Lisp_Object render_all (void); -static void run_protected (Lisp_Object (*code) (), Lisp_Object arg); +static Lisp_Object render_all (Lisp_Object ignore); +static void run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg); static Lisp_Object lisp_error_handler (Lisp_Object error); static LRESULT CALLBACK owner_callback (HWND win, UINT msg, WPARAM wp, LPARAM lp); @@ -220,11 +220,11 @@ convert_to_handle_as_coded (Lisp_Object coding_system) unsigned char *dst = NULL; struct coding_system coding; - ONTRACE (fprintf (stderr, "convert_to_handle_as_coded: %s\n", + ONTRACE (fprintf (stderr, "convert_to_handle_as_coded: %s\n", SDATA (SYMBOL_NAME (coding_system)))); setup_windows_coding_system (coding_system, &coding); - coding.dst_bytes = SBYTES(current_text) * 2; + coding.dst_bytes = SBYTES (current_text) * 2; coding.destination = (unsigned char *) xmalloc (coding.dst_bytes); encode_coding_object (&coding, current_text, 0, 0, SCHARS (current_text), SBYTES (current_text), Qnil); @@ -290,7 +290,7 @@ render (Lisp_Object oformat) if (SetClipboardData (format, htext) == NULL) { - GlobalFree(htext); + GlobalFree (htext); return Qnil; } @@ -314,7 +314,7 @@ render_locale (void) if ((lcid_ptr = (LCID *) GlobalLock (hlocale)) == NULL) { - GlobalFree(hlocale); + GlobalFree (hlocale); return Qnil; } @@ -323,7 +323,7 @@ render_locale (void) if (SetClipboardData (CF_LOCALE, hlocale) == NULL) { - GlobalFree(hlocale); + GlobalFree (hlocale); return Qnil; } @@ -334,7 +334,7 @@ render_locale (void) data survives us. This code will do that. */ static Lisp_Object -render_all (void) +render_all (Lisp_Object ignore) { ONTRACE (fprintf (stderr, "render_all\n")); @@ -380,7 +380,7 @@ render_all (void) automatic conversions anywhere else, so to get consistent results, we probably don't want to rely on it here either. */ - render_locale(); + render_locale (); if (current_clipboard_type == CF_UNICODETEXT) render (make_number (CF_TEXT)); @@ -392,7 +392,7 @@ render_all (void) } static void -run_protected (Lisp_Object (*code) (), Lisp_Object arg) +run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg) { /* FIXME: This works but it doesn't feel right. Too much fiddling with global variables and calling strange looking functions. Is @@ -514,7 +514,7 @@ setup_config (void) && EQ (cfg_coding_system, dos_coding_system)) return; cfg_coding_system = dos_coding_system; - + /* Set some sensible fallbacks */ cfg_codepage = ANSICP; cfg_lcid = LOCALE_NEUTRAL; @@ -583,7 +583,7 @@ enum_locale_callback (/*const*/ char* loc_string) cfg_clipboard_type = CF_TEXT; return FALSE; /* Stop enumeration */ } - + /* Is the wanted codepage the OEM codepage for this locale? */ codepage = cp_from_locale (lcid, CF_OEMTEXT); if (codepage == cfg_codepage) @@ -681,8 +681,7 @@ setup_windows_coding_system (Lisp_Object coding_system, DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, Sw32_set_clipboard_data, 1, 2, 0, doc: /* This sets the clipboard data to the given text. */) - (string, ignored) - Lisp_Object string, ignored; + (Lisp_Object string, Lisp_Object ignored) { BOOL ok = TRUE; int nbytes; @@ -704,7 +703,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, current_lcid = cfg_lcid; current_num_nls = 0; current_requires_encoding = 0; - + BLOCK_INPUT; /* Check for non-ASCII characters. While we are at it, count the @@ -744,7 +743,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, /* If we have something non-ASCII we may want to set a locale. We do that directly (non-delayed), as it's just a small bit. */ if (ok) - ok = !NILP(render_locale()); + ok = !NILP (render_locale ()); if (ok) { @@ -753,7 +752,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, /* If for some reason we don't have a clipboard_owner, we just set the text format as chosen by the configuration and than forget about the whole thing. */ - ok = !NILP(render (make_number (current_clipboard_type))); + ok = !NILP (render (make_number (current_clipboard_type))); current_text = Qnil; current_coding_system = Qnil; } @@ -802,8 +801,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data, Sw32_get_clipboard_data, 0, 1, 0, doc: /* This gets the clipboard data in text format. */) - (ignored) - Lisp_Object ignored; + (Lisp_Object ignored) { HGLOBAL htext; Lisp_Object ret = Qnil; @@ -884,7 +882,7 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data, struct coding_system coding; Lisp_Object coding_system = Qnil; Lisp_Object dos_coding_system; - + /* `next-selection-coding-system' should override everything, even when the locale passed by the system disagrees. The only exception is when `next-selection-coding-system' @@ -1027,8 +1025,7 @@ the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. \(Those are literal upper-case symbol names, since that's what X expects.) For convenience, the symbol nil is the same as `PRIMARY', and t is the same as `SECONDARY'. */) - (selection) - Lisp_Object selection; + (Lisp_Object selection) { CHECK_SYMBOL (selection); @@ -1065,7 +1062,7 @@ and t is the same as `SECONDARY'. */) dumped version. */ void -syms_of_w32select () +syms_of_w32select (void) { defsubr (&Sw32_set_clipboard_data); defsubr (&Sw32_get_clipboard_data); @@ -1076,7 +1073,7 @@ syms_of_w32select () When sending or receiving text via cut_buffer, selection, and clipboard, the text is encoded or decoded by this coding system. The default value is the current system default encoding on 9x/Me and -`utf-16le-dos' (Unicode) on NT/W2K/XP. */); +`utf-16le-dos' (Unicode) on NT/W2K/XP. */); /* The actual value is set dynamically in the dumped Emacs, see below. */ Vselection_coding_system = Qnil; @@ -1104,7 +1101,7 @@ set to nil. */); un-dumped version. */ void -globals_of_w32select () +globals_of_w32select (void) { DEFAULT_LCID = GetUserDefaultLCID (); /* Drop the sort order from the LCID, so we can compare this with diff --git a/src/w32term.c b/src/w32term.c index 0b71b7e02b7..abd7843c2ef 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -96,7 +96,7 @@ int x_underline_at_descent_line; extern unsigned int msh_mousewheel; -extern void free_frame_menubar (); +extern void free_frame_menubar (struct frame *); extern int w32_codepage_for_font (char *fontname); extern Cursor w32_load_cursor (LPCTSTR name); @@ -234,43 +234,43 @@ extern EMACS_INT extra_keyboard_modifiers; /* Keyboard code page - may be changed by language-change events. */ static int keyboard_codepage; -static void x_update_window_end P_ ((struct window *, int, int)); -static void w32_handle_tool_bar_click P_ ((struct frame *, - struct input_event *)); -static void w32_define_cursor P_ ((Window, Cursor)); +static void x_update_window_end (struct window *, int, int); +static void w32_handle_tool_bar_click (struct frame *, + struct input_event *); +static void w32_define_cursor (Window, Cursor); -void x_lower_frame P_ ((struct frame *)); -void x_scroll_bar_clear P_ ((struct frame *)); -void x_wm_set_size_hint P_ ((struct frame *, long, int)); -void x_raise_frame P_ ((struct frame *)); -void x_set_window_size P_ ((struct frame *, int, int, int)); -void x_wm_set_window_state P_ ((struct frame *, int)); -void x_wm_set_icon_pixmap P_ ((struct frame *, int)); -static void w32_initialize P_ ((void)); -static void x_update_end P_ ((struct frame *)); -static void w32_frame_up_to_date P_ ((struct frame *)); -static void w32_set_terminal_modes P_ ((struct terminal *)); -static void w32_reset_terminal_modes P_ ((struct terminal *)); -static void x_clear_frame P_ ((struct frame *)); -static void frame_highlight P_ ((struct frame *)); -static void frame_unhighlight P_ ((struct frame *)); -static void x_new_focus_frame P_ ((struct w32_display_info *, - struct frame *)); -static void x_focus_changed P_ ((int, int, struct w32_display_info *, - struct frame *, struct input_event *)); -static void w32_detect_focus_change P_ ((struct w32_display_info *, - W32Msg *, struct input_event *)); -static void w32_frame_rehighlight P_ ((struct frame *)); -static void x_frame_rehighlight P_ ((struct w32_display_info *)); -static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *)); -static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int, - enum text_cursor_kinds)); -static void w32_clip_to_row P_ ((struct window *, struct glyph_row *, int, HDC)); -static BOOL my_show_window P_ ((struct frame *, HWND, int)); -static void my_set_window_pos P_ ((HWND, HWND, int, int, int, int, UINT)); -static void my_set_focus P_ ((struct frame *, HWND)); -static void my_set_foreground_window P_ ((HWND)); -static void my_destroy_window P_ ((struct frame *, HWND)); +void x_lower_frame (struct frame *); +void x_scroll_bar_clear (struct frame *); +void x_wm_set_size_hint (struct frame *, long, int); +void x_raise_frame (struct frame *); +void x_set_window_size (struct frame *, int, int, int); +void x_wm_set_window_state (struct frame *, int); +void x_wm_set_icon_pixmap (struct frame *, int); +static void w32_initialize (void); +static void x_update_end (struct frame *); +static void w32_frame_up_to_date (struct frame *); +static void w32_set_terminal_modes (struct terminal *); +static void w32_reset_terminal_modes (struct terminal *); +static void x_clear_frame (struct frame *); +static void frame_highlight (struct frame *); +static void frame_unhighlight (struct frame *); +static void x_new_focus_frame (struct w32_display_info *, + struct frame *); +static void x_focus_changed (int, int, struct w32_display_info *, + struct frame *, struct input_event *); +static void w32_detect_focus_change (struct w32_display_info *, + W32Msg *, struct input_event *); +static void w32_frame_rehighlight (struct frame *); +static void x_frame_rehighlight (struct w32_display_info *); +static void x_draw_hollow_cursor (struct window *, struct glyph_row *); +static void x_draw_bar_cursor (struct window *, struct glyph_row *, int, + enum text_cursor_kinds); +static void w32_clip_to_row (struct window *, struct glyph_row *, int, HDC); +static BOOL my_show_window (struct frame *, HWND, int); +static void my_set_window_pos (HWND, HWND, int, int, int, int, UINT); +static void my_set_focus (struct frame *, HWND); +static void my_set_foreground_window (HWND); +static void my_destroy_window (struct frame *, HWND); static Lisp_Object Qvendor_specific_keysyms; @@ -294,9 +294,7 @@ struct record event_record[100]; int event_record_index; -record_event (locus, type) - char *locus; - int type; +record_event (char *locus, int type) { if (event_record_index == sizeof (event_record) / sizeof (struct record)) event_record_index = 0; @@ -310,7 +308,7 @@ record_event (locus, type) void -XChangeGC (void * ignore, XGCValues* gc, unsigned long mask, +XChangeGC (void *ignore, XGCValues *gc, unsigned long mask, XGCValues *xgcv) { if (mask & GCForeground) @@ -321,11 +319,11 @@ XChangeGC (void * ignore, XGCValues* gc, unsigned long mask, gc->font = xgcv->font; } -XGCValues *XCreateGC (void * ignore, Window window, unsigned long mask, - XGCValues *xgcv) +XGCValues * +XCreateGC (void *ignore, Window window, unsigned long mask, XGCValues *xgcv) { XGCValues *gc = (XGCValues *) xmalloc (sizeof (XGCValues)); - bzero (gc, sizeof (XGCValues)); + memset (gc, 0, sizeof (XGCValues)); XChangeGC (ignore, gc, mask, xgcv); @@ -333,8 +331,8 @@ XGCValues *XCreateGC (void * ignore, Window window, unsigned long mask, } void -XGetGCValues (void* ignore, XGCValues *gc, - unsigned long mask, XGCValues *xgcv) +XGetGCValues (void *ignore, XGCValues *gc, + unsigned long mask, XGCValues *xgcv) { XChangeGC (ignore, xgcv, mask, gc); } @@ -376,11 +374,7 @@ w32_draw_rectangle (HDC hdc, XGCValues *gc, int x, int y, /* Draw a filled rectangle at the specified position. */ void -w32_fill_rect (f, hdc, pix, lprect) - FRAME_PTR f; - HDC hdc; - COLORREF pix; - RECT * lprect; +w32_fill_rect (FRAME_PTR f, HDC hdc, COLORREF pix, RECT *lprect) { HBRUSH hb; @@ -390,8 +384,7 @@ w32_fill_rect (f, hdc, pix, lprect) } void -w32_clear_window (f) - FRAME_PTR f; +w32_clear_window (FRAME_PTR f) { RECT rect; HDC hdc = get_frame_dc (f); @@ -411,8 +404,7 @@ w32_clear_window (f) #define OPAQUE_FRAME 255 void -x_set_frame_alpha (f) - struct frame *f; +x_set_frame_alpha (struct frame *f) { struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); double alpha = 1.0; @@ -458,8 +450,7 @@ x_set_frame_alpha (f) } int -x_display_pixel_height (dpyinfo) - struct w32_display_info *dpyinfo; +x_display_pixel_height (struct w32_display_info *dpyinfo) { HDC dc = GetDC (NULL); int pixels = GetDeviceCaps (dc, VERTRES); @@ -468,8 +459,7 @@ x_display_pixel_height (dpyinfo) } int -x_display_pixel_width (dpyinfo) - struct w32_display_info *dpyinfo; +x_display_pixel_width (struct w32_display_info *dpyinfo) { HDC dc = GetDC (NULL); int pixels = GetDeviceCaps (dc, HORZRES); @@ -488,8 +478,7 @@ x_display_pixel_width (dpyinfo) each window being updated. */ static void -x_update_begin (f) - struct frame *f; +x_update_begin (struct frame *f) { struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f); @@ -511,8 +500,7 @@ x_update_begin (f) position of W. */ static void -x_update_window_begin (w) - struct window *w; +x_update_window_begin (struct window *w) { struct frame *f = XFRAME (WINDOW_FRAME (w)); struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f); @@ -571,9 +559,7 @@ x_update_window_begin (w) /* Draw a vertical window border from (x,y0) to (x,y1) */ static void -w32_draw_vertical_window_border (w, x, y0, y1) - struct window *w; - int x, y0, y1; +w32_draw_vertical_window_border (struct window *w, int x, int y0, int y1) { struct frame *f = XFRAME (WINDOW_FRAME (w)); RECT r; @@ -610,9 +596,8 @@ w32_draw_vertical_window_border (w, x, y0, y1) here. */ static void -x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p) - struct window *w; - int cursor_on_p, mouse_face_overwritten_p; +x_update_window_end (struct window *w, int cursor_on_p, + int mouse_face_overwritten_p) { struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (XFRAME (w->frame)); @@ -656,8 +641,7 @@ x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p) update_end. */ static void -x_update_end (f) - struct frame *f; +x_update_end (struct frame *f) { if (! FRAME_W32_P (f)) return; @@ -672,8 +656,7 @@ x_update_end (f) updated_window is not available here. */ static void -w32_frame_up_to_date (f) - struct frame *f; +w32_frame_up_to_date (struct frame *f) { if (FRAME_W32_P (f)) { @@ -702,8 +685,7 @@ w32_frame_up_to_date (f) between bitmaps to be drawn between current row and DESIRED_ROW. */ static void -x_after_update_window_line (desired_row) - struct glyph_row *desired_row; +x_after_update_window_line (struct glyph_row *desired_row) { struct window *w = updated_window; struct frame *f; @@ -749,15 +731,12 @@ x_after_update_window_line (desired_row) drawn. */ static void -w32_draw_fringe_bitmap (w, row, p) - struct window *w; - struct glyph_row *row; - struct draw_fringe_bitmap_params *p; +w32_draw_fringe_bitmap (struct window *w, struct glyph_row *row, + struct draw_fringe_bitmap_params *p) { struct frame *f = XFRAME (WINDOW_FRAME (w)); HDC hdc; struct face *face = p->face; - int rowY; hdc = get_frame_dc (f); @@ -816,21 +795,7 @@ w32_draw_fringe_bitmap (w, row, p) } /* Must clip because of partially visible lines. */ - rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); - if (p->y < rowY) - { - /* Adjust position of "bottom aligned" bitmap on partially - visible last row. */ - int oldY = row->y; - int oldVH = row->visible_height; - row->visible_height = p->h; - row->y -= rowY - p->y; - w32_clip_to_row (w, row, -1, hdc); - row->y = oldY; - row->visible_height = oldVH; - } - else - w32_clip_to_row (w, row, -1, hdc); + w32_clip_to_row (w, row, -1, hdc); if (p->which && p->which < max_fringe_bmp) { @@ -890,10 +855,7 @@ w32_draw_fringe_bitmap (w, row, p) } static void -w32_define_fringe_bitmap (which, bits, h, wd) - int which; - unsigned short *bits; - int h, wd; +w32_define_fringe_bitmap (int which, unsigned short *bits, int h, int wd) { if (which >= max_fringe_bmp) { @@ -908,8 +870,7 @@ w32_define_fringe_bitmap (which, bits, h, wd) } static void -w32_destroy_fringe_bitmap (which) - int which; +w32_destroy_fringe_bitmap (int which) { if (which >= max_fringe_bmp) return; @@ -947,40 +908,39 @@ w32_reset_terminal_modes (struct terminal *term) /* Function prototypes of this page. */ -static void x_set_glyph_string_clipping P_ ((struct glyph_string *)); -static void x_set_glyph_string_gc P_ ((struct glyph_string *)); -static void x_draw_glyph_string_background P_ ((struct glyph_string *, - int)); -static void x_draw_glyph_string_foreground P_ ((struct glyph_string *)); -static void x_draw_composite_glyph_string_foreground P_ ((struct glyph_string *)); -static void x_draw_glyph_string_box P_ ((struct glyph_string *)); -static void x_draw_glyph_string P_ ((struct glyph_string *)); -static void x_set_cursor_gc P_ ((struct glyph_string *)); -static void x_set_mode_line_face_gc P_ ((struct glyph_string *)); -static void x_set_mouse_face_gc P_ ((struct glyph_string *)); +static void x_set_glyph_string_clipping (struct glyph_string *); +static void x_set_glyph_string_gc (struct glyph_string *); +static void x_draw_glyph_string_background (struct glyph_string *, + int); +static void x_draw_glyph_string_foreground (struct glyph_string *); +static void x_draw_composite_glyph_string_foreground (struct glyph_string *); +static void x_draw_glyph_string_box (struct glyph_string *); +static void x_draw_glyph_string (struct glyph_string *); +static void x_set_cursor_gc (struct glyph_string *); +static void x_set_mode_line_face_gc (struct glyph_string *); +static void x_set_mouse_face_gc (struct glyph_string *); static int w32_alloc_lighter_color (struct frame *, COLORREF *, double, int); -static void w32_setup_relief_color P_ ((struct frame *, struct relief *, - double, int, COLORREF)); -static void x_setup_relief_colors P_ ((struct glyph_string *)); -static void x_draw_image_glyph_string P_ ((struct glyph_string *)); -static void x_draw_image_relief P_ ((struct glyph_string *)); -static void x_draw_image_foreground P_ ((struct glyph_string *)); -static void w32_draw_image_foreground_1 P_ ((struct glyph_string *, HBITMAP)); -static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int, - int, int, int)); -static void w32_draw_relief_rect P_ ((struct frame *, int, int, int, int, - int, int, int, int, int, int, - RECT *)); -static void w32_draw_box_rect P_ ((struct glyph_string *, int, int, int, int, - int, int, int, RECT *)); +static void w32_setup_relief_color (struct frame *, struct relief *, + double, int, COLORREF); +static void x_setup_relief_colors (struct glyph_string *); +static void x_draw_image_glyph_string (struct glyph_string *); +static void x_draw_image_relief (struct glyph_string *); +static void x_draw_image_foreground (struct glyph_string *); +static void w32_draw_image_foreground_1 (struct glyph_string *, HBITMAP); +static void x_clear_glyph_string_rect (struct glyph_string *, int, + int, int, int); +static void w32_draw_relief_rect (struct frame *, int, int, int, int, + int, int, int, int, int, int, + RECT *); +static void w32_draw_box_rect (struct glyph_string *, int, int, int, int, + int, int, int, RECT *); /* Set S->gc to a suitable GC for drawing glyph string S in cursor face. */ static void -x_set_cursor_gc (s) - struct glyph_string *s; +x_set_cursor_gc (struct glyph_string *s) { if (s->font == FRAME_FONT (s->f) && s->face->background == FRAME_BACKGROUND_PIXEL (s->f) @@ -1031,8 +991,7 @@ x_set_cursor_gc (s) /* Set up S->gc of glyph string S for drawing text in mouse face. */ static void -x_set_mouse_face_gc (s) - struct glyph_string *s; +x_set_mouse_face_gc (struct glyph_string *s) { int face_id; struct face *face; @@ -1085,8 +1044,7 @@ x_set_mouse_face_gc (s) matrix was built, so there isn't much to do, here. */ static INLINE void -x_set_mode_line_face_gc (s) - struct glyph_string *s; +x_set_mode_line_face_gc (struct glyph_string *s) { s->gc = s->face->gc; } @@ -1097,8 +1055,7 @@ x_set_mode_line_face_gc (s) pattern. */ static INLINE void -x_set_glyph_string_gc (s) - struct glyph_string *s; +x_set_glyph_string_gc (struct glyph_string *s) { PREPARE_FACE_FOR_DISPLAY (s->f, s->face); @@ -1143,8 +1100,7 @@ x_set_glyph_string_gc (s) line or menu if we don't have X toolkit support. */ static INLINE void -x_set_glyph_string_clipping (s) - struct glyph_string *s; +x_set_glyph_string_clipping (struct glyph_string *s) { RECT *r = s->clip; int n = get_glyph_string_clip_rects (s, r, 2); @@ -1172,8 +1128,8 @@ x_set_glyph_string_clipping (s) the area of SRC. */ static void -x_set_glyph_string_clipping_exactly (src, dst) - struct glyph_string *src, *dst; +x_set_glyph_string_clipping_exactly (struct glyph_string *src, + struct glyph_string *dst) { RECT r; @@ -1190,8 +1146,7 @@ x_set_glyph_string_clipping_exactly (src, dst) Compute left and right overhang of glyph string S. */ static void -w32_compute_glyph_string_overhangs (s) - struct glyph_string *s; +w32_compute_glyph_string_overhangs (struct glyph_string *s) { if (s->cmp == NULL && s->first_glyph->type == CHAR_GLYPH @@ -1219,9 +1174,8 @@ w32_compute_glyph_string_overhangs (s) /* Fill rectangle X, Y, W, H with background color of glyph string S. */ static INLINE void -x_clear_glyph_string_rect (s, x, y, w, h) - struct glyph_string *s; - int x, y, w, h; +x_clear_glyph_string_rect (struct glyph_string *s, + int x, int y, int w, int h) { int real_x = x; int real_y = y; @@ -1251,9 +1205,7 @@ x_clear_glyph_string_rect (s, x, y, w, h) contains the first component of a composition. */ static void -x_draw_glyph_string_background (s, force_p) - struct glyph_string *s; - int force_p; +x_draw_glyph_string_background (struct glyph_string *s, int force_p) { /* Nothing to do if background has already been drawn or if it shouldn't be drawn in the first place. */ @@ -1292,8 +1244,7 @@ x_draw_glyph_string_background (s, force_p) /* Draw the foreground of glyph string S. */ static void -x_draw_glyph_string_foreground (s) - struct glyph_string *s; +x_draw_glyph_string_foreground (struct glyph_string *s) { int i, x; @@ -1350,8 +1301,7 @@ x_draw_glyph_string_foreground (s) /* Draw the foreground of composite glyph string S. */ static void -x_draw_composite_glyph_string_foreground (s) - struct glyph_string *s; +x_draw_composite_glyph_string_foreground (struct glyph_string *s) { int i, j, x; struct font *font = s->font; @@ -1464,11 +1414,8 @@ x_draw_composite_glyph_string_foreground (s) Value is non-zero if successful. */ static int -w32_alloc_lighter_color (f, color, factor, delta) - struct frame *f; - COLORREF *color; - double factor; - int delta; +w32_alloc_lighter_color (struct frame *f, COLORREF *color, + double factor, int delta) { COLORREF new; long bright; @@ -1527,10 +1474,7 @@ w32_alloc_lighter_color (f, color, factor, delta) colors in COLORS. On W32, we no longer try to map colors to a palette. */ void -x_query_colors (f, colors, ncolors) - struct frame *f; - XColor *colors; - int ncolors; +x_query_colors (struct frame *f, XColor *colors, int ncolors) { int i; @@ -1545,9 +1489,7 @@ x_query_colors (f, colors, ncolors) } void -x_query_color (f, color) - struct frame *f; - XColor *color; +x_query_color (struct frame *f, XColor *color) { x_query_colors (f, color, 1); } @@ -1561,12 +1503,8 @@ x_query_color (f, color) be allocated, use DEFAULT_PIXEL, instead. */ static void -w32_setup_relief_color (f, relief, factor, delta, default_pixel) - struct frame *f; - struct relief *relief; - double factor; - int delta; - COLORREF default_pixel; +w32_setup_relief_color (struct frame *f, struct relief *relief, double factor, + int delta, COLORREF default_pixel) { XGCValues xgcv; struct w32_output *di = f->output_data.w32; @@ -1602,8 +1540,7 @@ w32_setup_relief_color (f, relief, factor, delta, default_pixel) /* Set up colors for the relief lines around glyph string S. */ static void -x_setup_relief_colors (s) - struct glyph_string *s; +x_setup_relief_colors (struct glyph_string *s) { struct w32_output *di = s->f->output_data.w32; COLORREF color; @@ -1638,12 +1575,10 @@ x_setup_relief_colors (s) when drawing. */ static void -w32_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, - raised_p, top_p, bot_p, left_p, right_p, clip_rect) - struct frame *f; - int left_x, top_y, right_x, bottom_y, width; - int top_p, bot_p, left_p, right_p, raised_p; - RECT *clip_rect; +w32_draw_relief_rect (struct frame *f, + int left_x, int top_y, int right_x, int bottom_y, int width, + int raised_p, int top_p, int bot_p, int left_p, int right_p, + RECT *clip_rect) { int i; XGCValues gc; @@ -1703,11 +1638,9 @@ w32_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, rectangle to use when drawing. */ static void -w32_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width, - left_p, right_p, clip_rect) - struct glyph_string *s; - int left_x, top_y, right_x, bottom_y, width, left_p, right_p; - RECT *clip_rect; +w32_draw_box_rect (struct glyph_string *s, + int left_x, int top_y, int right_x, int bottom_y, int width, + int left_p, int right_p, RECT *clip_rect) { w32_set_clip_rectangle (s->hdc, clip_rect); @@ -1740,8 +1673,7 @@ w32_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width, /* Draw a box around glyph string S. */ static void -x_draw_glyph_string_box (s) - struct glyph_string *s; +x_draw_glyph_string_box (struct glyph_string *s) { int width, left_x, right_x, top_y, bottom_y, last_x, raised_p; int left_p, right_p; @@ -1792,8 +1724,7 @@ x_draw_glyph_string_box (s) /* Draw foreground of image glyph string S. */ static void -x_draw_image_foreground (s) - struct glyph_string *s; +x_draw_image_foreground (struct glyph_string *s) { int x = s->x; int y = s->ybase - image_ascent (s->img, s->face, &s->slice); @@ -1883,8 +1814,7 @@ x_draw_image_foreground (s) /* Draw a relief around the image glyph string S. */ static void -x_draw_image_relief (s) - struct glyph_string *s; +x_draw_image_relief (struct glyph_string *s) { int x0, y0, x1, y1, thick, raised_p; RECT r; @@ -1936,9 +1866,7 @@ x_draw_image_relief (s) /* Draw the foreground of image glyph string S to PIXMAP. */ static void -w32_draw_image_foreground_1 (s, pixmap) - struct glyph_string *s; - HBITMAP pixmap; +w32_draw_image_foreground_1 (struct glyph_string *s, HBITMAP pixmap) { HDC hdc = CreateCompatibleDC (s->hdc); HGDIOBJ orig_hdc_obj = SelectObject (hdc, pixmap); @@ -2025,9 +1953,7 @@ w32_draw_image_foreground_1 (s, pixmap) give the rectangle to draw. */ static void -x_draw_glyph_string_bg_rect (s, x, y, w, h) - struct glyph_string *s; - int x, y, w, h; +x_draw_glyph_string_bg_rect (struct glyph_string *s, int x, int y, int w, int h) { #if 0 /* TODO: stipple */ if (s->stippled_p) @@ -2058,8 +1984,7 @@ x_draw_glyph_string_bg_rect (s, x, y, w, h) */ static void -x_draw_image_glyph_string (s) - struct glyph_string *s; +x_draw_image_glyph_string (struct glyph_string *s) { int x, y; int box_line_hwidth = eabs (s->face->box_line_width); @@ -2172,8 +2097,7 @@ x_draw_image_glyph_string (s) /* Draw stretch glyph string S. */ static void -x_draw_stretch_glyph_string (s) - struct glyph_string *s; +x_draw_stretch_glyph_string (struct glyph_string *s) { xassert (s->first_glyph->type == STRETCH_GLYPH); @@ -2255,8 +2179,7 @@ x_draw_stretch_glyph_string (s) /* Draw glyph string S. */ static void -x_draw_glyph_string (s) - struct glyph_string *s; +x_draw_glyph_string (struct glyph_string *s) { int relief_drawn_p = 0; @@ -2421,7 +2344,7 @@ x_draw_glyph_string (s) /* Draw strike-through. */ if (s->face->strike_through_p - && !FONT_TEXTMETRIC(s->font).tmStruckOut) + && !FONT_TEXTMETRIC (s->font).tmStruckOut) { unsigned long h = 1; unsigned long dy = (s->height - h) / 2; @@ -2502,9 +2425,8 @@ x_draw_glyph_string (s) /* Shift display to make room for inserted glyphs. */ void -w32_shift_glyphs_for_insert (f, x, y, width, height, shift_by) - struct frame *f; - int x, y, width, height, shift_by; +w32_shift_glyphs_for_insert (struct frame *f, int x, int y, + int width, int height, int shift_by) { HDC hdc; @@ -2520,9 +2442,7 @@ w32_shift_glyphs_for_insert (f, x, y, width, height, shift_by) for X frames. */ static void -x_delete_glyphs (f, n) - struct frame *f; - register int n; +x_delete_glyphs (struct frame *f, register int n) { if (! FRAME_W32_P (f)) return; @@ -2592,8 +2512,7 @@ w32_ring_bell (struct frame *f) that is bounded by calls to x_update_begin and x_update_end. */ static void -w32_set_terminal_window (n) - register int n; +w32_set_terminal_window (struct frame *f, int n) { /* This function intentionally left blank. */ } @@ -2607,9 +2526,7 @@ w32_set_terminal_window (n) lines or deleting -N lines at vertical position VPOS. */ static void -x_ins_del_lines (f, vpos, n) - struct frame *f; - int vpos, n; +x_ins_del_lines (struct frame *f, int vpos, int n) { if (! FRAME_W32_P (f)) return; @@ -2621,9 +2538,7 @@ x_ins_del_lines (f, vpos, n) /* Scroll part of the display as described by RUN. */ static void -x_scroll_run (w, run) - struct window *w; - struct run *run; +x_scroll_run (struct window *w, struct run *run) { struct frame *f = XFRAME (w->frame); int x, y, width, height, from_y, to_y, bottom_y; @@ -2705,16 +2620,14 @@ x_scroll_run (w, run) ***********************************************************************/ static void -frame_highlight (f) - struct frame *f; +frame_highlight (struct frame *f) { x_update_cursor (f, 1); x_set_frame_alpha (f); } static void -frame_unhighlight (f) - struct frame *f; +frame_unhighlight (struct frame *f) { x_update_cursor (f, 1); x_set_frame_alpha (f); @@ -2727,9 +2640,7 @@ frame_unhighlight (f) Lisp code can tell when the switch took place by examining the events. */ static void -x_new_focus_frame (dpyinfo, frame) - struct w32_display_info *dpyinfo; - struct frame *frame; +x_new_focus_frame (struct w32_display_info *dpyinfo, struct frame *frame) { struct frame *old_focus = dpyinfo->w32_focus_frame; @@ -2757,12 +2668,8 @@ x_new_focus_frame (dpyinfo, frame) a FOCUS_IN_EVENT into *BUFP. */ static void -x_focus_changed (type, state, dpyinfo, frame, bufp) - int type; - int state; - struct w32_display_info *dpyinfo; - struct frame *frame; - struct input_event *bufp; +x_focus_changed (int type, int state, struct w32_display_info *dpyinfo, + struct frame *frame, struct input_event *bufp) { if (type == WM_SETFOCUS) { @@ -2807,10 +2714,8 @@ x_focus_changed (type, state, dpyinfo, frame, bufp) Returns FOCUS_IN_EVENT event in *BUFP. */ static void -w32_detect_focus_change (dpyinfo, event, bufp) - struct w32_display_info *dpyinfo; - W32Msg *event; - struct input_event *bufp; +w32_detect_focus_change (struct w32_display_info *dpyinfo, W32Msg *event, + struct input_event *bufp) { struct frame *frame; @@ -2829,8 +2734,7 @@ w32_detect_focus_change (dpyinfo, event, bufp) /* Handle an event saying the mouse has moved out of an Emacs frame. */ void -x_mouse_leave (dpyinfo) - struct w32_display_info *dpyinfo; +x_mouse_leave (struct w32_display_info *dpyinfo) { x_new_focus_frame (dpyinfo, dpyinfo->w32_focus_event_frame); } @@ -2844,8 +2748,7 @@ x_mouse_leave (dpyinfo) the appropriate X display info. */ static void -w32_frame_rehighlight (frame) - struct frame *frame; +w32_frame_rehighlight (struct frame *frame) { if (! FRAME_W32_P (frame)) return; @@ -2853,8 +2756,7 @@ w32_frame_rehighlight (frame) } static void -x_frame_rehighlight (dpyinfo) - struct w32_display_info *dpyinfo; +x_frame_rehighlight (struct w32_display_info *dpyinfo) { struct frame *old_highlight = dpyinfo->x_highlight_frame; @@ -2887,8 +2789,7 @@ x_frame_rehighlight (dpyinfo) /* Convert a keysym to its name. */ char * -x_get_keysym_name (keysym) - int keysym; +x_get_keysym_name (int keysym) { /* Make static so we can always return it */ static char value[100]; @@ -2900,7 +2801,8 @@ x_get_keysym_name (keysym) return value; } -static int codepage_for_locale(LCID locale) +static int +codepage_for_locale (LCID locale) { char cp[20]; @@ -2917,11 +2819,7 @@ static int codepage_for_locale(LCID locale) the state in PUP. XBUTTON provides extra information for extended mouse button messages. Returns FALSE if unable to parse the message. */ BOOL -parse_button (message, xbutton, pbutton, pup) - int message; - int xbutton; - int * pbutton; - int * pup; +parse_button (int message, int xbutton, int * pbutton, int * pup) { int button = 0; int up = 0; @@ -2989,10 +2887,7 @@ parse_button (message, xbutton, pbutton, pup) the mouse. */ static Lisp_Object -construct_mouse_click (result, msg, f) - struct input_event *result; - W32Msg *msg; - struct frame *f; +construct_mouse_click (struct input_event *result, W32Msg *msg, struct frame *f) { int button; int up; @@ -3018,10 +2913,7 @@ construct_mouse_click (result, msg, f) } static Lisp_Object -construct_mouse_wheel (result, msg, f) - struct input_event *result; - W32Msg *msg; - struct frame *f; +construct_mouse_wheel (struct input_event *result, W32Msg *msg, struct frame *f) { POINT p; int delta; @@ -3054,10 +2946,7 @@ construct_mouse_wheel (result, msg, f) } static Lisp_Object -construct_drag_n_drop (result, msg, f) - struct input_event *result; - W32Msg *msg; - struct frame *f; +construct_drag_n_drop (struct input_event *result, W32Msg *msg, struct frame *f) { Lisp_Object files; Lisp_Object frame; @@ -3118,9 +3007,7 @@ static MSG last_mouse_motion_event; static Lisp_Object last_mouse_motion_frame; static int -note_mouse_movement (frame, msg) - FRAME_PTR frame; - MSG *msg; +note_mouse_movement (FRAME_PTR frame, MSG *msg) { int mouse_x = LOWORD (msg->lParam); int mouse_y = HIWORD (msg->lParam); @@ -3168,12 +3055,15 @@ note_mouse_movement (frame, msg) Mouse Face ************************************************************************/ -static struct scroll_bar *x_window_to_scroll_bar (); -static void x_scroll_bar_report_motion (); -static void x_check_fullscreen P_ ((struct frame *)); +static struct scroll_bar *x_window_to_scroll_bar (Window); +static void x_scroll_bar_report_motion (FRAME_PTR *, Lisp_Object *, + enum scroll_bar_part *, + Lisp_Object *, Lisp_Object *, + unsigned long *); +static void x_check_fullscreen (struct frame *); static void -redo_mouse_highlight () +redo_mouse_highlight (void) { if (!NILP (last_mouse_motion_frame) && FRAME_LIVE_P (XFRAME (last_mouse_motion_frame))) @@ -3183,9 +3073,7 @@ redo_mouse_highlight () } static void -w32_define_cursor (window, cursor) - Window window; - Cursor cursor; +w32_define_cursor (Window window, Cursor cursor) { PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0); } @@ -3210,13 +3098,9 @@ w32_define_cursor (window, cursor) movement. */ static void -w32_mouse_position (fp, insist, bar_window, part, x, y, time) - FRAME_PTR *fp; - int insist; - Lisp_Object *bar_window; - enum scroll_bar_part *part; - Lisp_Object *x, *y; - unsigned long *time; +w32_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, + enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, + unsigned long *time) { FRAME_PTR f1; @@ -3307,9 +3191,7 @@ w32_mouse_position (fp, insist, bar_window, part, x, y, time) or ButtonRelase. */ static void -w32_handle_tool_bar_click (f, button_event) - struct frame *f; - struct input_event *button_event; +w32_handle_tool_bar_click (struct frame *f, struct input_event *button_event) { int x = XFASTINT (button_event->x); int y = XFASTINT (button_event->y); @@ -3334,8 +3216,7 @@ w32_handle_tool_bar_click (f, button_event) bits. */ static struct scroll_bar * -x_window_to_scroll_bar (window_id) - Window window_id; +x_window_to_scroll_bar (Window window_id) { Lisp_Object tail; @@ -3371,9 +3252,8 @@ x_window_to_scroll_bar (window_id) displaying PORTION out of a whole WHOLE, and our position POSITION. */ static void -w32_set_scroll_bar_thumb (bar, portion, position, whole) - struct scroll_bar *bar; - int portion, position, whole; +w32_set_scroll_bar_thumb (struct scroll_bar *bar, + int portion, int position, int whole) { Window w = SCROLL_BAR_W32_WINDOW (bar); /* We use the whole scroll-bar height in the calculations below, to @@ -3399,7 +3279,7 @@ w32_set_scroll_bar_thumb (bar, portion, position, whole) BLOCK_INPUT; si.cbSize = sizeof (si); si.fMask = SIF_POS | SIF_PAGE; - GetScrollInfo(w, SB_CTL, &si); + GetScrollInfo (w, SB_CTL, &si); near_bottom_p = si.nPos + si.nPage >= range; UNBLOCK_INPUT; if (!near_bottom_p) @@ -3448,9 +3328,7 @@ w32_set_scroll_bar_thumb (bar, portion, position, whole) ************************************************************************/ static HWND -my_create_scrollbar (f, bar) - struct frame * f; - struct scroll_bar * bar; +my_create_scrollbar (struct frame * f, struct scroll_bar * bar) { return (HWND) SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_CREATESCROLLBAR, (WPARAM) f, @@ -3488,27 +3366,24 @@ my_set_window_pos (HWND hwnd, HWND hwndAfter, #endif } +#if 0 static void -my_set_focus (f, hwnd) - struct frame * f; - HWND hwnd; +my_set_focus (struct frame * f, HWND hwnd) { SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SETFOCUS, (WPARAM) hwnd, 0); } +#endif static void -my_set_foreground_window (hwnd) - HWND hwnd; +my_set_foreground_window (HWND hwnd) { SendMessage (hwnd, WM_EMACS_SETFOREGROUND, (WPARAM) hwnd, 0); } static void -my_destroy_window (f, hwnd) - struct frame * f; - HWND hwnd; +my_destroy_window (struct frame * f, HWND hwnd) { SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW, (WPARAM) hwnd, 0); @@ -3520,9 +3395,7 @@ my_destroy_window (f, hwnd) scroll bar. */ static struct scroll_bar * -x_scroll_bar_create (w, top, left, width, height) - struct window *w; - int top, left, width, height; +x_scroll_bar_create (struct window *w, int top, int left, int width, int height) { struct frame *f = XFRAME (WINDOW_FRAME (w)); HWND hwnd; @@ -3575,8 +3448,7 @@ x_scroll_bar_create (w, top, left, width, height) nil. */ static void -x_scroll_bar_remove (bar) - struct scroll_bar *bar; +x_scroll_bar_remove (struct scroll_bar *bar) { FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); @@ -3596,9 +3468,8 @@ x_scroll_bar_remove (bar) characters, starting at POSITION. If WINDOW has no scroll bar, create one. */ static void -w32_set_vertical_scroll_bar (w, portion, whole, position) - struct window *w; - int portion, whole, position; +w32_set_vertical_scroll_bar (struct window *w, + int portion, int whole, int position) { struct frame *f = XFRAME (w->frame); struct scroll_bar *bar; @@ -3741,8 +3612,7 @@ w32_set_vertical_scroll_bar (w, portion, whole, position) `*redeem_scroll_bar_hook' is applied to its window before the judgment. */ static void -w32_condemn_scroll_bars (frame) - FRAME_PTR frame; +w32_condemn_scroll_bars (FRAME_PTR frame) { /* Transfer all the scroll bars to FRAME_CONDEMNED_SCROLL_BARS. */ while (! NILP (FRAME_SCROLL_BARS (frame))) @@ -3763,8 +3633,7 @@ w32_condemn_scroll_bars (frame) Note that WINDOW isn't necessarily condemned at all. */ static void -w32_redeem_scroll_bar (window) - struct window *window; +w32_redeem_scroll_bar (struct window *window) { struct scroll_bar *bar; struct frame *f; @@ -3809,8 +3678,7 @@ w32_redeem_scroll_bar (window) last call to `*condemn_scroll_bars_hook'. */ static void -w32_judge_scroll_bars (f) - FRAME_PTR f; +w32_judge_scroll_bars (FRAME_PTR f) { Lisp_Object bar, next; @@ -3841,10 +3709,8 @@ w32_judge_scroll_bars (f) mark bits. */ static int -w32_scroll_bar_handle_click (bar, msg, emacs_event) - struct scroll_bar *bar; - W32Msg *msg; - struct input_event *emacs_event; +w32_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg, + struct input_event *emacs_event) { if (! WINDOWP (bar->window)) abort (); @@ -3950,12 +3816,10 @@ w32_scroll_bar_handle_click (bar, msg, emacs_event) on the scroll bar. */ static void -x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) - FRAME_PTR *fp; - Lisp_Object *bar_window; - enum scroll_bar_part *part; - Lisp_Object *x, *y; - unsigned long *time; +x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, + enum scroll_bar_part *part, + Lisp_Object *x, Lisp_Object *y, + unsigned long *time) { struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); Window w = SCROLL_BAR_W32_WINDOW (bar); @@ -4011,8 +3875,7 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) redraw them. */ void -x_scroll_bar_clear (f) - FRAME_PTR f; +x_scroll_bar_clear (FRAME_PTR f) { Lisp_Object bar; @@ -4071,10 +3934,8 @@ static char dbcs_lead = 0; */ int -w32_read_socket (sd, expected, hold_quit) - register int sd; - int expected; - struct input_event *hold_quit; +w32_read_socket (struct terminal *terminal, int expected, + struct input_event *hold_quit) { int count = 0; int check_visibility = 0; @@ -4295,7 +4156,7 @@ w32_read_socket (sd, expected, hold_quit) temp_index = 0; temp_buffer[temp_index++] = msg.msg.wParam; inev.kind = MULTIMEDIA_KEY_EVENT; - inev.code = GET_APPCOMMAND_LPARAM(msg.msg.lParam); + inev.code = GET_APPCOMMAND_LPARAM (msg.msg.lParam); inev.modifiers = msg.dwModifiers; XSETFRAME (inev.frame_or_window, f); inev.timestamp = msg.msg.time; @@ -4343,7 +4204,7 @@ w32_read_socket (sd, expected, hold_quit) selected now and last mouse movement event was not in it. Minibuffer window will be selected only when it is active. */ - if (WINDOWP(window) + if (WINDOWP (window) && !EQ (window, last_window) && !EQ (window, selected_window) /* For click-to-focus window managers @@ -4903,11 +4764,7 @@ w32_read_socket (sd, expected, hold_quit) mode lines must be clipped to the whole window. */ static void -w32_clip_to_row (w, row, area, hdc) - struct window *w; - struct glyph_row *row; - int area; - HDC hdc; +w32_clip_to_row (struct window *w, struct glyph_row *row, int area, HDC hdc) { struct frame *f = XFRAME (WINDOW_FRAME (w)); RECT clip_rect; @@ -4928,9 +4785,7 @@ w32_clip_to_row (w, row, area, hdc) /* Draw a hollow box cursor on window W in glyph row ROW. */ static void -x_draw_hollow_cursor (w, row) - struct window *w; - struct glyph_row *row; +x_draw_hollow_cursor (struct window *w, struct glyph_row *row) { struct frame *f = XFRAME (WINDOW_FRAME (w)); HDC hdc; @@ -4970,11 +4825,8 @@ x_draw_hollow_cursor (w, row) --gerd. */ static void -x_draw_bar_cursor (w, row, width, kind) - struct window *w; - struct glyph_row *row; - int width; - enum text_cursor_kinds kind; +x_draw_bar_cursor (struct window *w, struct glyph_row *row, + int width, enum text_cursor_kinds kind) { struct frame *f = XFRAME (w->frame); struct glyph *cursor_glyph; @@ -5053,9 +4905,7 @@ x_draw_bar_cursor (w, row, width, kind) /* RIF: Define cursor CURSOR on frame F. */ static void -w32_define_frame_cursor (f, cursor) - struct frame *f; - Cursor cursor; +w32_define_frame_cursor (struct frame *f, Cursor cursor) { w32_define_cursor (FRAME_W32_WINDOW (f), cursor); } @@ -5064,9 +4914,7 @@ w32_define_frame_cursor (f, cursor) /* RIF: Clear area on frame F. */ static void -w32_clear_frame_area (f, x, y, width, height) - struct frame *f; - int x, y, width, height; +w32_clear_frame_area (struct frame *f, int x, int y, int width, int height) { HDC hdc; @@ -5078,12 +4926,9 @@ w32_clear_frame_area (f, x, y, width, height) /* RIF: Draw or clear cursor on window W. */ static void -w32_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, active_p) - struct window *w; - struct glyph_row *glyph_row; - int x, y; - int cursor_type, cursor_width; - int on_p, active_p; +w32_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, + int x, int y, int cursor_type, int cursor_width, + int on_p, int active_p) { if (on_p) { @@ -5178,9 +5023,7 @@ w32_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, act /* Icons. */ int -x_bitmap_icon (f, icon) - struct frame *f; - Lisp_Object icon; +x_bitmap_icon (struct frame *f, Lisp_Object icon) { HANDLE main_icon; HANDLE small_icon = NULL; @@ -5269,10 +5112,7 @@ x_io_error_quitter (display) /* Changing the font of the frame. */ Lisp_Object -x_new_font (f, font_object, fontset) - struct frame *f; - Lisp_Object font_object; - int fontset; +x_new_font (struct frame *f, Lisp_Object font_object, int fontset) { struct font *font = XFONT_OBJECT (font_object); @@ -5340,8 +5180,7 @@ xim_close_dpy (dpyinfo) from its current recorded position values and gravity. */ void -x_calc_absolute_position (f) - struct frame *f; +x_calc_absolute_position (struct frame *f) { int flags = f->size_hint_flags; @@ -5401,10 +5240,8 @@ x_calc_absolute_position (f) which means, do adjust for borders but don't change the gravity. */ void -x_set_offset (f, xoff, yoff, change_gravity) - struct frame *f; - register int xoff, yoff; - int change_gravity; +x_set_offset (struct frame *f, register int xoff, register int yoff, + int change_gravity) { int modified_top, modified_left; @@ -5439,8 +5276,7 @@ x_set_offset (f, xoff, yoff, change_gravity) /* Check if we need to resize the frame due to a fullscreen request. If so needed, resize the frame. */ static void -x_check_fullscreen (f) - struct frame *f; +x_check_fullscreen (struct frame *f) { if (f->want_fullscreen & FULLSCREEN_BOTH) { @@ -5470,10 +5306,7 @@ x_check_fullscreen (f) Otherwise we leave the window gravity unchanged. */ void -x_set_window_size (f, change_gravity, cols, rows) - struct frame *f; - int change_gravity; - int cols, rows; +x_set_window_size (struct frame *f, int change_gravity, int cols, int rows) { int pixelwidth, pixelheight; @@ -5498,8 +5331,8 @@ x_set_window_size (f, change_gravity, cols, rows) rect.right = pixelwidth; rect.bottom = pixelheight; - AdjustWindowRect(&rect, f->output_data.w32->dwStyle, - FRAME_EXTERNAL_MENU_BAR (f)); + AdjustWindowRect (&rect, f->output_data.w32->dwStyle, + FRAME_EXTERNAL_MENU_BAR (f)); my_set_window_pos (FRAME_W32_WINDOW (f), NULL, @@ -5565,9 +5398,7 @@ x_set_window_size (f, change_gravity, cols, rows) void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y); void -x_set_mouse_position (f, x, y) - struct frame *f; - int x, y; +x_set_mouse_position (struct frame *f, int x, int y) { int pix_x, pix_y; @@ -5584,9 +5415,7 @@ x_set_mouse_position (f, x, y) } void -x_set_mouse_pixel_position (f, pix_x, pix_y) - struct frame *f; - int pix_x, pix_y; +x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) { RECT rect; POINT pt; @@ -5607,8 +5436,7 @@ x_set_mouse_pixel_position (f, pix_x, pix_y) /* focus shifting, raising and lowering. */ void -x_focus_on_frame (f) - struct frame *f; +x_focus_on_frame (struct frame *f) { struct w32_display_info *dpyinfo = &one_w32_display_info; @@ -5625,15 +5453,13 @@ x_focus_on_frame (f) } void -x_unfocus_frame (f) - struct frame *f; +x_unfocus_frame (struct frame *f) { } /* Raise frame F. */ void -x_raise_frame (f) - struct frame *f; +x_raise_frame (struct frame *f) { BLOCK_INPUT; @@ -5692,8 +5518,7 @@ x_raise_frame (f) /* Lower frame F. */ void -x_lower_frame (f) - struct frame *f; +x_lower_frame (struct frame *f) { BLOCK_INPUT; my_set_window_pos (FRAME_W32_WINDOW (f), @@ -5704,9 +5529,7 @@ x_lower_frame (f) } static void -w32_frame_raise_lower (f, raise_flag) - FRAME_PTR f; - int raise_flag; +w32_frame_raise_lower (FRAME_PTR f, int raise_flag) { if (! FRAME_W32_P (f)) return; @@ -5727,8 +5550,7 @@ w32_frame_raise_lower (f, raise_flag) finishes with it. */ void -x_make_frame_visible (f) - struct frame *f; +x_make_frame_visible (struct frame *f) { Lisp_Object type; @@ -5752,8 +5574,8 @@ x_make_frame_visible (f) /* Adjust vertical window position in order to avoid being covered by a task bar placed at the bottom of the desktop. */ - SystemParametersInfo(SPI_GETWORKAREA, 0, &workarea_rect, 0); - GetWindowRect(FRAME_W32_WINDOW(f), &window_rect); + SystemParametersInfo (SPI_GETWORKAREA, 0, &workarea_rect, 0); + GetWindowRect (FRAME_W32_WINDOW(f), &window_rect); if (window_rect.bottom > workarea_rect.bottom && window_rect.top > workarea_rect.top) f->top_pos = max (window_rect.top @@ -5820,8 +5642,8 @@ x_make_frame_visible (f) /* Make the frame visible (mapped and not iconified). */ -x_make_frame_invisible (f) - struct frame *f; +void +x_make_frame_invisible (struct frame *f) { /* Don't keep the highlight on an invisible frame. */ if (FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame == f) @@ -5847,8 +5669,7 @@ x_make_frame_invisible (f) /* Change window state from mapped to iconified. */ void -x_iconify_frame (f) - struct frame *f; +x_iconify_frame (struct frame *f) { Lisp_Object type; @@ -5875,8 +5696,7 @@ x_iconify_frame (f) /* Free X resources of frame F. */ void -x_free_frame_resources (f) - struct frame *f; +x_free_frame_resources (struct frame *f) { struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); @@ -5934,8 +5754,7 @@ x_free_frame_resources (f) /* Destroy the window of frame F. */ void -x_destroy_window (f) - struct frame *f; +x_destroy_window (struct frame *f) { struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); @@ -5952,10 +5771,7 @@ x_destroy_window (f) If USER_POSITION is nonzero, we set the USPosition flag (this is useful when FLAGS is 0). */ void -x_wm_set_size_hint (f, flags, user_position) - struct frame *f; - long flags; - int user_position; +x_wm_set_size_hint (struct frame *f, long flags, int user_position) { Window window = FRAME_W32_WINDOW (f); @@ -5971,9 +5787,7 @@ x_wm_set_size_hint (f, flags, user_position) /* Window manager things */ void -x_wm_set_icon_position (f, icon_x, icon_y) - struct frame *f; - int icon_x, icon_y; +x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y) { #if 0 Window window = FRAME_W32_WINDOW (f); @@ -5994,12 +5808,11 @@ x_wm_set_icon_position (f, icon_x, icon_y) static int w32_initialized = 0; void -w32_initialize_display_info (display_name) - Lisp_Object display_name; +w32_initialize_display_info (Lisp_Object display_name) { struct w32_display_info *dpyinfo = &one_w32_display_info; - bzero (dpyinfo, sizeof (*dpyinfo)); + memset (dpyinfo, 0, sizeof (*dpyinfo)); /* Put it on w32_display_name_list. */ w32_display_name_list = Fcons (Fcons (display_name, Qnil), @@ -6048,8 +5861,7 @@ w32_initialize_display_info (display_name) but any whitespace following value is not removed. */ static char * -w32_make_rdb (xrm_option) - char *xrm_option; +w32_make_rdb (char *xrm_option) { char *buffer = xmalloc (strlen (xrm_option) + 2); char *current = buffer; @@ -6208,10 +6020,7 @@ x_delete_terminal (struct terminal *terminal) } struct w32_display_info * -w32_term_init (display_name, xrm_option, resource_name) - Lisp_Object display_name; - char *xrm_option; - char *resource_name; +w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) { struct w32_display_info *dpyinfo; struct terminal *terminal; @@ -6286,8 +6095,7 @@ w32_term_init (display_name, xrm_option, resource_name) /* Get rid of display DPYINFO, assuming all frames are already gone. */ void -x_delete_display (dpyinfo) - struct w32_display_info *dpyinfo; +x_delete_display (struct w32_display_info *dpyinfo) { /* Discard this display from w32_display_name_list and w32_display_list. We can't use Fdelq because that can quit. */ @@ -6323,7 +6131,7 @@ x_delete_display (dpyinfo) } dpyinfo->color_list = NULL; if (dpyinfo->palette) - DeleteObject(dpyinfo->palette); + DeleteObject (dpyinfo->palette); } xfree (dpyinfo->w32_id_name); @@ -6335,7 +6143,7 @@ x_delete_display (dpyinfo) DWORD WINAPI w32_msg_worker (void * arg); static void -w32_initialize () +w32_initialize (void) { HANDLE shell; HRESULT (WINAPI * set_user_model) (wchar_t * id); @@ -6438,7 +6246,7 @@ w32_initialize () } void -syms_of_w32term () +syms_of_w32term (void) { staticpro (&w32_display_name_list); w32_display_name_list = Qnil; diff --git a/src/w32term.h b/src/w32term.h index ea5f420a7dc..b5b3d4451f2 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -228,14 +228,14 @@ extern Lisp_Object Vx_pixel_size_width_font_regexp; struct w32_display_info *x_display_info_for_name (); -Lisp_Object display_x_get_resource P_ ((struct w32_display_info *, - Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object)); +Lisp_Object display_x_get_resource (struct w32_display_info *, + Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object); extern struct w32_display_info *w32_term_init (); -extern int x_display_pixel_height P_ ((struct w32_display_info *)); -extern int x_display_pixel_width P_ ((struct w32_display_info *)); +extern int x_display_pixel_height (struct w32_display_info *); +extern int x_display_pixel_width (struct w32_display_info *); #define PIX_TYPE COLORREF diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index cfdf629ceee..9edd6353ba3 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -57,15 +57,14 @@ extern int initialized; extern struct font_driver uniscribe_font_driver; /* EnumFontFamiliesEx callback. */ -static int CALLBACK add_opentype_font_name_to_list P_ ((ENUMLOGFONTEX *, - NEWTEXTMETRICEX *, - DWORD, LPARAM)); +static int CALLBACK add_opentype_font_name_to_list (ENUMLOGFONTEX *, + NEWTEXTMETRICEX *, + DWORD, LPARAM); /* Used by uniscribe_otf_capability. */ static Lisp_Object otf_features (HDC context, char *table); static int -memq_no_quit (elt, list) - Lisp_Object elt, list; +memq_no_quit (Lisp_Object elt, Lisp_Object list) { while (CONSP (list) && ! EQ (XCAR (list), elt)) list = XCDR (list); @@ -75,8 +74,7 @@ memq_no_quit (elt, list) /* Font backend interface implementation. */ static Lisp_Object -uniscribe_list (frame, font_spec) - Lisp_Object frame, font_spec; +uniscribe_list (Lisp_Object frame, Lisp_Object font_spec) { Lisp_Object fonts = w32font_list_internal (frame, font_spec, 1); FONT_ADD_LOG ("uniscribe-list", font_spec, fonts); @@ -84,8 +82,7 @@ uniscribe_list (frame, font_spec) } static Lisp_Object -uniscribe_match (frame, font_spec) - Lisp_Object frame, font_spec; +uniscribe_match (Lisp_Object frame, Lisp_Object font_spec) { Lisp_Object entity = w32font_match_internal (frame, font_spec, 1); FONT_ADD_LOG ("uniscribe-match", font_spec, entity); @@ -93,15 +90,14 @@ uniscribe_match (frame, font_spec) } static Lisp_Object -uniscribe_list_family (frame) - Lisp_Object frame; +uniscribe_list_family (Lisp_Object frame) { Lisp_Object list = Qnil; LOGFONT font_match_pattern; HDC dc; FRAME_PTR f = XFRAME (frame); - bzero (&font_match_pattern, sizeof (font_match_pattern)); + memset (&font_match_pattern, 0, sizeof (font_match_pattern)); /* Limit enumerated fonts to outline fonts to save time. */ font_match_pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; @@ -116,10 +112,7 @@ uniscribe_list_family (frame) } static Lisp_Object -uniscribe_open (f, font_entity, pixel_size) - FRAME_PTR f; - Lisp_Object font_entity; - int pixel_size; +uniscribe_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) { Lisp_Object font_object = font_make_object (VECSIZE (struct uniscribe_font_info), @@ -148,9 +141,7 @@ uniscribe_open (f, font_entity, pixel_size) } static void -uniscribe_close (f, font) - FRAME_PTR f; - struct font *font; +uniscribe_close (FRAME_PTR f, struct font *font) { struct uniscribe_font_info *uniscribe_font = (struct uniscribe_font_info *) font; @@ -164,8 +155,7 @@ uniscribe_close (f, font) /* Return a list describing which scripts/languages FONT supports by which GSUB/GPOS features of OpenType tables. */ static Lisp_Object -uniscribe_otf_capability (font) - struct font *font; +uniscribe_otf_capability (struct font *font) { HDC context; HFONT old_font; @@ -175,7 +165,7 @@ uniscribe_otf_capability (font) f = XFRAME (selected_frame); context = get_frame_dc (f); - old_font = SelectObject (context, FONT_HANDLE(font)); + old_font = SelectObject (context, FONT_HANDLE (font)); features = otf_features (context, "GSUB"); XSETCAR (capability, features); @@ -202,8 +192,7 @@ uniscribe_otf_capability (font) than the length of LGSTRING, nil should be return. In that case, this function is called again with the larger LGSTRING. */ static Lisp_Object -uniscribe_shape (lgstring) - Lisp_Object lgstring; +uniscribe_shape (Lisp_Object lgstring) { struct font * font; struct uniscribe_font_info * uniscribe_font; @@ -287,7 +276,7 @@ uniscribe_shape (lgstring) passed in. */ f = XFRAME (selected_frame); context = get_frame_dc (f); - old_font = SelectObject (context, FONT_HANDLE(font)); + old_font = SelectObject (context, FONT_HANDLE (font)); result = ScriptShape (context, &(uniscribe_font->cache), chars + items[i].iCharPos, nchars_in_run, @@ -322,7 +311,7 @@ uniscribe_shape (lgstring) /* Cache not complete... */ f = XFRAME (selected_frame); context = get_frame_dc (f); - old_font = SelectObject (context, FONT_HANDLE(font)); + old_font = SelectObject (context, FONT_HANDLE (font)); result = ScriptPlace (context, &(uniscribe_font->cache), glyphs, nglyphs, attributes, &(items[i].a), @@ -397,7 +386,7 @@ uniscribe_shape (lgstring) /* Cache incomplete... */ f = XFRAME (selected_frame); context = get_frame_dc (f); - old_font = SelectObject (context, FONT_HANDLE(font)); + old_font = SelectObject (context, FONT_HANDLE (font)); result = ScriptGetGlyphABCWidth (context, &(uniscribe_font->cache), glyphs[j], &char_metric); @@ -451,9 +440,7 @@ uniscribe_shape (lgstring) Return a glyph code of FONT for characer C (Unicode code point). If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ static unsigned -uniscribe_encode_char (font, c) - struct font *font; - int c; +uniscribe_encode_char (struct font *font, int c) { HDC context = NULL; struct frame *f = NULL; @@ -509,7 +496,7 @@ uniscribe_encode_char (font, c) the frame. */ f = XFRAME (selected_frame); context = get_frame_dc (f); - old_font = SelectObject (context, FONT_HANDLE(font)); + old_font = SelectObject (context, FONT_HANDLE (font)); result = ScriptShape (context, &(uniscribe_font->cache), ch, len, 2, &(items[0].a), glyphs, clusters, attrs, &nglyphs); @@ -574,12 +561,9 @@ uniscribe_encode_char (font, c) Adds the name of opentype fonts to a Lisp list (passed in as the lParam arg). */ static int CALLBACK -add_opentype_font_name_to_list (logical_font, physical_font, font_type, - list_object) - ENUMLOGFONTEX *logical_font; - NEWTEXTMETRICEX *physical_font; - DWORD font_type; - LPARAM list_object; +add_opentype_font_name_to_list (ENUMLOGFONTEX *logical_font, + NEWTEXTMETRICEX *physical_font, + DWORD font_type, LPARAM list_object) { Lisp_Object* list = (Lisp_Object *) list_object; Lisp_Object family; @@ -650,9 +634,8 @@ static char* NOTHING = " "; /* Check if font supports the otf script/language/features specified. OTF_SPEC is in the format (script lang [(gsub_feature ...)|nil] [(gpos_feature ...)]?) */ -int uniscribe_check_otf (font, otf_spec) - LOGFONT *font; - Lisp_Object otf_spec; +int +uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec) { Lisp_Object script, lang, rest; Lisp_Object features[2]; @@ -947,7 +930,7 @@ struct font_driver uniscribe_font_driver = NULL, /* get_outline */ NULL, /* free_outline */ NULL, /* anchor_point */ - uniscribe_otf_capability, /* Defined so (font-get FONTOBJ :otf) works. */ + uniscribe_otf_capability, /* Defined so (font-get FONTOBJ :otf) works. */ NULL, /* otf_drive - use shape instead. */ NULL, /* start_for_frame */ NULL, /* end_for_frame */ @@ -957,7 +940,7 @@ struct font_driver uniscribe_font_driver = /* Note that this should be called at every startup, not just when dumping, as it needs to test for the existence of the Uniscribe library. */ void -syms_of_w32uniscribe () +syms_of_w32uniscribe (void) { HMODULE uniscribe; diff --git a/src/w32xfns.c b/src/w32xfns.c index d77eb6b68ea..8fee42dae48 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -39,7 +39,7 @@ HANDLE input_available = NULL; HANDLE interrupt_handle = NULL; void -init_crit () +init_crit (void) { InitializeCriticalSection (&critsect); @@ -57,7 +57,7 @@ init_crit () } void -delete_crit () +delete_crit (void) { DeleteCriticalSection (&critsect); @@ -74,7 +74,7 @@ delete_crit () } void -signal_quit () +signal_quit (void) { /* Make sure this event never remains signaled; if the main thread isn't in a blocking call, then this should do nothing. */ @@ -161,9 +161,7 @@ int_msg *lpTail = NULL; int nQueue = 0; BOOL -get_next_msg (lpmsg, bWait) - W32Msg * lpmsg; - BOOL bWait; +get_next_msg (W32Msg * lpmsg, BOOL bWait) { BOOL bRet = FALSE; @@ -180,7 +178,7 @@ get_next_msg (lpmsg, bWait) if (nQueue) { - bcopy (&(lpHead->w32msg), lpmsg, sizeof (W32Msg)); + memcpy (lpmsg, &lpHead->w32msg, sizeof (W32Msg)); { int_msg * lpCur = lpHead; @@ -216,7 +214,7 @@ get_next_msg (lpmsg, bWait) if (!UnionRect (&(lpmsg->rect), &(lpmsg->rect), &(lpCur->w32msg.rect))) { - SetRectEmpty(&(lpmsg->rect)); + SetRectEmpty (&(lpmsg->rect)); } myfree (lpCur); @@ -245,15 +243,14 @@ get_next_msg (lpmsg, bWait) } BOOL -post_msg (lpmsg) - W32Msg * lpmsg; +post_msg (W32Msg * lpmsg) { int_msg * lpNew = (int_msg *) myalloc (sizeof (int_msg)); if (!lpNew) return (FALSE); - bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg)); + memcpy (&lpNew->w32msg, lpmsg, sizeof (W32Msg)); lpNew->lpNext = NULL; enter_crit (); @@ -283,7 +280,7 @@ prepend_msg (W32Msg *lpmsg) if (!lpNew) return (FALSE); - bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg)); + memcpy (&lpNew->w32msg, lpmsg, sizeof (W32Msg)); enter_crit (); @@ -298,7 +295,7 @@ prepend_msg (W32Msg *lpmsg) /* Process all messages in the current thread's queue. */ void -drain_message_queue () +drain_message_queue (void) { MSG msg; while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) @@ -322,9 +319,7 @@ drain_message_queue () */ static int -read_integer (string, NextString) - register char *string; - char **NextString; +read_integer (register char *string, char **NextString) { register int Result = 0; int Sign = 1; @@ -348,10 +343,9 @@ read_integer (string, NextString) } int -XParseGeometry (string, x, y, width, height) - char *string; - int *x, *y; - unsigned int *width, *height; /* RETURN */ +XParseGeometry (char *string, + int *x, int *y, + unsigned int *width, unsigned int *height) { int mask = NoValue; register char *strind; @@ -446,8 +440,7 @@ XParseGeometry (string, x, y, width, height) /* x_sync is a no-op on W32. */ void -x_sync (f) - void *f; +x_sync (void *f) { } diff --git a/src/widget.c b/src/widget.c index 0c3aa64a74e..2301f76c7c9 100644 --- a/src/widget.c +++ b/src/widget.c @@ -76,14 +76,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define DEFAULT_FACE_FONT "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*" -static void EmacsFrameInitialize (/*Widget, Widget, ArgList, Cardinal * */); -static void EmacsFrameDestroy (/* Widget */); -static void EmacsFrameRealize (/* Widget, XtValueMask*, XSetWindowAttributes* */); -void EmacsFrameResize (/* Widget widget */); -static Boolean EmacsFrameSetValues (/* Widget, Widget, Widget, - ArgList, Cardinal * */); -static XtGeometryResult EmacsFrameQueryGeometry (/* Widget, XtWidgetGeometry*, - XtWidgetGeometry* */); +static void EmacsFrameInitialize (Widget request, Widget new, ArgList dum1, Cardinal *dum2); +static void EmacsFrameDestroy (Widget widget); +static void EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs); +void EmacsFrameResize (Widget widget); +static Boolean EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, ArgList dum1, Cardinal *dum2); +static XtGeometryResult EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request, XtWidgetGeometry *result); #undef XtOffset @@ -180,10 +178,7 @@ EmacsFrameClassRec emacsFrameClassRec = { WidgetClass emacsFrameClass = (WidgetClass) &emacsFrameClassRec; static void -get_default_char_pixel_size (ew, pixel_width, pixel_height) - EmacsFrame ew; - int* pixel_width; - int* pixel_height; +get_default_char_pixel_size (EmacsFrame ew, int *pixel_width, int *pixel_height) { struct frame* f = ew->emacs_frame.frame; *pixel_width = FRAME_COLUMN_WIDTH (f); @@ -191,12 +186,7 @@ get_default_char_pixel_size (ew, pixel_width, pixel_height) } static void -pixel_to_char_size (ew, pixel_width, pixel_height, char_width, char_height) - EmacsFrame ew; - Dimension pixel_width; - Dimension pixel_height; - int* char_width; - int* char_height; +pixel_to_char_size (EmacsFrame ew, Dimension pixel_width, Dimension pixel_height, int *char_width, int *char_height) { struct frame* f = ew->emacs_frame.frame; *char_width = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, (int) pixel_width); @@ -204,12 +194,7 @@ pixel_to_char_size (ew, pixel_width, pixel_height, char_width, char_height) } static void -char_to_pixel_size (ew, char_width, char_height, pixel_width, pixel_height) - EmacsFrame ew; - int char_width; - int char_height; - Dimension* pixel_width; - Dimension* pixel_height; +char_to_pixel_size (EmacsFrame ew, int char_width, int char_height, Dimension *pixel_width, Dimension *pixel_height) { struct frame* f = ew->emacs_frame.frame; *pixel_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, char_width); @@ -217,12 +202,7 @@ char_to_pixel_size (ew, char_width, char_height, pixel_width, pixel_height) } static void -round_size_to_char (ew, in_width, in_height, out_width, out_height) - EmacsFrame ew; - Dimension in_width; - Dimension in_height; - Dimension* out_width; - Dimension* out_height; +round_size_to_char (EmacsFrame ew, Dimension in_width, Dimension in_height, Dimension *out_width, Dimension *out_height) { int char_width; int char_height; @@ -231,8 +211,7 @@ round_size_to_char (ew, in_width, in_height, out_width, out_height) } static Widget -get_wm_shell (w) - Widget w; +get_wm_shell (Widget w) { Widget wmshell; @@ -269,8 +248,7 @@ static Boolean first_frame_p = True; #endif static void -set_frame_size (ew) - EmacsFrame ew; +set_frame_size (EmacsFrame ew) { /* The widget hierarchy is @@ -491,8 +469,7 @@ set_frame_size (ew) int update_hints_inhibit; static void -update_wm_hints (ew) - EmacsFrame ew; +update_wm_hints (EmacsFrame ew) { Widget wmshell = get_wm_shell ((Widget)ew); int cw; @@ -570,8 +547,7 @@ static char setup_frame_cursor_bits[] = }; static void -setup_frame_gcs (ew) - EmacsFrame ew; +setup_frame_gcs (EmacsFrame ew) { XGCValues gc_values; struct frame* s = ew->emacs_frame.frame; @@ -649,8 +625,7 @@ setup_frame_gcs (ew) } static void -update_various_frame_slots (ew) - EmacsFrame ew; +update_various_frame_slots (EmacsFrame ew) { struct frame *f = ew->emacs_frame.frame; struct x_output *x = f->output_data.x; @@ -661,8 +636,7 @@ update_various_frame_slots (ew) } static void -update_from_various_frame_slots (ew) - EmacsFrame ew; +update_from_various_frame_slots (EmacsFrame ew) { struct frame *f = ew->emacs_frame.frame; struct x_output *x = f->output_data.x; @@ -677,11 +651,7 @@ update_from_various_frame_slots (ew) } static void -EmacsFrameInitialize (request, new, dum1, dum2) - Widget request; - Widget new; - ArgList dum1; - Cardinal *dum2; +EmacsFrameInitialize (Widget request, Widget new, ArgList dum1, Cardinal *dum2) { EmacsFrame ew = (EmacsFrame)new; @@ -698,10 +668,7 @@ EmacsFrameInitialize (request, new, dum1, dum2) static void -EmacsFrameRealize (widget, mask, attrs) - Widget widget; - XtValueMask *mask; - XSetWindowAttributes *attrs; +EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs) { EmacsFrame ew = (EmacsFrame)widget; @@ -717,11 +684,10 @@ EmacsFrameRealize (widget, mask, attrs) update_wm_hints (ew); } -extern void free_frame_faces (/* struct frame * */); +extern void free_frame_faces (struct frame *); static void -EmacsFrameDestroy (widget) - Widget widget; +EmacsFrameDestroy (Widget widget) { EmacsFrame ew = (EmacsFrame) widget; struct frame* s = ew->emacs_frame.frame; @@ -739,8 +705,7 @@ EmacsFrameDestroy (widget) } void -EmacsFrameResize (widget) - Widget widget; +EmacsFrameResize (Widget widget) { EmacsFrame ew = (EmacsFrame)widget; struct frame *f = ew->emacs_frame.frame; @@ -756,12 +721,7 @@ EmacsFrameResize (widget) } static Boolean -EmacsFrameSetValues (cur_widget, req_widget, new_widget, dum1, dum2) - Widget cur_widget; - Widget req_widget; - Widget new_widget; - ArgList dum1; - Cardinal *dum2; +EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, ArgList dum1, Cardinal *dum2) { EmacsFrame cur = (EmacsFrame)cur_widget; EmacsFrame new = (EmacsFrame)new_widget; @@ -834,10 +794,7 @@ EmacsFrameSetValues (cur_widget, req_widget, new_widget, dum1, dum2) } static XtGeometryResult -EmacsFrameQueryGeometry (widget, request, result) - Widget widget; - XtWidgetGeometry* request; - XtWidgetGeometry* result; +EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request, XtWidgetGeometry *result) { EmacsFrame ew = (EmacsFrame)widget; @@ -867,10 +824,7 @@ EmacsFrameQueryGeometry (widget, request, result) /* Special entrypoints */ void -EmacsFrameSetCharSize (widget, columns, rows) - Widget widget; - int columns; - int rows; +EmacsFrameSetCharSize (Widget widget, int columns, int rows) { EmacsFrame ew = (EmacsFrame) widget; struct frame *f = ew->emacs_frame.frame; @@ -880,8 +834,7 @@ EmacsFrameSetCharSize (widget, columns, rows) void -widget_store_internal_border (widget) - Widget widget; +widget_store_internal_border (Widget widget) { EmacsFrame ew = (EmacsFrame) widget; FRAME_PTR f = ew->emacs_frame.frame; diff --git a/src/widget.h b/src/widget.h index 00c08914059..a1ddeb2e94f 100644 --- a/src/widget.h +++ b/src/widget.h @@ -94,8 +94,8 @@ extern WidgetClass emacsFrameClass; extern struct _DisplayContext* display_context; /* Special entrypoints */ -void EmacsFrameSetCharSize P_ ((Widget, int, int)); -void widget_store_internal_border P_ ((Widget widget)); +void EmacsFrameSetCharSize (Widget, int, int); +void widget_store_internal_border (Widget widget); #endif /* _EmacsFrame_h */ diff --git a/src/window.c b/src/window.c index c105e37c462..89563112628 100644 --- a/src/window.c +++ b/src/window.c @@ -59,32 +59,32 @@ Lisp_Object Qwindow_size_fixed; extern Lisp_Object Qleft_margin, Qright_margin; -static int displayed_window_lines P_ ((struct window *)); -static struct window *decode_window P_ ((Lisp_Object)); -static int count_windows P_ ((struct window *)); -static int get_leaf_windows P_ ((struct window *, struct window **, int)); -static void window_scroll P_ ((Lisp_Object, int, int, int)); -static void window_scroll_pixel_based P_ ((Lisp_Object, int, int, int)); -static void window_scroll_line_based P_ ((Lisp_Object, int, int, int)); -static int window_min_size_1 P_ ((struct window *, int, int)); -static int window_min_size_2 P_ ((struct window *, int, int)); -static int window_min_size P_ ((struct window *, int, int, int, int *)); -static void size_window P_ ((Lisp_Object, int, int, int, int, int)); -static int freeze_window_start P_ ((struct window *, void *)); -static int window_fixed_size_p P_ ((struct window *, int, int)); -static void enlarge_window P_ ((Lisp_Object, int, int)); -static Lisp_Object window_list P_ ((void)); -static int add_window_to_list P_ ((struct window *, void *)); -static int candidate_window_p P_ ((Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object)); -static Lisp_Object next_window P_ ((Lisp_Object, Lisp_Object, - Lisp_Object, int)); -static void decode_next_window_args P_ ((Lisp_Object *, Lisp_Object *, - Lisp_Object *)); -static int foreach_window_1 P_ ((struct window *, - int (* fn) (struct window *, void *), - void *)); -static Lisp_Object window_list_1 P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); +static int displayed_window_lines (struct window *); +static struct window *decode_window (Lisp_Object); +static int count_windows (struct window *); +static int get_leaf_windows (struct window *, struct window **, int); +static void window_scroll (Lisp_Object, int, int, int); +static void window_scroll_pixel_based (Lisp_Object, int, int, int); +static void window_scroll_line_based (Lisp_Object, int, int, int); +static int window_min_size_1 (struct window *, int, int); +static int window_min_size_2 (struct window *, int, int); +static int window_min_size (struct window *, int, int, int, int *); +static void size_window (Lisp_Object, int, int, int, int, int); +static int freeze_window_start (struct window *, void *); +static int window_fixed_size_p (struct window *, int, int); +static void enlarge_window (Lisp_Object, int, int); +static Lisp_Object window_list (void); +static int add_window_to_list (struct window *, void *); +static int candidate_window_p (Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object); +static Lisp_Object next_window (Lisp_Object, Lisp_Object, + Lisp_Object, int); +static void decode_next_window_args (Lisp_Object *, Lisp_Object *, + Lisp_Object *); +static int foreach_window_1 (struct window *, + int (* fn) (struct window *, void *), + void *); +static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object); /* This is the window in which the terminal's cursor should be left when nothing is being done with it. This must @@ -205,22 +205,20 @@ extern Lisp_Object Qtty; DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, doc: /* Return t if OBJECT is a window. */) - (object) - Lisp_Object object; + (Lisp_Object object) { return WINDOWP (object) ? Qt : Qnil; } DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0, doc: /* Return t if OBJECT is a window which is currently visible. */) - (object) - Lisp_Object object; + (Lisp_Object object) { return WINDOW_LIVE_P (object) ? Qt : Qnil; } Lisp_Object -make_window () +make_window (void) { Lisp_Object val; register struct window *p; @@ -243,9 +241,9 @@ make_window () p->dedicated = Qnil; p->window_parameters = Qnil; p->pseudo_window_p = 0; - bzero (&p->cursor, sizeof (p->cursor)); - bzero (&p->last_cursor, sizeof (p->last_cursor)); - bzero (&p->phys_cursor, sizeof (p->phys_cursor)); + memset (&p->cursor, 0, sizeof (p->cursor)); + memset (&p->last_cursor, 0, sizeof (p->last_cursor)); + memset (&p->phys_cursor, 0, sizeof (p->phys_cursor)); p->desired_matrix = p->current_matrix = 0; p->nrows_scale_factor = p->ncols_scale_factor = 1; p->phys_cursor_type = -1; @@ -274,7 +272,7 @@ make_window () DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0, doc: /* Return the window that the cursor now appears in and commands apply to. */) - () + (void) { return selected_window; } @@ -283,8 +281,7 @@ DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 1, 0, doc: /* Return the window used now for minibuffers. If the optional argument FRAME is specified, return the minibuffer window used by that frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { if (NILP (frame)) frame = selected_frame; @@ -295,8 +292,7 @@ used by that frame. */) DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 0, 1, 0, doc: /* Return non-nil if WINDOW is a minibuffer window. WINDOW defaults to the selected window. */) - (window) - Lisp_Object window; + (Lisp_Object window) { struct window *w = decode_window (window); return MINI_WINDOW_P (w) ? Qt : Qnil; @@ -320,8 +316,7 @@ of the window. The remaining elements are omitted if the character after POS is fully visible; otherwise, RTOP and RBOT are the number of pixels off-window at the top and bottom of the row, ROWH is the height of the display row, and VPOS is the row number (0-based) containing POS. */) - (pos, window, partially) - Lisp_Object pos, window, partially; + (Lisp_Object pos, Lisp_Object window, Lisp_Object partially) { register struct window *w; register int posint; @@ -389,8 +384,7 @@ of the (first) text line, YPOS is negative. Return nil if window display is not up-to-date. In that case, use `pos-visible-in-window-p' to obtain the information. */) - (line, window) - Lisp_Object line, window; + (Lisp_Object line, Lisp_Object window) { register struct window *w; register struct buffer *b; @@ -483,8 +477,7 @@ Return nil if window display is not up-to-date. In that case, use static struct window * -decode_window (window) - register Lisp_Object window; +decode_window (register Lisp_Object window) { if (NILP (window)) return XWINDOW (selected_window); @@ -494,8 +487,7 @@ decode_window (window) } static struct window * -decode_any_window (window) - register Lisp_Object window; +decode_any_window (register Lisp_Object window) { if (NILP (window)) return XWINDOW (selected_window); @@ -507,8 +499,7 @@ decode_any_window (window) DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, doc: /* Return the buffer that WINDOW is displaying. WINDOW defaults to the selected window. */) - (window) - Lisp_Object window; + (Lisp_Object window) { return decode_window (window)->buffer; } @@ -518,8 +509,7 @@ DEFUN ("window-height", Fwindow_height, Swindow_height, 0, 1, 0, WINDOW defaults to the selected window. The return value includes WINDOW's mode line and header line, if any. */) - (window) - Lisp_Object window; + (Lisp_Object window) { return decode_any_window (window)->total_lines; } @@ -531,8 +521,7 @@ WINDOW defaults to the selected window. Note: The return value is the number of columns available for text in WINDOW. If you want to find out how many columns WINDOW takes up, use (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))). */) - (window) - Lisp_Object window; + (Lisp_Object window) { return make_number (window_box_text_cols (decode_any_window (window))); } @@ -540,8 +529,7 @@ WINDOW. If you want to find out how many columns WINDOW takes up, use DEFUN ("window-full-width-p", Fwindow_full_width_p, Swindow_full_width_p, 0, 1, 0, doc: /* Return t if WINDOW is as wide as its frame. WINDOW defaults to the selected window. */) - (window) - Lisp_Object window; + (Lisp_Object window) { return WINDOW_FULL_WIDTH_P (decode_any_window (window)) ? Qt : Qnil; } @@ -549,8 +537,7 @@ WINDOW defaults to the selected window. */) DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, doc: /* Return the number of columns by which WINDOW is scrolled from left margin. WINDOW defaults to the selected window. */) - (window) - Lisp_Object window; + (Lisp_Object window) { return decode_window (window)->hscroll; } @@ -561,8 +548,7 @@ Return NCOL. NCOL should be zero or positive. Note that if `automatic-hscrolling' is non-nil, you cannot scroll the window so that the location of point moves off-window. */) - (window, ncol) - Lisp_Object window, ncol; + (Lisp_Object window, Lisp_Object ncol) { struct window *w = decode_window (window); int hscroll; @@ -583,8 +569,7 @@ DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, doc: /* Return WINDOW's redisplay end trigger value. WINDOW defaults to the selected window. See `set-window-redisplay-end-trigger' for more information. */) - (window) - Lisp_Object window; + (Lisp_Object window) { return decode_window (window)->redisplay_end_trigger; } @@ -597,8 +582,7 @@ If it is a buffer position, then if redisplay in WINDOW reaches a position beyond VALUE, the functions in `redisplay-end-trigger-functions' are called with two arguments: WINDOW, and the end trigger value. Afterwards the end-trigger value is reset to nil. */) - (window, value) - register Lisp_Object window, value; + (register Lisp_Object window, Lisp_Object value) { register struct window *w; @@ -618,8 +602,7 @@ BOTTOM is one more than the bottommost row occupied by WINDOW. The edges include the space used by WINDOW's scroll bar, display margins, fringes, header line, and/or mode line. For the edges of just the text area, use `window-inside-edges'. */) - (window) - Lisp_Object window; + (Lisp_Object window) { register struct window *w = decode_any_window (window); @@ -640,8 +623,7 @@ BOTTOM is one more than the bottommost y position occupied by WINDOW. The pixel edges include the space used by WINDOW's scroll bar, display margins, fringes, header line, and/or mode line. For the pixel edges of just the text area, use `window-inside-pixel-edges'. */) - (window) - Lisp_Object window; + (Lisp_Object window) { register struct window *w = decode_any_window (window); @@ -652,6 +634,47 @@ of just the text area, use `window-inside-pixel-edges'. */) Qnil)))); } +static void +calc_absolute_offset(struct window *w, int *add_x, int *add_y) +{ + struct frame *f = XFRAME (w->frame); + *add_y = f->top_pos; +#ifdef FRAME_MENUBAR_HEIGHT + *add_y += FRAME_MENUBAR_HEIGHT (f); +#endif +#ifdef FRAME_TOOLBAR_HEIGHT + *add_y += FRAME_TOOLBAR_HEIGHT (f); +#endif +#ifdef FRAME_NS_TITLEBAR_HEIGHT + *add_y += FRAME_NS_TITLEBAR_HEIGHT (f); +#endif + *add_x = f->left_pos; +} + +DEFUN ("window-absolute-pixel-edges", Fwindow_absolute_pixel_edges, + Swindow_absolute_pixel_edges, 0, 1, 0, + doc: /* Return a list of the edge pixel coordinates of WINDOW. +The list has the form (LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at +the top left corner of the display. + +RIGHT is one more than the rightmost x position occupied by WINDOW. +BOTTOM is one more than the bottommost y position occupied by WINDOW. +The pixel edges include the space used by WINDOW's scroll bar, display +margins, fringes, header line, and/or mode line. For the pixel edges +of just the text area, use `window-inside-absolute-pixel-edges'. */) + (Lisp_Object window) +{ + register struct window *w = decode_any_window (window); + int add_x, add_y; + calc_absolute_offset (w, &add_x, &add_y); + + return Fcons (make_number (WINDOW_LEFT_EDGE_X (w) + add_x), + Fcons (make_number (WINDOW_TOP_EDGE_Y (w) + add_y), + Fcons (make_number (WINDOW_RIGHT_EDGE_X (w) + add_x), + Fcons (make_number (WINDOW_BOTTOM_EDGE_Y (w) + add_y), + Qnil)))); +} + DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0, doc: /* Return a list of the edge coordinates of WINDOW. The list has the form (LEFT TOP RIGHT BOTTOM). @@ -662,8 +685,7 @@ RIGHT is one more than the rightmost column of WINDOW's text area. BOTTOM is one more than the bottommost row of WINDOW's text area. The inside edges do not include the space used by the WINDOW's scroll bar, display margins, fringes, header line, and/or mode line. */) - (window) - Lisp_Object window; + (Lisp_Object window) { register struct window *w = decode_any_window (window); @@ -688,8 +710,7 @@ RIGHT is one more than the rightmost x position of WINDOW's text area. BOTTOM is one more than the bottommost y position of WINDOW's text area. The inside edges do not include the space used by WINDOW's scroll bar, display margins, fringes, header line, and/or mode line. */) - (window) - Lisp_Object window; + (Lisp_Object window) { register struct window *w = decode_any_window (window); @@ -705,6 +726,35 @@ display margins, fringes, header line, and/or mode line. */) - WINDOW_MODE_LINE_HEIGHT (w))); } +DEFUN ("window-inside-absolute-pixel-edges", + Fwindow_inside_absolute_pixel_edges, + Swindow_inside_absolute_pixel_edges, 0, 1, 0, + doc: /* Return a list of the edge pixel coordinates of WINDOW. +The list has the form (LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at +the top left corner of the display. + +RIGHT is one more than the rightmost x position of WINDOW's text area. +BOTTOM is one more than the bottommost y position of WINDOW's text area. +The inside edges do not include the space used by WINDOW's scroll bar, +display margins, fringes, header line, and/or mode line. */) + (Lisp_Object window) +{ + register struct window *w = decode_any_window (window); + int add_x, add_y; + calc_absolute_offset (w, &add_x, &add_y); + + return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) + + WINDOW_LEFT_MARGIN_WIDTH (w) + + WINDOW_LEFT_FRINGE_WIDTH (w) + add_x), + make_number (WINDOW_TOP_EDGE_Y (w) + + WINDOW_HEADER_LINE_HEIGHT (w) + add_y), + make_number (WINDOW_BOX_RIGHT_EDGE_X (w) + - WINDOW_RIGHT_MARGIN_WIDTH (w) + - WINDOW_RIGHT_FRINGE_WIDTH (w) + add_x), + make_number (WINDOW_BOTTOM_EDGE_Y (w) + - WINDOW_MODE_LINE_HEIGHT (w) + add_y)); +} + /* Test if the character at column *X, row *Y is within window W. If it is not, return ON_NOTHING; if it is in the window's text area, @@ -727,9 +777,7 @@ display margins, fringes, header line, and/or mode line. */) X and Y are frame relative pixel coordinates. */ static enum window_part -coordinates_in_window (w, x, y) - register struct window *w; - register int *x, *y; +coordinates_in_window (register struct window *w, register int *x, register int *y) { struct frame *f = XFRAME (WINDOW_FRAME (w)); int left_x, right_x, top_y, bottom_y; @@ -934,8 +982,7 @@ If they are on the border between WINDOW and its right sibling, `vertical-line' is returned. If they are in the windows's left or right marginal areas, `left-margin'\n\ or `right-margin' is returned. */) - (coordinates, window) - register Lisp_Object coordinates, window; + (register Lisp_Object coordinates, Lisp_Object window) { struct window *w; struct frame *f; @@ -1012,9 +1059,7 @@ struct check_window_data }; static int -check_window_containing (w, user_data) - struct window *w; - void *user_data; +check_window_containing (struct window *w, void *user_data) { struct check_window_data *cw = (struct check_window_data *) user_data; enum window_part found; @@ -1052,12 +1097,7 @@ check_window_containing (w, user_data) case. */ Lisp_Object -window_from_coordinates (f, x, y, part, wx, wy, tool_bar_p) - struct frame *f; - int x, y; - enum window_part *part; - int *wx, *wy; - int tool_bar_p; +window_from_coordinates (struct frame *f, int x, int y, enum window_part *part, int *wx, int *wy, int tool_bar_p) { Lisp_Object window; struct check_window_data cw; @@ -1094,8 +1134,7 @@ DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0, If omitted, FRAME defaults to the currently selected frame. The top left corner of the frame is considered to be row 0, column 0. */) - (x, y, frame) - Lisp_Object x, y, frame; + (Lisp_Object x, Lisp_Object y, Lisp_Object frame) { struct frame *f; @@ -1128,8 +1167,7 @@ is also currently selected, the value returned is the same as (point). It would be more strictly correct to return the `top-level' value of point, outside of any save-excursion forms. But that is hard to define. */) - (window) - Lisp_Object window; + (Lisp_Object window) { register struct window *w = decode_window (window); @@ -1143,8 +1181,7 @@ DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0, doc: /* Return position at which display currently starts in WINDOW. WINDOW defaults to the selected window. This is updated by redisplay or by calling `set-window-start'. */) - (window) - Lisp_Object window; + (Lisp_Object window) { return Fmarker_position (decode_window (window)->start); } @@ -1170,8 +1207,7 @@ Return nil if there is no recorded value. \(This can happen if the last redisplay of WINDOW was preempted, and did not finish.) If UPDATE is non-nil, compute the up-to-date position if it isn't already recorded. */) - (window, update) - Lisp_Object window, update; + (Lisp_Object window, Lisp_Object update) { Lisp_Object value; struct window *w = decode_window (window); @@ -1239,8 +1275,7 @@ if it isn't already recorded. */) DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0, doc: /* Make point value in WINDOW be at position POS in WINDOW's buffer. Return POS. */) - (window, pos) - Lisp_Object window, pos; + (Lisp_Object window, Lisp_Object pos) { register struct window *w = decode_window (window); @@ -1264,8 +1299,7 @@ DEFUN ("set-window-start", Fset_window_start, Sset_window_start, 2, 3, 0, WINDOW defaults to the selected window. Return POS. Optional third arg NOFORCE non-nil inhibits next redisplay from overriding motion of point in order to display at this exact start. */) - (window, pos, noforce) - Lisp_Object window, pos, noforce; + (Lisp_Object window, Lisp_Object pos, Lisp_Object noforce) { register struct window *w = decode_window (window); @@ -1303,8 +1337,7 @@ from displaying another buffer in it. `get-lru-window' and Functions like `set-window-buffer' may change the buffer displayed by a window, unless that window is "strongly" dedicated to its buffer, that is the value returned by `window-dedicated-p' is t. */) - (window) - Lisp_Object window; + (Lisp_Object window) { return decode_window (window)->dedicated; } @@ -1328,8 +1361,7 @@ its buffer. Functions like `set-window-buffer' may change the buffer displayed by a window, unless that window is strongly dedicated to its buffer. If and when `set-window-buffer' displays another buffer in a window, it also makes sure that the window is not marked as dedicated. */) - (window, flag) - Lisp_Object window, flag; + (Lisp_Object window, Lisp_Object flag) { register struct window *w = decode_window (window); @@ -1343,8 +1375,7 @@ DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, doc: /* Return the parameters of WINDOW and their values. WINDOW defaults to the selected window. The return value is a list of elements of the form (PARAMETER . VALUE). */) - (window) - Lisp_Object window; + (Lisp_Object window) { return Fcopy_alist (decode_window (window)->window_parameters); } @@ -1353,8 +1384,7 @@ DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter, 2, 2, 0, doc: /* Return WINDOW's value for PARAMETER. WINDOW defaults to the selected window. */) - (window, parameter) - Lisp_Object window, parameter; + (Lisp_Object window, Lisp_Object parameter) { Lisp_Object result; @@ -1366,8 +1396,7 @@ DEFUN ("set-window-parameter", Fset_window_parameter, Sset_window_parameter, 3, 3, 0, doc: /* Set WINDOW's value of PARAMETER to VALUE. WINDOW defaults to the selected window. Return VALUE. */) - (window, parameter, value) - Lisp_Object window, parameter, value; + (Lisp_Object window, Lisp_Object parameter, Lisp_Object value) { register struct window *w = decode_window (window); Lisp_Object old_alist_elt; @@ -1385,8 +1414,7 @@ DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, 0, 1, 0, doc: /* Return the display-table that WINDOW is using. WINDOW defaults to the selected window. */) - (window) - Lisp_Object window; + (Lisp_Object window) { return decode_window (window)->display_table; } @@ -1397,8 +1425,7 @@ WINDOW defaults to the selected window. */) return 0. */ struct Lisp_Char_Table * -window_display_table (w) - struct window *w; +window_display_table (struct window *w) { struct Lisp_Char_Table *dp = NULL; @@ -1419,8 +1446,7 @@ window_display_table (w) DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_display_table, 2, 2, 0, doc: /* Set WINDOW's display-table to TABLE. */) - (window, table) - register Lisp_Object window, table; + (register Lisp_Object window, Lisp_Object table) { register struct window *w; @@ -1432,8 +1458,7 @@ DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_displa /* Record info on buffer window w is displaying when it is about to cease to display that buffer. */ static void -unshow_buffer (w) - register struct window *w; +unshow_buffer (register struct window *w) { Lisp_Object buf; struct buffer *b; @@ -1481,8 +1506,7 @@ unshow_buffer (w) /* Put replacement into the window structure in place of old. */ static void -replace_window (old, replacement) - Lisp_Object old, replacement; +replace_window (Lisp_Object old, Lisp_Object replacement) { register Lisp_Object tem; register struct window *o = XWINDOW (old), *p = XWINDOW (replacement); @@ -1499,9 +1523,9 @@ replace_window (old, replacement) p->total_lines = o->total_lines; p->desired_matrix = p->current_matrix = 0; p->vscroll = 0; - bzero (&p->cursor, sizeof (p->cursor)); - bzero (&p->last_cursor, sizeof (p->last_cursor)); - bzero (&p->phys_cursor, sizeof (p->phys_cursor)); + memset (&p->cursor, 0, sizeof (p->cursor)); + memset (&p->last_cursor, 0, sizeof (p->last_cursor)); + memset (&p->phys_cursor, 0, sizeof (p->phys_cursor)); p->phys_cursor_type = -1; p->phys_cursor_width = -1; p->must_be_updated_p = 0; @@ -1538,8 +1562,7 @@ DEFUN ("delete-window", Fdelete_window, Sdelete_window, 0, 1, "", doc: /* Remove WINDOW from its frame. WINDOW defaults to the selected window. Return nil. Signal an error when WINDOW is the only window on its frame. */) - (window) - register Lisp_Object window; + (register Lisp_Object window) { struct frame *f; if (NILP (window)) @@ -1556,8 +1579,7 @@ Signal an error when WINDOW is the only window on its frame. */) } void -delete_window (window) - register Lisp_Object window; +delete_window (register Lisp_Object window) { register Lisp_Object tem, parent, sib; register struct window *p; @@ -1771,9 +1793,7 @@ delete_window (window) function window_list. */ static int -add_window_to_list (w, user_data) - struct window *w; - void *user_data; +add_window_to_list (struct window *w, void *user_data) { Lisp_Object *list = (Lisp_Object *) user_data; Lisp_Object window; @@ -1788,7 +1808,7 @@ add_window_to_list (w, user_data) list, cache it in Vwindow_list, and return that. */ static Lisp_Object -window_list () +window_list (void) { if (!CONSP (Vwindow_list)) { @@ -1829,8 +1849,7 @@ window_list () a frame means consider windows on that frame, only. */ static int -candidate_window_p (window, owindow, minibuf, all_frames) - Lisp_Object window, owindow, minibuf, all_frames; +candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf, Lisp_Object all_frames) { struct window *w = XWINDOW (window); struct frame *f = XFRAME (w->frame); @@ -1895,8 +1914,7 @@ candidate_window_p (window, owindow, minibuf, all_frames) ALL_FRAMES. */ static void -decode_next_window_args (window, minibuf, all_frames) - Lisp_Object *window, *minibuf, *all_frames; +decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object *all_frames) { if (NILP (*window)) *window = selected_window; @@ -1942,9 +1960,7 @@ decode_next_window_args (window, minibuf, all_frames) ALL_FRAMES. */ static Lisp_Object -next_window (window, minibuf, all_frames, next_p) - Lisp_Object window, minibuf, all_frames; - int next_p; +next_window (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames, int next_p) { decode_next_window_args (&window, &minibuf, &all_frames); @@ -2043,8 +2059,7 @@ If you use consistent values for MINIBUF and ALL-FRAMES, you can use `next-window' to iterate through the entire cycle of acceptable windows, eventually ending up back at the window you started with. `previous-window' traverses the same cycle, in the reverse order. */) - (window, minibuf, all_frames) - Lisp_Object window, minibuf, all_frames; + (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames) { return next_window (window, minibuf, all_frames, 1); } @@ -2061,8 +2076,7 @@ use `previous-window' to iterate through the entire cycle of acceptable windows, eventually ending up back at the window you started with. `next-window' traverses the same cycle, in the reverse order. */) - (window, minibuf, all_frames) - Lisp_Object window, minibuf, all_frames; + (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames) { return next_window (window, minibuf, all_frames, 0); } @@ -2081,8 +2095,7 @@ This function uses `next-window' for finding the window to select. The argument ALL-FRAMES has the same meaning as in `next-window', but the MINIBUF argument of `next-window' is always effectively nil. */) - (count, all_frames) - Lisp_Object count, all_frames; + (Lisp_Object count, Lisp_Object all_frames) { Lisp_Object window; int i; @@ -2108,8 +2121,7 @@ MINIBUF t means include the minibuffer window, even if it isn't active. MINIBUF nil or omitted means include the minibuffer window only if it's active. MINIBUF neither nil nor t means never include the minibuffer window. */) - (frame, minibuf, window) - Lisp_Object frame, minibuf, window; + (Lisp_Object frame, Lisp_Object minibuf, Lisp_Object window) { if (NILP (window)) window = FRAMEP (frame) ? XFRAME (frame)->selected_window : selected_window; @@ -2128,8 +2140,7 @@ MINIBUF neither nil nor t means never include the minibuffer window. */) for `next-window'. */ static Lisp_Object -window_list_1 (window, minibuf, all_frames) - Lisp_Object window, minibuf, all_frames; +window_list_1 (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames) { Lisp_Object tail, list, rest; @@ -2177,10 +2188,7 @@ enum window_loop }; static Lisp_Object -window_loop (type, obj, mini, frames) - enum window_loop type; - Lisp_Object obj, frames; - int mini; +window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frames) { Lisp_Object window, windows, best_window, frame_arg; struct frame *f; @@ -2407,7 +2415,7 @@ window_loop (type, obj, mini, frames) /* Used for debugging. Abort if any window has a dead buffer. */ void -check_all_windows () +check_all_windows (void) { window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt); } @@ -2425,8 +2433,7 @@ If FRAME is 0, search all visible and iconified frames. If FRAME is t, search all frames. If FRAME is nil, search only the selected frame. If FRAME is a frame, search only that frame. */) - (frame, dedicated) - Lisp_Object frame, dedicated; + (Lisp_Object frame, Lisp_Object dedicated) { register Lisp_Object w; /* First try for a window that is full-width */ @@ -2451,8 +2458,7 @@ If FRAME is 0, search all visible and iconified frames. If FRAME is t, search all frames. If FRAME is nil, search only the selected frame. If FRAME is a frame, search only that frame. */) - (frame, dedicated) - Lisp_Object frame, dedicated; + (Lisp_Object frame, Lisp_Object dedicated) { return window_loop (GET_LARGEST_WINDOW, dedicated, 0, frame); @@ -2467,8 +2473,7 @@ If optional argument FRAME is 0, search all visible and iconified frames. If FRAME is t, search all frames. If FRAME is nil, search only the selected frame. If FRAME is a frame, search only that frame. */) - (buffer_or_name, frame) - Lisp_Object buffer_or_name, frame; + (Lisp_Object buffer_or_name, Lisp_Object frame) { Lisp_Object buffer; @@ -2492,8 +2497,7 @@ previously visible in WINDOW in the same place on the frame. Doing this depends on the value of (window-start WINDOW), so if calling this function in a program gives strange scrolling, make sure the window-start value is reasonable when this function is called. */) - (window) - Lisp_Object window; + (Lisp_Object window) { struct window *w; int startpos; @@ -2560,8 +2564,7 @@ If FRAME is t, search only the selected frame. If FRAME is a frame, search only that frame. When a window showing BUFFER-OR-NAME is dedicated and the only window of its frame, that frame is deleted when there are other frames left. */) - (buffer_or_name, frame) - Lisp_Object buffer_or_name, frame; + (Lisp_Object buffer_or_name, Lisp_Object frame) { Lisp_Object buffer; @@ -2596,8 +2599,7 @@ When a window showing BUFFER-OR-NAME is dedicated that window is deleted. If that window is the only window on its frame, that frame is deleted too when there are other frames left. If there are no other frames left, some other buffer is displayed in that window. */) - (buffer_or_name) - Lisp_Object buffer_or_name; + (Lisp_Object buffer_or_name) { Lisp_Object buffer; @@ -2618,8 +2620,7 @@ frames left, some other buffer is displayed in that window. */) of all frames, even those on other keyboards. */ void -replace_buffer_in_all_windows (buffer) - Lisp_Object buffer; +replace_buffer_in_all_windows (Lisp_Object buffer) { Lisp_Object tail, frame; @@ -2648,9 +2649,7 @@ replace_buffer_in_all_windows (buffer) minimum allowable size. */ void -check_frame_size (frame, rows, cols) - FRAME_PTR frame; - int *rows, *cols; +check_frame_size (FRAME_PTR frame, int *rows, int *cols) { /* For height, we have to see: how many windows the frame has at minimum (one or two), @@ -2676,9 +2675,7 @@ check_frame_size (frame, rows, cols) either. */ static int -window_fixed_size_p (w, width_p, check_siblings_p) - struct window *w; - int width_p, check_siblings_p; +window_fixed_size_p (struct window *w, int width_p, int check_siblings_p) { int fixed_p; struct window *c; @@ -2778,9 +2775,7 @@ window_fixed_size_p (w, width_p, check_siblings_p) minibuffer window, always return 1. */ static int -window_min_size_2 (w, width_p, safe_p) - struct window *w; - int width_p, safe_p; +window_min_size_2 (struct window *w, int width_p, int safe_p) { /* We should consider buffer-local values of window_min_height and window_min_width here. */ @@ -2814,9 +2809,7 @@ window_min_size_2 (w, width_p, safe_p) sizes of W's children. */ static int -window_min_size_1 (w, width_p, safe_p) - struct window *w; - int width_p, safe_p; +window_min_size_1 (struct window *w, int width_p, int safe_p) { struct window *c; int size; @@ -2891,9 +2884,7 @@ window_min_size_1 (w, width_p, safe_p) to 1 if W is fixed-size unless FIXED is null. */ static int -window_min_size (w, width_p, safe_p, ignore_fixed_p, fixed) - struct window *w; - int width_p, safe_p, ignore_fixed_p, *fixed; +window_min_size (struct window *w, int width_p, int safe_p, int ignore_fixed_p, int *fixed) { int size, fixed_p; @@ -2919,8 +2910,7 @@ window_min_size (w, width_p, safe_p, ignore_fixed_p, fixed) is still too narrow. */ static int -adjust_window_margins (w) - struct window *w; +adjust_window_margins (struct window *w) { int box_cols = (WINDOW_TOTAL_COLS (w) - WINDOW_FRINGE_COLS (w) @@ -2974,11 +2964,8 @@ adjust_window_margins (w) a specific window, it will attempt to strictly resize that window proportionally, even at the expense of deleting smaller windows. */ static int * -shrink_windows (total, size, nchildren, shrinkable, resize_fixed_p, - forward, width_p, safe_p) - int total, size, nchildren, shrinkable; - int resize_fixed_p, width_p, safe_p; - Lisp_Object forward; +shrink_windows (int total, int size, int nchildren, int shrinkable, + int resize_fixed_p, Lisp_Object forward, int width_p, int safe_p) { int available_resize = 0; int *new_sizes, *min_sizes; @@ -3118,10 +3105,7 @@ shrink_windows (total, size, nchildren, shrinkable, resize_fixed_p, This should give better behavior when resizing frames. */ static void -size_window (window, size, width_p, nodelete_p, first_only, last_only) - Lisp_Object window; - int size, width_p, nodelete_p; - int first_only, last_only; +size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int first_only, int last_only) { struct window *w = XWINDOW (window); struct window *c; @@ -3312,10 +3296,7 @@ size_window (window, size, width_p, nodelete_p, first_only, last_only) displayed correctly. */ void -set_window_height (window, height, nodelete) - Lisp_Object window; - int height; - int nodelete; +set_window_height (Lisp_Object window, int height, int nodelete) { size_window (window, height, 0, nodelete, 0, 0); } @@ -3329,10 +3310,7 @@ set_window_height (window, height, nodelete) displayed correctly. */ void -set_window_width (window, width, nodelete) - Lisp_Object window; - int width; - int nodelete; +set_window_width (Lisp_Object window, int width, int nodelete) { size_window (window, width, 1, nodelete, 0, 0); } @@ -3340,9 +3318,7 @@ set_window_width (window, width, nodelete) /* Change window heights in windows rooted in WINDOW by N lines. */ void -change_window_heights (window, n) - Lisp_Object window; - int n; +change_window_heights (Lisp_Object window, int n) { struct window *w = XWINDOW (window); @@ -3438,9 +3414,7 @@ run_window_configuration_change_hook (struct frame *f) reset from the buffer's local settings. */ void -set_window_buffer (window, buffer, run_hooks_p, keep_margins_p) - Lisp_Object window, buffer; - int run_hooks_p, keep_margins_p; +set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int keep_margins_p) { struct window *w = XWINDOW (window); struct buffer *b = XBUFFER (buffer); @@ -3462,7 +3436,7 @@ set_window_buffer (window, buffer, run_hooks_p, keep_margins_p) XSETFASTINT (w->window_end_pos, 0); XSETFASTINT (w->window_end_vpos, 0); - bzero (&w->last_cursor, sizeof w->last_cursor); + memset (&w->last_cursor, 0, sizeof w->last_cursor); w->window_end_valid = Qnil; if (!(keep_margins_p && samebuf)) { /* If we're not actually changing the buffer, don't reset hscroll and @@ -3551,8 +3525,7 @@ already display BUFFER-OR-NAME. This function runs `window-scroll-functions' before running `window-configuration-change-hook'. */) - (window, buffer_or_name, keep_margins) - register Lisp_Object window, buffer_or_name, keep_margins; + (register Lisp_Object window, Lisp_Object buffer_or_name, Lisp_Object keep_margins) { register Lisp_Object tem, buffer; register struct window *w = decode_window (window); @@ -3595,8 +3568,7 @@ make this window the most recently selected one. Note that the main editor command loop selects the buffer of the selected window before each command. */) - (window, norecord) - register Lisp_Object window, norecord; + (register Lisp_Object window, Lisp_Object norecord) { register struct window *w; register struct window *ow; @@ -3671,24 +3643,21 @@ selected window before each command. */) } static Lisp_Object -select_window_norecord (window) - Lisp_Object window; +select_window_norecord (Lisp_Object window) { return WINDOW_LIVE_P (window) ? Fselect_window (window, Qt) : selected_window; } static Lisp_Object -select_frame_norecord (frame) - Lisp_Object frame; +select_frame_norecord (Lisp_Object frame) { return FRAME_LIVE_P (XFRAME (frame)) ? Fselect_frame (frame, Qt) : selected_frame; } Lisp_Object -display_buffer (buffer, not_this_window_p, override_frame) - Lisp_Object buffer, not_this_window_p, override_frame; +display_buffer (Lisp_Object buffer, Lisp_Object not_this_window_p, Lisp_Object override_frame) { return call3 (Qdisplay_buffer, buffer, not_this_window_p, override_frame); } @@ -3699,8 +3668,7 @@ DEFUN ("force-window-update", Fforce_window_update, Sforce_window_update, If optional arg OBJECT is a window, force redisplay of that window only. If OBJECT is a buffer or buffer name, force redisplay of all windows displaying that buffer. */) - (object) - Lisp_Object object; + (Lisp_Object object) { if (NILP (object)) { @@ -3739,8 +3707,7 @@ displaying that buffer. */) void -temp_output_buffer_show (buf) - register Lisp_Object buf; +temp_output_buffer_show (register Lisp_Object buf) { register struct buffer *old = current_buffer; register Lisp_Object window; @@ -3800,8 +3767,7 @@ temp_output_buffer_show (buf) } static void -make_dummy_parent (window) - Lisp_Object window; +make_dummy_parent (Lisp_Object window) { Lisp_Object new; register struct window *o, *p; @@ -3843,8 +3809,7 @@ The upper or leftmost window is the original one, and remains selected if it was selected before. See Info node `(elisp)Splitting Windows' for more details and examples. */) - (window, size, horizontal) - Lisp_Object window, size, horizontal; + (Lisp_Object window, Lisp_Object size, Lisp_Object horizontal) { register Lisp_Object new; register struct window *o, *p; @@ -3934,7 +3899,7 @@ See Info node `(elisp)Splitting Windows' for more details and examples. */) p->parent = o->parent; p->buffer = Qt; p->window_end_valid = Qnil; - bzero (&p->last_cursor, sizeof p->last_cursor); + memset (&p->last_cursor, 0, sizeof p->last_cursor); /* Duplicate special geometry settings. */ @@ -3983,8 +3948,7 @@ window wider by SIZE columns. If SIZE is negative, shrink the window by This function can delete windows if they get too small. The size of fixed size windows is not altered by this function. */) - (size, horizontal) - Lisp_Object size, horizontal; + (Lisp_Object size, Lisp_Object horizontal) { CHECK_NUMBER (size); enlarge_window (selected_window, XINT (size), !NILP (horizontal)); @@ -4003,8 +3967,7 @@ window by -SIZE lines or columns. Return nil. This function can delete windows if they get too small. The size of fixed size windows is not altered by this function. */) - (size, horizontal) - Lisp_Object size, horizontal; + (Lisp_Object size, Lisp_Object horizontal) { CHECK_NUMBER (size); enlarge_window (selected_window, -XINT (size), !NILP (horizontal)); @@ -4015,16 +3978,14 @@ fixed size windows is not altered by this function. */) } int -window_height (window) - Lisp_Object window; +window_height (Lisp_Object window) { register struct window *p = XWINDOW (window); return WINDOW_TOTAL_LINES (p); } int -window_width (window) - Lisp_Object window; +window_width (Lisp_Object window) { register struct window *p = XWINDOW (window); return WINDOW_TOTAL_COLS (p); @@ -4046,17 +4007,15 @@ window_width (window) deleted. */ static void -enlarge_window (window, delta, horiz_flag) - Lisp_Object window; - int delta, horiz_flag; +enlarge_window (Lisp_Object window, int delta, int horiz_flag) { Lisp_Object parent, next, prev; struct window *p; Lisp_Object *sizep; int maximum; - int (*sizefun) P_ ((Lisp_Object)) + int (*sizefun) (Lisp_Object) = horiz_flag ? window_width : window_height; - void (*setsizefun) P_ ((Lisp_Object, int, int)) + void (*setsizefun) (Lisp_Object, int, int) = (horiz_flag ? set_window_width : set_window_height); /* Give up if this window cannot be resized. */ @@ -4324,9 +4283,7 @@ enlarge_window (window, delta, horiz_flag) are not deleted; instead, we signal an error. */ static void -adjust_window_trailing_edge (window, delta, horiz_flag) - Lisp_Object window; - int delta, horiz_flag; +adjust_window_trailing_edge (Lisp_Object window, int delta, int horiz_flag) { Lisp_Object parent, child; struct window *p; @@ -4462,8 +4419,7 @@ Otherwise, adjust the height, moving the bottom edge. Following siblings of the selected window are resized to fulfill the size request. If they become too small in the process, they are not deleted; instead, we signal an error. */) - (window, delta, horizontal) - Lisp_Object window, delta, horizontal; + (Lisp_Object window, Lisp_Object delta, Lisp_Object horizontal) { CHECK_NUMBER (delta); if (NILP (window)) @@ -4482,7 +4438,7 @@ are not deleted; instead, we signal an error. */) Resizing Mini-Windows ***********************************************************************/ -static void shrink_window_lowest_first P_ ((struct window *, int)); +static void shrink_window_lowest_first (struct window *, int); enum save_restore_action { @@ -4491,16 +4447,14 @@ enum save_restore_action RESTORE_ORIG_SIZES }; -static int save_restore_orig_size P_ ((struct window *, - enum save_restore_action)); +static int save_restore_orig_size (struct window *, + enum save_restore_action); /* Shrink windows rooted in window W to HEIGHT. Take the space needed from lowest windows first. */ static void -shrink_window_lowest_first (w, height) - struct window *w; - int height; +shrink_window_lowest_first (struct window *w, int height) { struct window *c; Lisp_Object child; @@ -4582,9 +4536,7 @@ shrink_window_lowest_first (w, height) stored in orig_top_line and orig_total_lines for all windows. */ static int -save_restore_orig_size (w, action) - struct window *w; - enum save_restore_action action; +save_restore_orig_size (struct window *w, enum save_restore_action action) { int success_p = 1; @@ -4639,9 +4591,7 @@ save_restore_orig_size (w, action) without deleting other windows. */ void -grow_mini_window (w, delta) - struct window *w; - int delta; +grow_mini_window (struct window *w, int delta) { struct frame *f = XFRAME (w->frame); struct window *root; @@ -4690,8 +4640,7 @@ grow_mini_window (w, delta) line. */ void -shrink_mini_window (w) - struct window *w; +shrink_mini_window (struct window *w) { struct frame *f = XFRAME (w->frame); struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f)); @@ -4721,8 +4670,7 @@ shrink_mini_window (w) the frame are cleared. */ void -mark_window_cursors_off (w) - struct window *w; +mark_window_cursors_off (struct window *w) { while (w) { @@ -4741,8 +4689,7 @@ mark_window_cursors_off (w) /* Return number of lines of text (not counting mode lines) in W. */ int -window_internal_height (w) - struct window *w; +window_internal_height (struct window *w) { int ht = XFASTINT (w->total_lines); @@ -4769,8 +4716,7 @@ window_internal_height (w) separating W from the sibling to its right. */ int -window_box_text_cols (w) - struct window *w; +window_box_text_cols (struct window *w) { struct frame *f = XFRAME (WINDOW_FRAME (w)); int width = XINT (w->total_cols); @@ -4807,11 +4753,7 @@ window_box_text_cols (w) respectively. */ static void -window_scroll (window, n, whole, noerror) - Lisp_Object window; - int n; - int whole; - int noerror; +window_scroll (Lisp_Object window, int n, int whole, int noerror) { immediate_quit = 1; @@ -4831,11 +4773,7 @@ window_scroll (window, n, whole, noerror) descriptions. */ static void -window_scroll_pixel_based (window, n, whole, noerror) - Lisp_Object window; - int n; - int whole; - int noerror; +window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) { struct it it; struct window *w = XWINDOW (window); @@ -5181,11 +5119,7 @@ window_scroll_pixel_based (window, n, whole, noerror) See the comment of window_scroll for parameter descriptions. */ static void -window_scroll_line_based (window, n, whole, noerror) - Lisp_Object window; - int n; - int whole; - int noerror; +window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) { register struct window *w = XWINDOW (window); register int opoint = PT, opoint_byte = PT_BYTE; @@ -5343,9 +5277,7 @@ window_scroll_line_based (window, n, whole, noerror) up. This is the guts of Fscroll_up and Fscroll_down. */ static void -scroll_command (n, direction) - Lisp_Object n; - int direction; +scroll_command (Lisp_Object n, int direction) { int count = SPECPDL_INDEX (); @@ -5382,8 +5314,7 @@ A near full screen is `next-screen-context-lines' less than a full screen. Negative ARG means scroll downward. If ARG is the atom `-', scroll downward by nearly full screen. When calling from a program, supply as argument a number, nil, or `-'. */) - (arg) - Lisp_Object arg; + (Lisp_Object arg) { scroll_command (arg, 1); return Qnil; @@ -5396,8 +5327,7 @@ A near full screen is `next-screen-context-lines' less than a full screen. Negative ARG means scroll upward. If ARG is the atom `-', scroll upward by nearly full screen. When calling from a program, supply as argument a number, nil, or `-'. */) - (arg) - Lisp_Object arg; + (Lisp_Object arg) { scroll_command (arg, -1); return Qnil; @@ -5410,7 +5340,7 @@ showing that buffer is used. If in the minibuffer, `minibuffer-scroll-window' if non-nil specifies the window. This takes precedence over `other-window-scroll-buffer'. */) - () + (void) { Lisp_Object window; @@ -5460,8 +5390,7 @@ showing that buffer, popping the buffer up if necessary. If in the minibuffer, `minibuffer-scroll-window' if non-nil specifies the window to scroll. This takes precedence over `other-window-scroll-buffer'. */) - (arg) - Lisp_Object arg; + (Lisp_Object arg) { Lisp_Object window; struct window *w; @@ -5504,8 +5433,7 @@ If SET-MINIMUM is non-nil, the new scroll amount becomes the lower bound for automatic scrolling, i.e. automatic scrolling will not scroll a window to a column less than the value returned by this function. This happens in an interactive call. */) - (arg, set_minimum) - register Lisp_Object arg, set_minimum; + (register Lisp_Object arg, Lisp_Object set_minimum) { Lisp_Object result; int hscroll; @@ -5534,8 +5462,7 @@ If SET-MINIMUM is non-nil, the new scroll amount becomes the lower bound for automatic scrolling, i.e. automatic scrolling will not scroll a window to a column less than the value returned by this function. This happens in an interactive call. */) - (arg, set_minimum) - register Lisp_Object arg, set_minimum; + (register Lisp_Object arg, Lisp_Object set_minimum) { Lisp_Object result; int hscroll; @@ -5558,7 +5485,7 @@ by this function. This happens in an interactive call. */) DEFUN ("minibuffer-selected-window", Fminibuffer_selected_window, Sminibuffer_selected_window, 0, 0, 0, doc: /* Return the window which was selected when entering the minibuffer. Returns nil, if selected window is not a minibuffer window. */) - () + (void) { if (minibuf_level > 0 && MINI_WINDOW_P (XWINDOW (selected_window)) @@ -5572,8 +5499,7 @@ Returns nil, if selected window is not a minibuffer window. */) as opposed to its height. */ static int -displayed_window_lines (w) - struct window *w; +displayed_window_lines (struct window *w) { struct it it; struct text_pos start; @@ -5641,8 +5567,7 @@ then only tty frame are redrawn. Just C-u as prefix means put point in the center of the window and redisplay normally--don't erase and redraw the frame. */) - (arg) - register Lisp_Object arg; + (register Lisp_Object arg) { struct window *w = XWINDOW (selected_window); struct buffer *buf = XBUFFER (w->buffer); @@ -5826,8 +5751,7 @@ WINDOW defaults to the selected window. The return value does not include the mode line, any header line, nor any partial-height lines in the text display area. */) - (window) - Lisp_Object window; + (Lisp_Object window) { struct window *w = decode_window (window); int pixel_height = window_box_height (w); @@ -5843,8 +5767,7 @@ DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line, With no argument, position point at center of window. An argument specifies vertical position within the window; zero means top of window, negative means relative to bottom of window. */) - (arg) - Lisp_Object arg; + (Lisp_Object arg) { struct window *w = XWINDOW (selected_window); int lines, start; @@ -5957,16 +5880,14 @@ struct saved_window DEFUN ("window-configuration-p", Fwindow_configuration_p, Swindow_configuration_p, 1, 1, 0, doc: /* Return t if OBJECT is a window-configuration object. */) - (object) - Lisp_Object object; + (Lisp_Object object) { return WINDOW_CONFIGURATIONP (object) ? Qt : Qnil; } DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_configuration_frame, 1, 1, 0, doc: /* Return the frame that CONFIG, a window-configuration object, is about. */) - (config) - Lisp_Object config; + (Lisp_Object config) { register struct save_window_data *data; struct Lisp_Vector *saved_windows; @@ -5986,8 +5907,7 @@ by `current-window-configuration' (which see). If CONFIGURATION was made from a frame that is now deleted, only frame-independent values can be restored. In this case, the return value is nil. Otherwise the value is t. */) - (configuration) - Lisp_Object configuration; + (Lisp_Object configuration) { register struct save_window_data *data; struct Lisp_Vector *saved_windows; @@ -6318,8 +6238,7 @@ the return value is nil. Otherwise the value is t. */) by setting their buffers to nil. */ void -delete_all_subwindows (w) - register struct window *w; +delete_all_subwindows (register struct window *w) { if (!NILP (w->next)) delete_all_subwindows (XWINDOW (w->next)); @@ -6345,8 +6264,7 @@ delete_all_subwindows (w) } static int -count_windows (window) - register struct window *window; +count_windows (register struct window *window) { register int count = 1; if (!NILP (window->next)) @@ -6363,10 +6281,7 @@ count_windows (window) Value is last index + 1. */ static int -get_leaf_windows (w, flat, i) - struct window *w; - struct window **flat; - int i; +get_leaf_windows (struct window *w, struct window **flat, int i) { while (w) { @@ -6389,8 +6304,7 @@ get_leaf_windows (w, flat, i) can be returned. */ struct glyph * -get_phys_cursor_glyph (w) - struct window *w; +get_phys_cursor_glyph (struct window *w) { struct glyph_row *row; struct glyph *glyph; @@ -6409,10 +6323,7 @@ get_phys_cursor_glyph (w) static int -save_window_save (window, vector, i) - Lisp_Object window; - struct Lisp_Vector *vector; - int i; +save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) { register struct saved_window *p; register struct window *w; @@ -6502,8 +6413,7 @@ point and mark. An exception is made for point in the current buffer: its value is -not- saved. This also records the currently selected frame, and FRAME's focus redirection (see `redirect-frame-focus'). */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { register Lisp_Object tem; register int n_windows; @@ -6551,8 +6461,7 @@ Also restore the choice of selected window. Also restore which buffer is current. Does not restore the value of point in current buffer. usage: (save-window-excursion BODY...) */) - (args) - Lisp_Object args; + (Lisp_Object args) { register Lisp_Object val; register int count = SPECPDL_INDEX (); @@ -6570,8 +6479,7 @@ usage: (save-window-excursion BODY...) */) ***********************************************************************/ static Lisp_Object -window_tree (w) - struct window *w; +window_tree (struct window *w) { Lisp_Object tail = Qnil; Lisp_Object result = Qnil; @@ -6624,8 +6532,7 @@ EDGES is a list \(LEFT TOP RIGHT BOTTOM) as returned by `window-edges'. If FRAME is nil or omitted, return information on the currently selected frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { FRAME_PTR f; @@ -6654,8 +6561,7 @@ Second arg LEFT-WIDTH specifies the number of character cells to reserve for the left marginal area. Optional third arg RIGHT-WIDTH does the same for the right marginal area. A nil width parameter means no margin. */) - (window, left_width, right_width) - Lisp_Object window, left_width, right_width; + (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width) { struct window *w = decode_window (window); @@ -6699,8 +6605,7 @@ If WINDOW is omitted or nil, use the currently selected window. Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH). If a marginal area does not exist, its width will be returned as nil. */) - (window) - Lisp_Object window; + (Lisp_Object window) { struct window *w = decode_window (window); return Fcons (w->left_margin_cols, w->right_margin_cols); @@ -6725,8 +6630,7 @@ the command `set-fringe-style'. If optional fourth arg OUTSIDE-MARGINS is non-nil, draw the fringes outside of the display margins. By default, fringes are drawn between display marginal areas and the text area. */) - (window, left_width, right_width, outside_margins) - Lisp_Object window, left_width, right_width, outside_margins; + (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width, Lisp_Object outside_margins) { struct window *w = decode_window (window); @@ -6763,8 +6667,7 @@ DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes, doc: /* Get width of fringes of window WINDOW. If WINDOW is omitted or nil, use the currently selected window. Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) - (window) - Lisp_Object window; + (Lisp_Object window) { struct window *w = decode_window (window); @@ -6791,8 +6694,7 @@ bar: left, right, or nil. If WIDTH is nil, use the frame's scroll-bar width. If VERTICAL-TYPE is t, use the frame's scroll-bar type. Fourth parameter HORIZONTAL-TYPE is currently unused. */) - (window, width, vertical_type, horizontal_type) - Lisp_Object window, width, vertical_type, horizontal_type; + (Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type, Lisp_Object horizontal_type) { struct window *w = decode_window (window); @@ -6836,8 +6738,7 @@ If WINDOW is omitted or nil, use the currently selected window. Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE). If WIDTH is nil or TYPE is t, the window is using the frame's corresponding value. */) - (window) - Lisp_Object window; + (Lisp_Object window) { struct window *w = decode_window (window); return Fcons (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) @@ -6859,8 +6760,7 @@ DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 2, 0, Use the selected window if WINDOW is nil or omitted. Normally, value is a multiple of the canonical character height of WINDOW; optional second arg PIXELS-P means value is measured in pixels. */) - (window, pixels_p) - Lisp_Object window, pixels_p; + (Lisp_Object window, Lisp_Object pixels_p) { Lisp_Object result; struct frame *f; @@ -6893,8 +6793,7 @@ If PIXELS-P is nil, VSCROLL may have to be rounded so that it corresponds to an integral number of pixels. The return value is the result of this rounding. If PIXELS-P is non-nil, the return value is VSCROLL. */) - (window, vscroll, pixels_p) - Lisp_Object window, vscroll, pixels_p; + (Lisp_Object window, Lisp_Object vscroll, Lisp_Object pixels_p) { struct window *w; struct frame *f; @@ -6938,10 +6837,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */) additional argument USER_DATA. Stops when FN returns 0. */ void -foreach_window (f, fn, user_data) - struct frame *f; - int (* fn) P_ ((struct window *, void *)); - void *user_data; +foreach_window (struct frame *f, int (*fn) (struct window *, void *), void *user_data) { /* delete_frame may set FRAME_ROOT_WINDOW (f) to Qnil. */ if (WINDOWP (FRAME_ROOT_WINDOW (f))) @@ -6955,10 +6851,7 @@ foreach_window (f, fn, user_data) Stop when FN returns 0. Value is 0 if stopped by FN. */ static int -foreach_window_1 (w, fn, user_data) - struct window *w; - int (* fn) P_ ((struct window *, void *)); - void *user_data; +foreach_window_1 (struct window *w, int (*fn) (struct window *, void *), void *user_data) { int cont; @@ -6983,9 +6876,7 @@ foreach_window_1 (w, fn, user_data) the window start. */ static int -freeze_window_start (w, freeze_p) - struct window *w; - void *freeze_p; +freeze_window_start (struct window *w, void *freeze_p) { if (MINI_WINDOW_P (w) || (WINDOWP (selected_window) /* Can be nil in corner cases. */ @@ -7005,9 +6896,7 @@ freeze_window_start (w, freeze_p) means freeze the window start. */ void -freeze_window_starts (f, freeze_p) - struct frame *f; - int freeze_p; +freeze_window_starts (struct frame *f, int freeze_p) { foreach_window (f, freeze_window_start, (void *) (freeze_p ? f : 0)); } @@ -7021,9 +6910,7 @@ freeze_window_starts (f, freeze_p) describe the same state of affairs. This is used by Fequal. */ int -compare_window_configurations (c1, c2, ignore_positions) - Lisp_Object c1, c2; - int ignore_positions; +compare_window_configurations (Lisp_Object c1, Lisp_Object c2, int ignore_positions) { register struct save_window_data *d1, *d2; struct Lisp_Vector *sw1, *sw2; @@ -7140,8 +7027,7 @@ DEFUN ("compare-window-configurations", Fcompare_window_configurations, doc: /* Compare two window configurations as regards the structure of windows. This function ignores details such as the values of point and mark and scrolling positions. */) - (x, y) - Lisp_Object x, y; + (Lisp_Object x, Lisp_Object y) { if (compare_window_configurations (x, y, 1)) return Qt; @@ -7149,7 +7035,7 @@ and scrolling positions. */) } void -init_window_once () +init_window_once (void) { struct frame *f = make_initial_frame (); XSETFRAME (selected_frame, f); @@ -7162,13 +7048,13 @@ init_window_once () } void -init_window () +init_window (void) { Vwindow_list = Qnil; } void -syms_of_window () +syms_of_window (void) { Qscroll_up = intern_c_string ("scroll-up"); staticpro (&Qscroll_up); @@ -7312,8 +7198,10 @@ frame to be redrawn only if it is a tty frame. */); defsubr (&Sset_window_redisplay_end_trigger); defsubr (&Swindow_edges); defsubr (&Swindow_pixel_edges); + defsubr (&Swindow_absolute_pixel_edges); defsubr (&Swindow_inside_edges); defsubr (&Swindow_inside_pixel_edges); + defsubr (&Swindow_inside_absolute_pixel_edges); defsubr (&Scoordinates_in_window_p); defsubr (&Swindow_at); defsubr (&Swindow_point); @@ -7375,7 +7263,7 @@ frame to be redrawn only if it is a tty frame. */); } void -keys_of_window () +keys_of_window (void) { initial_define_key (control_x_map, '1', "delete-other-windows"); initial_define_key (control_x_map, '2', "split-window"); diff --git a/src/window.h b/src/window.h index 17332f0af20..e9529487b14 100644 --- a/src/window.h +++ b/src/window.h @@ -785,25 +785,25 @@ EXFUN (Fwindow_vscroll, 2); EXFUN (Fset_window_margins, 3); EXFUN (Fwindow_live_p, 1); EXFUN (Fset_window_point, 2); -extern Lisp_Object make_window P_ ((void)); -extern void delete_window P_ ((Lisp_Object)); -extern Lisp_Object window_from_coordinates P_ ((struct frame *, int, int, - enum window_part *, - int *, int*, int)); +extern Lisp_Object make_window (void); +extern void delete_window (Lisp_Object); +extern Lisp_Object window_from_coordinates (struct frame *, int, int, + enum window_part *, + int *, int*, int); EXFUN (Fwindow_dedicated_p, 1); -extern int window_height P_ ((Lisp_Object)); -extern int window_width P_ ((Lisp_Object)); +extern int window_height (Lisp_Object); +extern int window_width (Lisp_Object); EXFUN (Fwindow_full_width_p, 1); -extern void set_window_height P_ ((Lisp_Object, int, int)); -extern void set_window_width P_ ((Lisp_Object, int, int)); -extern void change_window_heights P_ ((Lisp_Object, int)); -extern void delete_all_subwindows P_ ((struct window *)); -extern void freeze_window_starts P_ ((struct frame *, int)); -extern void foreach_window P_ ((struct frame *, - int (* fn) (struct window *, void *), - void *)); -extern void grow_mini_window P_ ((struct window *, int)); -extern void shrink_mini_window P_ ((struct window *)); +extern void set_window_height (Lisp_Object, int, int); +extern void set_window_width (Lisp_Object, int, int); +extern void change_window_heights (Lisp_Object, int); +extern void delete_all_subwindows (struct window *); +extern void freeze_window_starts (struct frame *, int); +extern void foreach_window (struct frame *, + int (* fn) (struct window *, void *), + void *); +extern void grow_mini_window (struct window *, int); +extern void shrink_mini_window (struct window *); void run_window_configuration_change_hook (struct frame *f); @@ -811,8 +811,8 @@ void run_window_configuration_change_hook (struct frame *f); means it's allowed to run hooks. See make_frame for a case where it's not allowed. */ -void set_window_buffer P_ ((Lisp_Object window, Lisp_Object buffer, - int run_hooks_p, int keep_margins_p)); +void set_window_buffer (Lisp_Object window, Lisp_Object buffer, + int run_hooks_p, int keep_margins_p); /* Prompt to display in front of the minibuffer contents. */ @@ -862,13 +862,13 @@ extern int buffer_shared; /* If *ROWS or *COLS are too small a size for FRAME, set them to the minimum allowable size. */ -extern void check_frame_size P_ ((struct frame *frame, int *rows, int *cols)); +extern void check_frame_size (struct frame *frame, int *rows, int *cols); /* Return a pointer to the glyph W's physical cursor is on. Value is null if W's current matrix is invalid, so that no meaningfull glyph can be returned. */ -struct glyph *get_phys_cursor_glyph P_ ((struct window *w)); +struct glyph *get_phys_cursor_glyph (struct window *w); /* Value is non-zero if WINDOW is a live window. */ @@ -891,24 +891,24 @@ EXFUN (Fsave_window_excursion, UNEVALLED); EXFUN (Fsplit_window, 3); EXFUN (Fset_window_configuration, 1); EXFUN (Fcurrent_window_configuration, 1); -extern int compare_window_configurations P_ ((Lisp_Object, Lisp_Object, int)); +extern int compare_window_configurations (Lisp_Object, Lisp_Object, int); EXFUN (Fcoordinates_in_window_p, 2); EXFUN (Fwindow_at, 3); EXFUN (Fpos_visible_in_window_p, 3); -extern void mark_window_cursors_off P_ ((struct window *)); -extern int window_internal_height P_ ((struct window *)); -extern int window_internal_width P_ ((struct window *)); +extern void mark_window_cursors_off (struct window *); +extern int window_internal_height (struct window *); +extern int window_internal_width (struct window *); EXFUN (Frecenter, 1); EXFUN (Fscroll_other_window, 1); EXFUN (Fset_window_start, 3); -extern void temp_output_buffer_show P_ ((Lisp_Object)); -extern void replace_buffer_in_all_windows P_ ((Lisp_Object)); -extern void init_window_once P_ ((void)); -extern void init_window P_ ((void)); -extern void syms_of_window P_ ((void)); -extern void keys_of_window P_ ((void)); +extern void temp_output_buffer_show (Lisp_Object); +extern void replace_buffer_in_all_windows (Lisp_Object); +extern void init_window_once (void); +extern void init_window (void); +extern void syms_of_window (void); +extern void keys_of_window (void); -extern int window_box_text_cols P_ ((struct window *w)); +extern int window_box_text_cols (struct window *w); #endif /* not WINDOW_H_INCLUDED */ diff --git a/src/xdisp.c b/src/xdisp.c index c8043308ec8..53fba8caa90 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -270,8 +270,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \ || defined(HAVE_NS) || defined (USE_GTK) -extern void set_frame_menubar P_ ((struct frame *f, int, int)); -extern int pending_menu_activation; +extern void set_frame_menubar (struct frame *f, int, int); #endif extern int interrupt_input; @@ -831,15 +830,15 @@ struct props /* A handler function called to set up iterator IT from the property at IT's current position. Value is used to steer handle_stop. */ - enum prop_handled (*handler) P_ ((struct it *it)); + enum prop_handled (*handler) (struct it *it); }; -static enum prop_handled handle_face_prop P_ ((struct it *)); -static enum prop_handled handle_invisible_prop P_ ((struct it *)); -static enum prop_handled handle_display_prop P_ ((struct it *)); -static enum prop_handled handle_composition_prop P_ ((struct it *)); -static enum prop_handled handle_overlay_change P_ ((struct it *)); -static enum prop_handled handle_fontified_prop P_ ((struct it *)); +static enum prop_handled handle_face_prop (struct it *); +static enum prop_handled handle_invisible_prop (struct it *); +static enum prop_handled handle_display_prop (struct it *); +static enum prop_handled handle_composition_prop (struct it *); +static enum prop_handled handle_overlay_change (struct it *); +static enum prop_handled handle_fontified_prop (struct it *); /* Properties handled by iterators. */ @@ -949,149 +948,149 @@ Lisp_Object Vhourglass_delay; /* Function prototypes. */ -static void setup_for_ellipsis P_ ((struct it *, int)); -static void mark_window_display_accurate_1 P_ ((struct window *, int)); -static int single_display_spec_string_p P_ ((Lisp_Object, Lisp_Object)); -static int display_prop_string_p P_ ((Lisp_Object, Lisp_Object)); -static int cursor_row_p P_ ((struct window *, struct glyph_row *)); -static int redisplay_mode_lines P_ ((Lisp_Object, int)); -static char *decode_mode_spec_coding P_ ((Lisp_Object, char *, int)); +static void setup_for_ellipsis (struct it *, int); +static void mark_window_display_accurate_1 (struct window *, int); +static int single_display_spec_string_p (Lisp_Object, Lisp_Object); +static int display_prop_string_p (Lisp_Object, Lisp_Object); +static int cursor_row_p (struct window *, struct glyph_row *); +static int redisplay_mode_lines (Lisp_Object, int); +static char *decode_mode_spec_coding (Lisp_Object, char *, int); -static Lisp_Object get_it_property P_ ((struct it *it, Lisp_Object prop)); +static Lisp_Object get_it_property (struct it *it, Lisp_Object prop); -static void handle_line_prefix P_ ((struct it *)); +static void handle_line_prefix (struct it *); -static void pint2str P_ ((char *, int, int)); -static void pint2hrstr P_ ((char *, int, int)); -static struct text_pos run_window_scroll_functions P_ ((Lisp_Object, - struct text_pos)); -static void reconsider_clip_changes P_ ((struct window *, struct buffer *)); -static int text_outside_line_unchanged_p P_ ((struct window *, int, int)); -static void store_mode_line_noprop_char P_ ((char)); -static int store_mode_line_noprop P_ ((const unsigned char *, int, int)); -static void x_consider_frame_title P_ ((Lisp_Object)); -static void handle_stop P_ ((struct it *)); -static void handle_stop_backwards P_ ((struct it *, EMACS_INT)); -static int tool_bar_lines_needed P_ ((struct frame *, int *)); -static int single_display_spec_intangible_p P_ ((Lisp_Object)); -static void ensure_echo_area_buffers P_ ((void)); -static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object)); -static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *)); -static int with_echo_area_buffer P_ ((struct window *, int, - int (*) (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT), - EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); -static void clear_garbaged_frames P_ ((void)); -static int current_message_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); -static int truncate_message_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); -static int set_message_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); -static int display_echo_area P_ ((struct window *)); -static int display_echo_area_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); -static int resize_mini_window_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); -static Lisp_Object unwind_redisplay P_ ((Lisp_Object)); -static int string_char_and_length P_ ((const unsigned char *, int *)); -static struct text_pos display_prop_end P_ ((struct it *, Lisp_Object, - struct text_pos)); -static int compute_window_start_on_continuation_line P_ ((struct window *)); -static Lisp_Object safe_eval_handler P_ ((Lisp_Object)); -static void insert_left_trunc_glyphs P_ ((struct it *)); -static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *, - Lisp_Object)); -static void extend_face_to_end_of_line P_ ((struct it *)); -static int append_space_for_newline P_ ((struct it *, int)); -static int cursor_row_fully_visible_p P_ ((struct window *, int, int)); -static int try_scrolling P_ ((Lisp_Object, int, EMACS_INT, EMACS_INT, int, int)); -static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *)); -static int trailing_whitespace_p P_ ((int)); -static int message_log_check_duplicate P_ ((int, int, int, int)); -static void push_it P_ ((struct it *)); -static void pop_it P_ ((struct it *)); -static void sync_frame_with_window_matrix_rows P_ ((struct window *)); -static void select_frame_for_redisplay P_ ((Lisp_Object)); -static void redisplay_internal P_ ((int)); -static int echo_area_display P_ ((int)); -static void redisplay_windows P_ ((Lisp_Object)); -static void redisplay_window P_ ((Lisp_Object, int)); -static Lisp_Object redisplay_window_error (); -static Lisp_Object redisplay_window_0 P_ ((Lisp_Object)); -static Lisp_Object redisplay_window_1 P_ ((Lisp_Object)); -static int update_menu_bar P_ ((struct frame *, int, int)); -static int try_window_reusing_current_matrix P_ ((struct window *)); -static int try_window_id P_ ((struct window *)); -static int display_line P_ ((struct it *)); -static int display_mode_lines P_ ((struct window *)); -static int display_mode_line P_ ((struct window *, enum face_id, Lisp_Object)); -static int display_mode_element P_ ((struct it *, int, int, int, Lisp_Object, Lisp_Object, int)); -static int store_mode_line_string P_ ((char *, Lisp_Object, int, int, int, Lisp_Object)); -static char *decode_mode_spec P_ ((struct window *, int, int, int, - Lisp_Object *)); -static void display_menu_bar P_ ((struct window *)); -static int display_count_lines P_ ((int, int, int, int, int *)); -static int display_string P_ ((unsigned char *, Lisp_Object, Lisp_Object, - EMACS_INT, EMACS_INT, struct it *, int, int, int, int)); -static void compute_line_metrics P_ ((struct it *)); -static void run_redisplay_end_trigger_hook P_ ((struct it *)); -static int get_overlay_strings P_ ((struct it *, int)); -static int get_overlay_strings_1 P_ ((struct it *, int, int)); -static void next_overlay_string P_ ((struct it *)); -static void reseat P_ ((struct it *, struct text_pos, int)); -static void reseat_1 P_ ((struct it *, struct text_pos, int)); -static void back_to_previous_visible_line_start P_ ((struct it *)); -void reseat_at_previous_visible_line_start P_ ((struct it *)); -static void reseat_at_next_visible_line_start P_ ((struct it *, int)); -static int next_element_from_ellipsis P_ ((struct it *)); -static int next_element_from_display_vector P_ ((struct it *)); -static int next_element_from_string P_ ((struct it *)); -static int next_element_from_c_string P_ ((struct it *)); -static int next_element_from_buffer P_ ((struct it *)); -static int next_element_from_composition P_ ((struct it *)); -static int next_element_from_image P_ ((struct it *)); -static int next_element_from_stretch P_ ((struct it *)); -static void load_overlay_strings P_ ((struct it *, int)); -static int init_from_display_pos P_ ((struct it *, struct window *, - struct display_pos *)); -static void reseat_to_string P_ ((struct it *, unsigned char *, - Lisp_Object, int, int, int, int)); +static void pint2str (char *, int, int); +static void pint2hrstr (char *, int, int); +static struct text_pos run_window_scroll_functions (Lisp_Object, + struct text_pos); +static void reconsider_clip_changes (struct window *, struct buffer *); +static int text_outside_line_unchanged_p (struct window *, int, int); +static void store_mode_line_noprop_char (char); +static int store_mode_line_noprop (const unsigned char *, int, int); +static void x_consider_frame_title (Lisp_Object); +static void handle_stop (struct it *); +static void handle_stop_backwards (struct it *, EMACS_INT); +static int tool_bar_lines_needed (struct frame *, int *); +static int single_display_spec_intangible_p (Lisp_Object); +static void ensure_echo_area_buffers (void); +static Lisp_Object unwind_with_echo_area_buffer (Lisp_Object); +static Lisp_Object with_echo_area_buffer_unwind_data (struct window *); +static int with_echo_area_buffer (struct window *, int, + int (*) (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT), + EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT); +static void clear_garbaged_frames (void); +static int current_message_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT); +static int truncate_message_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT); +static int set_message_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT); +static int display_echo_area (struct window *); +static int display_echo_area_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT); +static int resize_mini_window_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT); +static Lisp_Object unwind_redisplay (Lisp_Object); +static int string_char_and_length (const unsigned char *, int *); +static struct text_pos display_prop_end (struct it *, Lisp_Object, + struct text_pos); +static int compute_window_start_on_continuation_line (struct window *); +static Lisp_Object safe_eval_handler (Lisp_Object); +static void insert_left_trunc_glyphs (struct it *); +static struct glyph_row *get_overlay_arrow_glyph_row (struct window *, + Lisp_Object); +static void extend_face_to_end_of_line (struct it *); +static int append_space_for_newline (struct it *, int); +static int cursor_row_fully_visible_p (struct window *, int, int); +static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int); +static int try_cursor_movement (Lisp_Object, struct text_pos, int *); +static int trailing_whitespace_p (int); +static int message_log_check_duplicate (int, int, int, int); +static void push_it (struct it *); +static void pop_it (struct it *); +static void sync_frame_with_window_matrix_rows (struct window *); +static void select_frame_for_redisplay (Lisp_Object); +static void redisplay_internal (int); +static int echo_area_display (int); +static void redisplay_windows (Lisp_Object); +static void redisplay_window (Lisp_Object, int); +static Lisp_Object redisplay_window_error (Lisp_Object); +static Lisp_Object redisplay_window_0 (Lisp_Object); +static Lisp_Object redisplay_window_1 (Lisp_Object); +static int update_menu_bar (struct frame *, int, int); +static int try_window_reusing_current_matrix (struct window *); +static int try_window_id (struct window *); +static int display_line (struct it *); +static int display_mode_lines (struct window *); +static int display_mode_line (struct window *, enum face_id, Lisp_Object); +static int display_mode_element (struct it *, int, int, int, Lisp_Object, Lisp_Object, int); +static int store_mode_line_string (char *, Lisp_Object, int, int, int, Lisp_Object); +static char *decode_mode_spec (struct window *, int, int, int, + Lisp_Object *); +static void display_menu_bar (struct window *); +static int display_count_lines (int, int, int, int, int *); +static int display_string (unsigned char *, Lisp_Object, Lisp_Object, + EMACS_INT, EMACS_INT, struct it *, int, int, int, int); +static void compute_line_metrics (struct it *); +static void run_redisplay_end_trigger_hook (struct it *); +static int get_overlay_strings (struct it *, int); +static int get_overlay_strings_1 (struct it *, int, int); +static void next_overlay_string (struct it *); +static void reseat (struct it *, struct text_pos, int); +static void reseat_1 (struct it *, struct text_pos, int); +static void back_to_previous_visible_line_start (struct it *); +void reseat_at_previous_visible_line_start (struct it *); +static void reseat_at_next_visible_line_start (struct it *, int); +static int next_element_from_ellipsis (struct it *); +static int next_element_from_display_vector (struct it *); +static int next_element_from_string (struct it *); +static int next_element_from_c_string (struct it *); +static int next_element_from_buffer (struct it *); +static int next_element_from_composition (struct it *); +static int next_element_from_image (struct it *); +static int next_element_from_stretch (struct it *); +static void load_overlay_strings (struct it *, int); +static int init_from_display_pos (struct it *, struct window *, + struct display_pos *); +static void reseat_to_string (struct it *, unsigned char *, + Lisp_Object, int, int, int, int); static enum move_it_result move_it_in_display_line_to (struct it *, EMACS_INT, int, enum move_operation_enum); -void move_it_vertically_backward P_ ((struct it *, int)); -static void init_to_row_start P_ ((struct it *, struct window *, - struct glyph_row *)); -static int init_to_row_end P_ ((struct it *, struct window *, - struct glyph_row *)); -static void back_to_previous_line_start P_ ((struct it *)); -static int forward_to_next_line_start P_ ((struct it *, int *)); -static struct text_pos string_pos_nchars_ahead P_ ((struct text_pos, - Lisp_Object, int)); -static struct text_pos string_pos P_ ((int, Lisp_Object)); -static struct text_pos c_string_pos P_ ((int, unsigned char *, int)); -static int number_of_chars P_ ((unsigned char *, int)); -static void compute_stop_pos P_ ((struct it *)); -static void compute_string_pos P_ ((struct text_pos *, struct text_pos, - Lisp_Object)); -static int face_before_or_after_it_pos P_ ((struct it *, int)); -static EMACS_INT next_overlay_change P_ ((EMACS_INT)); -static int handle_single_display_spec P_ ((struct it *, Lisp_Object, - Lisp_Object, Lisp_Object, - struct text_pos *, int)); -static int underlying_face_id P_ ((struct it *)); -static int in_ellipses_for_invisible_text_p P_ ((struct display_pos *, - struct window *)); +void move_it_vertically_backward (struct it *, int); +static void init_to_row_start (struct it *, struct window *, + struct glyph_row *); +static int init_to_row_end (struct it *, struct window *, + struct glyph_row *); +static void back_to_previous_line_start (struct it *); +static int forward_to_next_line_start (struct it *, int *); +static struct text_pos string_pos_nchars_ahead (struct text_pos, + Lisp_Object, int); +static struct text_pos string_pos (int, Lisp_Object); +static struct text_pos c_string_pos (int, unsigned char *, int); +static int number_of_chars (unsigned char *, int); +static void compute_stop_pos (struct it *); +static void compute_string_pos (struct text_pos *, struct text_pos, + Lisp_Object); +static int face_before_or_after_it_pos (struct it *, int); +static EMACS_INT next_overlay_change (EMACS_INT); +static int handle_single_display_spec (struct it *, Lisp_Object, + Lisp_Object, Lisp_Object, + struct text_pos *, int); +static int underlying_face_id (struct it *); +static int in_ellipses_for_invisible_text_p (struct display_pos *, + struct window *); #define face_before_it_pos(IT) face_before_or_after_it_pos ((IT), 1) #define face_after_it_pos(IT) face_before_or_after_it_pos ((IT), 0) #ifdef HAVE_WINDOW_SYSTEM -static void update_tool_bar P_ ((struct frame *, int)); -static void build_desired_tool_bar_string P_ ((struct frame *f)); -static int redisplay_tool_bar P_ ((struct frame *)); -static void display_tool_bar_line P_ ((struct it *, int)); -static void notice_overwritten_cursor P_ ((struct window *, - enum glyph_row_area, - int, int, int, int)); -static void append_stretch_glyph P_ ((struct it *, Lisp_Object, - int, int, int)); +static void update_tool_bar (struct frame *, int); +static void build_desired_tool_bar_string (struct frame *f); +static int redisplay_tool_bar (struct frame *); +static void display_tool_bar_line (struct it *, int); +static void notice_overwritten_cursor (struct window *, + enum glyph_row_area, + int, int, int, int); +static void append_stretch_glyph (struct it *, Lisp_Object, + int, int, int); @@ -1109,8 +1108,7 @@ static void append_stretch_glyph P_ ((struct it *, Lisp_Object, This is the height of W minus the height of a mode line, if any. */ INLINE int -window_text_bottom_y (w) - struct window *w; +window_text_bottom_y (struct window *w) { int height = WINDOW_TOTAL_HEIGHT (w); @@ -1124,9 +1122,7 @@ window_text_bottom_y (w) the left and right of the window. */ INLINE int -window_box_width (w, area) - struct window *w; - int area; +window_box_width (struct window *w, int area) { int cols = XFASTINT (w->total_cols); int pixels = 0; @@ -1165,8 +1161,7 @@ window_box_width (w, area) including mode lines of W, if any. */ INLINE int -window_box_height (w) - struct window *w; +window_box_height (struct window *w) { struct frame *f = XFRAME (w->frame); int height = WINDOW_TOTAL_HEIGHT (w); @@ -1213,9 +1208,7 @@ window_box_height (w) whole window, to the right of the left fringe of W. */ INLINE int -window_box_left_offset (w, area) - struct window *w; - int area; +window_box_left_offset (struct window *w, int area) { int x; @@ -1247,9 +1240,7 @@ window_box_left_offset (w, area) whole window, to the left of the right fringe of W. */ INLINE int -window_box_right_offset (w, area) - struct window *w; - int area; +window_box_right_offset (struct window *w, int area) { return window_box_left_offset (w, area) + window_box_width (w, area); } @@ -1259,9 +1250,7 @@ window_box_right_offset (w, area) whole window, to the right of the left fringe of W. */ INLINE int -window_box_left (w, area) - struct window *w; - int area; +window_box_left (struct window *w, int area) { struct frame *f = XFRAME (w->frame); int x; @@ -1281,9 +1270,7 @@ window_box_left (w, area) whole window, to the left of the right fringe of W. */ INLINE int -window_box_right (w, area) - struct window *w; - int area; +window_box_right (struct window *w, int area) { return window_box_left (w, area) + window_box_width (w, area); } @@ -1296,10 +1283,8 @@ window_box_right (w, area) *BOX_WIDTH, and *BOX_HEIGHT the pixel width and height of the box. */ INLINE void -window_box (w, area, box_x, box_y, box_width, box_height) - struct window *w; - int area; - int *box_x, *box_y, *box_width, *box_height; +window_box (struct window *w, int area, int *box_x, int *box_y, + int *box_width, int *box_height) { if (box_width) *box_width = window_box_width (w, area); @@ -1325,11 +1310,8 @@ window_box (w, area, box_x, box_y, box_width, box_height) box. */ INLINE void -window_box_edges (w, area, top_left_x, top_left_y, - bottom_right_x, bottom_right_y) - struct window *w; - int area; - int *top_left_x, *top_left_y, *bottom_right_x, *bottom_right_y; +window_box_edges (struct window *w, int area, int *top_left_x, int *top_left_y, + int *bottom_right_x, int *bottom_right_y) { window_box (w, area, top_left_x, top_left_y, bottom_right_x, bottom_right_y); @@ -1347,8 +1329,7 @@ window_box_edges (w, area, top_left_x, top_left_y, This can modify IT's settings. */ int -line_bottom_y (it) - struct it *it; +line_bottom_y (struct it *it) { int line_height = it->max_ascent + it->max_descent; int line_top_y = it->current_y; @@ -1390,9 +1371,8 @@ line_bottom_y (it) Set *ROWH and *VPOS to row's visible height and VPOS (row number). */ int -pos_visible_p (w, charpos, x, y, rtop, rbot, rowh, vpos) - struct window *w; - int charpos, *x, *y, *rtop, *rbot, *rowh, *vpos; +pos_visible_p (struct window *w, int charpos, int *x, int *y, + int *rtop, int *rbot, int *rowh, int *vpos) { struct it it; struct text_pos top; @@ -1531,9 +1511,7 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, rowh, vpos) character. */ static INLINE int -string_char_and_length (str, len) - const unsigned char *str; - int *len; +string_char_and_length (const unsigned char *str, int *len) { int c; @@ -1553,10 +1531,7 @@ string_char_and_length (str, len) in STRING, return the position NCHARS ahead (NCHARS >= 0). */ static struct text_pos -string_pos_nchars_ahead (pos, string, nchars) - struct text_pos pos; - Lisp_Object string; - int nchars; +string_pos_nchars_ahead (struct text_pos pos, Lisp_Object string, int nchars) { xassert (STRINGP (string) && nchars >= 0); @@ -1586,9 +1561,7 @@ string_pos_nchars_ahead (pos, string, nchars) for character position CHARPOS in STRING. */ static INLINE struct text_pos -string_pos (charpos, string) - int charpos; - Lisp_Object string; +string_pos (int charpos, Lisp_Object string) { struct text_pos pos; xassert (STRINGP (string)); @@ -1603,10 +1576,7 @@ string_pos (charpos, string) means recognize multibyte characters. */ static struct text_pos -c_string_pos (charpos, s, multibyte_p) - int charpos; - unsigned char *s; - int multibyte_p; +c_string_pos (int charpos, unsigned char *s, int multibyte_p) { struct text_pos pos; @@ -1638,9 +1608,7 @@ c_string_pos (charpos, s, multibyte_p) non-zero means recognize multibyte characters. */ static int -number_of_chars (s, multibyte_p) - unsigned char *s; - int multibyte_p; +number_of_chars (unsigned char *s, int multibyte_p) { int nchars; @@ -1667,9 +1635,7 @@ number_of_chars (s, multibyte_p) NEWPOS->charpos must be >= POS.charpos. */ static void -compute_string_pos (newpos, pos, string) - struct text_pos *newpos, pos; - Lisp_Object string; +compute_string_pos (struct text_pos *newpos, struct text_pos pos, Lisp_Object string) { xassert (STRINGP (string)); xassert (CHARPOS (*newpos) >= CHARPOS (pos)); @@ -1686,9 +1652,7 @@ compute_string_pos (newpos, pos, string) frame F. FACE_ID specifies what line's height to estimate. */ int -estimate_mode_line_height (f, face_id) - struct frame *f; - enum face_id face_id; +estimate_mode_line_height (struct frame *f, enum face_id face_id) { #ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f)) @@ -1722,12 +1686,8 @@ estimate_mode_line_height (f, face_id) not force the value into range. */ void -pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip) - FRAME_PTR f; - register int pix_x, pix_y; - int *x, *y; - NativeRectangle *bounds; - int noclip; +pixel_to_glyph_coords (FRAME_PTR f, register int pix_x, register int pix_y, + int *x, int *y, NativeRectangle *bounds, int noclip) { #ifdef HAVE_WINDOW_SYSTEM @@ -1776,10 +1736,8 @@ pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip) return 0. */ int -glyph_to_pixel_coords (w, hpos, vpos, frame_x, frame_y) - struct window *w; - int hpos, vpos; - int *frame_x, *frame_y; +glyph_to_pixel_coords (struct window *w, int hpos, int vpos, + int *frame_x, int *frame_y) { #ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (XFRAME (WINDOW_FRAME (w)))) @@ -1839,10 +1797,8 @@ glyph_to_pixel_coords (w, hpos, vpos, frame_x, frame_y) static struct glyph * -x_y_to_hpos_vpos (w, x, y, hpos, vpos, dx, dy, area) - struct window *w; - int x, y; - int *hpos, *vpos, *dx, *dy, *area; +x_y_to_hpos_vpos (struct window *w, int x, int y, int *hpos, int *vpos, + int *dx, int *dy, int *area) { struct glyph *glyph, *end; struct glyph_row *row = NULL; @@ -1919,9 +1875,7 @@ x_y_to_hpos_vpos (w, x, y, hpos, vpos, dx, dy, area) Takes pseudo-windows into account. */ void -frame_to_window_pixel_xy (w, x, y) - struct window *w; - int *x, *y; +frame_to_window_pixel_xy (struct window *w, int *x, int *y) { if (w->pseudo_window_p) { @@ -1943,10 +1897,7 @@ frame_to_window_pixel_xy (w, x, y) Return the number of stored rectangles. */ int -get_glyph_string_clip_rects (s, rects, n) - struct glyph_string *s; - NativeRectangle *rects; - int n; +get_glyph_string_clip_rects (struct glyph_string *s, NativeRectangle *rects, int n) { XRectangle r; @@ -2140,9 +2091,7 @@ get_glyph_string_clip_rects (s, rects, n) Return in *NR the clipping rectangle for glyph string S. */ void -get_glyph_string_clip_rect (s, nr) - struct glyph_string *s; - NativeRectangle *nr; +get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr) { get_glyph_string_clip_rects (s, nr, 1); } @@ -2154,11 +2103,8 @@ get_glyph_string_clip_rect (s, nr) */ void -get_phys_cursor_geometry (w, row, glyph, xp, yp, heightp) - struct window *w; - struct glyph_row *row; - struct glyph *glyph; - int *xp, *yp, *heightp; +get_phys_cursor_geometry (struct window *w, struct glyph_row *row, + struct glyph *glyph, int *xp, int *yp, int *heightp) { struct frame *f = XFRAME (WINDOW_FRAME (w)); int x, y, wd, h, h0, y0; @@ -2218,10 +2164,7 @@ get_phys_cursor_geometry (w, row, glyph, xp, yp, heightp) */ void -remember_mouse_glyph (f, gx, gy, rect) - struct frame *f; - int gx, gy; - NativeRectangle *rect; +remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) { Lisp_Object window; struct window *w; @@ -2417,8 +2360,7 @@ remember_mouse_glyph (f, gx, gy, rect) /* Error handler for safe_eval and safe_call. */ static Lisp_Object -safe_eval_handler (arg) - Lisp_Object arg; +safe_eval_handler (Lisp_Object arg) { add_to_log ("Error during redisplay: %s", arg, Qnil); return Qnil; @@ -2433,9 +2375,7 @@ safe_eval_handler (arg) redisplay during the evaluation. */ Lisp_Object -safe_call (nargs, args) - int nargs; - Lisp_Object *args; +safe_call (int nargs, Lisp_Object *args) { Lisp_Object val; @@ -2465,8 +2405,7 @@ safe_call (nargs, args) Return the result, or nil if something went wrong. */ Lisp_Object -safe_call1 (fn, arg) - Lisp_Object fn, arg; +safe_call1 (Lisp_Object fn, Lisp_Object arg) { Lisp_Object args[2]; args[0] = fn; @@ -2595,12 +2534,9 @@ check_window_end (w) the desired matrix of W. */ void -init_iterator (it, w, charpos, bytepos, row, base_face_id) - struct it *it; - struct window *w; - EMACS_INT charpos, bytepos; - struct glyph_row *row; - enum face_id base_face_id; +init_iterator (struct it *it, struct window *w, + EMACS_INT charpos, EMACS_INT bytepos, + struct glyph_row *row, enum face_id base_face_id) { int highlight_region_p; enum face_id remapped_base_face_id = base_face_id; @@ -2636,7 +2572,7 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id) } /* Clear IT. */ - bzero (it, sizeof *it); + memset (it, 0, sizeof *it); it->current.overlay_string_index = -1; it->current.dpvec_index = -1; it->base_face_id = remapped_base_face_id; @@ -2896,10 +2832,7 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id) /* Initialize IT for the display of window W with window start POS. */ void -start_display (it, w, pos) - struct it *it; - struct window *w; - struct text_pos pos; +start_display (struct it *it, struct window *w, struct text_pos pos) { struct glyph_row *row; int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0; @@ -2971,9 +2904,7 @@ start_display (it, w, pos) text. W is the window we display, for text property lookup. */ static int -in_ellipses_for_invisible_text_p (pos, w) - struct display_pos *pos; - struct window *w; +in_ellipses_for_invisible_text_p (struct display_pos *pos, struct window *w) { Lisp_Object prop, window; int ellipses_p = 0; @@ -3007,10 +2938,7 @@ in_ellipses_for_invisible_text_p (pos, w) is zero if there are overlay strings with newlines at POS. */ static int -init_from_display_pos (it, w, pos) - struct it *it; - struct window *w; - struct display_pos *pos; +init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos) { EMACS_INT charpos = CHARPOS (pos->pos), bytepos = BYTEPOS (pos->pos); int i, overlay_strings_with_newlines = 0; @@ -3118,10 +3046,7 @@ init_from_display_pos (it, w, pos) starting at ROW->start. */ static void -init_to_row_start (it, w, row) - struct it *it; - struct window *w; - struct glyph_row *row; +init_to_row_start (struct it *it, struct window *w, struct glyph_row *row) { init_from_display_pos (it, w, &row->start); it->start = row->start; @@ -3136,10 +3061,7 @@ init_to_row_start (it, w, row) end position. */ static int -init_to_row_end (it, w, row) - struct it *it; - struct window *w; - struct glyph_row *row; +init_to_row_end (struct it *it, struct window *w, struct glyph_row *row) { int success = 0; @@ -3167,8 +3089,7 @@ init_to_row_end (it, w, row) to stop. */ static void -handle_stop (it) - struct it *it; +handle_stop (struct it *it) { enum prop_handled handled; int handle_overlay_change_p; @@ -3261,8 +3182,7 @@ handle_stop (it) information for IT's current position. */ static void -compute_stop_pos (it) - struct it *it; +compute_stop_pos (struct it *it) { register INTERVAL iv, next_iv; Lisp_Object object, limit, position; @@ -3371,8 +3291,7 @@ compute_stop_pos (it) xmalloc. */ static EMACS_INT -next_overlay_change (pos) - EMACS_INT pos; +next_overlay_change (EMACS_INT pos) { int noverlays; EMACS_INT endpos; @@ -3408,8 +3327,7 @@ next_overlay_change (pos) regions of text. */ static enum prop_handled -handle_fontified_prop (it) - struct it *it; +handle_fontified_prop (struct it *it) { Lisp_Object prop, pos; enum prop_handled handled = HANDLED_NORMALLY; @@ -3496,8 +3414,7 @@ handle_fontified_prop (it) Called from handle_stop. */ static enum prop_handled -handle_face_prop (it) - struct it *it; +handle_face_prop (struct it *it) { int new_face_id; EMACS_INT next_stop; @@ -3635,8 +3552,7 @@ handle_face_prop (it) Otherwise, use the iterator's base_face_id. */ static int -underlying_face_id (it) - struct it *it; +underlying_face_id (struct it *it) { int face_id = it->base_face_id, i; @@ -3655,9 +3571,7 @@ underlying_face_id (it) position. Value is the id of the face. */ static int -face_before_or_after_it_pos (it, before_p) - struct it *it; - int before_p; +face_before_or_after_it_pos (struct it *it, int before_p) { int face_id, limit; EMACS_INT next_check_charpos; @@ -3771,8 +3685,7 @@ face_before_or_after_it_pos (it, before_p) position. Called from handle_stop. */ static enum prop_handled -handle_invisible_prop (it) - struct it *it; +handle_invisible_prop (struct it *it) { enum prop_handled handled = HANDLED_NORMALLY; @@ -3985,9 +3898,7 @@ handle_invisible_prop (it) Replaces LEN characters from buffer. */ static void -setup_for_ellipsis (it, len) - struct it *it; - int len; +setup_for_ellipsis (struct it *it, int len) { /* Use the display table definition for `...'. Invalid glyphs will be handled by the method returning elements from dpvec. */ @@ -4031,8 +3942,7 @@ setup_for_ellipsis (it, len) Otherwise we return HANDLED_NORMALLY. */ static enum prop_handled -handle_display_prop (it) - struct it *it; +handle_display_prop (struct it *it) { Lisp_Object prop, object, overlay; struct text_pos *position; @@ -4129,10 +4039,7 @@ handle_display_prop (it) at START_POS in OBJECT. */ static struct text_pos -display_prop_end (it, object, start_pos) - struct it *it; - Lisp_Object object; - struct text_pos start_pos; +display_prop_end (struct it *it, Lisp_Object object, struct text_pos start_pos) { Lisp_Object end; struct text_pos end_pos; @@ -4167,14 +4074,9 @@ display_prop_end (it, object, start_pos) of buffer or string text. */ static int -handle_single_display_spec (it, spec, object, overlay, position, - display_replaced_before_p) - struct it *it; - Lisp_Object spec; - Lisp_Object object; - Lisp_Object overlay; - struct text_pos *position; - int display_replaced_before_p; +handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, + Lisp_Object overlay, struct text_pos *position, + int display_replaced_before_p) { Lisp_Object form; Lisp_Object location, value; @@ -4539,8 +4441,7 @@ handle_single_display_spec (it, spec, object, overlay, position, treated as intangible. */ static int -single_display_spec_intangible_p (prop) - Lisp_Object prop; +single_display_spec_intangible_p (Lisp_Object prop) { /* Skip over `when FORM'. */ if (CONSP (prop) && EQ (XCAR (prop), Qwhen)) @@ -4582,8 +4483,7 @@ single_display_spec_intangible_p (prop) treated as intangible. */ int -display_prop_intangible_p (prop) - Lisp_Object prop; +display_prop_intangible_p (Lisp_Object prop) { if (CONSP (prop) && CONSP (XCAR (prop)) @@ -4615,8 +4515,7 @@ display_prop_intangible_p (prop) /* Return 1 if PROP is a display sub-property value containing STRING. */ static int -single_display_spec_string_p (prop, string) - Lisp_Object prop, string; +single_display_spec_string_p (Lisp_Object prop, Lisp_Object string) { if (EQ (string, prop)) return 1; @@ -4650,8 +4549,7 @@ single_display_spec_string_p (prop, string) /* Return 1 if STRING appears in the `display' property PROP. */ static int -display_prop_string_p (prop, string) - Lisp_Object prop, string; +display_prop_string_p (Lisp_Object prop, Lisp_Object string) { if (CONSP (prop) && CONSP (XCAR (prop)) @@ -4692,11 +4590,8 @@ display_prop_string_p (prop, string) called asynchronously from note_mouse_highlight. */ static EMACS_INT -string_buffer_position_lim (w, string, from, to, back_p) - struct window *w; - Lisp_Object string; - EMACS_INT from, to; - int back_p; +string_buffer_position_lim (struct window *w, Lisp_Object string, + EMACS_INT from, EMACS_INT to, int back_p) { Lisp_Object limit, prop, pos; int found = 0; @@ -4745,10 +4640,7 @@ string_buffer_position_lim (w, string, from, to, back_p) called asynchronously from note_mouse_highlight. */ EMACS_INT -string_buffer_position (w, string, around_charpos) - struct window *w; - Lisp_Object string; - EMACS_INT around_charpos; +string_buffer_position (struct window *w, Lisp_Object string, EMACS_INT around_charpos) { Lisp_Object limit, prop, pos; const int MAX_DISTANCE = 1000; @@ -4772,8 +4664,7 @@ string_buffer_position (w, string, around_charpos) position. Called from handle_stop. */ static enum prop_handled -handle_composition_prop (it) - struct it *it; +handle_composition_prop (struct it *it) { Lisp_Object prop, string; EMACS_INT pos, pos_byte, start, end; @@ -4846,8 +4737,7 @@ struct overlay_entry Called from handle_stop. */ static enum prop_handled -handle_overlay_change (it) - struct it *it; +handle_overlay_change (struct it *it) { if (!STRINGP (it->string) && get_overlay_strings (it, 0)) return HANDLED_RECOMPUTE_PROPS; @@ -4864,8 +4754,7 @@ handle_overlay_change (it) Otherwise IT->string is set to nil. */ static void -next_overlay_string (it) - struct it *it; +next_overlay_string (struct it *it) { ++it->current.overlay_string_index; if (it->current.overlay_string_index == it->n_overlay_strings) @@ -4933,8 +4822,7 @@ next_overlay_string (it) static int -compare_overlay_entries (e1, e2) - void *e1, *e2; +compare_overlay_entries (const void *e1, const void *e2) { struct overlay_entry *entry1 = (struct overlay_entry *) e1; struct overlay_entry *entry2 = (struct overlay_entry *) e2; @@ -4985,9 +4873,7 @@ compare_overlay_entries (e1, e2) compare_overlay_entries. */ static void -load_overlay_strings (it, charpos) - struct it *it; - int charpos; +load_overlay_strings (struct it *it, int charpos) { extern Lisp_Object Qwindow, Qpriority; Lisp_Object overlay, window, str, invisible; @@ -5017,7 +4903,7 @@ load_overlay_strings (it, charpos) entries = \ (struct overlay_entry *) alloca (new_size \ * sizeof *entries); \ - bcopy (old, entries, size * sizeof *entries); \ + memcpy (entries, old, size * sizeof *entries); \ size = new_size; \ } \ \ @@ -5138,10 +5024,7 @@ load_overlay_strings (it, charpos) least one overlay string was found. */ static int -get_overlay_strings_1 (it, charpos, compute_stop_p) - struct it *it; - int charpos; - int compute_stop_p; +get_overlay_strings_1 (struct it *it, int charpos, int compute_stop_p) { /* Get the first OVERLAY_STRING_CHUNK_SIZE overlay strings to process. This fills IT->overlay_strings with strings, and sets @@ -5192,9 +5075,7 @@ get_overlay_strings_1 (it, charpos, compute_stop_p) } static int -get_overlay_strings (it, charpos) - struct it *it; - int charpos; +get_overlay_strings (struct it *it, int charpos) { it->string = Qnil; it->method = GET_FROM_BUFFER; @@ -5219,8 +5100,7 @@ get_overlay_strings (it, charpos) processed. */ static void -push_it (it) - struct it *it; +push_it (struct it *it) { struct iterator_stack_entry *p; @@ -5264,8 +5144,7 @@ push_it (it) } static void -iterate_out_of_display_property (it) - struct it *it; +iterate_out_of_display_property (struct it *it) { /* Maybe initialize paragraph direction. If we are at the beginning of a new paragraph, next_element_from_buffer may not have a @@ -5298,8 +5177,7 @@ iterate_out_of_display_property (it) elements from an overlay string, or from a buffer. */ static void -pop_it (it) - struct it *it; +pop_it (struct it *it) { struct iterator_stack_entry *p; @@ -5378,8 +5256,7 @@ pop_it (it) /* Set IT's current position to the previous line start. */ static void -back_to_previous_line_start (it) - struct it *it; +back_to_previous_line_start (struct it *it) { IT_CHARPOS (*it) = find_next_newline_no_quit (IT_CHARPOS (*it) - 1, -1); IT_BYTEPOS (*it) = CHAR_TO_BYTE (IT_CHARPOS (*it)); @@ -5405,9 +5282,7 @@ back_to_previous_line_start (it) leads to wrong cursor motion. */ static int -forward_to_next_line_start (it, skipped_p) - struct it *it; - int *skipped_p; +forward_to_next_line_start (struct it *it, int *skipped_p) { int old_selective, newline_found_p, n; const int MAX_NEWLINE_DISTANCE = 500; @@ -5488,8 +5363,7 @@ forward_to_next_line_start (it, skipped_p) IT->hpos. */ static void -back_to_previous_visible_line_start (it) - struct it *it; +back_to_previous_visible_line_start (struct it *it) { while (IT_CHARPOS (*it) > BEGV) { @@ -5569,8 +5443,7 @@ back_to_previous_visible_line_start (it) face information etc. */ void -reseat_at_previous_visible_line_start (it) - struct it *it; +reseat_at_previous_visible_line_start (struct it *it) { back_to_previous_visible_line_start (it); reseat (it, it->current.pos, 1); @@ -5586,9 +5459,7 @@ reseat_at_previous_visible_line_start (it) is invisible because of text properties. */ static void -reseat_at_next_visible_line_start (it, on_newline_p) - struct it *it; - int on_newline_p; +reseat_at_next_visible_line_start (struct it *it, int on_newline_p) { int newline_found_p, skipped_p = 0; @@ -5642,10 +5513,7 @@ reseat_at_next_visible_line_start (it, on_newline_p) IT->check_charpos of a property. */ static void -reseat (it, pos, force_p) - struct it *it; - struct text_pos pos; - int force_p; +reseat (struct it *it, struct text_pos pos, int force_p) { int original_pos = IT_CHARPOS (*it); @@ -5689,10 +5557,7 @@ reseat (it, pos, force_p) IT->stop_pos to POS, also. */ static void -reseat_1 (it, pos, set_stop_p) - struct it *it; - struct text_pos pos; - int set_stop_p; +reseat_1 (struct it *it, struct text_pos pos, int set_stop_p) { /* Don't call this function when scanning a C string. */ xassert (it->s == NULL); @@ -5746,12 +5611,8 @@ reseat_1 (it, pos, set_stop_p) calling this function. */ static void -reseat_to_string (it, s, string, charpos, precision, field_width, multibyte) - struct it *it; - unsigned char *s; - Lisp_Object string; - int charpos; - int precision, field_width, multibyte; +reseat_to_string (struct it *it, unsigned char *s, Lisp_Object string, + int charpos, int precision, int field_width, int multibyte) { /* No region in strings. */ it->region_beg_charpos = it->region_end_charpos = -1; @@ -5760,7 +5621,7 @@ reseat_to_string (it, s, string, charpos, precision, field_width, multibyte) it->stop_charpos = -1; /* Set iterator position and end position. */ - bzero (&it->current, sizeof it->current); + memset (&it->current, 0, sizeof it->current); it->current.overlay_string_index = -1; it->current.dpvec_index = -1; xassert (charpos >= 0); @@ -5839,7 +5700,7 @@ reseat_to_string (it, s, string, charpos, precision, field_width, multibyte) /* Map enum it_method value to corresponding next_element_from_* function. */ -static int (* get_next_element[NUM_IT_METHODS]) P_ ((struct it *it)) = +static int (* get_next_element[NUM_IT_METHODS]) (struct it *it) = { next_element_from_buffer, next_element_from_display_vector, @@ -5873,8 +5734,7 @@ static unsigned last_escape_glyph_face_id = (1 << FACE_ID_BITS); static int last_escape_glyph_merged_face_id = 0; int -get_next_display_element (it) - struct it *it; +get_next_display_element (struct it *it) { /* Non-zero means that we found a display element. Zero means that we hit the end of what we iterate over. Performance note: the @@ -6266,9 +6126,7 @@ get_next_display_element (it) decrement position function which would not be easy to write. */ void -set_iterator_to_next (it, reseat_p) - struct it *it; - int reseat_p; +set_iterator_to_next (struct it *it, int reseat_p) { /* Reset flags indicating start and end of a sequence of characters with box. Reset them at the start of this function because @@ -6533,8 +6391,7 @@ set_iterator_to_next (it, reseat_p) is restored into IT->face_id in set_iterator_to_next. */ static int -next_element_from_display_vector (it) - struct it *it; +next_element_from_display_vector (struct it *it) { Lisp_Object gc; @@ -6583,8 +6440,7 @@ next_element_from_display_vector (it) overlay string. */ static int -next_element_from_string (it) - struct it *it; +next_element_from_string (struct it *it) { struct text_pos position; @@ -6685,8 +6541,7 @@ next_element_from_string (it) reached, including padding spaces. */ static int -next_element_from_c_string (it) - struct it *it; +next_element_from_c_string (struct it *it) { int success_p = 1; @@ -6731,8 +6586,7 @@ next_element_from_c_string (it) ellipsis if an ellipsis is to be displayed. */ static int -next_element_from_ellipsis (it) - struct it *it; +next_element_from_ellipsis (struct it *it) { if (it->selective_display_ellipsis_p) setup_for_ellipsis (it, it->len); @@ -6759,10 +6613,10 @@ next_element_from_ellipsis (it) static int -next_element_from_image (it) - struct it *it; +next_element_from_image (struct it *it) { it->what = IT_IMAGE; + it->ignore_overlay_strings_at_pos_p = 0; return 1; } @@ -6772,8 +6626,7 @@ next_element_from_image (it) always 1. */ static int -next_element_from_stretch (it) - struct it *it; +next_element_from_stretch (struct it *it) { it->what = IT_STRETCH; return 1; @@ -6788,9 +6641,7 @@ next_element_from_stretch (it) position. */ static void -handle_stop_backwards (it, charpos) - struct it *it; - EMACS_INT charpos; +handle_stop_backwards (struct it *it, EMACS_INT charpos) { EMACS_INT where_we_are = IT_CHARPOS (*it); struct display_pos save_current = it->current; @@ -6828,8 +6679,7 @@ handle_stop_backwards (it, charpos) end. */ static int -next_element_from_buffer (it) - struct it *it; +next_element_from_buffer (struct it *it) { int success_p = 1; @@ -7038,8 +6888,7 @@ next_element_from_buffer (it) /* Run the redisplay end trigger hook for IT. */ static void -run_redisplay_end_trigger_hook (it) - struct it *it; +run_redisplay_end_trigger_hook (struct it *it) { Lisp_Object args[3]; @@ -7069,8 +6918,7 @@ run_redisplay_end_trigger_hook (it) next_element_from_string when necessary. */ static int -next_element_from_composition (it) - struct it *it; +next_element_from_composition (struct it *it) { it->what = IT_COMPOSITION; it->len = it->cmp_it.nbytes; @@ -7593,10 +7441,7 @@ move_it_in_display_line (struct it *it, TO_CHARPOS. */ void -move_it_to (it, to_charpos, to_x, to_y, to_vpos, op) - struct it *it; - int to_charpos, to_x, to_y, to_vpos; - int op; +move_it_to (struct it *it, int to_charpos, int to_x, int to_y, int to_vpos, int op) { enum move_it_result skip, skip2 = MOVE_X_REACHED; int line_height, line_start_x = 0, reached = 0; @@ -7847,9 +7692,7 @@ move_it_to (it, to_charpos, to_x, to_y, to_vpos, op) set to the top of the line moved to. */ void -move_it_vertically_backward (it, dy) - struct it *it; - int dy; +move_it_vertically_backward (struct it *it, int dy) { int nlines, h; struct it it2, it3; @@ -7968,9 +7811,7 @@ move_it_vertically_backward (it, dy) end, IT will be on the start of a screen line. */ void -move_it_vertically (it, dy) - struct it *it; - int dy; +move_it_vertically (struct it *it, int dy) { if (dy <= 0) move_it_vertically_backward (it, -dy); @@ -7994,8 +7835,7 @@ move_it_vertically (it, dy) /* Move iterator IT past the end of the text line it is in. */ void -move_it_past_eol (it) - struct it *it; +move_it_past_eol (struct it *it) { enum move_it_result rc; @@ -8015,9 +7855,7 @@ move_it_past_eol (it) truncate-lines nil. */ void -move_it_by_lines (it, dvpos, need_y_p) - struct it *it; - int dvpos, need_y_p; +move_it_by_lines (struct it *it, int dvpos, int need_y_p) { struct position pos; @@ -8111,8 +7949,7 @@ move_it_by_lines (it, dvpos, need_y_p) /* Return 1 if IT points into the middle of a display vector. */ int -in_display_vector_p (it) - struct it *it; +in_display_vector_p (struct it *it) { return (it->method == GET_FROM_DISPLAY_VECTOR && it->current.dpvec_index > 0 @@ -8129,9 +7966,7 @@ in_display_vector_p (it) to *Messages*. */ void -add_to_log (format, arg1, arg2) - char *format; - Lisp_Object arg1, arg2; +add_to_log (char *format, Lisp_Object arg1, Lisp_Object arg2) { Lisp_Object args[3]; Lisp_Object msg, fmt; @@ -8156,7 +7991,7 @@ add_to_log (format, arg1, arg2) len = SBYTES (msg) + 1; SAFE_ALLOCA (buffer, char *, len); - bcopy (SDATA (msg), buffer, len); + memcpy (buffer, SDATA (msg), len); message_dolog (buffer, len - 1, 1, 0); SAFE_FREE (); @@ -8168,7 +8003,7 @@ add_to_log (format, arg1, arg2) /* Output a newline in the *Messages* buffer if "needs" one. */ void -message_log_maybe_newline () +message_log_maybe_newline (void) { if (message_log_need_newline) message_dolog ("", 0, 1, 0); @@ -8185,9 +8020,7 @@ message_log_maybe_newline () so the buffer M must NOT point to a Lisp string. */ void -message_dolog (m, nbytes, nlflag, multibyte) - const char *m; - int nbytes, nlflag, multibyte; +message_dolog (const char *m, int nbytes, int nlflag, int multibyte) { if (!NILP (Vmemory_full)) return; @@ -8357,9 +8190,8 @@ message_dolog (m, nbytes, nlflag, multibyte) value N > 1 if we should also append " [N times]". */ static int -message_log_check_duplicate (prev_bol, prev_bol_byte, this_bol, this_bol_byte) - int prev_bol, this_bol; - int prev_bol_byte, this_bol_byte; +message_log_check_duplicate (int prev_bol, int prev_bol_byte, + int this_bol, int this_bol_byte) { int i; int len = Z_BYTE - 1 - this_bol_byte; @@ -8397,10 +8229,7 @@ message_log_check_duplicate (prev_bol, prev_bol_byte, this_bol, this_bol_byte) This may GC, so the buffer M must NOT point to a Lisp string. */ void -message2 (m, nbytes, multibyte) - const char *m; - int nbytes; - int multibyte; +message2 (const char *m, int nbytes, int multibyte) { /* First flush out any partial line written with print. */ message_log_maybe_newline (); @@ -8413,9 +8242,7 @@ message2 (m, nbytes, multibyte) /* The non-logging counterpart of message2. */ void -message2_nolog (m, nbytes, multibyte) - const char *m; - int nbytes, multibyte; +message2_nolog (const char *m, int nbytes, int multibyte) { struct frame *sf = SELECTED_FRAME (); message_enable_multibyte = multibyte; @@ -8477,10 +8304,7 @@ message2_nolog (m, nbytes, multibyte) This function cancels echoing. */ void -message3 (m, nbytes, multibyte) - Lisp_Object m; - int nbytes; - int multibyte; +message3 (Lisp_Object m, int nbytes, int multibyte) { struct gcpro gcpro1; @@ -8496,7 +8320,7 @@ message3 (m, nbytes, multibyte) USE_SAFE_ALLOCA; SAFE_ALLOCA (buffer, char *, nbytes); - bcopy (SDATA (m), buffer, nbytes); + memcpy (buffer, SDATA (m), nbytes); message_dolog (buffer, nbytes, 1, multibyte); SAFE_FREE (); } @@ -8512,9 +8336,7 @@ message3 (m, nbytes, multibyte) and make this cancel echoing. */ void -message3_nolog (m, nbytes, multibyte) - Lisp_Object m; - int nbytes, multibyte; +message3_nolog (Lisp_Object m, int nbytes, int multibyte) { struct frame *sf = SELECTED_FRAME (); message_enable_multibyte = multibyte; @@ -8582,8 +8404,7 @@ message3_nolog (m, nbytes, multibyte) that was alloca'd. */ void -message1 (m) - char *m; +message1 (const char *m) { message2 (m, (m ? strlen (m) : 0), 0); } @@ -8592,8 +8413,7 @@ message1 (m) /* The non-logging counterpart of message1. */ void -message1_nolog (m) - char *m; +message1_nolog (const char *m) { message2_nolog (m, (m ? strlen (m) : 0), 0); } @@ -8602,10 +8422,7 @@ message1_nolog (m) which gets replaced with STRING. */ void -message_with_string (m, string, log) - char *m; - Lisp_Object string; - int log; +message_with_string (const char *m, Lisp_Object string, int log) { CHECK_STRING (string); @@ -8668,11 +8485,8 @@ message_with_string (m, string, log) /* Dump an informative message to the minibuf. If M is 0, clear out any existing message, and let the mini-buffer text show through. */ -/* VARARGS 1 */ -void -message (m, a1, a2, a3) - char *m; - EMACS_INT a1, a2, a3; +static void +vmessage (const char *m, va_list ap) { if (noninteractive) { @@ -8681,7 +8495,7 @@ message (m, a1, a2, a3) if (noninteractive_need_newline) putc ('\n', stderr); noninteractive_need_newline = 0; - fprintf (stderr, m, a1, a2, a3); + vfprintf (stderr, m, ap); if (cursor_in_echo_area == 0) fprintf (stderr, "\n"); fflush (stderr); @@ -8709,13 +8523,9 @@ message (m, a1, a2, a3) if (m) { int len; - char *a[3]; - a[0] = (char *) a1; - a[1] = (char *) a2; - a[2] = (char *) a3; len = doprnt (FRAME_MESSAGE_BUF (f), - FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, 3, a); + FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, ap); message2 (FRAME_MESSAGE_BUF (f), len, 0); } @@ -8729,19 +8539,29 @@ message (m, a1, a2, a3) } } +void +message (const char *m, ...) +{ + va_list ap; + va_start (ap, m); + vmessage (m, ap); + va_end (ap); +} + /* The non-logging version of message. */ void -message_nolog (m, a1, a2, a3) - char *m; - EMACS_INT a1, a2, a3; +message_nolog (const char *m, ...) { Lisp_Object old_log_max; + va_list ap; + va_start (ap, m); old_log_max = Vmessage_log_max; Vmessage_log_max = Qnil; - message (m, a1, a2, a3); + vmessage (m, ap); Vmessage_log_max = old_log_max; + va_end (ap); } @@ -8750,7 +8570,7 @@ message_nolog (m, a1, a2, a3) critical. */ void -update_echo_area () +update_echo_area (void) { if (!NILP (echo_area_buffer[0])) { @@ -8766,7 +8586,7 @@ update_echo_area () If they aren't, make new ones. */ static void -ensure_echo_area_buffers () +ensure_echo_area_buffers (void) { int i; @@ -8810,13 +8630,9 @@ ensure_echo_area_buffers () Value is what FN returns. */ static int -with_echo_area_buffer (w, which, fn, a1, a2, a3, a4) - struct window *w; - int which; - int (*fn) P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT)); - EMACS_INT a1; - Lisp_Object a2; - EMACS_INT a3, a4; +with_echo_area_buffer (struct window *w, int which, + int (*fn) (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT), + EMACS_INT a1, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4) { Lisp_Object buffer; int this_one, the_other, clear_buffer_p, rc; @@ -8903,8 +8719,7 @@ with_echo_area_buffer (w, which, fn, a1, a2, a3, a4) FN called in with_echo_area_buffer. */ static Lisp_Object -with_echo_area_buffer_unwind_data (w) - struct window *w; +with_echo_area_buffer_unwind_data (struct window *w) { int i = 0; Lisp_Object vector, tmp; @@ -8944,8 +8759,7 @@ with_echo_area_buffer_unwind_data (w) with_echo_area_buffer_unwind_data. */ static Lisp_Object -unwind_with_echo_area_buffer (vector) - Lisp_Object vector; +unwind_with_echo_area_buffer (Lisp_Object vector) { set_buffer_internal_1 (XBUFFER (AREF (vector, 0))); Vdeactivate_mark = AREF (vector, 1); @@ -8975,8 +8789,7 @@ unwind_with_echo_area_buffer (vector) non-zero means we will print multibyte. */ void -setup_echo_area_for_printing (multibyte_p) - int multibyte_p; +setup_echo_area_for_printing (int multibyte_p) { /* If we can't find an echo area any more, exit. */ if (! FRAME_LIVE_P (XFRAME (selected_frame))) @@ -9050,8 +8863,7 @@ setup_echo_area_for_printing (multibyte_p) display the current message. */ static int -display_echo_area (w) - struct window *w; +display_echo_area (struct window *w) { int i, no_message_p, window_height_changed_p, count; @@ -9089,10 +8901,7 @@ display_echo_area (w) Value is non-zero if height of W was changed. */ static int -display_echo_area_1 (a1, a2, a3, a4) - EMACS_INT a1; - Lisp_Object a2; - EMACS_INT a3, a4; +display_echo_area_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4) { struct window *w = (struct window *) a1; Lisp_Object window; @@ -9121,7 +8930,7 @@ display_echo_area_1 (a1, a2, a3, a4) is active, don't shrink it. */ void -resize_echo_area_exactly () +resize_echo_area_exactly (void) { if (BUFFERP (echo_area_buffer[0]) && WINDOWP (echo_area_window)) @@ -9154,10 +8963,7 @@ resize_echo_area_exactly () resize_mini_window returns. */ static int -resize_mini_window_1 (a1, exactly, a3, a4) - EMACS_INT a1; - Lisp_Object exactly; - EMACS_INT a3, a4; +resize_mini_window_1 (EMACS_INT a1, Lisp_Object exactly, EMACS_INT a3, EMACS_INT a4) { return resize_mini_window ((struct window *) a1, !NILP (exactly)); } @@ -9175,9 +8981,7 @@ resize_mini_window_1 (a1, exactly, a3, a4) Value is non-zero if the window height has been changed. */ int -resize_mini_window (w, exact_p) - struct window *w; - int exact_p; +resize_mini_window (struct window *w, int exact_p) { struct frame *f = XFRAME (w->frame); int window_height_changed_p = 0; @@ -9318,7 +9122,7 @@ resize_mini_window (w, exact_p) current message. */ Lisp_Object -current_message () +current_message (void) { Lisp_Object msg; @@ -9337,10 +9141,7 @@ current_message () static int -current_message_1 (a1, a2, a3, a4) - EMACS_INT a1; - Lisp_Object a2; - EMACS_INT a3, a4; +current_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4) { Lisp_Object *msg = (Lisp_Object *) a1; @@ -9358,7 +9159,7 @@ current_message_1 (a1, a2, a3, a4) worth optimizing. */ int -push_message () +push_message (void) { Lisp_Object msg; msg = current_message (); @@ -9370,7 +9171,7 @@ push_message () /* Restore message display from the top of Vmessage_stack. */ void -restore_message () +restore_message (void) { Lisp_Object msg; @@ -9386,8 +9187,7 @@ restore_message () /* Handler for record_unwind_protect calling pop_message. */ Lisp_Object -pop_message_unwind (dummy) - Lisp_Object dummy; +pop_message_unwind (Lisp_Object dummy) { pop_message (); return Qnil; @@ -9396,7 +9196,7 @@ pop_message_unwind (dummy) /* Pop the top-most entry off Vmessage_stack. */ void -pop_message () +pop_message (void) { xassert (CONSP (Vmessage_stack)); Vmessage_stack = XCDR (Vmessage_stack); @@ -9408,7 +9208,7 @@ pop_message () somewhere. */ void -check_message_stack () +check_message_stack (void) { if (!NILP (Vmessage_stack)) abort (); @@ -9419,8 +9219,7 @@ check_message_stack () time we display it---but don't redisplay it now. */ void -truncate_echo_area (nchars) - int nchars; +truncate_echo_area (int nchars) { if (nchars == 0) echo_area_buffer[0] = Qnil; @@ -9442,10 +9241,7 @@ truncate_echo_area (nchars) message to at most NCHARS characters. */ static int -truncate_message_1 (nchars, a2, a3, a4) - EMACS_INT nchars; - Lisp_Object a2; - EMACS_INT a3, a4; +truncate_message_1 (EMACS_INT nchars, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4) { if (BEG + nchars < Z) del_range (BEG + nchars, Z); @@ -9470,10 +9266,7 @@ truncate_message_1 (nchars, a2, a3, a4) */ void -set_message (s, string, nbytes, multibyte_p) - const char *s; - Lisp_Object string; - int nbytes, multibyte_p; +set_message (const char *s, Lisp_Object string, int nbytes, int multibyte_p) { message_enable_multibyte = ((s && multibyte_p) @@ -9492,10 +9285,7 @@ set_message (s, string, nbytes, multibyte_p) current. */ static int -set_message_1 (a1, a2, nbytes, multibyte_p) - EMACS_INT a1; - Lisp_Object a2; - EMACS_INT nbytes, multibyte_p; +set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multibyte_p) { const char *s = (const char *) a1; Lisp_Object string = a2; @@ -9574,8 +9364,7 @@ set_message_1 (a1, a2, nbytes, multibyte_p) last displayed. */ void -clear_message (current_p, last_displayed_p) - int current_p, last_displayed_p; +clear_message (int current_p, int last_displayed_p) { if (current_p) { @@ -9599,7 +9388,7 @@ clear_message (current_p, last_displayed_p) and ensure a complete redisplay of all windows. */ static void -clear_garbaged_frames () +clear_garbaged_frames (void) { if (frame_garbaged) { @@ -9636,8 +9425,7 @@ clear_garbaged_frames () mini-windows height has been changed. */ static int -echo_area_display (update_frame_p) - int update_frame_p; +echo_area_display (int update_frame_p) { Lisp_Object mini_window; struct window *w; @@ -9812,8 +9600,7 @@ format_mode_line_unwind_data (struct buffer *obuf, } static Lisp_Object -unwind_format_mode_line (vector) - Lisp_Object vector; +unwind_format_mode_line (Lisp_Object vector) { mode_line_target = XINT (AREF (vector, 0)); mode_line_noprop_ptr = mode_line_noprop_buf + XINT (AREF (vector, 1)); @@ -9842,12 +9629,7 @@ unwind_format_mode_line (vector) Re-allocate mode_line_noprop_buf if necessary. */ static void -#ifdef PROTOTYPES store_mode_line_noprop_char (char c) -#else -store_mode_line_noprop_char (c) - char c; -#endif { /* If output position has reached the end of the allocated buffer, double the buffer's size. */ @@ -9873,9 +9655,7 @@ store_mode_line_noprop_char (c) frame title. */ static int -store_mode_line_noprop (str, field_width, precision) - const unsigned char *str; - int field_width, precision; +store_mode_line_noprop (const unsigned char *str, int field_width, int precision) { int n = 0; int dummy, nbytes; @@ -9908,8 +9688,7 @@ store_mode_line_noprop (str, field_width, precision) frame_title_format. */ static void -x_consider_frame_title (frame) - Lisp_Object frame; +x_consider_frame_title (Lisp_Object frame) { struct frame *f = XFRAME (frame); @@ -9969,7 +9748,7 @@ x_consider_frame_title (frame) higher level than this.) */ if (! STRINGP (f->name) || SBYTES (f->name) != len - || bcmp (title, SDATA (f->name), len) != 0) + || memcmp (title, SDATA (f->name), len) != 0) x_implicitly_set_name (f, make_string (title, len), Qnil); } } @@ -9988,7 +9767,7 @@ x_consider_frame_title (frame) appropriate. This can call eval. */ void -prepare_menu_bars () +prepare_menu_bars (void) { int all_windows; struct gcpro gcpro1, gcpro2; @@ -10086,12 +9865,6 @@ prepare_menu_bars () update_tool_bar (sf, 1); #endif } - - /* Motif needs this. See comment in xmenu.c. Turn it off when - pending_menu_activation is not defined. */ -#ifdef USE_X_TOOLKIT - pending_menu_activation = 0; -#endif } @@ -10107,10 +9880,7 @@ prepare_menu_bars () updated value of this flag, to pass to the next call. */ static int -update_menu_bar (f, save_match_data, hooks_run) - struct frame *f; - int save_match_data; - int hooks_run; +update_menu_bar (struct frame *f, int save_match_data, int hooks_run) { Lisp_Object window; register struct window *w; @@ -10235,8 +10005,7 @@ struct cursor_pos output_cursor; positions are relative to updated_window. */ void -set_output_cursor (cursor) - struct cursor_pos *cursor; +set_output_cursor (struct cursor_pos *cursor) { output_cursor.hpos = cursor->hpos; output_cursor.vpos = cursor->vpos; @@ -10257,8 +10026,7 @@ set_output_cursor (cursor) selected_window and display the cursor at the given position. */ void -x_cursor_to (vpos, hpos, y, x) - int vpos, hpos, y, x; +x_cursor_to (int vpos, int hpos, int y, int x) { struct window *w; @@ -10306,8 +10074,7 @@ int last_tool_bar_item; static Lisp_Object -update_tool_bar_unwind (frame) - Lisp_Object frame; +update_tool_bar_unwind (Lisp_Object frame) { selected_frame = frame; return Qnil; @@ -10319,9 +10086,7 @@ update_tool_bar_unwind (frame) and restore it here. */ static void -update_tool_bar (f, save_match_data) - struct frame *f; - int save_match_data; +update_tool_bar (struct frame *f, int save_match_data) { #if defined (USE_GTK) || defined (HAVE_NS) int do_update = FRAME_EXTERNAL_TOOL_BAR (f); @@ -10419,8 +10184,7 @@ update_tool_bar (f, save_match_data) been set up previously by calling prepare_menu_bars. */ static void -build_desired_tool_bar_string (f) - struct frame *f; +build_desired_tool_bar_string (struct frame *f) { int i, size, size_needed; struct gcpro gcpro1, gcpro2, gcpro3; @@ -10591,9 +10355,7 @@ build_desired_tool_bar_string (f) */ static void -display_tool_bar_line (it, height) - struct it *it; - int height; +display_tool_bar_line (struct it *it, int height) { struct glyph_row *row = it->glyph_row; int max_x = it->last_visible_x; @@ -10720,9 +10482,7 @@ display_tool_bar_line (it, height) returned in *N_ROWS if non-NULL. */ static int -tool_bar_lines_needed (f, n_rows) - struct frame *f; - int *n_rows; +tool_bar_lines_needed (struct frame *f, int *n_rows) { struct window *w = XWINDOW (f->tool_bar_window); struct it it; @@ -10757,8 +10517,7 @@ tool_bar_lines_needed (f, n_rows) DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed, 0, 1, 0, doc: /* Return the number of lines occupied by the tool bar of FRAME. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { struct frame *f; struct window *w; @@ -10790,8 +10549,7 @@ DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed, height should be changed. */ static int -redisplay_tool_bar (f) - struct frame *f; +redisplay_tool_bar (struct frame *f) { struct window *w; struct it it; @@ -10962,10 +10720,7 @@ redisplay_tool_bar (f) GLYPH doesn't display a tool-bar item. */ static int -tool_bar_item_info (f, glyph, prop_idx) - struct frame *f; - struct glyph *glyph; - int *prop_idx; +tool_bar_item_info (struct frame *f, struct glyph *glyph, int *prop_idx) { Lisp_Object prop; int success_p; @@ -11005,11 +10760,8 @@ tool_bar_item_info (f, glyph, prop_idx) 1 otherwise. */ static int -get_tool_bar_item (f, x, y, glyph, hpos, vpos, prop_idx) - struct frame *f; - int x, y; - struct glyph **glyph; - int *hpos, *vpos, *prop_idx; +get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph, + int *hpos, int *vpos, int *prop_idx) { Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); struct window *w = XWINDOW (f->tool_bar_window); @@ -11047,10 +10799,8 @@ get_tool_bar_item (f, x, y, glyph, hpos, vpos, prop_idx) release. */ void -handle_tool_bar_click (f, x, y, down_p, modifiers) - struct frame *f; - int x, y, down_p; - unsigned int modifiers; +handle_tool_bar_click (struct frame *f, int x, int y, int down_p, + unsigned int modifiers) { Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); struct window *w = XWINDOW (f->tool_bar_window); @@ -11108,9 +10858,7 @@ handle_tool_bar_click (f, x, y, down_p, modifiers) note_mouse_highlight. */ static void -note_tool_bar_highlight (f, x, y) - struct frame *f; - int x, y; +note_tool_bar_highlight (struct frame *f, int x, int y) { Lisp_Object window = f->tool_bar_window; struct window *w = XWINDOW (window); @@ -11204,8 +10952,8 @@ note_tool_bar_highlight (f, x, y) Horizontal scrolling ************************************************************************/ -static int hscroll_window_tree P_ ((Lisp_Object)); -static int hscroll_windows P_ ((Lisp_Object)); +static int hscroll_window_tree (Lisp_Object); +static int hscroll_windows (Lisp_Object); /* For all leaf windows in the window tree rooted at WINDOW, set their hscroll value so that PT is (i) visible in the window, and (ii) so @@ -11214,8 +10962,7 @@ static int hscroll_windows P_ ((Lisp_Object)); changed. */ static int -hscroll_window_tree (window) - Lisp_Object window; +hscroll_window_tree (Lisp_Object window) { int hscrolled_p = 0; int hscroll_relative_p = FLOATP (Vhscroll_step); @@ -11358,8 +11105,7 @@ hscroll_window_tree (window) of WINDOW are cleared. */ static int -hscroll_windows (window) - Lisp_Object window; +hscroll_windows (Lisp_Object window) { int hscrolled_p = hscroll_window_tree (window); if (hscrolled_p) @@ -11442,9 +11188,7 @@ debug_method_add (w, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9) redisplay_internal for display optimization. */ static INLINE int -text_outside_line_unchanged_p (w, start, end) - struct window *w; - int start, end; +text_outside_line_unchanged_p (struct window *w, int start, int end) { int unchanged_p = 1; @@ -11511,15 +11255,14 @@ text_outside_line_unchanged_p (w, start, end) mini-buffer if that is in use. */ void -redisplay () +redisplay (void) { redisplay_internal (0); } static Lisp_Object -overlay_arrow_string_or_property (var) - Lisp_Object var; +overlay_arrow_string_or_property (Lisp_Object var) { Lisp_Object val; @@ -11531,7 +11274,7 @@ overlay_arrow_string_or_property (var) /* Return 1 if there are any overlay-arrows in current_buffer. */ static int -overlay_arrow_in_current_buffer_p () +overlay_arrow_in_current_buffer_p (void) { Lisp_Object vlist; @@ -11557,7 +11300,7 @@ overlay_arrow_in_current_buffer_p () has changed. */ static int -overlay_arrows_changed_p () +overlay_arrows_changed_p (void) { Lisp_Object vlist; @@ -11585,8 +11328,7 @@ overlay_arrows_changed_p () /* Mark overlay arrows to be updated on next redisplay. */ static void -update_overlay_arrows (up_to_date) - int up_to_date; +update_overlay_arrows (int up_to_date) { Lisp_Object vlist; @@ -11622,9 +11364,7 @@ update_overlay_arrows (up_to_date) Return nil if no overlay arrow. */ static Lisp_Object -overlay_arrow_at_row (it, row) - struct it *it; - struct glyph_row *row; +overlay_arrow_at_row (struct it *it, struct glyph_row *row) { Lisp_Object vlist; @@ -11669,9 +11409,8 @@ overlay_arrow_at_row (it, row) position. BUF and PT are the current point buffer and position. */ int -check_point_in_composition (prev_buf, prev_pt, buf, pt) - struct buffer *prev_buf, *buf; - int prev_pt, pt; +check_point_in_composition (struct buffer *prev_buf, int prev_pt, + struct buffer *buf, int pt) { EMACS_INT start, end; Lisp_Object prop; @@ -11707,9 +11446,7 @@ check_point_in_composition (prev_buf, prev_pt, buf, pt) in window W. */ static INLINE void -reconsider_clip_changes (w, b) - struct window *w; - struct buffer *b; +reconsider_clip_changes (struct window *w, struct buffer *b) { if (b->clip_changed && !NILP (w->window_end_valid) @@ -11748,8 +11485,7 @@ reconsider_clip_changes (w, b) directly. */ static void -select_frame_for_redisplay (frame) - Lisp_Object frame; +select_frame_for_redisplay (Lisp_Object frame) { Lisp_Object tail, tem; Lisp_Object old = selected_frame; @@ -11790,8 +11526,7 @@ do { if (polling_stopped_here) start_polling (); \ causes some problems. */ static void -redisplay_internal (preserve_echo_area) - int preserve_echo_area; +redisplay_internal (int preserve_echo_area) { struct window *w = XWINDOW (selected_window); struct frame *f; @@ -12524,8 +12259,7 @@ redisplay_internal (preserve_echo_area) called. This is useful for debugging. */ void -redisplay_preserve_echo_area (from_where) - int from_where; +redisplay_preserve_echo_area (int from_where) { TRACE ((stderr, "redisplay_preserve_echo_area (%d)\n", from_where)); @@ -12554,8 +12288,7 @@ redisplay_preserve_echo_area (from_where) failure during redisplay, for example). */ static Lisp_Object -unwind_redisplay (val) - Lisp_Object val; +unwind_redisplay (Lisp_Object val) { Lisp_Object old_redisplaying_p, old_frame; @@ -12575,9 +12308,7 @@ unwind_redisplay (val) redisplay_internal is called. */ static void -mark_window_display_accurate_1 (w, accurate_p) - struct window *w; - int accurate_p; +mark_window_display_accurate_1 (struct window *w, int accurate_p) { if (BUFFERP (w->buffer)) { @@ -12628,9 +12359,7 @@ mark_window_display_accurate_1 (w, accurate_p) be redisplayed the next time redisplay_internal is called. */ void -mark_window_display_accurate (window, accurate_p) - Lisp_Object window; - int accurate_p; +mark_window_display_accurate (Lisp_Object window, int accurate_p) { struct window *w; @@ -12665,9 +12394,7 @@ mark_window_display_accurate (window, accurate_p) macro DISP_CHAR_VECTOR. */ Lisp_Object -disp_char_vector (dp, c) - struct Lisp_Char_Table *dp; - int c; +disp_char_vector (struct Lisp_Char_Table *dp, int c) { Lisp_Object val; @@ -12698,8 +12425,7 @@ disp_char_vector (dp, c) /* Redisplay all leaf windows in the window tree rooted at WINDOW. */ static void -redisplay_windows (window) - Lisp_Object window; +redisplay_windows (Lisp_Object window) { while (!NILP (window)) { @@ -12724,15 +12450,14 @@ redisplay_windows (window) } static Lisp_Object -redisplay_window_error () +redisplay_window_error (Lisp_Object ignore) { displayed_buffer->display_error_modiff = BUF_MODIFF (displayed_buffer); return Qnil; } static Lisp_Object -redisplay_window_0 (window) - Lisp_Object window; +redisplay_window_0 (Lisp_Object window) { if (displayed_buffer->display_error_modiff < BUF_MODIFF (displayed_buffer)) redisplay_window (window, 0); @@ -12740,8 +12465,7 @@ redisplay_window_0 (window) } static Lisp_Object -redisplay_window_1 (window) - Lisp_Object window; +redisplay_window_1 (Lisp_Object window) { if (displayed_buffer->display_error_modiff < BUF_MODIFF (displayed_buffer)) redisplay_window (window, 1); @@ -12769,11 +12493,9 @@ redisplay_window_1 (window) Return 0 if cursor is not on this row, 1 otherwise. */ int -set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) - struct window *w; - struct glyph_row *row; - struct glyph_matrix *matrix; - int delta, delta_bytes, dy, dvpos; +set_cursor_from_row (struct window *w, struct glyph_row *row, + struct glyph_matrix *matrix, int delta, int delta_bytes, + int dy, int dvpos) { struct glyph *glyph = row->glyphs[TEXT_AREA]; struct glyph *end = glyph + row->used[TEXT_AREA]; @@ -13198,7 +12920,7 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) point. */ if (/* previous candidate is a glyph in TEXT_AREA of that row */ w->cursor.hpos >= 0 - && w->cursor.hpos < MATRIX_ROW_USED(matrix, w->cursor.vpos) + && w->cursor.hpos < MATRIX_ROW_USED (matrix, w->cursor.vpos) && BUFFERP (g1->object) && (g1->charpos == pt_old /* an exact match always wins */ || (BUFFERP (glyph->object) @@ -13259,9 +12981,7 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) We assume that the window's buffer is really current. */ static INLINE struct text_pos -run_window_scroll_functions (window, startp) - Lisp_Object window; - struct text_pos startp; +run_window_scroll_functions (Lisp_Object window, struct text_pos startp) { struct window *w = XWINDOW (window); SET_MARKER_FROM_TEXT_POS (w->start, startp); @@ -13295,10 +13015,7 @@ run_window_scroll_functions (window, startp) as if point had gone off the screen. */ static int -cursor_row_fully_visible_p (w, force_p, current_matrix_p) - struct window *w; - int force_p; - int current_matrix_p; +cursor_row_fully_visible_p (struct window *w, int force_p, int current_matrix_p) { struct glyph_matrix *matrix; struct glyph_row *row; @@ -13358,13 +13075,9 @@ enum }; static int -try_scrolling (window, just_this_one_p, scroll_conservatively, - scroll_step, temp_scroll_step, last_line_misfit) - Lisp_Object window; - int just_this_one_p; - EMACS_INT scroll_conservatively, scroll_step; - int temp_scroll_step; - int last_line_misfit; +try_scrolling (Lisp_Object window, int just_this_one_p, + EMACS_INT scroll_conservatively, EMACS_INT scroll_step, + int temp_scroll_step, int last_line_misfit) { struct window *w = XWINDOW (window); struct frame *f = XFRAME (w->frame); @@ -13431,14 +13144,22 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, if (PT > CHARPOS (it.current.pos)) { int y0 = line_bottom_y (&it); + /* Compute how many pixels below window bottom to stop searching + for PT. This avoids costly search for PT that is far away if + the user limited scrolling by a small number of lines, but + always finds PT if scroll_conservatively is set to a large + number, such as most-positive-fixnum. */ + int slack = max (scroll_max, 10 * FRAME_LINE_HEIGHT (f)); + int y_to_move = + slack >= INT_MAX - it.last_visible_y + ? INT_MAX + : it.last_visible_y + slack; - /* Compute the distance from the scroll margin to PT - (including the height of the cursor line). Moving the - iterator unconditionally to PT can be slow if PT is far - away, so stop 10 lines past the window bottom (is there a - way to do the right thing quickly?). */ - move_it_to (&it, PT, -1, - it.last_visible_y + 10 * FRAME_LINE_HEIGHT (f), + /* Compute the distance from the scroll margin to PT or to + the scroll limit, whichever comes first. This should + include the height of the cursor line, to make that line + fully visible. */ + move_it_to (&it, PT, -1, y_to_move, -1, MOVE_TO_POS | MOVE_TO_Y); dy = line_bottom_y (&it) - y0; @@ -13478,7 +13199,26 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, return SCROLLING_FAILED; start_display (&it, w, startp); - move_it_vertically (&it, amount_to_scroll); + if (scroll_max < INT_MAX) + move_it_vertically (&it, amount_to_scroll); + else + { + /* Extra precision for users who set scroll-conservatively + to most-positive-fixnum: make sure the amount we scroll + the window start is never less than amount_to_scroll, + which was computed as distance from window bottom to + point. This matters when lines at window top and lines + below window bottom have different height. */ + struct it it1 = it; + /* We use a temporary it1 because line_bottom_y can modify + its argument, if it moves one line down; see there. */ + int start_y = line_bottom_y (&it1); + + do { + move_it_by_lines (&it, 1, 1); + it1 = it; + } while (line_bottom_y (&it1) - start_y < amount_to_scroll); + } /* If STARTP is unchanged, move it down another screen line. */ if (CHARPOS (it.current.pos) == CHARPOS (startp)) @@ -13590,8 +13330,7 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, screen line with the minimum distance from the old start W->start. */ static int -compute_window_start_on_continuation_line (w) - struct window *w; +compute_window_start_on_continuation_line (struct window *w) { struct text_pos pos, start_pos; int window_start_changed_p = 0; @@ -13677,10 +13416,7 @@ enum }; static int -try_cursor_movement (window, startp, scroll_step) - Lisp_Object window; - struct text_pos startp; - int *scroll_step; +try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_step) { struct window *w = XWINDOW (window); struct frame *f = XFRAME (w->frame); @@ -13984,8 +13720,7 @@ try_cursor_movement (window, startp, scroll_step) } void -set_vertical_scroll_bar (w) - struct window *w; +set_vertical_scroll_bar (struct window *w) { int start, end, whole; @@ -14030,9 +13765,7 @@ set_vertical_scroll_bar (w) retry. */ static void -redisplay_window (window, just_this_one_p) - Lisp_Object window; - int just_this_one_p; +redisplay_window (Lisp_Object window, int just_this_one_p) { struct window *w = XWINDOW (window); struct frame *f = XFRAME (w->frame); @@ -14826,10 +14559,7 @@ redisplay_window (window, just_this_one_p) set in FLAGS.) */ int -try_window (window, pos, flags) - Lisp_Object window; - struct text_pos pos; - int flags; +try_window (Lisp_Object window, struct text_pos pos, int flags) { struct window *w = XWINDOW (window); struct it it; @@ -14929,8 +14659,7 @@ try_window (window, pos, flags) W->start is the new window start. */ static int -try_window_reusing_current_matrix (w) - struct window *w; +try_window_reusing_current_matrix (struct window *w) { struct frame *f = XFRAME (w->frame); struct glyph_row *row, *bottom_row; @@ -15357,12 +15086,12 @@ try_window_reusing_current_matrix (w) Window redisplay reusing current matrix when buffer has changed ************************************************************************/ -static struct glyph_row *find_last_unchanged_at_beg_row P_ ((struct window *)); -static struct glyph_row *find_first_unchanged_at_end_row P_ ((struct window *, - int *, int *)); +static struct glyph_row *find_last_unchanged_at_beg_row (struct window *); +static struct glyph_row *find_first_unchanged_at_end_row (struct window *, + int *, int *); static struct glyph_row * -find_last_row_displaying_text P_ ((struct glyph_matrix *, struct it *, - struct glyph_row *)); +find_last_row_displaying_text (struct glyph_matrix *, struct it *, + struct glyph_row *); /* Return the last row in MATRIX displaying text. If row START is @@ -15371,10 +15100,8 @@ find_last_row_displaying_text P_ ((struct glyph_matrix *, struct it *, a pointer to the row found. */ static struct glyph_row * -find_last_row_displaying_text (matrix, it, start) - struct glyph_matrix *matrix; - struct it *it; - struct glyph_row *start; +find_last_row_displaying_text (struct glyph_matrix *matrix, struct it *it, + struct glyph_row *start) { struct glyph_row *row, *row_found; @@ -15407,8 +15134,7 @@ find_last_row_displaying_text (matrix, it, start) when the current matrix was built. */ static struct glyph_row * -find_last_unchanged_at_beg_row (w) - struct window *w; +find_last_unchanged_at_beg_row (struct window *w) { int first_changed_pos = BEG + BEG_UNCHANGED; struct glyph_row *row; @@ -15457,9 +15183,7 @@ find_last_unchanged_at_beg_row (w) changes. */ static struct glyph_row * -find_first_unchanged_at_end_row (w, delta, delta_bytes) - struct window *w; - int *delta, *delta_bytes; +find_first_unchanged_at_end_row (struct window *w, int *delta, int *delta_bytes) { struct glyph_row *row; struct glyph_row *row_found = NULL; @@ -15532,8 +15256,7 @@ find_first_unchanged_at_end_row (w, delta, delta_bytes) try_window_reusing_current_matrix. */ static void -sync_frame_with_window_matrix_rows (w) - struct window *w; +sync_frame_with_window_matrix_rows (struct window *w) { struct frame *f = XFRAME (w->frame); struct glyph_row *window_row, *window_row_end, *frame_row; @@ -15577,11 +15300,8 @@ sync_frame_with_window_matrix_rows (w) containing CHARPOS or null. */ struct glyph_row * -row_containing_pos (w, charpos, start, end, dy) - struct window *w; - int charpos; - struct glyph_row *start, *end; - int dy; +row_containing_pos (struct window *w, int charpos, struct glyph_row *start, + struct glyph_row *end, int dy) { struct glyph_row *row = start; struct glyph_row *best_row = NULL; @@ -15683,8 +15403,7 @@ row_containing_pos (w, charpos, start, end, dy) 7. Update W's window end information. */ static int -try_window_id (w) - struct window *w; +try_window_id (struct window *w) { struct frame *f = XFRAME (w->frame); struct glyph_matrix *current_matrix = w->current_matrix; @@ -16420,9 +16139,9 @@ try_window_id (w) #if GLYPH_DEBUG -void dump_glyph_row P_ ((struct glyph_row *, int, int)); -void dump_glyph_matrix P_ ((struct glyph_matrix *, int)); -void dump_glyph P_ ((struct glyph_row *, struct glyph *, int)); +void dump_glyph_row (struct glyph_row *, int, int); +void dump_glyph_matrix (struct glyph_matrix *, int); +void dump_glyph (struct glyph_row *, struct glyph *, int); /* Dump the contents of glyph matrix MATRIX on stderr. @@ -16639,8 +16358,7 @@ DEFUN ("dump-glyph-matrix", Fdump_glyph_matrix, Shows contents of glyph row structures. With non-nil parameter GLYPHS, dump glyphs as well. If GLYPHS is 1 show glyphs in short form, otherwise show glyphs in long form. */) - (glyphs) - Lisp_Object glyphs; + (Lisp_Object glyphs) { struct window *w = XWINDOW (selected_window); struct buffer *buffer = XBUFFER (w->buffer); @@ -16658,7 +16376,7 @@ glyphs in short form, otherwise show glyphs in long form. */) DEFUN ("dump-frame-glyph-matrix", Fdump_frame_glyph_matrix, Sdump_frame_glyph_matrix, 0, 0, "", doc: /* */) - () + (void) { struct frame *f = XFRAME (selected_frame); dump_glyph_matrix (f->current_matrix, 1); @@ -16671,8 +16389,7 @@ DEFUN ("dump-glyph-row", Fdump_glyph_row, Sdump_glyph_row, 1, 2, "", GLYPH 0 means don't dump glyphs. GLYPH 1 means dump glyphs in short form. GLYPH > 1 or omitted means dump glyphs in long form. */) - (row, glyphs) - Lisp_Object row, glyphs; + (Lisp_Object row, Lisp_Object glyphs) { struct glyph_matrix *matrix; int vpos; @@ -16693,8 +16410,7 @@ DEFUN ("dump-tool-bar-row", Fdump_tool_bar_row, Sdump_tool_bar_row, 1, 2, "", GLYPH 0 means don't dump glyphs. GLYPH 1 means dump glyphs in short form. GLYPH > 1 or omitted means dump glyphs in long form. */) - (row, glyphs) - Lisp_Object row, glyphs; + (Lisp_Object row, Lisp_Object glyphs) { struct frame *sf = SELECTED_FRAME (); struct glyph_matrix *m = XWINDOW (sf->tool_bar_window)->current_matrix; @@ -16712,8 +16428,7 @@ GLYPH > 1 or omitted means dump glyphs in long form. */) DEFUN ("trace-redisplay", Ftrace_redisplay, Strace_redisplay, 0, 1, "P", doc: /* Toggle tracing of redisplay. With ARG, turn tracing on if and only if ARG is positive. */) - (arg) - Lisp_Object arg; + (Lisp_Object arg) { if (NILP (arg)) trace_redisplay_p = !trace_redisplay_p; @@ -16730,9 +16445,7 @@ With ARG, turn tracing on if and only if ARG is positive. */) DEFUN ("trace-to-stderr", Ftrace_to_stderr, Strace_to_stderr, 1, MANY, "", doc: /* Like `format', but print result to stderr. usage: (trace-to-stderr STRING &rest OBJECTS) */) - (nargs, args) - int nargs; - Lisp_Object *args; + (int nargs, Lisp_Object *args) { Lisp_Object s = Fformat (nargs, args); fprintf (stderr, "%s", SDATA (s)); @@ -16751,9 +16464,7 @@ usage: (trace-to-stderr STRING &rest OBJECTS) */) Used for non-window-redisplay windows, and for windows w/o left fringe. */ static struct glyph_row * -get_overlay_arrow_glyph_row (w, overlay_arrow_string) - struct window *w; - Lisp_Object overlay_arrow_string; +get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string) { struct frame *f = XFRAME (WINDOW_FRAME (w)); struct buffer *buffer = XBUFFER (w->buffer); @@ -16815,8 +16526,7 @@ get_overlay_arrow_glyph_row (w, overlay_arrow_string) produce_special_glyphs. */ static void -insert_left_trunc_glyphs (it) - struct it *it; +insert_left_trunc_glyphs (struct it *it) { struct it truncate_it; struct glyph *from, *end, *to, *toend; @@ -16910,8 +16620,7 @@ insert_left_trunc_glyphs (it) must not be zero. */ static void -compute_line_metrics (it) - struct it *it; +compute_line_metrics (struct it *it) { struct glyph_row *row = it->glyph_row; int area, i; @@ -17006,9 +16715,7 @@ compute_line_metrics (it) end of the line if the row ends in italic text. */ static int -append_space_for_newline (it, default_face_p) - struct it *it; - int default_face_p; +append_space_for_newline (struct it *it, int default_face_p) { if (FRAME_WINDOW_P (it->f)) { @@ -17033,7 +16740,7 @@ append_space_for_newline (it, default_face_p) saved_pos = it->position; it->what = IT_CHARACTER; - bzero (&it->position, sizeof it->position); + memset (&it->position, 0, sizeof it->position); it->object = make_number (0); it->c = ' '; it->len = 1; @@ -17072,8 +16779,7 @@ append_space_for_newline (it, default_face_p) left of the leftmost glyph. */ static void -extend_face_to_end_of_line (it) - struct it *it; +extend_face_to_end_of_line (struct it *it) { struct face *face; struct frame *f = it->f; @@ -17154,7 +16860,7 @@ extend_face_to_end_of_line (it) (((it->ascent + it->descent) * FONT_BASE (font)) / FONT_HEIGHT (font)); saved_pos = it->position; - bzero (&it->position, sizeof it->position); + memset (&it->position, 0, sizeof it->position); saved_avoid_cursor = it->avoid_cursor_p; it->avoid_cursor_p = 1; saved_face_id = it->face_id; @@ -17187,7 +16893,7 @@ extend_face_to_end_of_line (it) saved_pos = it->position; it->what = IT_CHARACTER; - bzero (&it->position, sizeof it->position); + memset (&it->position, 0, sizeof it->position); it->object = make_number (0); it->c = ' '; it->len = 1; @@ -17219,8 +16925,7 @@ extend_face_to_end_of_line (it) trailing whitespace. */ static int -trailing_whitespace_p (charpos) - int charpos; +trailing_whitespace_p (int charpos) { int bytepos = CHAR_TO_BYTE (charpos); int c = 0; @@ -17242,9 +16947,7 @@ trailing_whitespace_p (charpos) /* Highlight trailing whitespace, if any, in ROW. */ void -highlight_trailing_whitespace (f, row) - struct frame *f; - struct glyph_row *row; +highlight_trailing_whitespace (struct frame *f, struct glyph_row *row) { int used = row->used[TEXT_AREA]; @@ -17321,9 +17024,7 @@ highlight_trailing_whitespace (f, row) used to hold the cursor. */ static int -cursor_row_p (w, row) - struct window *w; - struct glyph_row *row; +cursor_row_p (struct window *w, struct glyph_row *row) { int cursor_row_p = 1; @@ -17438,9 +17139,7 @@ push_display_prop (struct it *it, Lisp_Object prop) /* Return the character-property PROP at the current position in IT. */ static Lisp_Object -get_it_property (it, prop) - struct it *it; - Lisp_Object prop; +get_it_property (struct it *it, Lisp_Object prop) { Lisp_Object position; @@ -17489,9 +17188,7 @@ handle_line_prefix (struct it *it) glyphs were produced by PRODUCE_GLYPHS, and the line needs to be continued. */ static void -unproduce_glyphs (it, n) - struct it *it; - int n; +unproduce_glyphs (struct it *it, int n) { struct glyph *glyph, *end; @@ -17511,10 +17208,9 @@ unproduce_glyphs (it, n) /* Find the positions in a bidi-reordered ROW to serve as ROW->minpos and ROW->maxpos. */ static void -find_row_edges (it, row, min_pos, min_bpos, max_pos, max_bpos) - struct it *it; - struct glyph_row *row; - EMACS_INT min_pos, min_bpos, max_pos, max_bpos; +find_row_edges (struct it *it, struct glyph_row *row, + EMACS_INT min_pos, EMACS_INT min_bpos, + EMACS_INT max_pos, EMACS_INT max_bpos) { /* FIXME: Revisit this when glyph ``spilling'' in continuation lines' rows is implemented for bidi-reordered rows. */ @@ -17598,8 +17294,7 @@ find_row_edges (it, row, min_pos, min_bpos, max_pos, max_bpos) only. */ static int -display_line (it) - struct it *it; +display_line (struct it *it) { struct glyph_row *row = it->glyph_row; Lisp_Object overlay_arrow_string; @@ -18269,8 +17964,7 @@ and the reading direction is generally left to right. In right-to-left paragraphs, text begins at the right margin and is read from right to left. See also `bidi-paragraph-direction'. */) - (buffer) - Lisp_Object buffer; + (Lisp_Object buffer) { struct buffer *buf; struct buffer *old; @@ -18352,8 +18046,7 @@ See also `bidi-paragraph-direction'. */) for the menu bar. */ static void -display_menu_bar (w) - struct window *w; +display_menu_bar (struct window *w) { struct frame *f = XFRAME (WINDOW_FRAME (w)); struct it it; @@ -18457,9 +18150,7 @@ display_menu_bar (w) the number of windows whose mode lines were redisplayed. */ static int -redisplay_mode_lines (window, force) - Lisp_Object window; - int force; +redisplay_mode_lines (Lisp_Object window, int force) { int nwindows = 0; @@ -18521,8 +18212,7 @@ redisplay_mode_lines (window, force) sum number of mode lines and header lines displayed. */ static int -display_mode_lines (w) - struct window *w; +display_mode_lines (struct window *w) { Lisp_Object old_selected_window, old_selected_frame; int n = 0; @@ -18566,10 +18256,7 @@ display_mode_lines (w) displayed. */ static int -display_mode_line (w, face_id, format) - struct window *w; - enum face_id face_id; - Lisp_Object format; +display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format) { struct it it; struct face *face; @@ -18628,8 +18315,7 @@ display_mode_line (w, face_id, format) Return the updated list. */ static Lisp_Object -move_elt_to_front (elt, list) - Lisp_Object elt, list; +move_elt_to_front (Lisp_Object elt, Lisp_Object list) { register Lisp_Object tail, prev; register Lisp_Object tem; @@ -18687,12 +18373,8 @@ move_elt_to_front (elt, list) `store_mode_line_string', or `display_string'. */ static int -display_mode_element (it, depth, field_width, precision, elt, props, risky) - struct it *it; - int depth; - int field_width, precision; - Lisp_Object elt, props; - int risky; +display_mode_element (struct it *it, int depth, int field_width, int precision, + Lisp_Object elt, Lisp_Object props, int risky) { int n = 0, field, prec; int literal = 0; @@ -19154,13 +18836,8 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky) */ static int -store_mode_line_string (string, lisp_string, copy_string, field_width, precision, props) - char *string; - Lisp_Object lisp_string; - int copy_string; - int field_width; - int precision; - Lisp_Object props; +store_mode_line_string (char *string, Lisp_Object lisp_string, int copy_string, + int field_width, int precision, Lisp_Object props) { int len; int n = 0; @@ -19251,8 +18928,7 @@ If FACE is an integer, the value string has no text properties. Optional third and fourth args WINDOW and BUFFER specify the window and buffer to use as the context for the formatting (defaults are the selected window and the window's buffer). */) - (format, face, window, buffer) - Lisp_Object format, face, window, buffer; + (Lisp_Object format, Lisp_Object face, Lisp_Object window, Lisp_Object buffer) { struct it it; int len; @@ -19347,10 +19023,7 @@ are the selected window and the window's buffer). */) the positive integer D to BUF using a minimal field width WIDTH. */ static void -pint2str (buf, width, d) - register char *buf; - register int width; - register int d; +pint2str (register char *buf, register int width, register int d) { register char *p = buf; @@ -19394,10 +19067,7 @@ static const char power_letter[] = }; static void -pint2hrstr (buf, width, d) - char *buf; - int width; - int d; +pint2hrstr (char *buf, int width, int d) { /* We aim to represent the nonnegative integer D as QUOTIENT.TENTHS * 10 ^ (3 * EXPONENT). */ @@ -19498,10 +19168,7 @@ pint2hrstr (buf, width, d) static unsigned char invalid_eol_type[] = "(*invalid*)"; static char * -decode_mode_spec_coding (coding_system, buf, eol_flag) - Lisp_Object coding_system; - register char *buf; - int eol_flag; +decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_flag) { Lisp_Object val; int multibyte = !NILP (current_buffer->enable_multibyte_characters); @@ -19567,7 +19234,7 @@ decode_mode_spec_coding (coding_system, buf, eol_flag) eol_str = invalid_eol_type; eol_str_len = sizeof (invalid_eol_type) - 1; } - bcopy (eol_str, buf, eol_str_len); + memcpy (buf, eol_str, eol_str_len); buf += eol_str_len; } @@ -19586,11 +19253,8 @@ decode_mode_spec_coding (coding_system, buf, eol_flag) static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------"; static char * -decode_mode_spec (w, c, field_width, precision, string) - struct window *w; - register int c; - int field_width, precision; - Lisp_Object *string; +decode_mode_spec (struct window *w, register int c, int field_width, + int precision, Lisp_Object *string) { Lisp_Object obj; struct frame *f = XFRAME (WINDOW_FRAME (w)); @@ -19926,7 +19590,7 @@ decode_mode_spec (w, c, field_width, precision, string) obj = Fget_buffer_process (Fcurrent_buffer ()); if (NILP (obj)) return "no process"; -#ifdef subprocesses +#ifndef MSDOS obj = Fsymbol_name (Fprocess_status (obj)); #endif break; @@ -20007,9 +19671,8 @@ decode_mode_spec (w, c, field_width, precision, string) Set *BYTE_POS_PTR to 1 if we found COUNT lines, 0 if we hit LIMIT. */ static int -display_count_lines (start, start_byte, limit_byte, count, byte_pos_ptr) - int start, start_byte, limit_byte, count; - int *byte_pos_ptr; +display_count_lines (int start, int start_byte, int limit_byte, int count, + int *byte_pos_ptr) { register unsigned char *cursor; unsigned char *base; @@ -20149,16 +19812,9 @@ display_count_lines (start, start_byte, limit_byte, count, byte_pos_ptr) Value is the number of columns displayed. */ static int -display_string (string, lisp_string, face_string, face_string_pos, - start, it, field_width, precision, max_x, multibyte) - unsigned char *string; - Lisp_Object lisp_string; - Lisp_Object face_string; - EMACS_INT face_string_pos; - EMACS_INT start; - struct it *it; - int field_width, precision, max_x; - int multibyte; +display_string (unsigned char *string, Lisp_Object lisp_string, Lisp_Object face_string, + EMACS_INT face_string_pos, EMACS_INT start, struct it *it, + int field_width, int precision, int max_x, int multibyte) { int hpos_at_start = it->hpos; int saved_face_id = it->face_id; @@ -20168,7 +19824,7 @@ display_string (string, lisp_string, face_string, face_string_pos, with index START. */ reseat_to_string (it, NILP (lisp_string) ? string : NULL, lisp_string, start, precision, field_width, multibyte); - if (string && STRINGP (lisp_string)) + if (string && STRINGP (lisp_string)) /* LISP_STRING is the one returned by decode_mode_spec. We should ignore its text properties. */ it->stop_charpos = -1; @@ -20342,9 +19998,7 @@ display_string (string, lisp_string, face_string, face_string_pos, and 1 if it's invisible and without an ellipsis. */ int -invisible_p (propval, list) - register Lisp_Object propval; - Lisp_Object list; +invisible_p (register Lisp_Object propval, Lisp_Object list) { register Lisp_Object tail, proptail; @@ -20387,8 +20041,7 @@ is checked; or it can be some other value, which is then presumed to be the value of the `invisible' property of the text of interest. The non-nil value returned can be t for truly invisible text or something else if the text is replaced by an ellipsis. */) - (pos_or_prop) - Lisp_Object pos_or_prop; + (Lisp_Object pos_or_prop) { Lisp_Object prop = (NATNUMP (pos_or_prop) || MARKERP (pos_or_prop) @@ -20473,12 +20126,8 @@ else if the text is replaced by an ellipsis. */) : - 1) int -calc_pixel_width_or_height (res, it, prop, font, width_p, align_to) - double *res; - struct it *it; - Lisp_Object prop; - struct font *font; - int width_p, *align_to; +calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, + struct font *font, int width_p, int *align_to) { double pixels; @@ -20696,7 +20345,7 @@ dump_glyph_string (s) face-override for drawing S. */ #ifdef HAVE_NTGUI -#define OPTIONAL_HDC(hdc) hdc, +#define OPTIONAL_HDC(hdc) HDC hdc, #define DECLARE_HDC(hdc) HDC hdc; #define ALLOCATE_HDC(hdc, f) hdc = get_frame_dc ((f)) #define RELEASE_HDC(hdc, f) release_frame_dc ((f), (hdc)) @@ -20710,17 +20359,12 @@ dump_glyph_string (s) #endif static void -init_glyph_string (s, OPTIONAL_HDC (hdc) char2b, w, row, area, start, hl) - struct glyph_string *s; - DECLARE_HDC (hdc) - XChar2b *char2b; - struct window *w; - struct glyph_row *row; - enum glyph_row_area area; - int start; - enum draw_glyphs_face hl; +init_glyph_string (struct glyph_string *s, + OPTIONAL_HDC (hdc) + XChar2b *char2b, struct window *w, struct glyph_row *row, + enum glyph_row_area area, int start, enum draw_glyphs_face hl) { - bzero (s, sizeof *s); + memset (s, 0, sizeof *s); s->w = w; s->f = XFRAME (w->frame); #ifdef HAVE_NTGUI @@ -20743,9 +20387,8 @@ init_glyph_string (s, OPTIONAL_HDC (hdc) char2b, w, row, area, start, hl) with head *HEAD and tail *TAIL. Set *HEAD and *TAIL to the result. */ static INLINE void -append_glyph_string_lists (head, tail, h, t) - struct glyph_string **head, **tail; - struct glyph_string *h, *t; +append_glyph_string_lists (struct glyph_string **head, struct glyph_string **tail, + struct glyph_string *h, struct glyph_string *t) { if (h) { @@ -20764,9 +20407,8 @@ append_glyph_string_lists (head, tail, h, t) result. */ static INLINE void -prepend_glyph_string_lists (head, tail, h, t) - struct glyph_string **head, **tail; - struct glyph_string *h, *t; +prepend_glyph_string_lists (struct glyph_string **head, struct glyph_string **tail, + struct glyph_string *h, struct glyph_string *t) { if (h) { @@ -20784,9 +20426,8 @@ prepend_glyph_string_lists (head, tail, h, t) Set *HEAD and *TAIL to the resulting list. */ static INLINE void -append_glyph_string (head, tail, s) - struct glyph_string **head, **tail; - struct glyph_string *s; +append_glyph_string (struct glyph_string **head, struct glyph_string **tail, + struct glyph_string *s) { s->next = s->prev = NULL; append_glyph_string_lists (head, tail, s, s); @@ -20801,11 +20442,8 @@ append_glyph_string (head, tail, s) DISPLAY_P is non-zero. */ static INLINE struct face * -get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p, display_p) - struct frame *f; - int c, face_id; - XChar2b *char2b; - int multibyte_p, display_p; +get_char_face_and_encoding (struct frame *f, int c, int face_id, + XChar2b *char2b, int multibyte_p, int display_p) { struct face *face = FACE_FROM_ID (f, face_id); @@ -20837,11 +20475,8 @@ get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p, display_p) a pointer to a realized face that is ready for display. */ static INLINE struct face * -get_glyph_face_and_encoding (f, glyph, char2b, two_byte_p) - struct frame *f; - struct glyph *glyph; - XChar2b *char2b; - int *two_byte_p; +get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph, + XChar2b *char2b, int *two_byte_p) { struct face *face; @@ -20879,10 +20514,8 @@ get_glyph_face_and_encoding (f, glyph, char2b, two_byte_p) Value is the index of a component not in S. */ static int -fill_composite_glyph_string (s, base_face, overlaps) - struct glyph_string *s; - struct face *base_face; - int overlaps; +fill_composite_glyph_string (struct glyph_string *s, struct face *base_face, + int overlaps) { int i; /* For all glyphs of this composition, starting at the offset @@ -20945,10 +20578,8 @@ fill_composite_glyph_string (s, base_face, overlaps) } static int -fill_gstring_glyph_string (s, face_id, start, end, overlaps) - struct glyph_string *s; - int face_id; - int start, end, overlaps; +fill_gstring_glyph_string (struct glyph_string *s, int face_id, + int start, int end, int overlaps) { struct glyph *glyph, *last; Lisp_Object lgstring; @@ -20992,10 +20623,8 @@ fill_gstring_glyph_string (s, face_id, start, end, overlaps) Value is the index of the first glyph not in S. */ static int -fill_glyph_string (s, face_id, start, end, overlaps) - struct glyph_string *s; - int face_id; - int start, end, overlaps; +fill_glyph_string (struct glyph_string *s, int face_id, + int start, int end, int overlaps) { struct glyph *glyph, *last; int voffset; @@ -21055,8 +20684,7 @@ fill_glyph_string (s, face_id, start, end, overlaps) /* Fill glyph string S from image glyph S->first_glyph. */ static void -fill_image_glyph_string (s) - struct glyph_string *s; +fill_image_glyph_string (struct glyph_string *s) { xassert (s->first_glyph->type == IMAGE_GLYPH); s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id); @@ -21080,11 +20708,8 @@ fill_image_glyph_string (s) Value is the index of the first glyph not in S. */ static int -fill_stretch_glyph_string (s, row, area, start, end) - struct glyph_string *s; - struct glyph_row *row; - enum glyph_row_area area; - int start, end; +fill_stretch_glyph_string (struct glyph_string *s, struct glyph_row *row, + enum glyph_row_area area, int start, int end) { struct glyph *glyph, *last; int voffset, face_id; @@ -21118,10 +20743,7 @@ fill_stretch_glyph_string (s, row, area, start, end) } static struct font_metrics * -get_per_char_metric (f, font, char2b) - struct frame *f; - struct font *font; - XChar2b *char2b; +get_per_char_metric (struct frame *f, struct font *font, XChar2b *char2b) { static struct font_metrics metrics; unsigned code = (XCHAR2B_BYTE1 (char2b) << 8) | XCHAR2B_BYTE2 (char2b); @@ -21138,10 +20760,7 @@ get_per_char_metric (f, font, char2b) assumed to be zero. */ void -x_get_glyph_overhangs (glyph, f, left, right) - struct glyph *glyph; - struct frame *f; - int *left, *right; +x_get_glyph_overhangs (struct glyph *glyph, struct frame *f, int *left, int *right) { *left = *right = 0; @@ -21192,8 +20811,7 @@ x_get_glyph_overhangs (glyph, f, left, right) if no glyphs are overwritten. */ static int -left_overwritten (s) - struct glyph_string *s; +left_overwritten (struct glyph_string *s) { int k; @@ -21220,8 +20838,7 @@ left_overwritten (s) glyph in front of S overwrites S. */ static int -left_overwriting (s) - struct glyph_string *s; +left_overwriting (struct glyph_string *s) { int i, k, x; struct glyph *glyphs = s->row->glyphs[s->area]; @@ -21247,8 +20864,7 @@ left_overwriting (s) no such glyph is found. */ static int -right_overwritten (s) - struct glyph_string *s; +right_overwritten (struct glyph_string *s) { int k = -1; @@ -21274,8 +20890,7 @@ right_overwritten (s) if no such glyph is found. */ static int -right_overwriting (s) - struct glyph_string *s; +right_overwriting (struct glyph_string *s) { int i, k, x; int end = s->row->used[s->area]; @@ -21302,10 +20917,7 @@ right_overwriting (s) in the drawing area. */ static INLINE void -set_glyph_string_background_width (s, start, last_x) - struct glyph_string *s; - int start; - int last_x; +set_glyph_string_background_width (struct glyph_string *s, int start, int last_x) { /* If the face of this glyph string has to be drawn to the end of the drawing area, set S->extends_to_end_of_line_p. */ @@ -21334,10 +20946,7 @@ set_glyph_string_background_width (s, start, last_x) BACKWARD_P non-zero means process predecessors. */ static void -compute_overhangs_and_x (s, x, backward_p) - struct glyph_string *s; - int x; - int backward_p; +compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p) { if (backward_p) { @@ -21593,14 +21202,9 @@ compute_overhangs_and_x (s, x, backward_p) Value is the x-position reached, relative to AREA of W. */ static int -draw_glyphs (w, x, row, area, start, end, hl, overlaps) - struct window *w; - int x; - struct glyph_row *row; - enum glyph_row_area area; - EMACS_INT start, end; - enum draw_glyphs_face hl; - int overlaps; +draw_glyphs (struct window *w, int x, struct glyph_row *row, + enum glyph_row_area area, EMACS_INT start, EMACS_INT end, + enum draw_glyphs_face hl, int overlaps) { struct glyph_string *head, *tail; struct glyph_string *s; @@ -21848,8 +21452,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps) Called from x_produce_glyphs when IT->glyph_row is non-null. */ static INLINE void -append_glyph (it) - struct it *it; +append_glyph (struct it *it) { struct glyph *glyph; enum glyph_row_area area = it->area; @@ -21923,8 +21526,7 @@ append_glyph (it) non-null. */ static INLINE void -append_composite_glyph (it) - struct it *it; +append_composite_glyph (struct it *it) { struct glyph *glyph; enum glyph_row_area area = it->area; @@ -21993,8 +21595,7 @@ append_composite_glyph (it) IT->voffset. */ static INLINE void -take_vertical_position_into_account (it) - struct it *it; +take_vertical_position_into_account (struct it *it) { if (it->voffset) { @@ -22015,8 +21616,7 @@ take_vertical_position_into_account (it) an overview of struct display_iterator. */ static void -produce_image_glyph (it) - struct it *it; +produce_image_glyph (struct it *it) { struct image *img; struct face *face; @@ -22176,11 +21776,8 @@ produce_image_glyph (it) stretch. ASCENT is the ascent of the glyph (0 <= ASCENT <= HEIGHT). */ static void -append_stretch_glyph (it, object, width, height, ascent) - struct it *it; - Lisp_Object object; - int width, height; - int ascent; +append_stretch_glyph (struct it *it, Lisp_Object object, + int width, int height, int ascent) { struct glyph *glyph; enum glyph_row_area area = it->area; @@ -22271,8 +21868,7 @@ append_stretch_glyph (it, object, width, height, ascent) ASCENT must be in the range 0 <= ASCENT <= 100. */ static void -produce_stretch_glyph (it) - struct it *it; +produce_stretch_glyph (struct it *it) { /* (space :width WIDTH :height HEIGHT ...) */ Lisp_Object prop, plist; @@ -22398,11 +21994,8 @@ produce_stretch_glyph (it) static Lisp_Object -calc_line_height_property (it, val, font, boff, override) - struct it *it; - Lisp_Object val; - struct font *font; - int boff, override; +calc_line_height_property (struct it *it, Lisp_Object val, struct font *font, + int boff, int override) { Lisp_Object face_name = Qnil; int ascent, descent, height; @@ -22478,8 +22071,7 @@ calc_line_height_property (it, val, font, boff, override) for an overview of struct it. */ void -x_produce_glyphs (it) - struct it *it; +x_produce_glyphs (struct it *it) { int extra_line_spacing = it->extra_line_spacing; @@ -22684,7 +22276,7 @@ x_produce_glyphs (it) it->pixel_width = 0; it->nglyphs = 0; - height = get_it_property(it, Qline_height); + height = get_it_property (it, Qline_height); /* Split (line-height total-height) list */ if (CONSP (height) && CONSP (XCDR (height)) @@ -22693,7 +22285,7 @@ x_produce_glyphs (it) total_height = XCAR (XCDR (height)); height = XCAR (height); } - height = calc_line_height_property(it, height, font, boff, 1); + height = calc_line_height_property (it, height, font, boff, 1); if (it->override_ascent >= 0) { @@ -22743,11 +22335,11 @@ x_produce_glyphs (it) it->ascent = XINT (height) - it->descent; if (!NILP (total_height)) - spacing = calc_line_height_property(it, total_height, font, boff, 0); + spacing = calc_line_height_property (it, total_height, font, boff, 0); else { - spacing = get_it_property(it, Qline_spacing); - spacing = calc_line_height_property(it, spacing, font, boff, 0); + spacing = get_it_property (it, Qline_spacing); + spacing = calc_line_height_property (it, spacing, font, boff, 0); } if (INTEGERP (spacing)) { @@ -23265,9 +22857,7 @@ x_produce_glyphs (it) row being updated. */ void -x_write_glyphs (start, len) - struct glyph *start; - int len; +x_write_glyphs (struct glyph *start, int len) { int x, hpos; @@ -23302,9 +22892,7 @@ x_write_glyphs (start, len) Insert LEN glyphs from START at the nominal cursor position. */ void -x_insert_glyphs (start, len) - struct glyph *start; - int len; +x_insert_glyphs (struct glyph *start, int len) { struct frame *f; struct window *w; @@ -23362,8 +22950,7 @@ x_insert_glyphs (start, len) updated_window. TO_X == -1 means clear to the end of this area. */ void -x_clear_end_of_line (to_x) - int to_x; +x_clear_end_of_line (int to_x) { struct frame *f; struct window *w = updated_window; @@ -23439,9 +23026,7 @@ x_clear_end_of_line (to_x) of the bar cursor. */ static enum text_cursor_kinds -get_specified_cursor_type (arg, width) - Lisp_Object arg; - int *width; +get_specified_cursor_type (Lisp_Object arg, int *width) { enum text_cursor_kinds type; @@ -23494,9 +23079,7 @@ get_specified_cursor_type (arg, width) /* Set the default cursor types for specified frame. */ void -set_frame_cursor_types (f, arg) - struct frame *f; - Lisp_Object arg; +set_frame_cursor_types (struct frame *f, Lisp_Object arg) { int width; Lisp_Object tem; @@ -23530,11 +23113,8 @@ set_frame_cursor_types (f, arg) In all other cases, we want a hollow box cursor. */ static enum text_cursor_kinds -get_window_cursor_type (w, glyph, width, active_cursor) - struct window *w; - struct glyph *glyph; - int *width; - int *active_cursor; +get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, + int *active_cursor) { struct frame *f = XFRAME (w->frame); struct buffer *b = XBUFFER (w->buffer); @@ -23690,10 +23270,8 @@ get_window_cursor_type (w, glyph, width, active_cursor) are window-relative. */ static void -notice_overwritten_cursor (w, area, x0, x1, y0, y1) - struct window *w; - enum glyph_row_area area; - int x0, y0, x1, y1; +notice_overwritten_cursor (struct window *w, enum glyph_row_area area, + int x0, int x1, int y0, int y1) { int cx0, cx1, cy0, cy1; struct glyph_row *row; @@ -23760,11 +23338,8 @@ notice_overwritten_cursor (w, area, x0, x1, y0, y1) with respect to the overlapping part OVERLAPS. */ void -x_fix_overlapping_area (w, row, area, overlaps) - struct window *w; - struct glyph_row *row; - enum glyph_row_area area; - int overlaps; +x_fix_overlapping_area (struct window *w, struct glyph_row *row, + enum glyph_row_area area, int overlaps) { int i, x; @@ -23805,10 +23380,8 @@ x_fix_overlapping_area (w, row, area, overlaps) comment of draw_glyphs for the meaning of HL. */ void -draw_phys_cursor_glyph (w, row, hl) - struct window *w; - struct glyph_row *row; - enum draw_glyphs_face hl; +draw_phys_cursor_glyph (struct window *w, struct glyph_row *row, + enum draw_glyphs_face hl) { /* If cursor hpos is out of bounds, don't draw garbage. This can happen in mini-buffer windows when switching between echo area @@ -23851,8 +23424,7 @@ draw_phys_cursor_glyph (w, row, hl) Erase the image of a cursor of window W from the screen. */ void -erase_phys_cursor (w) - struct window *w; +erase_phys_cursor (struct window *w) { struct frame *f = XFRAME (w->frame); Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); @@ -23968,9 +23540,8 @@ erase_phys_cursor (w) where to put the cursor is specified by HPOS, VPOS, X and Y. */ void -display_and_set_cursor (w, on, hpos, vpos, x, y) - struct window *w; - int on, hpos, vpos, x, y; +display_and_set_cursor (struct window *w, int on, + int hpos, int vpos, int x, int y) { struct frame *f = XFRAME (w->frame); int new_cursor_type; @@ -24053,9 +23624,7 @@ display_and_set_cursor (w, on, hpos, vpos, x, y) of ON. */ void -update_window_cursor (w, on) - struct window *w; - int on; +update_window_cursor (struct window *w, int on) { /* Don't update cursor in windows whose frame is in the process of being deleted. */ @@ -24073,9 +23642,7 @@ update_window_cursor (w, on) in the window tree rooted at W. */ static void -update_cursor_in_window_tree (w, on_p) - struct window *w; - int on_p; +update_cursor_in_window_tree (struct window *w, int on_p) { while (w) { @@ -24096,9 +23663,7 @@ update_cursor_in_window_tree (w, on_p) Don't change the cursor's position. */ void -x_update_cursor (f, on_p) - struct frame *f; - int on_p; +x_update_cursor (struct frame *f, int on_p) { update_cursor_in_window_tree (XWINDOW (f->root_window), on_p); } @@ -24110,8 +23675,7 @@ x_update_cursor (f, on_p) is about to be rewritten. */ void -x_clear_cursor (w) - struct window *w; +x_clear_cursor (struct window *w) { if (FRAME_VISIBLE_P (XFRAME (w->frame)) && w->phys_cursor_on_p) update_window_cursor (w, 0); @@ -24122,9 +23686,7 @@ x_clear_cursor (w) Display the active region described by mouse_face_* according to DRAW. */ void -show_mouse_face (dpyinfo, draw) - Display_Info *dpyinfo; - enum draw_glyphs_face draw; +show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) { struct window *w = XWINDOW (dpyinfo->mouse_face_window); struct frame *f = XFRAME (WINDOW_FRAME (w)); @@ -24207,8 +23769,7 @@ show_mouse_face (dpyinfo, draw) face was actually drawn unhighlighted. */ int -clear_mouse_face (dpyinfo) - Display_Info *dpyinfo; +clear_mouse_face (Display_Info *dpyinfo) { int cleared = 0; @@ -24230,8 +23791,7 @@ clear_mouse_face (dpyinfo) Non-zero if physical cursor of window W is within mouse face. */ int -cursor_in_mouse_face_p (w) - struct window *w; +cursor_in_mouse_face_p (struct window *w) { Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); int in_mouse_face = 0; @@ -24456,12 +24016,8 @@ mouse_face_from_buffer_pos (Lisp_Object window, Value is non-zero if a glyph was found. */ static int -fast_find_string_pos (w, pos, object, hpos, vpos, x, y, right_p) - struct window *w; - EMACS_INT pos; - Lisp_Object object; - int *hpos, *vpos, *x, *y; - int right_p; +fast_find_string_pos (struct window *w, EMACS_INT pos, Lisp_Object object, + int *hpos, int *vpos, int *x, int *y, int right_p) { int yb = window_text_bottom_y (w); struct glyph_row *r; @@ -24525,9 +24081,7 @@ fast_find_string_pos (w, pos, object, hpos, vpos, x, y, right_p) /* See if position X, Y is within a hot-spot of an image. */ static int -on_hot_spot_p (hot_spot, x, y) - Lisp_Object hot_spot; - int x, y; +on_hot_spot_p (Lisp_Object hot_spot, int x, int y) { if (!CONSP (hot_spot)) return 0; @@ -24623,9 +24177,7 @@ on_hot_spot_p (hot_spot, x, y) } Lisp_Object -find_hot_spot (map, x, y) - Lisp_Object map; - int x, y; +find_hot_spot (Lisp_Object map, int x, int y) { while (CONSP (map)) { @@ -24650,9 +24202,7 @@ and the radius of the circle; r may be a float or integer. A polygon is a cons (poly . [x0 y0 x1 y1 ...]) where each pair in the vector describes one corner in the polygon. Returns the alist element for the first matching AREA in MAP. */) - (map, x, y) - Lisp_Object map; - Lisp_Object x, y; + (Lisp_Object map, Lisp_Object x, Lisp_Object y) { if (NILP (map)) return Qnil; @@ -24666,10 +24216,7 @@ Returns the alist element for the first matching AREA in MAP. */) /* Display frame CURSOR, optionally using shape defined by POINTER. */ static void -define_frame_cursor1 (f, cursor, pointer) - struct frame *f; - Cursor cursor; - Lisp_Object pointer; +define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer) { /* Do not change cursor shape while dragging mouse. */ if (!NILP (do_mouse_tracking)) @@ -24708,10 +24255,8 @@ define_frame_cursor1 (f, cursor, pointer) position relative to the start of the mode line. */ static void -note_mode_line_or_margin_highlight (window, x, y, area) - Lisp_Object window; - int x, y; - enum window_part area; +note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, + enum window_part area) { struct window *w = XWINDOW (window); struct frame *f = XFRAME (w->frame); @@ -24951,9 +24496,7 @@ note_mode_line_or_margin_highlight (window, x, y, area) X and Y can be negative or out of range. */ void -note_mouse_highlight (f, x, y) - struct frame *f; - int x, y; +note_mouse_highlight (struct frame *f, int x, int y) { Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); enum window_part part; @@ -25419,8 +24962,7 @@ note_mouse_highlight (f, x, y) functions to ensure the mouse-highlight is off. */ void -x_clear_window_mouse_face (w) - struct window *w; +x_clear_window_mouse_face (struct window *w) { Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); Lisp_Object window; @@ -25438,8 +24980,7 @@ x_clear_window_mouse_face (w) This is used when the size of F is changed. */ void -cancel_mouse_face (f) - struct frame *f; +cancel_mouse_face (struct frame *f) { Lisp_Object window; Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); @@ -25467,11 +25008,8 @@ cancel_mouse_face (f) which intersects rectangle R. R is in window-relative coordinates. */ static void -expose_area (w, row, r, area) - struct window *w; - struct glyph_row *row; - XRectangle *r; - enum glyph_row_area area; +expose_area (struct window *w, struct glyph_row *row, XRectangle *r, + enum glyph_row_area area) { struct glyph *first = row->glyphs[area]; struct glyph *end = row->glyphs[area] + row->used[area]; @@ -25525,10 +25063,7 @@ expose_area (w, row, r, area) non-zero if mouse-face was overwritten. */ static int -expose_line (w, row, r) - struct window *w; - struct glyph_row *row; - XRectangle *r; +expose_line (struct window *w, struct glyph_row *row, XRectangle *r) { xassert (row->enabled_p); @@ -25560,11 +25095,10 @@ expose_line (w, row, r) LAST_OVERLAPPING_ROW is the last such row. */ static void -expose_overlaps (w, first_overlapping_row, last_overlapping_row, r) - struct window *w; - struct glyph_row *first_overlapping_row; - struct glyph_row *last_overlapping_row; - XRectangle *r; +expose_overlaps (struct window *w, + struct glyph_row *first_overlapping_row, + struct glyph_row *last_overlapping_row, + XRectangle *r) { struct glyph_row *row; @@ -25590,9 +25124,7 @@ expose_overlaps (w, first_overlapping_row, last_overlapping_row, r) /* Return non-zero if W's cursor intersects rectangle R. */ static int -phys_cursor_in_rect_p (w, r) - struct window *w; - XRectangle *r; +phys_cursor_in_rect_p (struct window *w, XRectangle *r) { XRectangle cr, result; struct glyph *cursor_glyph; @@ -25638,8 +25170,7 @@ phys_cursor_in_rect_p (w, r) have vertical scroll bars. */ void -x_draw_vertical_border (w) - struct window *w; +x_draw_vertical_border (struct window *w) { struct frame *f = XFRAME (WINDOW_FRAME (w)); @@ -25689,9 +25220,7 @@ x_draw_vertical_border (w) mouse-face. */ static int -expose_window (w, fr) - struct window *w; - XRectangle *fr; +expose_window (struct window *w, XRectangle *fr) { struct frame *f = XFRAME (w->frame); XRectangle wr, r; @@ -25824,9 +25353,7 @@ expose_window (w, fr) non-zero if the exposure overwrites mouse-face. */ static int -expose_window_tree (w, r) - struct window *w; - XRectangle *r; +expose_window_tree (struct window *w, XRectangle *r) { struct frame *f = XFRAME (w->frame); int mouse_face_overwritten_p = 0; @@ -25856,9 +25383,7 @@ expose_window_tree (w, r) the entire frame. */ void -expose_frame (f, x, y, w, h) - struct frame *f; - int x, y, w, h; +expose_frame (struct frame *f, int x, int y, int w, int h) { XRectangle r; int mouse_face_overwritten_p = 0; @@ -25946,8 +25471,7 @@ expose_frame (f, x, y, w, h) empty. */ int -x_intersect_rectangles (r1, r2, result) - XRectangle *r1, *r2, *result; +x_intersect_rectangles (XRectangle *r1, XRectangle *r2, XRectangle *result) { XRectangle *left, *right; XRectangle *upper, *lower; @@ -26002,7 +25526,7 @@ x_intersect_rectangles (r1, r2, result) ***********************************************************************/ void -syms_of_xdisp () +syms_of_xdisp (void) { Vwith_echo_area_save_vector = Qnil; staticpro (&Vwith_echo_area_save_vector); @@ -26649,7 +26173,7 @@ Value must be an integer or float. */); /* Initialize this module when Emacs starts. */ void -init_xdisp () +init_xdisp (void) { Lisp_Object root_window; struct window *mini_w; @@ -26706,14 +26230,14 @@ init_xdisp () /* Return non-zero if houglass timer has been started or hourglass is shown. */ int -hourglass_started () +hourglass_started (void) { return hourglass_shown_p || hourglass_atimer != NULL; } /* Cancel a currently active hourglass timer, and start a new one. */ void -start_hourglass () +start_hourglass (void) { #if defined (HAVE_WINDOW_SYSTEM) EMACS_TIME delay; @@ -26745,7 +26269,7 @@ start_hourglass () /* Cancel the hourglass cursor timer if active, hide a busy cursor if shown. */ void -cancel_hourglass () +cancel_hourglass (void) { #if defined (HAVE_WINDOW_SYSTEM) if (hourglass_atimer) diff --git a/src/xfaces.c b/src/xfaces.c index 6bde1c121d2..c0c53f3aa1f 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -510,56 +510,55 @@ int menu_face_changed_default; struct table_entry; struct named_merge_point; -static void map_tty_color P_ ((struct frame *, struct face *, - enum lface_attribute_index, int *)); -static Lisp_Object resolve_face_name P_ ((Lisp_Object, int)); -static int may_use_scalable_font_p P_ ((const char *)); -static void set_font_frame_param P_ ((Lisp_Object, Lisp_Object)); -static int get_lface_attributes P_ ((struct frame *, Lisp_Object, Lisp_Object *, - int, struct named_merge_point *)); -static int load_pixmap P_ ((struct frame *, Lisp_Object, unsigned *, unsigned *)); -static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int)); -static void load_face_colors P_ ((struct frame *, struct face *, Lisp_Object *)); -static void free_face_colors P_ ((struct frame *, struct face *)); -static int face_color_gray_p P_ ((struct frame *, char *)); -static struct face *realize_face P_ ((struct face_cache *, Lisp_Object *, - int)); -static struct face *realize_non_ascii_face P_ ((struct frame *, Lisp_Object, - struct face *)); -static struct face *realize_x_face P_ ((struct face_cache *, Lisp_Object *)); -static struct face *realize_tty_face P_ ((struct face_cache *, Lisp_Object *)); -static int realize_basic_faces P_ ((struct frame *)); -static int realize_default_face P_ ((struct frame *)); -static void realize_named_face P_ ((struct frame *, Lisp_Object, int)); -static int lface_fully_specified_p P_ ((Lisp_Object *)); -static int lface_equal_p P_ ((Lisp_Object *, Lisp_Object *)); -static unsigned hash_string_case_insensitive P_ ((Lisp_Object)); -static unsigned lface_hash P_ ((Lisp_Object *)); -static int lface_same_font_attributes_p P_ ((Lisp_Object *, Lisp_Object *)); -static struct face_cache *make_face_cache P_ ((struct frame *)); -static void clear_face_gcs P_ ((struct face_cache *)); -static void free_face_cache P_ ((struct face_cache *)); -static int face_fontset P_ ((Lisp_Object *)); -static void merge_face_vectors P_ ((struct frame *, Lisp_Object *, Lisp_Object*, - struct named_merge_point *)); -static int merge_face_ref P_ ((struct frame *, Lisp_Object, Lisp_Object *, - int, struct named_merge_point *)); -static int set_lface_from_font P_ ((struct frame *, Lisp_Object, Lisp_Object, - int)); -static Lisp_Object lface_from_face_name P_ ((struct frame *, Lisp_Object, int)); -static struct face *make_realized_face P_ ((Lisp_Object *)); -static void cache_face P_ ((struct face_cache *, struct face *, unsigned)); -static void uncache_face P_ ((struct face_cache *, struct face *)); +static void map_tty_color (struct frame *, struct face *, + enum lface_attribute_index, int *); +static Lisp_Object resolve_face_name (Lisp_Object, int); +static void set_font_frame_param (Lisp_Object, Lisp_Object); +static int get_lface_attributes (struct frame *, Lisp_Object, Lisp_Object *, + int, struct named_merge_point *); +static int load_pixmap (struct frame *, Lisp_Object, unsigned *, unsigned *); +static struct frame *frame_or_selected_frame (Lisp_Object, int); +static void load_face_colors (struct frame *, struct face *, Lisp_Object *); +static void free_face_colors (struct frame *, struct face *); +static int face_color_gray_p (struct frame *, char *); +static struct face *realize_face (struct face_cache *, Lisp_Object *, + int); +static struct face *realize_non_ascii_face (struct frame *, Lisp_Object, + struct face *); +static struct face *realize_x_face (struct face_cache *, Lisp_Object *); +static struct face *realize_tty_face (struct face_cache *, Lisp_Object *); +static int realize_basic_faces (struct frame *); +static int realize_default_face (struct frame *); +static void realize_named_face (struct frame *, Lisp_Object, int); +static int lface_fully_specified_p (Lisp_Object *); +static int lface_equal_p (Lisp_Object *, Lisp_Object *); +static unsigned hash_string_case_insensitive (Lisp_Object); +static unsigned lface_hash (Lisp_Object *); +static int lface_same_font_attributes_p (Lisp_Object *, Lisp_Object *); +static struct face_cache *make_face_cache (struct frame *); +static void clear_face_gcs (struct face_cache *); +static void free_face_cache (struct face_cache *); +static int face_fontset (Lisp_Object *); +static void merge_face_vectors (struct frame *, Lisp_Object *, Lisp_Object*, + struct named_merge_point *); +static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *, + int, struct named_merge_point *); +static int set_lface_from_font (struct frame *, Lisp_Object, Lisp_Object, + int); +static Lisp_Object lface_from_face_name (struct frame *, Lisp_Object, int); +static struct face *make_realized_face (Lisp_Object *); +static void cache_face (struct face_cache *, struct face *, unsigned); +static void uncache_face (struct face_cache *, struct face *); #ifdef HAVE_WINDOW_SYSTEM -static GC x_create_gc P_ ((struct frame *, unsigned long, XGCValues *)); -static void x_free_gc P_ ((struct frame *, GC)); +static GC x_create_gc (struct frame *, unsigned long, XGCValues *); +static void x_free_gc (struct frame *, GC); #ifdef USE_X_TOOLKIT -static void x_update_menu_appearance P_ ((struct frame *)); +static void x_update_menu_appearance (struct frame *); -extern void free_frame_menubar P_ ((struct frame *)); +extern void free_frame_menubar (struct frame *); #endif /* USE_X_TOOLKIT */ #endif /* HAVE_WINDOW_SYSTEM */ @@ -626,7 +625,7 @@ unregister_colors (pixels, n) DEFUN ("dump-colors", Fdump_colors, Sdump_colors, 0, 0, 0, doc: /* Dump currently allocated colors to stderr. */) - () + (void) { int i, n; @@ -656,10 +655,7 @@ DEFUN ("dump-colors", Fdump_colors, Sdump_colors, 0, 0, 0, is called. */ void -x_free_colors (f, pixels, npixels) - struct frame *f; - unsigned long *pixels; - int npixels; +x_free_colors (struct frame *f, long unsigned int *pixels, int npixels) { int class = FRAME_X_DISPLAY_INFO (f)->visual->class; @@ -681,12 +677,7 @@ x_free_colors (f, pixels, npixels) is called. */ void -x_free_dpy_colors (dpy, screen, cmap, pixels, npixels) - Display *dpy; - Screen *screen; - Colormap cmap; - unsigned long *pixels; - int npixels; +x_free_dpy_colors (Display *dpy, Screen *screen, Colormap cmap, long unsigned int *pixels, int npixels) { struct x_display_info *dpyinfo = x_display_info_for_display (dpy); int class = dpyinfo->visual->class; @@ -707,10 +698,7 @@ x_free_dpy_colors (dpy, screen, cmap, pixels, npixels) are given by XGCV and MASK. */ static INLINE GC -x_create_gc (f, mask, xgcv) - struct frame *f; - unsigned long mask; - XGCValues *xgcv; +x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv) { GC gc; BLOCK_INPUT; @@ -724,9 +712,7 @@ x_create_gc (f, mask, xgcv) /* Free GC which was used on frame F. */ static INLINE void -x_free_gc (f, gc) - struct frame *f; - GC gc; +x_free_gc (struct frame *f, GC gc) { eassert (interrupt_input_blocked); IF_DEBUG (xassert (--ngcs >= 0)); @@ -739,10 +725,7 @@ x_free_gc (f, gc) /* W32 emulation of GCs */ static INLINE GC -x_create_gc (f, mask, xgcv) - struct frame *f; - unsigned long mask; - XGCValues *xgcv; +x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv) { GC gc; BLOCK_INPUT; @@ -756,9 +739,7 @@ x_create_gc (f, mask, xgcv) /* Free GC which was used on frame F. */ static INLINE void -x_free_gc (f, gc) - struct frame *f; - GC gc; +x_free_gc (struct frame *f, GC gc) { IF_DEBUG (xassert (--ngcs >= 0)); xfree (gc); @@ -777,7 +758,7 @@ x_create_gc (f, mask, xgcv) { GC gc = xmalloc (sizeof (*gc)); if (gc) - bcopy(xgcv, gc, sizeof(XGCValues)); + memcpy (gc, xgcv, sizeof (XGCValues)); return gc; } @@ -794,8 +775,7 @@ x_free_gc (f, gc) are in ISO8859-1. */ int -xstrcasecmp (s1, s2) - const unsigned char *s1, *s2; +xstrcasecmp (const unsigned char *s1, const unsigned char *s2) { while (*s1 && *s2) { @@ -819,9 +799,7 @@ xstrcasecmp (s1, s2) Lisp function definitions. */ static INLINE struct frame * -frame_or_selected_frame (frame, nparam) - Lisp_Object frame; - int nparam; +frame_or_selected_frame (Lisp_Object frame, int nparam) { if (NILP (frame)) frame = selected_frame; @@ -838,8 +816,7 @@ frame_or_selected_frame (frame, nparam) /* Initialize face cache and basic faces for frame F. */ void -init_frame_faces (f) - struct frame *f; +init_frame_faces (struct frame *f) { /* Make a face cache, if F doesn't have one. */ if (FRAME_FACE_CACHE (f) == NULL) @@ -877,8 +854,7 @@ init_frame_faces (f) /* Free face cache of frame F. Called from delete_frame. */ void -free_frame_faces (f) - struct frame *f; +free_frame_faces (struct frame *f) { struct face_cache *face_cache = FRAME_FACE_CACHE (f); @@ -909,8 +885,7 @@ free_frame_faces (f) of named faces. */ void -recompute_basic_faces (f) - struct frame *f; +recompute_basic_faces (struct frame *f) { if (FRAME_FACE_CACHE (f)) { @@ -925,8 +900,7 @@ recompute_basic_faces (f) try to free unused fonts, too. */ void -clear_face_cache (clear_fonts_p) - int clear_fonts_p; +clear_face_cache (int clear_fonts_p) { #ifdef HAVE_WINDOW_SYSTEM Lisp_Object tail, frame; @@ -971,8 +945,7 @@ clear_face_cache (clear_fonts_p) DEFUN ("clear-face-cache", Fclear_face_cache, Sclear_face_cache, 0, 1, 0, doc: /* Clear face caches on all frames. Optional THOROUGHLY non-nil means try to free unused fonts, too. */) - (thoroughly) - Lisp_Object thoroughly; + (Lisp_Object thoroughly) { clear_face_cache (!NILP (thoroughly)); ++face_change_count; @@ -994,8 +967,7 @@ A bitmap specification is either a string, a file name, or a list HEIGHT is its height, and DATA is a string containing the bits of the pixmap. Bits are stored row by row, each row occupies \(WIDTH + 7)/8 bytes. */) - (object) - Lisp_Object object; + (Lisp_Object object) { int pixmap_p = 0; @@ -1045,10 +1017,7 @@ the pixmap. Bits are stored row by row, each row occupies if these pointers are not null. */ static int -load_pixmap (f, name, w_ptr, h_ptr) - FRAME_PTR f; - Lisp_Object name; - unsigned int *w_ptr, *h_ptr; +load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr, unsigned int *h_ptr) { int bitmap_id; @@ -1117,9 +1086,7 @@ load_pixmap (f, name, w_ptr, h_ptr) Return 0 if there's a problem with RGB_LIST, otherwise return 1. */ static int -parse_rgb_list (rgb_list, color) - Lisp_Object rgb_list; - XColor *color; +parse_rgb_list (Lisp_Object rgb_list, XColor *color) { #define PARSE_RGB_LIST_FIELD(field) \ if (CONSP (rgb_list) && INTEGERP (XCAR (rgb_list))) \ @@ -1144,10 +1111,7 @@ parse_rgb_list (rgb_list, color) returned in it. */ static int -tty_lookup_color (f, color, tty_color, std_color) - struct frame *f; - Lisp_Object color; - XColor *tty_color, *std_color; +tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, XColor *std_color) { Lisp_Object frame, color_desc; @@ -1207,11 +1171,7 @@ tty_lookup_color (f, color, tty_color, std_color) /* A version of defined_color for non-X frames. */ int -tty_defined_color (f, color_name, color_def, alloc) - struct frame *f; - char *color_name; - XColor *color_def; - int alloc; +tty_defined_color (struct frame *f, char *color_name, XColor *color_def, int alloc) { int status = 1; @@ -1246,11 +1206,7 @@ tty_defined_color (f, color_name, color_def, alloc) This does the right thing for any type of frame. */ int -defined_color (f, color_name, color_def, alloc) - struct frame *f; - char *color_name; - XColor *color_def; - int alloc; +defined_color (struct frame *f, char *color_name, XColor *color_def, int alloc) { if (!FRAME_WINDOW_P (f)) return tty_defined_color (f, color_name, color_def, alloc); @@ -1275,9 +1231,7 @@ defined_color (f, color_name, color_def, alloc) Lisp string. */ Lisp_Object -tty_color_name (f, idx) - struct frame *f; - int idx; +tty_color_name (struct frame *f, int idx) { if (idx >= 0 && !NILP (Ffboundp (Qtty_color_by_index))) { @@ -1312,9 +1266,7 @@ tty_color_name (f, idx) The criterion implemented here is not a terribly sophisticated one. */ static int -face_color_gray_p (f, color_name) - struct frame *f; - char *color_name; +face_color_gray_p (struct frame *f, char *color_name) { XColor color; int gray_p; @@ -1341,10 +1293,7 @@ face_color_gray_p (f, color_name) color. */ static int -face_color_supported_p (f, color_name, background_p) - struct frame *f; - char *color_name; - int background_p; +face_color_supported_p (struct frame *f, char *color_name, int background_p) { Lisp_Object frame; XColor not_used; @@ -1370,8 +1319,7 @@ DEFUN ("color-gray-p", Fcolor_gray_p, Scolor_gray_p, 1, 2, 0, doc: /* Return non-nil if COLOR is a shade of gray (or white or black). FRAME specifies the frame and thus the display for interpreting COLOR. If FRAME is nil or omitted, use the selected frame. */) - (color, frame) - Lisp_Object color, frame; + (Lisp_Object color, Lisp_Object frame) { struct frame *f; @@ -1392,8 +1340,7 @@ BACKGROUND-P non-nil means COLOR is used as a background. Otherwise, this function tells whether it can be used as a foreground. If FRAME is nil or omitted, use the selected frame. COLOR must be a valid color name. */) - (color, frame, background_p) - Lisp_Object frame, color, background_p; + (Lisp_Object color, Lisp_Object frame, Lisp_Object background_p) { struct frame *f; @@ -1419,11 +1366,7 @@ COLOR must be a valid color name. */) these colors. */ unsigned long -load_color (f, face, name, target_index) - struct frame *f; - struct face *face; - Lisp_Object name; - enum lface_attribute_index target_index; +load_color (struct frame *f, struct face *face, Lisp_Object name, enum lface_attribute_index target_index) { XColor color; @@ -1494,10 +1437,7 @@ load_color (f, face, name, target_index) try to emulate gray colors with a stipple from Vface_default_stipple. */ static void -load_face_colors (f, face, attrs) - struct frame *f; - struct face *face; - Lisp_Object *attrs; +load_face_colors (struct frame *f, struct face *face, Lisp_Object *attrs) { Lisp_Object fg, bg; @@ -1533,9 +1473,7 @@ load_face_colors (f, face, attrs) /* Free color PIXEL on frame F. */ void -unload_color (f, pixel) - struct frame *f; - unsigned long pixel; +unload_color (struct frame *f, long unsigned int pixel) { #ifdef HAVE_X_WINDOWS if (pixel != -1) @@ -1551,9 +1489,7 @@ unload_color (f, pixel) /* Free colors allocated for FACE. */ static void -free_face_colors (f, face) - struct frame *f; - struct face *face; +free_face_colors (struct frame *f, struct face *face) { /* PENDING(NS): need to do something here? */ #ifdef HAVE_X_WINDOWS @@ -1693,8 +1629,7 @@ static int font_sort_order[4]; static enum font_property_index font_props_for_sorting[FONT_SIZE_INDEX]; static int -compare_fonts_by_sort_order (v1, v2) - const void *v1, *v2; +compare_fonts_by_sort_order (const void *v1, const void *v2) { Lisp_Object font1 = *(Lisp_Object *) v1; Lisp_Object font2 = *(Lisp_Object *) v2; @@ -1742,8 +1677,7 @@ FULL is the full name of the font, and REGISTRY-AND-ENCODING is a string giving the registry and encoding of the font. The result list is sorted according to the current setting of the face font sort order. */) - (family, frame) - Lisp_Object family, frame; + (Lisp_Object family, Lisp_Object frame) { Lisp_Object font_spec, list, *drivers, vec; int i, nfonts, ndrivers; @@ -1840,8 +1774,7 @@ fonts to match. The first MAXIMUM fonts are reported. The optional fifth argument WIDTH, if specified, is a number of columns occupied by a character of a font. In that case, return only fonts the WIDTH times as wide as FACE on FRAME. */) - (pattern, face, frame, maximum, width) - Lisp_Object pattern, face, frame, maximum, width; + (Lisp_Object pattern, Lisp_Object face, Lisp_Object frame, Lisp_Object maximum, Lisp_Object width) { struct frame *f; int size, avgwidth; @@ -2150,9 +2083,7 @@ resolve_face_name_error (ignore) Return default face in case of errors. */ static Lisp_Object -resolve_face_name (face_name, signal_p) - Lisp_Object face_name; - int signal_p; +resolve_face_name (Lisp_Object face_name, int signal_p) { Lisp_Object orig_face; Lisp_Object tortoise, hare; @@ -2198,10 +2129,7 @@ resolve_face_name (face_name, signal_p) signal an error if FACE_NAME is not a valid face name. If SIGNAL_P is zero, value is nil if FACE_NAME is not a valid face name. */ static INLINE Lisp_Object -lface_from_face_name_no_resolve (f, face_name, signal_p) - struct frame *f; - Lisp_Object face_name; - int signal_p; +lface_from_face_name_no_resolve (struct frame *f, Lisp_Object face_name, int signal_p) { Lisp_Object lface; @@ -2229,10 +2157,7 @@ lface_from_face_name_no_resolve (f, face_name, signal_p) If SIGNAL_P is zero, value is nil if FACE_NAME is not a valid face name. */ static INLINE Lisp_Object -lface_from_face_name (f, face_name, signal_p) - struct frame *f; - Lisp_Object face_name; - int signal_p; +lface_from_face_name (struct frame *f, Lisp_Object face_name, int signal_p) { face_name = resolve_face_name (face_name, signal_p); return lface_from_face_name_no_resolve (f, face_name, signal_p); @@ -2246,19 +2171,15 @@ lface_from_face_name (f, face_name, signal_p) Otherwise, value is zero if FACE_NAME is not a face. */ static INLINE int -get_lface_attributes_no_remap (f, face_name, attrs, signal_p) - struct frame *f; - Lisp_Object face_name; - Lisp_Object *attrs; - int signal_p; +get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, Lisp_Object *attrs, int signal_p) { Lisp_Object lface; lface = lface_from_face_name_no_resolve (f, face_name, signal_p); if (! NILP (lface)) - bcopy (XVECTOR (lface)->contents, attrs, - LFACE_VECTOR_SIZE * sizeof *attrs); + memcpy (attrs, XVECTOR (lface)->contents, + LFACE_VECTOR_SIZE * sizeof *attrs); return !NILP (lface); } @@ -2271,12 +2192,7 @@ get_lface_attributes_no_remap (f, face_name, attrs, signal_p) Otherwise, value is zero if FACE_NAME is not a face. */ static INLINE int -get_lface_attributes (f, face_name, attrs, signal_p, named_merge_points) - struct frame *f; - Lisp_Object face_name; - Lisp_Object *attrs; - int signal_p; - struct named_merge_point *named_merge_points; +get_lface_attributes (struct frame *f, Lisp_Object face_name, Lisp_Object *attrs, int signal_p, struct named_merge_point *named_merge_points) { Lisp_Object face_remapping; @@ -2312,8 +2228,7 @@ get_lface_attributes (f, face_name, attrs, signal_p, named_merge_points) specified, i.e. are non-nil. */ static int -lface_fully_specified_p (attrs) - Lisp_Object *attrs; +lface_fully_specified_p (Lisp_Object *attrs) { int i; @@ -2333,10 +2248,7 @@ lface_fully_specified_p (attrs) of FORCE_P. */ static int -set_lface_from_font (f, lface, font_object, force_p) - struct frame *f; - Lisp_Object lface, font_object; - int force_p; +set_lface_from_font (struct frame *f, Lisp_Object lface, Lisp_Object font_object, int force_p) { Lisp_Object val; struct font *font = XFONT_OBJECT (font_object); @@ -2397,8 +2309,7 @@ set_lface_from_font (f, lface, font_object, force_p) unless both FROM and TO are relative. */ Lisp_Object -merge_face_heights (from, to, invalid) - Lisp_Object from, to, invalid; +merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid) { Lisp_Object result = invalid; @@ -2447,10 +2358,7 @@ merge_face_heights (from, to, invalid) other places. */ static INLINE void -merge_face_vectors (f, from, to, named_merge_points) - struct frame *f; - Lisp_Object *from, *to; - struct named_merge_point *named_merge_points; +merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to, struct named_merge_point *named_merge_points) { int i; @@ -2517,11 +2425,7 @@ merge_face_vectors (f, from, to, named_merge_points) merging succeeded. */ static int -merge_named_face (f, face_name, to, named_merge_points) - struct frame *f; - Lisp_Object face_name; - Lisp_Object *to; - struct named_merge_point *named_merge_points; +merge_named_face (struct frame *f, Lisp_Object face_name, Lisp_Object *to, struct named_merge_point *named_merge_points) { struct named_merge_point named_merge_point; @@ -2571,12 +2475,7 @@ merge_named_face (f, face_name, to, named_merge_points) specifications. */ static int -merge_face_ref (f, face_ref, to, err_msgs, named_merge_points) - struct frame *f; - Lisp_Object face_ref; - Lisp_Object *to; - int err_msgs; - struct named_merge_point *named_merge_points; +merge_face_ref (struct frame *f, Lisp_Object face_ref, Lisp_Object *to, int err_msgs, struct named_merge_point *named_merge_points) { int ok = 1; /* Succeed without an error? */ @@ -2806,8 +2705,7 @@ If FACE was not known as a face before, create a new one. If optional argument FRAME is specified, make a frame-local face for that frame. Otherwise operate on the global face definition. Value is a vector of face attributes. */) - (face, frame) - Lisp_Object face, frame; + (Lisp_Object face, Lisp_Object frame) { Lisp_Object global_lface, lface; struct frame *f; @@ -2895,8 +2793,7 @@ FACE should be a symbol or string. If optional second argument FRAME is non-nil, check for the existence of a frame-local face with name FACE on that frame. Otherwise check for the existence of a global face. */) - (face, frame) - Lisp_Object face, frame; + (Lisp_Object face, Lisp_Object frame) { Lisp_Object lface; @@ -2924,8 +2821,7 @@ definition of TO on NEW-FRAME. If NEW-FRAME is nil, FRAME controls where the data is copied to. The value is TO. */) - (from, to, frame, new_frame) - Lisp_Object from, to, frame, new_frame; + (Lisp_Object from, Lisp_Object to, Lisp_Object frame, Lisp_Object new_frame) { Lisp_Object lface, copy; @@ -2950,8 +2846,8 @@ The value is TO. */) copy = Finternal_make_lisp_face (to, new_frame); } - bcopy (XVECTOR (lface)->contents, XVECTOR (copy)->contents, - LFACE_VECTOR_SIZE * sizeof (Lisp_Object)); + memcpy (XVECTOR (copy)->contents, XVECTOR (lface)->contents, + LFACE_VECTOR_SIZE * sizeof (Lisp_Object)); /* Changing a named face means that all realized faces depending on that face are invalid. Since we cannot tell which realized faces @@ -2976,8 +2872,7 @@ FRAME nil means change the face of the selected frame. FRAME t means change the default for new frames. FRAME 0 means change the face on all frames, and change the default for new frames. */) - (face, attr, value, frame) - Lisp_Object face, attr, value, frame; + (Lisp_Object face, Lisp_Object attr, Lisp_Object value, Lisp_Object frame) { Lisp_Object lface; Lisp_Object old_value = Qnil; @@ -3490,44 +3385,11 @@ FRAME 0 means change the face on all frames, and change the default } -#ifdef HAVE_WINDOW_SYSTEM - -/* Set the `font' frame parameter of FRAME determined from the - font-object set in `default' face attributes LFACE. */ - -static void -set_font_frame_param (frame, lface) - Lisp_Object frame, lface; -{ - struct frame *f = XFRAME (frame); - Lisp_Object font; - - if (FRAME_WINDOW_P (f) - /* Don't do anything if the font is `unspecified'. This can - happen during frame creation. */ - && (font = LFACE_FONT (lface), - ! UNSPECIFIEDP (font))) - { - if (FONT_SPEC_P (font)) - { - font = font_load_for_lface (f, XVECTOR (lface)->contents, font); - if (NILP (font)) - return; - LFACE_FONT (lface) = font; - } - f->default_face_done_p = 0; - Fmodify_frame_parameters (frame, Fcons (Fcons (Qfont, font), Qnil)); - } -} - - /* Update the corresponding face when frame parameter PARAM on frame F has been assigned the value NEW_VALUE. */ void -update_face_from_frame_parameter (f, param, new_value) - struct frame *f; - Lisp_Object param, new_value; +update_face_from_frame_parameter (struct frame *f, Lisp_Object param, Lisp_Object new_value) { Lisp_Object face = Qnil; Lisp_Object lface; @@ -3562,6 +3424,7 @@ update_face_from_frame_parameter (f, param, new_value) ? new_value : Qunspecified); realize_basic_faces (f); } +#ifdef HAVE_WINDOW_SYSTEM else if (EQ (param, Qborder_color)) { face = Qborder; @@ -3583,6 +3446,7 @@ update_face_from_frame_parameter (f, param, new_value) LFACE_BACKGROUND (lface) = (STRINGP (new_value) ? new_value : Qunspecified); } +#endif /* Changing a named face means that all realized faces depending on that face are invalid. Since we cannot tell which realized faces @@ -3598,14 +3462,43 @@ update_face_from_frame_parameter (f, param, new_value) } +#ifdef HAVE_WINDOW_SYSTEM + +/* Set the `font' frame parameter of FRAME determined from the + font-object set in `default' face attributes LFACE. */ + +static void +set_font_frame_param (Lisp_Object frame, Lisp_Object lface) +{ + struct frame *f = XFRAME (frame); + Lisp_Object font; + + if (FRAME_WINDOW_P (f) + /* Don't do anything if the font is `unspecified'. This can + happen during frame creation. */ + && (font = LFACE_FONT (lface), + ! UNSPECIFIEDP (font))) + { + if (FONT_SPEC_P (font)) + { + font = font_load_for_lface (f, XVECTOR (lface)->contents, font); + if (NILP (font)) + return; + LFACE_FONT (lface) = font; + } + f->default_face_done_p = 0; + Fmodify_frame_parameters (frame, Fcons (Fcons (Qfont, font), Qnil)); + } +} + + /* Get the value of X resource RESOURCE, class CLASS for the display of frame FRAME. This is here because ordinary `x-get-resource' doesn't take a frame argument. */ DEFUN ("internal-face-x-get-resource", Finternal_face_x_get_resource, Sinternal_face_x_get_resource, 3, 3, 0, doc: /* */) - (resource, class, frame) - Lisp_Object resource, class, frame; + (Lisp_Object resource, Lisp_Object class, Lisp_Object frame) { Lisp_Object value = Qnil; CHECK_STRING (resource); @@ -3625,9 +3518,7 @@ DEFUN ("internal-face-x-get-resource", Finternal_face_x_get_resource, error; if SIGNAL_P is zero, return 0. */ static Lisp_Object -face_boolean_x_resource_value (value, signal_p) - Lisp_Object value; - int signal_p; +face_boolean_x_resource_value (Lisp_Object value, int signal_p) { Lisp_Object result = make_number (0); @@ -3652,8 +3543,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource", Finternal_set_lisp_face_attribute_from_resource, Sinternal_set_lisp_face_attribute_from_resource, 3, 4, 0, doc: /* */) - (face, attr, value, frame) - Lisp_Object face, attr, value, frame; + (Lisp_Object face, Lisp_Object attr, Lisp_Object value, Lisp_Object frame) { CHECK_SYMBOL (face); CHECK_SYMBOL (attr); @@ -3703,8 +3593,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource", /* Make menus on frame F appear as specified by the `menu' face. */ static void -x_update_menu_appearance (f) - struct frame *f; +x_update_menu_appearance (struct frame *f) { struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); XrmDatabase rdb; @@ -3778,7 +3667,7 @@ x_update_menu_appearance (f) { #if defined HAVE_X_I18N extern char *xic_create_fontsetname - P_ ((char *base_fontname, Bool motif)); + (char *base_fontname, Bool motif); char *fontsetname = xic_create_fontsetname (SDATA (xlfd), motif); #else char *fontsetname = (char *) SDATA (xlfd); @@ -3814,8 +3703,7 @@ A relative value is one that doesn't entirely override whatever is inherited from another face. For most possible attributes, the only relative value that users see is `unspecified'. However, for :height, floating point values are also relative. */) - (attribute, value) - Lisp_Object attribute, value; + (Lisp_Object attribute, Lisp_Object value) { if (EQ (value, Qunspecified) || (EQ (value, Qignore_defface))) return Qt; @@ -3830,8 +3718,7 @@ DEFUN ("merge-face-attribute", Fmerge_face_attribute, Smerge_face_attribute, doc: /* Return face ATTRIBUTE VALUE1 merged with VALUE2. If VALUE1 or VALUE2 are absolute (see `face-attribute-relative-p'), then the result will be absolute, otherwise it will be relative. */) - (attribute, value1, value2) - Lisp_Object attribute, value1, value2; + (Lisp_Object attribute, Lisp_Object value1, Lisp_Object value2) { if (EQ (value1, Qunspecified) || EQ (value1, Qignore_defface)) return value2; @@ -3851,8 +3738,7 @@ face attribute name, signal an error. If the optional argument FRAME is given, report on face SYMBOL in that frame. If FRAME is t, report on the defaults for face SYMBOL (for new frames). If FRAME is omitted or nil, use the selected frame. */) - (symbol, keyword, frame) - Lisp_Object symbol, keyword, frame; + (Lisp_Object symbol, Lisp_Object keyword, Lisp_Object frame) { Lisp_Object lface, value = Qnil; @@ -3919,8 +3805,7 @@ DEFUN ("internal-lisp-face-attribute-values", Sinternal_lisp_face_attribute_values, 1, 1, 0, doc: /* Return a list of valid discrete values for face attribute ATTR. Value is nil if ATTR doesn't have a discrete set of valid values. */) - (attr) - Lisp_Object attr; + (Lisp_Object attr) { Lisp_Object result = Qnil; @@ -3943,8 +3828,7 @@ DEFUN ("internal-merge-in-global-face", Finternal_merge_in_global_face, Sinternal_merge_in_global_face, 2, 2, 0, doc: /* Add attributes from frame-default definition of FACE to FACE on FRAME. Default face attributes override any local face attributes. */) - (face, frame) - Lisp_Object face, frame; + (Lisp_Object face, Lisp_Object frame) { int i; Lisp_Object global_lface, local_lface, *gvec, *lvec; @@ -3982,9 +3866,9 @@ Default face attributes override any local face attributes. */) { /* Ensure that the face vector is fully specified by merging the previously-cached vector. */ - bcopy (oldface->lface, attrs, sizeof attrs); + memcpy (attrs, oldface->lface, sizeof attrs); merge_face_vectors (f, lvec, attrs, 0); - bcopy (attrs, lvec, sizeof attrs); + memcpy (lvec, attrs, sizeof attrs); newface = realize_face (c, lvec, DEFAULT_FACE_ID); if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX]) @@ -4022,8 +3906,7 @@ If FRAME is t, report on the defaults for face FACE (for new frames). If FRAME is omitted or nil, use the selected frame. And, in this case, if the optional third argument CHARACTER is given, return the font name used for CHARACTER. */) - (face, frame, character) - Lisp_Object face, frame, character; + (Lisp_Object face, Lisp_Object frame, Lisp_Object character) { if (EQ (frame, Qt)) { @@ -4073,8 +3956,7 @@ return the font name used for CHARACTER. */) is called quite often. */ static INLINE int -face_attr_equal_p (v1, v2) - Lisp_Object v1, v2; +face_attr_equal_p (Lisp_Object v1, Lisp_Object v2) { /* Type can differ, e.g. when one attribute is unspecified, i.e. nil, and the other is specified. */ @@ -4090,7 +3972,7 @@ face_attr_equal_p (v1, v2) if (SBYTES (v1) != SBYTES (v2)) return 0; - return bcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0; + return memcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0; case_Lisp_Int: case Lisp_Symbol: @@ -4107,8 +3989,7 @@ face_attr_equal_p (v1, v2) is called quite often. */ static INLINE int -lface_equal_p (v1, v2) - Lisp_Object *v1, *v2; +lface_equal_p (Lisp_Object *v1, Lisp_Object *v2) { int i, equal_p = 1; @@ -4125,8 +4006,7 @@ DEFUN ("internal-lisp-face-equal-p", Finternal_lisp_face_equal_p, If the optional argument FRAME is given, report on FACE1 and FACE2 in that frame. If FRAME is t, report on the defaults for FACE1 and FACE2 (for new frames). If FRAME is omitted or nil, use the selected frame. */) - (face1, face2, frame) - Lisp_Object face1, face2, frame; + (Lisp_Object face1, Lisp_Object face2, Lisp_Object frame) { int equal_p; struct frame *f; @@ -4155,8 +4035,7 @@ DEFUN ("internal-lisp-face-empty-p", Finternal_lisp_face_empty_p, If the optional argument FRAME is given, report on face FACE in that frame. If FRAME is t, report on the defaults for face FACE (for new frames). If FRAME is omitted or nil, use the selected frame. */) - (face, frame) - Lisp_Object face, frame; + (Lisp_Object face, Lisp_Object frame) { struct frame *f; Lisp_Object lface; @@ -4184,8 +4063,7 @@ DEFUN ("frame-face-alist", Fframe_face_alist, Sframe_face_alist, 0, 1, 0, doc: /* Return an alist of frame-local faces defined on FRAME. For internal use only. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { struct frame *f = frame_or_selected_frame (frame, 0); return f->face_alist; @@ -4196,8 +4074,7 @@ For internal use only. */) below in computing a hash value for a Lisp face. */ static INLINE unsigned -hash_string_case_insensitive (string) - Lisp_Object string; +hash_string_case_insensitive (Lisp_Object string) { const unsigned char *s; unsigned hash = 0; @@ -4211,8 +4088,7 @@ hash_string_case_insensitive (string) /* Return a hash code for face attribute vector V. */ static INLINE unsigned -lface_hash (v) - Lisp_Object *v; +lface_hash (Lisp_Object *v) { return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX]) ^ hash_string_case_insensitive (v[LFACE_FOUNDRY_INDEX]) @@ -4231,8 +4107,7 @@ lface_hash (v) LFACE1 and LFACE2 must be fully-specified. */ static INLINE int -lface_same_font_attributes_p (lface1, lface2) - Lisp_Object *lface1, *lface2; +lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2) { xassert (lface_fully_specified_p (lface1) && lface_fully_specified_p (lface2)); @@ -4263,13 +4138,12 @@ lface_same_font_attributes_p (lface1, lface2) vector ATTR. */ static struct face * -make_realized_face (attr) - Lisp_Object *attr; +make_realized_face (Lisp_Object *attr) { struct face *face = (struct face *) xmalloc (sizeof *face); - bzero (face, sizeof *face); + memset (face, 0, sizeof *face); face->ascii_face = face; - bcopy (attr, face->lface, sizeof face->lface); + memcpy (face->lface, attr, sizeof face->lface); return face; } @@ -4278,9 +4152,7 @@ make_realized_face (attr) be null. */ void -free_realized_face (f, face) - struct frame *f; - struct face *face; +free_realized_face (struct frame *f, struct face *face) { if (face) { @@ -4315,9 +4187,7 @@ free_realized_face (f, face) by clearing the face cache. */ void -prepare_face_for_display (f, face) - struct frame *f; - struct face *face; +prepare_face_for_display (struct frame *f, struct face *face) { #ifdef HAVE_WINDOW_SYSTEM xassert (FRAME_WINDOW_P (f)); @@ -4354,8 +4224,7 @@ prepare_face_for_display (f, face) /* Returns the `distance' between the colors X and Y. */ static int -color_distance (x, y) - XColor *x, *y; +color_distance (XColor *x, XColor *y) { /* This formula is from a paper title `Colour metric' by Thiadmer Riemersma. Quoting from that paper: @@ -4384,8 +4253,7 @@ DEFUN ("color-distance", Fcolor_distance, Scolor_distance, 2, 3, 0, COLOR1 and COLOR2 may be either strings containing the color name, or lists of the form (RED GREEN BLUE). If FRAME is unspecified or nil, the current frame is used. */) - (color1, color2, frame) - Lisp_Object color1, color2, frame; + (Lisp_Object color1, Lisp_Object color2, Lisp_Object frame) { struct frame *f; XColor cdef1, cdef2; @@ -4413,17 +4281,16 @@ If FRAME is unspecified or nil, the current frame is used. */) /* Return a new face cache for frame F. */ static struct face_cache * -make_face_cache (f) - struct frame *f; +make_face_cache (struct frame *f) { struct face_cache *c; int size; c = (struct face_cache *) xmalloc (sizeof *c); - bzero (c, sizeof *c); + memset (c, 0, sizeof *c); size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; c->buckets = (struct face **) xmalloc (size); - bzero (c->buckets, size); + memset (c->buckets, 0, size); c->size = 50; c->faces_by_id = (struct face **) xmalloc (c->size * sizeof *c->faces_by_id); c->f = f; @@ -4437,8 +4304,7 @@ make_face_cache (f) keeping too many graphics contexts that are no longer needed. */ static void -clear_face_gcs (c) - struct face_cache *c; +clear_face_gcs (struct face_cache *c) { if (c && FRAME_WINDOW_P (c->f)) { @@ -4468,8 +4334,7 @@ clear_face_gcs (c) event doesn't try to use faces we destroyed. */ static void -free_realized_faces (c) - struct face_cache *c; +free_realized_faces (struct face_cache *c) { if (c && c->used) { @@ -4489,7 +4354,7 @@ free_realized_faces (c) c->used = 0; size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; - bzero (c->buckets, size); + memset (c->buckets, 0, size); /* Must do a thorough redisplay the next time. Mark current matrices as invalid because they will reference faces freed @@ -4509,9 +4374,7 @@ free_realized_faces (c) /* Free all realized faces that are using FONTSET on frame F. */ void -free_realized_faces_for_fontset (f, fontset) - struct frame *f; - int fontset; +free_realized_faces_for_fontset (struct frame *f, int fontset) { struct face_cache *cache = FRAME_FACE_CACHE (f); struct face *face; @@ -4552,8 +4415,7 @@ free_realized_faces_for_fontset (f, fontset) because we can't tell which realized faces depend on that face. */ void -free_all_realized_faces (frame) - Lisp_Object frame; +free_all_realized_faces (Lisp_Object frame) { if (NILP (frame)) { @@ -4569,8 +4431,7 @@ free_all_realized_faces (frame) /* Free face cache C and faces in it, including their X resources. */ static void -free_face_cache (c) - struct face_cache *c; +free_face_cache (struct face_cache *c) { if (c) { @@ -4590,10 +4451,7 @@ free_face_cache (c) that a requested face is not cached. */ static void -cache_face (c, face, hash) - struct face_cache *c; - struct face *face; - unsigned hash; +cache_face (struct face_cache *c, struct face *face, unsigned int hash) { int i = hash % FACE_CACHE_BUCKETS_SIZE; @@ -4670,9 +4528,7 @@ cache_face (c, face, hash) /* Remove face FACE from cache C. */ static void -uncache_face (c, face) - struct face_cache *c; - struct face *face; +uncache_face (struct face_cache *c, struct face *face) { int i = face->hash % FACE_CACHE_BUCKETS_SIZE; @@ -4696,9 +4552,7 @@ uncache_face (c, face) realize a new one. */ INLINE int -lookup_face (f, attr) - struct frame *f; - Lisp_Object *attr; +lookup_face (struct frame *f, Lisp_Object *attr) { struct face_cache *cache = FRAME_FACE_CACHE (f); unsigned hash; @@ -4744,10 +4598,7 @@ lookup_face (f, attr) suitable face is found, realize a new one. */ int -face_for_font (f, font_object, base_face) - struct frame *f; - Lisp_Object font_object; - struct face *base_face; +face_for_font (struct frame *f, Lisp_Object font_object, struct face *base_face) { struct face_cache *cache = FRAME_FACE_CACHE (f); unsigned hash; @@ -4782,10 +4633,7 @@ face_for_font (f, font_object, base_face) face isn't realized and cannot be realized. */ int -lookup_named_face (f, symbol, signal_p) - struct frame *f; - Lisp_Object symbol; - int signal_p; +lookup_named_face (struct frame *f, Lisp_Object symbol, int signal_p) { Lisp_Object attrs[LFACE_VECTOR_SIZE]; Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; @@ -4803,7 +4651,7 @@ lookup_named_face (f, symbol, signal_p) if (! get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0)) return -1; - bcopy (default_face->lface, attrs, sizeof attrs); + memcpy (attrs, default_face->lface, sizeof attrs); merge_face_vectors (f, symbol_attrs, attrs, 0); return lookup_face (f, attrs); @@ -4817,9 +4665,7 @@ lookup_named_face (f, symbol, signal_p) rather than signal an error. */ int -lookup_basic_face (f, face_id) - struct frame *f; - int face_id; +lookup_basic_face (struct frame *f, int face_id) { Lisp_Object name, mapping; int remapped_face_id; @@ -4866,9 +4712,7 @@ lookup_basic_face (f, face_id) LFACE_ID on frame F. Value is -1 if LFACE_ID isn't valid. */ int -ascii_face_of_lisp_face (f, lface_id) - struct frame *f; - int lface_id; +ascii_face_of_lisp_face (struct frame *f, int lface_id) { int face_id; @@ -4889,9 +4733,7 @@ ascii_face_of_lisp_face (f, lface_id) STEPS < 0 means larger. Value is the id of the face. */ int -smaller_face (f, face_id, steps) - struct frame *f; - int face_id, steps; +smaller_face (struct frame *f, int face_id, int steps) { #ifdef HAVE_WINDOW_SYSTEM struct face *face; @@ -4910,7 +4752,7 @@ smaller_face (f, face_id, steps) steps = eabs (steps); face = FACE_FROM_ID (f, face_id); - bcopy (face->lface, attrs, sizeof attrs); + memcpy (attrs, face->lface, sizeof attrs); pt = last_pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]); new_face_id = face_id; last_height = FONT_HEIGHT (face->font); @@ -4950,10 +4792,7 @@ smaller_face (f, face_id, steps) FACE_ID on frame F, but has height HEIGHT. */ int -face_with_height (f, face_id, height) - struct frame *f; - int face_id; - int height; +face_with_height (struct frame *f, int face_id, int height) { #ifdef HAVE_WINDOW_SYSTEM struct face *face; @@ -4964,7 +4803,7 @@ face_with_height (f, face_id, height) return face_id; face = FACE_FROM_ID (f, face_id); - bcopy (face->lface, attrs, sizeof attrs); + memcpy (attrs, face->lface, sizeof attrs); attrs[LFACE_HEIGHT_INDEX] = make_number (height); font_clear_prop (attrs, FONT_SIZE_INDEX); face_id = lookup_face (f, attrs); @@ -4982,11 +4821,7 @@ face_with_height (f, face_id, height) default face. FACE_ID is assumed to be already realized. */ int -lookup_derived_face (f, symbol, face_id, signal_p) - struct frame *f; - Lisp_Object symbol; - int face_id; - int signal_p; +lookup_derived_face (struct frame *f, Lisp_Object symbol, int face_id, int signal_p) { Lisp_Object attrs[LFACE_VECTOR_SIZE]; Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; @@ -4998,7 +4833,7 @@ lookup_derived_face (f, symbol, face_id, signal_p) if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0)) return -1; - bcopy (default_face->lface, attrs, sizeof attrs); + memcpy (attrs, default_face->lface, sizeof attrs); merge_face_vectors (f, symbol_attrs, attrs, 0); return lookup_face (f, attrs); } @@ -5006,8 +4841,7 @@ lookup_derived_face (f, symbol, face_id, signal_p) DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector, Sface_attributes_as_vector, 1, 1, 0, doc: /* Return a vector of face attributes corresponding to PLIST. */) - (plist) - Lisp_Object plist; + (Lisp_Object plist) { Lisp_Object lface; lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), @@ -5043,10 +4877,7 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector, \(2) `close in spirit' to what the attributes specify, if not exact. */ static int -x_supports_face_attributes_p (f, attrs, def_face) - struct frame *f; - Lisp_Object *attrs; - struct face *def_face; +x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face *def_face) { Lisp_Object *def_attrs = def_face->lface; @@ -5092,7 +4923,7 @@ x_supports_face_attributes_p (f, attrs, def_face) Lisp_Object merged_attrs[LFACE_VECTOR_SIZE]; int i; - bcopy (def_attrs, merged_attrs, sizeof merged_attrs); + memcpy (merged_attrs, def_attrs, sizeof merged_attrs); merge_face_vectors (f, attrs, merged_attrs, 0); @@ -5147,10 +4978,7 @@ x_supports_face_attributes_p (f, attrs, def_face) substitution of a `dim' face for italic. */ static int -tty_supports_face_attributes_p (f, attrs, def_face) - struct frame *f; - Lisp_Object *attrs; - struct face *def_face; +tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face *def_face) { int weight; Lisp_Object val, fg, bg; @@ -5330,8 +5158,7 @@ any display that can display bold, and a `:foreground \"yellow\"' as long as it can display a yellowish color, but `:slant italic' will _not_ be satisfied by the tty display code's automatic substitution of a `dim' face for italic. */) - (attributes, display) - Lisp_Object attributes, display; + (Lisp_Object attributes, Lisp_Object display) { int supports = 0, i; Lisp_Object frame; @@ -5408,15 +5235,14 @@ first in ORDER are matched first, e.g. if `:height' appears before `:weight' in ORDER, font selection first tries to find a font with a suitable height, and then tries to match the font weight. Value is ORDER. */) - (order) - Lisp_Object order; + (Lisp_Object order) { Lisp_Object list; int i; int indices[DIM (font_sort_order)]; CHECK_LIST (order); - bzero (indices, sizeof indices); + memset (indices, 0, sizeof indices); i = 0; for (list = order; @@ -5448,9 +5274,9 @@ Value is ORDER. */) if (indices[i] == 0) signal_error ("Invalid font sort order", order); - if (bcmp (indices, font_sort_order, sizeof indices) != 0) + if (memcmp (indices, font_sort_order, sizeof indices) != 0) { - bcopy (indices, font_sort_order, sizeof font_sort_order); + memcpy (font_sort_order, indices, sizeof font_sort_order); free_all_realized_faces (Qnil); } @@ -5467,8 +5293,7 @@ DEFUN ("internal-set-alternative-font-family-alist", ALIST is an alist of (FAMILY ALTERNATIVE1 ALTERNATIVE2 ...) entries. Each ALTERNATIVE is tried in order if no fonts of font family FAMILY can be found. Value is ALIST. */) - (alist) - Lisp_Object alist; + (Lisp_Object alist) { Lisp_Object entry, tail, tail2; @@ -5497,8 +5322,7 @@ DEFUN ("internal-set-alternative-font-registry-alist", ALIST is an alist of (REGISTRY ALTERNATIVE1 ALTERNATIVE2 ...) entries. Each ALTERNATIVE is tried in order if no fonts of font registry REGISTRY can be found. Value is ALIST. */) - (alist) - Lisp_Object alist; + (Lisp_Object alist) { Lisp_Object entry, tail, tail2; @@ -5530,8 +5354,7 @@ be found. Value is ALIST. */) attribute of ATTRS doesn't name a fontset. */ static int -face_fontset (attrs) - Lisp_Object *attrs; +face_fontset (Lisp_Object *attrs) { Lisp_Object name; @@ -5554,8 +5377,7 @@ face_fontset (attrs) face. */ static int -realize_basic_faces (f) - struct frame *f; +realize_basic_faces (struct frame *f) { int success_p = 0; int count = SPECPDL_INDEX (); @@ -5603,8 +5425,7 @@ realize_basic_faces (f) that are not explicitly specified are taken from frame parameters. */ static int -realize_default_face (f) - struct frame *f; +realize_default_face (struct frame *f) { struct face_cache *c = FRAME_FACE_CACHE (f); Lisp_Object lface; @@ -5698,7 +5519,7 @@ realize_default_face (f) /* Realize the face; it must be fully-specified now. */ xassert (lface_fully_specified_p (XVECTOR (lface)->contents)); check_lface (lface); - bcopy (XVECTOR (lface)->contents, attrs, sizeof attrs); + memcpy (attrs, XVECTOR (lface)->contents, sizeof attrs); face = realize_face (c, attrs, DEFAULT_FACE_ID); #ifdef HAVE_WINDOW_SYSTEM @@ -5727,10 +5548,7 @@ realize_default_face (f) have. The default face must have been realized already. */ static void -realize_named_face (f, symbol, id) - struct frame *f; - Lisp_Object symbol; - int id; +realize_named_face (struct frame *f, Lisp_Object symbol, int id) { struct face_cache *c = FRAME_FACE_CACHE (f); Lisp_Object lface = lface_from_face_name (f, symbol, 0); @@ -5766,10 +5584,7 @@ realize_named_face (f, symbol, id) face. Value is a pointer to the newly created realized face. */ static struct face * -realize_face (cache, attrs, former_face_id) - struct face_cache *cache; - Lisp_Object *attrs; - int former_face_id; +realize_face (struct face_cache *cache, Lisp_Object *attrs, int former_face_id) { struct face *face; @@ -5783,6 +5598,7 @@ realize_face (cache, attrs, former_face_id) struct face *former_face = cache->faces_by_id[former_face_id]; uncache_face (cache, former_face); free_realized_face (cache->f, former_face); + SET_FRAME_GARBAGED (cache->f); } if (FRAME_WINDOW_P (cache->f)) @@ -5810,10 +5626,7 @@ realize_face (cache, attrs, former_face_id) no-font. */ static struct face * -realize_non_ascii_face (f, font_object, base_face) - struct frame *f; - Lisp_Object font_object; - struct face *base_face; +realize_non_ascii_face (struct frame *f, Lisp_Object font_object, struct face *base_face) { struct face_cache *cache = FRAME_FACE_CACHE (f); struct face *face; @@ -5847,9 +5660,7 @@ realize_non_ascii_face (f, font_object, base_face) created realized face. */ static struct face * -realize_x_face (cache, attrs) - struct face_cache *cache; - Lisp_Object *attrs; +realize_x_face (struct face_cache *cache, Lisp_Object *attrs) { struct face *face = NULL; #ifdef HAVE_WINDOW_SYSTEM @@ -6056,11 +5867,7 @@ realize_x_face (cache, attrs) default foreground/background colors. */ static void -map_tty_color (f, face, idx, defaulted) - struct frame *f; - struct face *face; - enum lface_attribute_index idx; - int *defaulted; +map_tty_color (struct frame *f, struct face *face, enum lface_attribute_index idx, int *defaulted) { Lisp_Object frame, color, def; int foreground_p = idx == LFACE_FOREGROUND_INDEX; @@ -6137,9 +5944,7 @@ map_tty_color (f, face, idx, defaulted) Value is a pointer to the newly created realized face. */ static struct face * -realize_tty_face (cache, attrs) - struct face_cache *cache; - Lisp_Object *attrs; +realize_tty_face (struct face_cache *cache, Lisp_Object *attrs) { struct face *face; int weight, slant; @@ -6202,8 +6007,7 @@ This affects bold faces on TTYs whose foreground is the default background color of the display and whose background is the default foreground color. For such faces, the bold face attribute is ignored if this variable is non-nil. */) - (suppress) - Lisp_Object suppress; + (Lisp_Object suppress) { tty_suppress_bold_inverse_default_colors_p = !NILP (suppress); ++face_change_count; @@ -6220,10 +6024,7 @@ is non-nil. */) property PROP on frame F in current_buffer. */ int -compute_char_face (f, ch, prop) - struct frame *f; - int ch; - Lisp_Object prop; +compute_char_face (struct frame *f, int ch, Lisp_Object prop) { int face_id; @@ -6239,7 +6040,7 @@ compute_char_face (f, ch, prop) { Lisp_Object attrs[LFACE_VECTOR_SIZE]; struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); - bcopy (default_face->lface, attrs, sizeof attrs); + memcpy (attrs, default_face->lface, sizeof attrs); merge_face_ref (f, prop, attrs, 1, 0); face_id = lookup_face (f, attrs); } @@ -6266,15 +6067,10 @@ compute_char_face (f, ch, prop) The face returned is suitable for displaying ASCII characters. */ int -face_at_buffer_position (w, pos, region_beg, region_end, - endptr, limit, mouse, base_face_id) - struct window *w; - EMACS_INT pos; - EMACS_INT region_beg, region_end; - EMACS_INT *endptr; - EMACS_INT limit; - int mouse; - int base_face_id; +face_at_buffer_position (struct window *w, EMACS_INT pos, + EMACS_INT region_beg, EMACS_INT region_end, + EMACS_INT *endptr, EMACS_INT limit, + int mouse, int base_face_id) { struct frame *f = XFRAME (w->frame); Lisp_Object attrs[LFACE_VECTOR_SIZE]; @@ -6328,7 +6124,7 @@ face_at_buffer_position (w, pos, region_beg, region_end, return default_face->id; /* Begin with attributes from the default face. */ - bcopy (default_face->lface, attrs, sizeof attrs); + memcpy (attrs, default_face->lface, sizeof attrs); /* Merge in attributes specified via text properties. */ if (!NILP (prop)) @@ -6374,15 +6170,10 @@ face_at_buffer_position (w, pos, region_beg, region_end, simply disregards the `face' properties of all overlays. */ int -face_for_overlay_string (w, pos, region_beg, region_end, - endptr, limit, mouse, overlay) - struct window *w; - EMACS_INT pos; - EMACS_INT region_beg, region_end; - EMACS_INT *endptr; - EMACS_INT limit; - int mouse; - Lisp_Object overlay; +face_for_overlay_string (struct window *w, EMACS_INT pos, + EMACS_INT region_beg, EMACS_INT region_end, + EMACS_INT *endptr, EMACS_INT limit, + int mouse, Lisp_Object overlay) { struct frame *f = XFRAME (w->frame); Lisp_Object attrs[LFACE_VECTOR_SIZE]; @@ -6422,7 +6213,7 @@ face_for_overlay_string (w, pos, region_beg, region_end, return DEFAULT_FACE_ID; /* Begin with attributes from the default face. */ - bcopy (default_face->lface, attrs, sizeof attrs); + memcpy (attrs, default_face->lface, sizeof attrs); /* Merge in attributes specified via text properties. */ if (!NILP (prop)) @@ -6467,15 +6258,11 @@ face_for_overlay_string (w, pos, region_beg, region_end, for displaying ASCII characters. */ int -face_at_string_position (w, string, pos, bufpos, region_beg, - region_end, endptr, base_face_id, mouse_p) - struct window *w; - Lisp_Object string; - EMACS_INT pos, bufpos; - EMACS_INT region_beg, region_end; - EMACS_INT *endptr; - enum face_id base_face_id; - int mouse_p; +face_at_string_position (struct window *w, Lisp_Object string, + EMACS_INT pos, EMACS_INT bufpos, + EMACS_INT region_beg, EMACS_INT region_end, + EMACS_INT *endptr, enum face_id base_face_id, + int mouse_p) { Lisp_Object prop, position, end, limit; struct frame *f = XFRAME (WINDOW_FRAME (w)); @@ -6523,7 +6310,7 @@ face_at_string_position (w, string, pos, bufpos, region_beg, return base_face->id; /* Begin with attributes from the base face. */ - bcopy (base_face->lface, attrs, sizeof attrs); + memcpy (attrs, base_face->lface, sizeof attrs); /* Merge in attributes specified via text properties. */ if (!NILP (prop)) @@ -6557,10 +6344,7 @@ face_at_string_position (w, string, pos, bufpos, region_beg, */ int -merge_faces (f, face_name, face_id, base_face_id) - struct frame *f; - Lisp_Object face_name; - int face_id, base_face_id; +merge_faces (struct frame *f, Lisp_Object face_name, int face_id, int base_face_id) { Lisp_Object attrs[LFACE_VECTOR_SIZE]; struct face *base_face; @@ -6581,7 +6365,7 @@ merge_faces (f, face_name, face_id, base_face_id) } /* Begin with attributes from the base face. */ - bcopy (base_face->lface, attrs, sizeof attrs); + memcpy (attrs, base_face->lface, sizeof attrs); if (!NILP (face_name)) { @@ -6614,8 +6398,7 @@ DEFUN ("x-load-color-file", Fx_load_color_file, The file should define one named RGB color per line like so: R G B name where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */) - (filename) - Lisp_Object filename; + (Lisp_Object filename) { FILE *fp; Lisp_Object cmap = Qnil; @@ -6697,8 +6480,7 @@ dump_realized_face (face) DEFUN ("dump-face", Fdump_face, Sdump_face, 0, 1, 0, doc: /* */) - (n) - Lisp_Object n; + (Lisp_Object n) { if (NILP (n)) { @@ -6732,7 +6514,7 @@ DEFUN ("dump-face", Fdump_face, Sdump_face, 0, 1, 0, doc: /* */) DEFUN ("show-face-resources", Fshow_face_resources, Sshow_face_resources, 0, 0, 0, doc: /* */) - () + (void) { fprintf (stderr, "number of colors = %d\n", ncolors_allocated); fprintf (stderr, "number of pixmaps = %d\n", npixmaps_allocated); @@ -6749,7 +6531,7 @@ DEFUN ("show-face-resources", Fshow_face_resources, Sshow_face_resources, ***********************************************************************/ void -syms_of_xfaces () +syms_of_xfaces (void) { Qface = intern_c_string ("face"); staticpro (&Qface); @@ -6988,10 +6770,10 @@ Each element is of the form: (FACE REPLACEMENT...), which causes display of the face FACE to use REPLACEMENT... instead. -REPLACEMENT... is interpreted the same way the value of a `face' text -property is: it may be (1) A face name, (2) A list of face names, (3) A -property-list of face attribute/value pairs, or (4) A list of face names -intermixed with lists containing face attribute/value pairs. +REPLACEMENT... is interpreted the same way as the value of a `face' +text property: it may be (1) A face name, (2) A list of face names, +(3) A property-list of face attribute/value pairs, or (4) A list of +face names or lists containing face attribute/value pairs. Multiple entries in REPLACEMENT... are merged together to form the final result, with faces or attributes earlier in the list taking precedence @@ -7015,7 +6797,11 @@ face definitions. For instance, the mode my-mode could define a face `my-mode-default', and then in the mode setup function, do: (set (make-local-variable 'face-remapping-alist) - '((default my-mode-default)))). */); + '((default my-mode-default)))). + +Because Emacs normally only redraws screen areas when the underlying +buffer contents change, you may need to call `redraw-display' after +changing this variable for it to take effect. */); Vface_remapping_alist = Qnil; DEFVAR_LISP ("face-font-rescale-alist", &Vface_font_rescale_alist, diff --git a/src/xfns.c b/src/xfns.c index d19914e8dec..ee020371683 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -204,6 +204,9 @@ extern Lisp_Object Vsystem_name; /* The below are defined in frame.c. */ +extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode; +extern Lisp_Object Qtooltip; + #if GLYPH_DEBUG int image_cache_refcount, dpyinfo_refcount; #endif @@ -216,7 +219,7 @@ char *x_last_font_name; /* Error if we are not connected to X. */ void -check_x () +check_x (void) { if (! x_in_use) error ("X windows are not in use or not initialized"); @@ -226,7 +229,7 @@ check_x () You should not call this unless HAVE_MENUS is defined. */ int -have_menus_p () +have_menus_p (void) { return x_in_use; } @@ -235,8 +238,7 @@ have_menus_p () and checking validity for X. */ FRAME_PTR -check_x_frame (frame) - Lisp_Object frame; +check_x_frame (Lisp_Object frame) { FRAME_PTR f; @@ -255,8 +257,7 @@ check_x_frame (frame) the first X display on the list. */ struct x_display_info * -check_x_display_info (object) - Lisp_Object object; +check_x_display_info (Lisp_Object object) { struct x_display_info *dpyinfo = NULL; @@ -298,9 +299,7 @@ check_x_display_info (object) /* This function can be called during GC, so use GC_xxx type test macros. */ struct frame * -x_window_to_frame (dpyinfo, wdesc) - struct x_display_info *dpyinfo; - int wdesc; +x_window_to_frame (struct x_display_info *dpyinfo, int wdesc) { Lisp_Object tail, frame; struct frame *f; @@ -348,9 +347,7 @@ x_window_to_frame (dpyinfo, wdesc) windows. */ struct frame * -x_any_window_to_frame (dpyinfo, wdesc) - struct x_display_info *dpyinfo; - int wdesc; +x_any_window_to_frame (struct x_display_info *dpyinfo, int wdesc) { Lisp_Object tail, frame; struct frame *f, *found; @@ -401,10 +398,9 @@ x_any_window_to_frame (dpyinfo, wdesc) /* Likewise, but consider only the menu bar widget. */ struct frame * -x_menubar_window_to_frame (dpyinfo, wdesc) - struct x_display_info *dpyinfo; - int wdesc; +x_menubar_window_to_frame (struct x_display_info *dpyinfo, XEvent *event) { + Window wdesc = event->xany.window; Lisp_Object tail, frame; struct frame *f; struct x_output *x; @@ -420,21 +416,11 @@ x_menubar_window_to_frame (dpyinfo, wdesc) if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) continue; x = f->output_data.x; - /* Match if the window is this frame's menubar. */ #ifdef USE_GTK - if (x->menubar_widget) - { - GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc); - - /* This gives false positives, but the rectangle check in xterm.c - where this is called takes care of that. */ - if (gwdesc != 0 - && (gwdesc == x->menubar_widget - || gtk_widget_is_ancestor (x->menubar_widget, gwdesc) - || gtk_widget_is_ancestor (gwdesc, x->menubar_widget))) - return f; - } + if (x->menubar_widget && xg_event_is_for_menubar (f, event)) + return f; #else + /* Match if the window is this frame's menubar. */ if (x->menubar_widget && lw_window_is_in_menubar (wdesc, x->menubar_widget)) return f; @@ -447,9 +433,7 @@ x_menubar_window_to_frame (dpyinfo, wdesc) If WDESC is some other (smaller) window, we return 0. */ struct frame * -x_top_window_to_frame (dpyinfo, wdesc) - struct x_display_info *dpyinfo; - int wdesc; +x_top_window_to_frame (struct x_display_info *dpyinfo, int wdesc) { Lisp_Object tail, frame; struct frame *f; @@ -497,33 +481,33 @@ x_top_window_to_frame (dpyinfo, wdesc) -static void x_default_font_parameter P_ ((struct frame *, Lisp_Object)); +static void x_default_font_parameter (struct frame *, Lisp_Object); -static Lisp_Object unwind_create_frame P_ ((Lisp_Object)); -static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object)); +static Lisp_Object unwind_create_frame (Lisp_Object); +static Lisp_Object unwind_create_tip_frame (Lisp_Object); -void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); -static void x_set_wait_for_wm P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_icon_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_icon_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_explicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); -void x_set_scroll_bar_foreground P_ ((struct frame *, Lisp_Object, - Lisp_Object)); -void x_set_scroll_bar_background P_ ((struct frame *, Lisp_Object, - Lisp_Object)); -static Lisp_Object x_default_scroll_bar_color_parameter P_ ((struct frame *, - Lisp_Object, - Lisp_Object, - char *, char *, - int)); +void x_set_foreground_color (struct frame *, Lisp_Object, Lisp_Object); +static void x_set_wait_for_wm (struct frame *, Lisp_Object, Lisp_Object); +void x_set_background_color (struct frame *, Lisp_Object, Lisp_Object); +void x_set_mouse_color (struct frame *, Lisp_Object, Lisp_Object); +void x_set_cursor_color (struct frame *, Lisp_Object, Lisp_Object); +void x_set_border_color (struct frame *, Lisp_Object, Lisp_Object); +void x_set_cursor_type (struct frame *, Lisp_Object, Lisp_Object); +void x_set_icon_type (struct frame *, Lisp_Object, Lisp_Object); +void x_set_icon_name (struct frame *, Lisp_Object, Lisp_Object); +void x_explicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); +void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); +void x_set_title (struct frame *, Lisp_Object, Lisp_Object); +void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object); +void x_set_scroll_bar_foreground (struct frame *, Lisp_Object, + Lisp_Object); +void x_set_scroll_bar_background (struct frame *, Lisp_Object, + Lisp_Object); +static Lisp_Object x_default_scroll_bar_color_parameter (struct frame *, + Lisp_Object, + Lisp_Object, + char *, char *, + int); /* Store the screen positions of frame F into XPTR and YPTR. @@ -531,9 +515,7 @@ static Lisp_Object x_default_scroll_bar_color_parameter P_ ((struct frame *, not Emacs's own window. */ void -x_real_positions (f, xptr, yptr) - FRAME_PTR f; - int *xptr, *yptr; +x_real_positions (FRAME_PTR f, int *xptr, int *yptr) { int win_x, win_y, outer_x, outer_y; int real_x = 0, real_y = 0; @@ -651,9 +633,7 @@ x_real_positions (f, xptr, yptr) /* Gamma-correct COLOR on frame F. */ void -gamma_correct (f, color) - struct frame *f; - XColor *color; +gamma_correct (struct frame *f, XColor *color) { if (f->gamma) { @@ -670,11 +650,7 @@ gamma_correct (f, color) no color could be allocated. */ int -x_defined_color (f, color_name, color, alloc_p) - struct frame *f; - char *color_name; - XColor *color; - int alloc_p; +x_defined_color (struct frame *f, char *color_name, XColor *color, int alloc_p) { int success_p; Display *dpy = FRAME_X_DISPLAY (f); @@ -695,10 +671,7 @@ x_defined_color (f, color_name, color, alloc_p) Signal an error if color can't be allocated. */ int -x_decode_color (f, color_name, mono_color) - FRAME_PTR f; - Lisp_Object color_name; - int mono_color; +x_decode_color (FRAME_PTR f, Lisp_Object color_name, int mono_color) { XColor cdef; @@ -732,9 +705,7 @@ x_decode_color (f, color_name, mono_color) See also the comment of wait_for_wm in struct x_output. */ static void -x_set_wait_for_wm (f, new_value, old_value) - struct frame *f; - Lisp_Object new_value, old_value; +x_set_wait_for_wm (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { f->output_data.x->wait_for_wm = !NILP (new_value); } @@ -745,9 +716,7 @@ x_set_wait_for_wm (f, new_value, old_value) may be any format that GdkPixbuf knows about, i.e. not just bitmaps. */ int -xg_set_icon (f, file) - FRAME_PTR f; - Lisp_Object file; +xg_set_icon (FRAME_PTR f, Lisp_Object file) { int result = 0; Lisp_Object found; @@ -781,9 +750,7 @@ xg_set_icon (f, file) } int -xg_set_icon_from_xpm_data (f, data) - FRAME_PTR f; - char **data; +xg_set_icon_from_xpm_data (FRAME_PTR f, char **data) { int result = 0; GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) data); @@ -807,9 +774,7 @@ xg_set_icon_from_xpm_data (f, data) in the standard place; do not attempt to change the window. */ void -x_set_foreground_color (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { struct x_output *x = f->output_data.x; unsigned long fg, old_fg; @@ -845,9 +810,7 @@ x_set_foreground_color (f, arg, oldval) } void -x_set_background_color (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { struct x_output *x = f->output_data.x; unsigned long bg; @@ -893,8 +856,7 @@ x_set_background_color (f, arg, oldval) } static Cursor -make_invisible_cursor (f) - struct frame *f; +make_invisible_cursor (struct frame *f) { Display *dpy = FRAME_X_DISPLAY (f); static char const no_data[] = { 0 }; @@ -922,9 +884,7 @@ make_invisible_cursor (f) } void -x_set_mouse_color (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { struct x_output *x = f->output_data.x; Display *dpy = FRAME_X_DISPLAY (f); @@ -1069,9 +1029,7 @@ x_set_mouse_color (f, arg, oldval) } void -x_set_cursor_color (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { unsigned long fore_pixel, pixel; int fore_pixel_allocated_p = 0, pixel_allocated_p = 0; @@ -1142,9 +1100,7 @@ x_set_cursor_color (f, arg, oldval) F has an x-window. */ void -x_set_border_pixel (f, pix) - struct frame *f; - int pix; +x_set_border_pixel (struct frame *f, int pix) { unload_color (f, f->output_data.x->border_pixel); f->output_data.x->border_pixel = pix; @@ -1173,9 +1129,7 @@ x_set_border_pixel (f, pix) and so emacs' border colors may be overridden. */ void -x_set_border_color (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_border_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { int pix; @@ -1187,9 +1141,7 @@ x_set_border_color (f, arg, oldval) void -x_set_cursor_type (f, arg, oldval) - FRAME_PTR f; - Lisp_Object arg, oldval; +x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) { set_frame_cursor_types (f, arg); @@ -1198,9 +1150,7 @@ x_set_cursor_type (f, arg, oldval) } void -x_set_icon_type (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { int result; @@ -1232,9 +1182,7 @@ x_set_icon_type (f, arg, oldval) } void -x_set_icon_name (f, arg, oldval) - struct frame *f; - Lisp_Object arg, oldval; +x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { int result; @@ -1272,9 +1220,7 @@ x_set_icon_name (f, arg, oldval) void -x_set_menu_bar_lines (f, value, oldval) - struct frame *f; - Lisp_Object value, oldval; +x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { int nlines; #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) @@ -1364,9 +1310,7 @@ x_set_menu_bar_lines (f, value, oldval) The frame's height doesn't change. */ void -x_set_tool_bar_lines (f, value, oldval) - struct frame *f; - Lisp_Object value, oldval; +x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { int delta, nlines, root_height; Lisp_Object root_window; @@ -1461,9 +1405,7 @@ x_set_tool_bar_lines (f, value, oldval) the frame parameter. */ void -x_set_scroll_bar_foreground (f, value, oldval) - struct frame *f; - Lisp_Object value, oldval; +x_set_scroll_bar_foreground (struct frame *f, Lisp_Object value, Lisp_Object oldval) { unsigned long pixel; @@ -1496,9 +1438,7 @@ x_set_scroll_bar_foreground (f, value, oldval) parameter. */ void -x_set_scroll_bar_background (f, value, oldval) - struct frame *f; - Lisp_Object value, oldval; +x_set_scroll_bar_background (struct frame *f, Lisp_Object value, Lisp_Object oldval) { unsigned long pixel; @@ -1561,11 +1501,7 @@ x_set_scroll_bar_background (f, value, oldval) the result should be `COMPOUND_TEXT'. */ static unsigned char * -x_encode_text (string, coding_system, selectionp, text_bytes, stringp, freep) - Lisp_Object string, coding_system; - int *text_bytes, *stringp; - int selectionp; - int *freep; +x_encode_text (Lisp_Object string, Lisp_Object coding_system, int selectionp, int *text_bytes, int *stringp, int *freep) { int result = string_xstring_p (string); struct coding_system coding; @@ -1599,9 +1535,7 @@ x_encode_text (string, coding_system, selectionp, text_bytes, stringp, freep) icon name to NAME. */ static void -x_set_name_internal (f, name) - FRAME_PTR f; - Lisp_Object name; +x_set_name_internal (FRAME_PTR f, Lisp_Object name) { if (FRAME_X_WINDOW (f)) { @@ -1611,8 +1545,8 @@ x_set_name_internal (f, name) int bytes, stringp; int do_free_icon_value = 0, do_free_text_value = 0; Lisp_Object coding_system; -#ifdef USE_GTK Lisp_Object encoded_name; + Lisp_Object encoded_icon_name; struct gcpro gcpro1; /* As ENCODE_UTF_8 may cause GC and relocation of string data, @@ -1620,7 +1554,6 @@ x_set_name_internal (f, name) GCPRO1 (name); encoded_name = ENCODE_UTF_8 (name); UNGCPRO; -#endif coding_system = Qcompound_text; /* Note: Encoding strategy @@ -1636,7 +1569,12 @@ x_set_name_internal (f, name) We may also be able to use "UTF8_STRING" in text.encoding in the future which can encode all Unicode characters. But, for the moment, there's no way to know that the - current window manager supports it or not. */ + current window manager supports it or not. + + Either way, we also set the _NET_WM_NAME and _NET_WM_ICON_NAME + properties. Per the EWMH specification, those two properties + are always UTF8_STRING. This matches what gtk_window_set_title() + does in the USE_GTK case. */ text.value = x_encode_text (name, coding_system, 0, &bytes, &stringp, &do_free_text_value); text.encoding = (stringp ? XA_STRING @@ -1647,6 +1585,7 @@ x_set_name_internal (f, name) if (!STRINGP (f->icon_name)) { icon = text; + encoded_icon_name = encoded_name; } else { @@ -1657,6 +1596,8 @@ x_set_name_internal (f, name) : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT); icon.format = 8; icon.nitems = bytes; + + encoded_icon_name = ENCODE_UTF_8 (f->icon_name); } #ifdef USE_GTK @@ -1664,9 +1605,21 @@ x_set_name_internal (f, name) (char *) SDATA (encoded_name)); #else /* not USE_GTK */ XSetWMName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &text); + XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), + FRAME_X_DISPLAY_INFO (f)->Xatom_net_wm_name, + FRAME_X_DISPLAY_INFO (f)->Xatom_UTF8_STRING, + 8, PropModeReplace, + (char *) SDATA (encoded_name), + SBYTES (encoded_name)); #endif /* not USE_GTK */ XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &icon); + XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), + FRAME_X_DISPLAY_INFO (f)->Xatom_net_wm_icon_name, + FRAME_X_DISPLAY_INFO (f)->Xatom_UTF8_STRING, + 8, PropModeReplace, + (char *) SDATA (encoded_icon_name), + SBYTES (encoded_icon_name)); if (do_free_icon_value) xfree (icon.value); @@ -1689,10 +1642,7 @@ x_set_name_internal (f, name) F->explicit_name is set, ignore the new name; otherwise, set it. */ void -x_set_name (f, name, explicit) - struct frame *f; - Lisp_Object name; - int explicit; +x_set_name (struct frame *f, Lisp_Object name, int explicit) { /* Make sure that requests from lisp code override requests from Emacs redisplay code. */ @@ -1739,9 +1689,7 @@ x_set_name (f, name, explicit) specified a name for the frame; the name will override any set by the redisplay code. */ void -x_explicitly_set_name (f, arg, oldval) - FRAME_PTR f; - Lisp_Object arg, oldval; +x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) { x_set_name (f, arg, 1); } @@ -1750,9 +1698,7 @@ x_explicitly_set_name (f, arg, oldval) name; names set this way will never override names set by the user's lisp code. */ void -x_implicitly_set_name (f, arg, oldval) - FRAME_PTR f; - Lisp_Object arg, oldval; +x_implicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) { x_set_name (f, arg, 0); } @@ -1761,9 +1707,7 @@ x_implicitly_set_name (f, arg, oldval) If NAME is nil, use the frame name as the title. */ void -x_set_title (f, name, old_name) - struct frame *f; - Lisp_Object name, old_name; +x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) { /* Don't change the title if it's already NAME. */ if (EQ (name, f->title)) @@ -1782,8 +1726,7 @@ x_set_title (f, name, old_name) } void -x_set_scroll_bar_default_width (f) - struct frame *f; +x_set_scroll_bar_default_width (struct frame *f) { int wid = FRAME_COLUMN_WIDTH (f); @@ -1810,14 +1753,10 @@ x_set_scroll_bar_default_width (f) named NAME. If that is not found either, use the value DEFLT. */ static Lisp_Object -x_default_scroll_bar_color_parameter (f, alist, prop, xprop, xclass, - foreground_p) - struct frame *f; - Lisp_Object alist; - Lisp_Object prop; - char *xprop; - char *xclass; - int foreground_p; +x_default_scroll_bar_color_parameter (struct frame *f, + Lisp_Object alist, Lisp_Object prop, + char *xprop, char *xclass, + int foreground_p) { struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); Lisp_Object tem; @@ -1868,9 +1807,7 @@ x_default_scroll_bar_color_parameter (f, alist, prop, xprop, xclass, for example, but Xt doesn't). */ static void -hack_wm_protocols (f, widget) - FRAME_PTR f; - Widget widget; +hack_wm_protocols (FRAME_PTR f, Widget widget) { Display *dpy = XtDisplay (widget); Window w = XtWindow (widget); @@ -1936,8 +1873,8 @@ hack_wm_protocols (f, widget) #ifdef HAVE_X_I18N -static XFontSet xic_create_xfontset P_ ((struct frame *)); -static XIMStyle best_xim_style P_ ((XIMStyles *, XIMStyles *)); +static XFontSet xic_create_xfontset (struct frame *); +static XIMStyle best_xim_style (XIMStyles *, XIMStyles *); /* Supported XIM styles, ordered by preference. */ @@ -1964,9 +1901,7 @@ char xic_defaut_fontset[] = "-*-*-*-r-normal--14-*-*-*-*-*-*-*"; /* Create an Xt fontset spec from the name of a base font. If `motif' is True use the Motif syntax. */ char * -xic_create_fontsetname (base_fontname, motif) - char *base_fontname; - Bool motif; +xic_create_fontsetname (char *base_fontname, int motif) { const char *sep = motif ? ";" : ","; char *fontsetname; @@ -1976,7 +1911,7 @@ xic_create_fontsetname (base_fontname, motif) { /* There is no base font name, use the default. */ int len = strlen (base_fontname) + 2; fontsetname = xmalloc (len); - bzero (fontsetname, len); + memset (fontsetname, 0, len); strcpy (fontsetname, base_fontname); } else @@ -1997,7 +1932,7 @@ xic_create_fontsetname (base_fontname, motif) Use the specified font plus the default. */ int len = strlen (base_fontname) + strlen (xic_defaut_fontset) + 3; fontsetname = xmalloc (len); - bzero (fontsetname, len); + memset (fontsetname, 0, len); strcpy (fontsetname, base_fontname); strcat (fontsetname, sep); strcat (fontsetname, xic_defaut_fontset); @@ -2034,7 +1969,7 @@ xic_create_fontsetname (base_fontname, motif) int diff = (p2 - p3) - 2; base = alloca (strlen (base_fontname) + 1); - bcopy (base_fontname, base, p3 - base_fontname); + memcpy (base, base_fontname, p3 - base_fontname); base[p3 - base_fontname] = '*'; base[(p3 - base_fontname) + 1] = '-'; strcpy (base + (p3 - base_fontname) + 2, p2); @@ -2047,33 +1982,33 @@ xic_create_fontsetname (base_fontname, motif) /* Build the font spec that matches all charsets. */ len = p - base_fontname + strlen (allcs) + 1; font_allcs = (char *) alloca (len); - bzero (font_allcs, len); - bcopy (base_fontname, font_allcs, p - base_fontname); + memset (font_allcs, 0, len); + memcpy (font_allcs, base_fontname, p - base_fontname); strcat (font_allcs, allcs); /* Build the font spec that matches all families and add-styles. */ len = p - p1 + strlen (allcs) + strlen (allfamilies) + 1; font_allfamilies = (char *) alloca (len); - bzero (font_allfamilies, len); + memset (font_allfamilies, 0, len); strcpy (font_allfamilies, allfamilies); - bcopy (p1, font_allfamilies + strlen (allfamilies), p - p1); + memcpy (font_allfamilies + strlen (allfamilies), p1, p - p1); strcat (font_allfamilies, allcs); /* Build the font spec that matches all. */ len = p - p2 + strlen (allcs) + strlen (all) + strlen (allfamilies) + 1; font_all = (char *) alloca (len); - bzero (font_all, len); + memset (font_all, 0, len); strcpy (font_all, allfamilies); strcat (font_all, all); - bcopy (p2, font_all + strlen (all) + strlen (allfamilies), p - p2); + memcpy (font_all + strlen (all) + strlen (allfamilies), p2, p - p2); strcat (font_all, allcs); /* Build the actual font set name. */ len = strlen (base_fontname) + strlen (font_allcs) + strlen (font_allfamilies) + strlen (font_all) + 5; fontsetname = xmalloc (len); - bzero (fontsetname, len); + memset (fontsetname, 0, len); strcpy (fontsetname, base_fontname); strcat (fontsetname, sep); strcat (fontsetname, font_allcs); @@ -2112,8 +2047,7 @@ print_fontset_result (xfs, name, missing_list, missing_count) #endif static XFontSet -xic_create_xfontset (f) - struct frame *f; +xic_create_xfontset (struct frame *f) { XFontSet xfs = NULL; struct font *font = FRAME_FONT (f); @@ -2212,8 +2146,7 @@ xic_create_xfontset (f) /* Free the X fontset of frame F if it is the last frame using it. */ void -xic_free_xfontset (f) - struct frame *f; +xic_free_xfontset (struct frame *f) { Lisp_Object rest, frame; int shared_p = 0; @@ -2250,9 +2183,7 @@ xic_free_xfontset (f) input method XIM. */ static XIMStyle -best_xim_style (user, xim) - XIMStyles *user; - XIMStyles *xim; +best_xim_style (XIMStyles *user, XIMStyles *xim) { int i, j; @@ -2270,8 +2201,7 @@ best_xim_style (user, xim) static XIMStyle xic_style; void -create_frame_xic (f) - struct frame *f; +create_frame_xic (struct frame *f) { XIM xim; XIC xic = NULL; @@ -2346,8 +2276,7 @@ create_frame_xic (f) /* Destroy XIC and free XIC fontset of frame F, if any. */ void -free_frame_xic (f) - struct frame *f; +free_frame_xic (struct frame *f) { if (FRAME_XIC (f) == NULL) return; @@ -2363,9 +2292,7 @@ free_frame_xic (f) pixel position X/Y. X and Y are relative to window W. */ void -xic_set_preeditarea (w, x, y) - struct window *w; - int x, y; +xic_set_preeditarea (struct window *w, int x, int y) { struct frame *f = XFRAME (w->frame); XVaNestedList attr; @@ -2382,8 +2309,7 @@ xic_set_preeditarea (w, x, y) /* Place status area for XIC in bottom right corner of frame F.. */ void -xic_set_statusarea (f) - struct frame *f; +xic_set_statusarea (struct frame *f) { XIC xic = FRAME_XIC (f); XVaNestedList attr; @@ -2427,9 +2353,7 @@ xic_set_statusarea (f) BASE_FONTNAME. Called when a new Emacs fontset is chosen. */ void -xic_set_xfontset (f, base_fontname) - struct frame *f; - char *base_fontname; +xic_set_xfontset (struct frame *f, char *base_fontname) { XVaNestedList attr; XFontSet xfs; @@ -2457,10 +2381,7 @@ xic_set_xfontset (f, base_fontname) /* Create and set up the X widget for frame F. */ static void -x_window (f, window_prompting, minibuffer_only) - struct frame *f; - long window_prompting; - int minibuffer_only; +x_window (struct frame *f, long window_prompting, int minibuffer_only) { XClassHint class_hints; XSetWindowAttributes attributes; @@ -2512,6 +2433,7 @@ x_window (f, window_prompting, minibuffer_only) XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++; XtSetArg (al[ac], XtNdepth, FRAME_X_DISPLAY_INFO (f)->n_planes); ac++; XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++; + XtSetArg (al[ac], XtNborderWidth, 0); ac++; XtSetValues (pane_widget, al, ac); f->output_data.x->column_widget = pane_widget; @@ -2527,6 +2449,7 @@ x_window (f, window_prompting, minibuffer_only) XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++; XtSetArg (al[ac], XtNdepth, FRAME_X_DISPLAY_INFO (f)->n_planes); ac++; XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++; + XtSetArg (al[ac], XtNborderWidth, 0); ac++; frame_widget = XtCreateWidget (f->namebuf, emacsFrameClass, pane_widget, al, ac); @@ -2704,8 +2627,7 @@ x_window (f, window_prompting, minibuffer_only) #else /* not USE_X_TOOLKIT */ #ifdef USE_GTK void -x_window (f) - FRAME_PTR f; +x_window (FRAME_PTR f) { if (! xg_create_frame_widgets (f)) error ("Unable to create window"); @@ -2745,9 +2667,7 @@ x_window (f) /* Create and set up the X window for frame F. */ void -x_window (f) - struct frame *f; - +x_window (struct frame *f) { XClassHint class_hints; XSetWindowAttributes attributes; @@ -2852,9 +2772,7 @@ x_window (f) /* Verify that the icon position args for this window are valid. */ static void -x_icon_verify (f, parms) - struct frame *f; - Lisp_Object parms; +x_icon_verify (struct frame *f, Lisp_Object parms) { Lisp_Object icon_x, icon_y; @@ -2876,9 +2794,7 @@ x_icon_verify (f, parms) well. */ static void -x_icon (f, parms) - struct frame *f; - Lisp_Object parms; +x_icon (struct frame *f, Lisp_Object parms) { Lisp_Object icon_x, icon_y; #if 0 @@ -2924,8 +2840,7 @@ x_icon (f, parms) mouse cursor and the gray border tile. */ static void -x_make_gc (f) - struct frame *f; +x_make_gc (struct frame *f) { XGCValues gc_values; @@ -2984,8 +2899,7 @@ x_make_gc (f) /* Free what was allocated in x_make_gc. */ void -x_free_gcs (f) - struct frame *f; +x_free_gcs (struct frame *f) { Display *dpy = FRAME_X_DISPLAY (f); @@ -3024,8 +2938,7 @@ x_free_gcs (f) constructed. */ static Lisp_Object -unwind_create_frame (frame) - Lisp_Object frame; +unwind_create_frame (Lisp_Object frame) { struct frame *f = XFRAME (frame); @@ -3057,32 +2970,34 @@ unwind_create_frame (frame) static void -x_default_font_parameter (f, parms) - struct frame *f; - Lisp_Object parms; +x_default_font_parameter (struct frame *f, Lisp_Object parms) { struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); Lisp_Object font_param = x_get_arg (dpyinfo, parms, Qfont, NULL, NULL, RES_TYPE_STRING); - Lisp_Object font; - int got_from_gconf = 0; + Lisp_Object font = Qnil; if (EQ (font_param, Qunbound)) font_param = Qnil; if (NILP (font_param)) { - /* System font takes precedendce over X resources. We must suggest this + /* System font should take precedendce over X resources. We suggest this regardless of font-use-system-font because .emacs may not have been read yet. */ const char *system_font = xsettings_get_system_font (); - if (system_font) font_param = make_string (system_font, - strlen (system_font)); + if (system_font) + { + char *name = xstrdup (system_font); + font = font_open_by_name (f, name); + free (name); + } } - - font = !NILP (font_param) ? font_param - : x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING); - if (! STRINGP (font)) + if (NILP (font)) + font = !NILP (font_param) ? font_param + : x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING); + + if (! FONTP (font) && ! STRINGP (font)) { char *names[] = { @@ -3119,10 +3034,8 @@ x_default_font_parameter (f, parms) x_set_frame_parameters (f, Fcons (Fcons (Qfont_param, font_param), Qnil)); } - x_default_parameter (f, parms, Qfont, font, - got_from_gconf ? NULL : "font", - got_from_gconf ? NULL : "Font", - RES_TYPE_STRING); + /* This call will make X resources override any system font setting. */ + x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING); } @@ -3130,8 +3043,7 @@ DEFUN ("x-wm-set-size-hint", Fx_wm_set_size_hint, Sx_wm_set_size_hint, 0, 1, 0, doc: /* Send the size hints for frame FRAME to the window manager. If FRAME is nil, use the selected frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { struct frame *f; if (NILP (frame)) @@ -3186,8 +3098,7 @@ then `default-minibuffer-frame' must be a frame whose minibuffer can be shared by the new frame. This function is an internal primitive--use `make-frame' instead. */) - (parms) - Lisp_Object parms; + (Lisp_Object parms) { struct frame *f; Lisp_Object frame, tem; @@ -3264,7 +3175,7 @@ This function is an internal primitive--use `make-frame' instead. */) f->output_method = output_x_window; f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); - bzero (f->output_data.x, sizeof (struct x_output)); + memset (f->output_data.x, 0, sizeof (struct x_output)); f->output_data.x->icon_bitmap = -1; FRAME_FONTSET (f) = -1; f->output_data.x->scroll_bar_foreground_pixel = -1; @@ -3444,10 +3355,18 @@ This function is an internal primitive--use `make-frame' instead. */) happen. */ init_frame_faces (f); - x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), - "menuBar", "MenuBar", RES_TYPE_BOOLEAN_NUMBER); - x_default_parameter (f, parms, Qtool_bar_lines, make_number (1), - "toolBar", "ToolBar", RES_TYPE_NUMBER); + /* The X resources controlling the menu-bar and tool-bar are + processed specially at startup, and reflected in the mode + variables; ignore them here. */ + x_default_parameter (f, parms, Qmenu_bar_lines, + NILP (Vmenu_bar_mode) + ? make_number (0) : make_number (1), + NULL, NULL, RES_TYPE_NUMBER); + x_default_parameter (f, parms, Qtool_bar_lines, + NILP (Vtool_bar_mode) + ? make_number (0) : make_number (1), + NULL, NULL, RES_TYPE_NUMBER); + x_default_parameter (f, parms, Qbuffer_predicate, Qnil, "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); @@ -3599,8 +3518,7 @@ This function is an internal primitive--use `make-frame' instead. */) know about that structure. */ Lisp_Object -x_get_focus_frame (frame) - struct frame *frame; +x_get_focus_frame (struct frame *frame) { struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (frame); Lisp_Object xfocus; @@ -3624,8 +3542,7 @@ x_get_focus_frame (frame) DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, doc: /* Set the input focus to FRAME. FRAME nil means use the selected frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { struct frame *f = check_x_frame (frame); Display *dpy = FRAME_X_DISPLAY (f); @@ -3644,8 +3561,7 @@ FRAME nil means use the selected frame. */) DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, doc: /* Internal function called by `color-defined-p', which see. */) - (color, frame) - Lisp_Object color, frame; + (Lisp_Object color, Lisp_Object frame) { XColor foo; FRAME_PTR f = check_x_frame (frame); @@ -3660,8 +3576,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, doc: /* Internal function called by `color-values', which see. */) - (color, frame) - Lisp_Object color, frame; + (Lisp_Object color, Lisp_Object frame) { XColor foo; FRAME_PTR f = check_x_frame (frame); @@ -3678,8 +3593,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, doc: /* Internal function called by `display-color-p', which see. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); @@ -3706,8 +3620,7 @@ Note that color displays do support shades of gray. The optional argument TERMINAL specifies which display to ask about. TERMINAL should be a terminal object, a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); @@ -3735,8 +3648,7 @@ DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width, The optional argument TERMINAL specifies which display to ask about. TERMINAL should be a terminal object, a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); @@ -3749,8 +3661,7 @@ DEFUN ("x-display-pixel-height", Fx_display_pixel_height, The optional argument TERMINAL specifies which display to ask about. TERMINAL should be a terminal object, a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); @@ -3763,8 +3674,7 @@ DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes, The optional argument TERMINAL specifies which display to ask about. TERMINAL should be a terminal object, a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); @@ -3777,8 +3687,7 @@ DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells, The optional argument TERMINAL specifies which display to ask about. TERMINAL should be a terminal object, a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); @@ -3802,8 +3711,7 @@ DEFUN ("x-server-max-request-size", Fx_server_max_request_size, The optional argument TERMINAL specifies which display to ask about. TERMINAL should be a terminal object, a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); @@ -3817,8 +3725,7 @@ that operating systems cannot be developed and distributed noncommercially.) The optional argument TERMINAL specifies which display to ask about. TERMINAL should be a terminal object, a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); char *vendor = ServerVendor (dpyinfo->display); @@ -3836,8 +3743,7 @@ number. See also the function `x-server-vendor'. The optional argument TERMINAL specifies which display to ask about. TERMINAL should be a terminal object, a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); Display *dpy = dpyinfo->display; @@ -3852,8 +3758,7 @@ DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, The optional argument TERMINAL specifies which display to ask about. TERMINAL should be a terminal object, a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); @@ -3865,8 +3770,7 @@ DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, The optional argument TERMINAL specifies which display to ask about. TERMINAL should be a terminal object, a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); @@ -3878,8 +3782,7 @@ DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, The optional argument TERMINAL specifies which display to ask about. TERMINAL should be a terminal object, a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); @@ -3893,8 +3796,7 @@ The value may be `always', `when-mapped', or `not-useful'. The optional argument TERMINAL specifies which display to ask about. TERMINAL should be a terminal object, a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); Lisp_Object result; @@ -3930,8 +3832,7 @@ The value is one of the symbols `static-gray', `gray-scale', The optional argument TERMINAL specifies which display to ask about. TERMINAL should a terminal object, a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); Lisp_Object result; @@ -3970,8 +3871,7 @@ DEFUN ("x-display-save-under", Fx_display_save_under, The optional argument TERMINAL specifies which display to ask about. TERMINAL should be a terminal object, a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); @@ -3982,36 +3882,31 @@ If omitted or nil, that stands for the selected frame's display. */) } int -x_pixel_width (f) - register struct frame *f; +x_pixel_width (register struct frame *f) { return FRAME_PIXEL_WIDTH (f); } int -x_pixel_height (f) - register struct frame *f; +x_pixel_height (register struct frame *f) { return FRAME_PIXEL_HEIGHT (f); } int -x_char_width (f) - register struct frame *f; +x_char_width (register struct frame *f) { return FRAME_COLUMN_WIDTH (f); } int -x_char_height (f) - register struct frame *f; +x_char_height (register struct frame *f) { return FRAME_LINE_HEIGHT (f); } int -x_screen_planes (f) - register struct frame *f; +x_screen_planes (register struct frame *f) { return FRAME_X_DISPLAY_INFO (f)->n_planes; } @@ -4068,8 +3963,7 @@ XScreenNumberOfScreen (scr) members of DPYINFO appropriately. Called from x_term_init. */ void -select_visual (dpyinfo) - struct x_display_info *dpyinfo; +select_visual (struct x_display_info *dpyinfo) { Display *dpy = dpyinfo->display; Screen *screen = dpyinfo->screen; @@ -4091,7 +3985,7 @@ select_visual (dpyinfo) XVisualInfo vinfo; strcpy (s, SDATA (value)); - dash = index (s, '-'); + dash = strchr (s, '-'); if (dash) { dpyinfo->n_planes = atoi (dash + 1); @@ -4142,8 +4036,7 @@ select_visual (dpyinfo) Open a new connection if necessary. */ struct x_display_info * -x_display_info_for_name (name) - Lisp_Object name; +x_display_info_for_name (Lisp_Object name) { Lisp_Object names; struct x_display_info *dpyinfo; @@ -4190,8 +4083,7 @@ DISPLAY is the name of the display to connect to. Optional second arg XRM-STRING is a string of resources in xrdb format. If the optional third arg MUST-SUCCEED is non-nil, terminate Emacs if we can't open the connection. */) - (display, xrm_string, must_succeed) - Lisp_Object display, xrm_string, must_succeed; + (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed) { unsigned char *xrm_option; struct x_display_info *dpyinfo; @@ -4242,8 +4134,7 @@ DEFUN ("x-close-connection", Fx_close_connection, For TERMINAL, specify a terminal object, a frame or a display name (a string). If TERMINAL is nil, that stands for the selected frame's terminal. */) - (terminal) - Lisp_Object terminal; + (Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); @@ -4257,7 +4148,7 @@ terminal. */) DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, doc: /* Return the list of display names that Emacs has connections to. */) - () + (void) { Lisp_Object tail, result; @@ -4277,8 +4168,7 @@ easier. The optional second argument TERMINAL specifies which display to act on. TERMINAL should be a terminal object, a frame or a display name (a string). If TERMINAL is omitted or nil, that stands for the selected frame's display. */) - (on, terminal) - Lisp_Object terminal, on; + (Lisp_Object on, Lisp_Object terminal) { struct x_display_info *dpyinfo = check_x_display_info (terminal); @@ -4290,8 +4180,7 @@ If TERMINAL is omitted or nil, that stands for the selected frame's display. */ /* Wait for responses to all X commands issued so far for frame F. */ void -x_sync (f) - FRAME_PTR f; +x_sync (FRAME_PTR f) { BLOCK_INPUT; XSync (FRAME_X_DISPLAY (f), False); @@ -4322,8 +4211,7 @@ If OUTER_P is non-nil, the property is changed for the outer X window of FRAME. Default is to change on the edit X window. Value is VALUE. */) - (prop, value, frame, type, format, outer_p) - Lisp_Object prop, value, frame, type, format, outer_p; + (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) { struct frame *f = check_x_frame (frame); Atom prop_atom; @@ -4401,8 +4289,7 @@ DEFUN ("x-delete-window-property", Fx_delete_window_property, Sx_delete_window_property, 1, 2, 0, doc: /* Remove window property PROP from X window of FRAME. FRAME nil or omitted means use the selected frame. Value is PROP. */) - (prop, frame) - Lisp_Object prop, frame; + (Lisp_Object prop, Lisp_Object frame) { struct frame *f = check_x_frame (frame); Atom prop_atom; @@ -4433,8 +4320,7 @@ If VECTOR_RET_P is non-nil, don't return a string but a vector of values. Value is nil if FRAME hasn't a property with name PROP or if PROP has no value of TYPE. */) - (prop, frame, type, source, delete_p, vector_ret_p) - Lisp_Object prop, frame, type, source, delete_p, vector_ret_p; + (Lisp_Object prop, Lisp_Object frame, Lisp_Object type, Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p) { struct frame *f = check_x_frame (frame); Atom prop_atom; @@ -4502,7 +4388,7 @@ no value of TYPE. */) elements." This applies even if long is more than 32 bits, the X library converts from 32 bit elements received from the X server to long - and passes the long array to us. Thus, for that case bcopy can not + and passes the long array to us. Thus, for that case memcpy can not be used. We convert to a 32 bit type here, because so much code assume on that. @@ -4553,8 +4439,7 @@ no value of TYPE. */) shown on the frames. */ void -show_hourglass (timer) - struct atimer *timer; +show_hourglass (struct atimer *timer) { /* The timer implementation will cancel this timer automatically after this function has run. Set hourglass_atimer to null @@ -4618,7 +4503,7 @@ show_hourglass (timer) shown. */ void -hide_hourglass () +hide_hourglass (void) { if (hourglass_shown_p) { @@ -4653,10 +4538,10 @@ hide_hourglass () Tool tips ***********************************************************************/ -static Lisp_Object x_create_tip_frame P_ ((struct x_display_info *, - Lisp_Object, Lisp_Object)); -static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object, - Lisp_Object, int, int, int *, int *)); +static Lisp_Object x_create_tip_frame (struct x_display_info *, + Lisp_Object, Lisp_Object); +static void compute_tip_xy (struct frame *, Lisp_Object, Lisp_Object, + Lisp_Object, int, int, int *, int *); /* The frame of a currently visible tooltip. */ @@ -4679,8 +4564,7 @@ Lisp_Object Vx_max_tooltip_size; static Lisp_Object -unwind_create_tip_frame (frame) - Lisp_Object frame; +unwind_create_tip_frame (Lisp_Object frame) { Lisp_Object deleted; @@ -4705,9 +4589,7 @@ unwind_create_tip_frame (frame) when this happens. */ static Lisp_Object -x_create_tip_frame (dpyinfo, parms, text) - struct x_display_info *dpyinfo; - Lisp_Object parms, text; +x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms, Lisp_Object text) { struct frame *f; Lisp_Object frame, tem; @@ -4762,7 +4644,7 @@ x_create_tip_frame (dpyinfo, parms, text) counts etc. */ f->output_method = output_x_window; f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); - bzero (f->output_data.x, sizeof (struct x_output)); + memset (f->output_data.x, 0, sizeof (struct x_output)); f->output_data.x->icon_bitmap = -1; FRAME_FONTSET (f) = -1; f->output_data.x->scroll_bar_foreground_pixel = -1; @@ -4946,9 +4828,8 @@ x_create_tip_frame (dpyinfo, parms, text) change_frame_size (f, height, width, 1, 0, 0); /* Add `tooltip' frame parameter's default value. */ - if (NILP (Fframe_parameter (frame, intern ("tooltip")))) - Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt), - Qnil)); + if (NILP (Fframe_parameter (frame, Qtooltip))) + Fmodify_frame_parameters (frame, Fcons (Fcons (Qtooltip, Qt), Qnil)); /* FIXME - can this be done in a similar way to normal frames? http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg00641.html */ @@ -5022,11 +4903,7 @@ x_create_tip_frame (dpyinfo, parms, text) the display in *ROOT_X, and *ROOT_Y. */ static void -compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y) - struct frame *f; - Lisp_Object parms, dx, dy; - int width, height; - int *root_x, *root_y; +compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx, Lisp_Object dy, int width, int height, int *root_x, int *root_y) { Lisp_Object left, top; int win_x, win_y; @@ -5103,8 +4980,7 @@ DY added (default is -10). A tooltip's maximum size is specified by `x-max-tooltip-size'. Text larger than the specified size is clipped. */) - (string, frame, parms, timeout, dx, dy) - Lisp_Object string, frame, parms, timeout, dx, dy; + (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy) { struct frame *f; struct window *w; @@ -5295,7 +5171,7 @@ Text larger than the specified size is clipped. */) DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0, doc: /* Hide the current tooltip window, if there is any. Value is t if tooltip was open, nil otherwise. */) - () + (void) { int count; Lisp_Object deleted, frame, timer; @@ -5329,7 +5205,7 @@ Value is t if tooltip was open, nil otherwise. */) { struct frame *f = SELECTED_FRAME (); Widget w = f->output_data.x->menubar_widget; - extern void xlwmenu_redisplay P_ ((Widget)); + extern void xlwmenu_redisplay (Widget); if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen) && w != NULL) @@ -5356,7 +5232,7 @@ DEFUN ("x-uses-old-gtk-dialog", Fx_uses_old_gtk_dialog, Sx_uses_old_gtk_dialog, 0, 0, 0, doc: /* Return t if the old Gtk+ file selection dialog is used. */) - () + (void) { #ifdef USE_GTK extern int use_dialog_box; @@ -5423,8 +5299,7 @@ DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0, Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file selection box, if specified. If MUSTMATCH is non-nil, the returned file or directory must exist. ONLY-DIR-P is ignored." */) - (prompt, dir, default_filename, mustmatch, only_dir_p) - Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p; + (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) { int result; struct frame *f = SELECTED_FRAME (); @@ -5582,8 +5457,7 @@ or directory must exist. ONLY-DIR-P is ignored." */) #ifdef USE_GTK static Lisp_Object -clean_up_dialog (arg) - Lisp_Object arg; +clean_up_dialog (Lisp_Object arg) { x_menu_set_in_use (0); @@ -5596,8 +5470,7 @@ Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file selection box, if specified. If MUSTMATCH is non-nil, the returned file or directory must exist. If ONLY-DIR-P is non-nil, the user can only select directories. */) - (prompt, dir, default_filename, mustmatch, only_dir_p) - Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p; + (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) { FRAME_PTR f = SELECTED_FRAME (); char *fn; @@ -5658,8 +5531,7 @@ DEFUN ("x-select-font", Fx_select_font, Sx_select_font, 0, 2, 0, Return a GTK-style font string corresponding to the selection. If FRAME is omitted or nil, it defaults to the selected frame. */) - (frame, ignored) - Lisp_Object frame, ignored; + (Lisp_Object frame, Lisp_Object ignored) { FRAME_PTR f = check_x_frame (frame); char *name; @@ -5747,8 +5619,7 @@ FRAME nil means use the selected frame. Value is t if we know that both keys are present, and are mapped to the usual X keysyms. Value is `lambda' if we cannot determine if both keys are present and mapped to the usual X keysyms. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { #ifdef HAVE_XKBGETKEYBOARD XkbDescPtr kb; @@ -5809,9 +5680,9 @@ present and mapped to the usual X keysyms. */) /* The XKB symbolic key names can be seen most easily in the PS file generated by `xkbprint -label name $DISPLAY'. */ - if (bcmp ("DELE", kb->names->keys[i].name, 4) == 0) + if (memcmp ("DELE", kb->names->keys[i].name, 4) == 0) delete_keycode = i; - else if (bcmp ("BKSP", kb->names->keys[i].name, 4) == 0) + else if (memcmp ("BKSP", kb->names->keys[i].name, 4) == 0) backspace_keycode = i; } @@ -5879,7 +5750,7 @@ frame_parm_handler x_frame_parm_handlers[] = }; void -syms_of_xfns () +syms_of_xfns (void) { /* This is zero if not using X windows. */ x_in_use = 0; diff --git a/src/xfont.c b/src/xfont.c index d8fe40eaa93..b03bb1585d3 100644 --- a/src/xfont.c +++ b/src/xfont.c @@ -47,17 +47,15 @@ struct xfont_info }; /* Prototypes of support functions. */ -extern void x_clear_errors P_ ((Display *)); +extern void x_clear_errors (Display *); -static XCharStruct *xfont_get_pcm P_ ((XFontStruct *, XChar2b *)); +static XCharStruct *xfont_get_pcm (XFontStruct *, XChar2b *); /* Get metrics of character CHAR2B in XFONT. Value is null if CHAR2B is not contained in the font. */ static XCharStruct * -xfont_get_pcm (xfont, char2b) - XFontStruct *xfont; - XChar2b *char2b; +xfont_get_pcm (XFontStruct *xfont, XChar2b *char2b) { /* The result metric information. */ XCharStruct *pcm = NULL; @@ -119,19 +117,19 @@ xfont_get_pcm (xfont, char2b) ? NULL : pcm); } -static Lisp_Object xfont_get_cache P_ ((FRAME_PTR)); -static Lisp_Object xfont_list P_ ((Lisp_Object, Lisp_Object)); -static Lisp_Object xfont_match P_ ((Lisp_Object, Lisp_Object)); -static Lisp_Object xfont_list_family P_ ((Lisp_Object)); -static Lisp_Object xfont_open P_ ((FRAME_PTR, Lisp_Object, int)); -static void xfont_close P_ ((FRAME_PTR, struct font *)); -static int xfont_prepare_face P_ ((FRAME_PTR, struct face *)); -static int xfont_has_char P_ ((Lisp_Object, int)); -static unsigned xfont_encode_char P_ ((struct font *, int)); -static int xfont_text_extents P_ ((struct font *, unsigned *, int, - struct font_metrics *)); -static int xfont_draw P_ ((struct glyph_string *, int, int, int, int, int)); -static int xfont_check P_ ((FRAME_PTR, struct font *)); +static Lisp_Object xfont_get_cache (FRAME_PTR); +static Lisp_Object xfont_list (Lisp_Object, Lisp_Object); +static Lisp_Object xfont_match (Lisp_Object, Lisp_Object); +static Lisp_Object xfont_list_family (Lisp_Object); +static Lisp_Object xfont_open (FRAME_PTR, Lisp_Object, int); +static void xfont_close (FRAME_PTR, struct font *); +static int xfont_prepare_face (FRAME_PTR, struct face *); +static int xfont_has_char (Lisp_Object, int); +static unsigned xfont_encode_char (struct font *, int); +static int xfont_text_extents (struct font *, unsigned *, int, + struct font_metrics *); +static int xfont_draw (struct glyph_string *, int, int, int, int, int); +static int xfont_check (FRAME_PTR, struct font *); struct font_driver xfont_driver = { @@ -159,8 +157,7 @@ struct font_driver xfont_driver = extern Lisp_Object QCname; static Lisp_Object -xfont_get_cache (f) - FRAME_PTR f; +xfont_get_cache (FRAME_PTR f) { Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); @@ -497,8 +494,7 @@ xfont_list_pattern (Display *display, char *pattern, } static Lisp_Object -xfont_list (frame, spec) - Lisp_Object frame, spec; +xfont_list (Lisp_Object frame, Lisp_Object spec) { FRAME_PTR f = XFRAME (frame); Display *display = FRAME_X_DISPLAY_INFO (f)->display; @@ -566,7 +562,7 @@ xfont_list (frame, spec) val = assq_no_quit (QCname, AREF (spec, FONT_EXTRA_INDEX)); if (CONSP (val) && STRINGP (XCDR (val)) && SBYTES (XCDR (val)) < 512) { - bcopy (SDATA (XCDR (val)), name, SBYTES (XCDR (val)) + 1); + memcpy (name, SDATA (XCDR (val)), SBYTES (XCDR (val)) + 1); if (xfont_encode_coding_xlfd (name) < 0) return Qnil; list = xfont_list_pattern (display, name, registry, script); @@ -577,8 +573,7 @@ xfont_list (frame, spec) } static Lisp_Object -xfont_match (frame, spec) - Lisp_Object frame, spec; +xfont_match (Lisp_Object frame, Lisp_Object spec) { FRAME_PTR f = XFRAME (frame); Display *display = FRAME_X_DISPLAY_INFO (f)->display; @@ -595,7 +590,7 @@ xfont_match (frame, spec) return Qnil; } else if (SBYTES (XCDR (val)) < 512) - bcopy (SDATA (XCDR (val)), name, SBYTES (XCDR (val)) + 1); + memcpy (name, SDATA (XCDR (val)), SBYTES (XCDR (val)) + 1); else return Qnil; if (xfont_encode_coding_xlfd (name) < 0) @@ -636,8 +631,7 @@ xfont_match (frame, spec) } static Lisp_Object -xfont_list_family (frame) - Lisp_Object frame; +xfont_list_family (Lisp_Object frame) { FRAME_PTR f = XFRAME (frame); Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); @@ -675,7 +669,7 @@ xfont_list_family (frame) if (! *p1 || p1 == p0) continue; if (last_len == p1 - p0 - && bcmp (last_family, p0, last_len) == 0) + && memcmp (last_family, p0, last_len) == 0) continue; last_len = p1 - p0; last_family = p0; @@ -696,10 +690,7 @@ xfont_list_family (frame) extern Lisp_Object QCavgwidth; static Lisp_Object -xfont_open (f, entity, pixel_size) - FRAME_PTR f; - Lisp_Object entity; - int pixel_size; +xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) { Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); Display *display = dpyinfo->display; @@ -911,9 +902,7 @@ xfont_open (f, entity, pixel_size) } static void -xfont_close (f, font) - FRAME_PTR f; - struct font *font; +xfont_close (FRAME_PTR f, struct font *font) { BLOCK_INPUT; XFreeFont (FRAME_X_DISPLAY (f), ((struct xfont_info *) font)->xfont); @@ -921,9 +910,7 @@ xfont_close (f, font) } static int -xfont_prepare_face (f, face) - FRAME_PTR f; - struct face *face; +xfont_prepare_face (FRAME_PTR f, struct face *face) { BLOCK_INPUT; XSetFont (FRAME_X_DISPLAY (f), face->gc, @@ -934,9 +921,7 @@ xfont_prepare_face (f, face) } static int -xfont_has_char (font, c) - Lisp_Object font; - int c; +xfont_has_char (Lisp_Object font, int c) { Lisp_Object registry = AREF (font, FONT_REGISTRY_INDEX); struct charset *encoding; @@ -965,9 +950,7 @@ xfont_has_char (font, c) } static unsigned -xfont_encode_char (font, c) - struct font *font; - int c; +xfont_encode_char (struct font *font, int c) { XFontStruct *xfont = ((struct xfont_info *) font)->xfont; struct charset *charset; @@ -990,18 +973,14 @@ xfont_encode_char (font, c) } static int -xfont_text_extents (font, code, nglyphs, metrics) - struct font *font; - unsigned *code; - int nglyphs; - struct font_metrics *metrics; +xfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct font_metrics *metrics) { XFontStruct *xfont = ((struct xfont_info *) font)->xfont; int width = 0; int i, first, x; if (metrics) - bzero (metrics, sizeof (struct font_metrics)); + memset (metrics, 0, sizeof (struct font_metrics)); for (i = 0, x = 0, first = 1; i < nglyphs; i++) { XChar2b char2b; @@ -1046,9 +1025,7 @@ xfont_text_extents (font, code, nglyphs, metrics) } static int -xfont_draw (s, from, to, x, y, with_background) - struct glyph_string *s; - int from, to, x, y, with_background; +xfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background) { XFontStruct *xfont = ((struct xfont_info *) s->font)->xfont; int len = to - from; @@ -1123,9 +1100,7 @@ xfont_draw (s, from, to, x, y, with_background) } static int -xfont_check (f, font) - FRAME_PTR f; - struct font *font; +xfont_check (FRAME_PTR f, struct font *font) { struct xfont_info *xfont = (struct xfont_info *) font; @@ -1134,7 +1109,7 @@ xfont_check (f, font) void -syms_of_xfont () +syms_of_xfont (void) { staticpro (&xfont_scripts_cache); { /* Here we rely on the fact that syms_of_xfont (via syms_of_font) diff --git a/src/xftfont.c b/src/xftfont.c index 5d4581be4e9..68dd0af762f 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -70,9 +70,9 @@ struct xftface_info XftColor xft_bg; /* color for face->background */ }; -static void xftfont_get_colors P_ ((FRAME_PTR, struct face *, GC gc, - struct xftface_info *, - XftColor *fg, XftColor *bg)); +static void xftfont_get_colors (FRAME_PTR, struct face *, GC gc, + struct xftface_info *, + XftColor *fg, XftColor *bg); /* Setup foreground and background colors of GC into FG and BG. If @@ -80,12 +80,7 @@ static void xftfont_get_colors P_ ((FRAME_PTR, struct face *, GC gc, may be NULL. */ static void -xftfont_get_colors (f, face, gc, xftface_info, fg, bg) - FRAME_PTR f; - struct face *face; - GC gc; - struct xftface_info *xftface_info; - XftColor *fg, *bg; +xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *xftface_info, XftColor *fg, XftColor *bg) { if (xftface_info && face->gc == gc) { @@ -141,25 +136,23 @@ xftfont_get_colors (f, face, gc, xftface_info, fg, bg) } -static Lisp_Object xftfont_list P_ ((Lisp_Object, Lisp_Object)); -static Lisp_Object xftfont_match P_ ((Lisp_Object, Lisp_Object)); -static Lisp_Object xftfont_open P_ ((FRAME_PTR, Lisp_Object, int)); -static void xftfont_close P_ ((FRAME_PTR, struct font *)); -static int xftfont_prepare_face P_ ((FRAME_PTR, struct face *)); -static void xftfont_done_face P_ ((FRAME_PTR, struct face *)); -static int xftfont_has_char P_ ((Lisp_Object, int)); -static unsigned xftfont_encode_char P_ ((struct font *, int)); -static int xftfont_text_extents P_ ((struct font *, unsigned *, int, - struct font_metrics *)); -static int xftfont_draw P_ ((struct glyph_string *, int, int, int, int, int)); -static int xftfont_end_for_frame P_ ((FRAME_PTR f)); +static Lisp_Object xftfont_list (Lisp_Object, Lisp_Object); +static Lisp_Object xftfont_match (Lisp_Object, Lisp_Object); +static Lisp_Object xftfont_open (FRAME_PTR, Lisp_Object, int); +static void xftfont_close (FRAME_PTR, struct font *); +static int xftfont_prepare_face (FRAME_PTR, struct face *); +static void xftfont_done_face (FRAME_PTR, struct face *); +static int xftfont_has_char (Lisp_Object, int); +static unsigned xftfont_encode_char (struct font *, int); +static int xftfont_text_extents (struct font *, unsigned *, int, + struct font_metrics *); +static int xftfont_draw (struct glyph_string *, int, int, int, int, int); +static int xftfont_end_for_frame (FRAME_PTR f); struct font_driver xftfont_driver; static Lisp_Object -xftfont_list (frame, spec) - Lisp_Object frame; - Lisp_Object spec; +xftfont_list (Lisp_Object frame, Lisp_Object spec) { Lisp_Object list = ftfont_driver.list (frame, spec), tail; @@ -169,9 +162,7 @@ xftfont_list (frame, spec) } static Lisp_Object -xftfont_match (frame, spec) - Lisp_Object frame; - Lisp_Object spec; +xftfont_match (Lisp_Object frame, Lisp_Object spec) { Lisp_Object entity = ftfont_driver.match (frame, spec); @@ -180,15 +171,14 @@ xftfont_match (frame, spec) return entity; } -extern Lisp_Object ftfont_font_format P_ ((FcPattern *, Lisp_Object)); -extern FcCharSet *ftfont_get_fc_charset P_ ((Lisp_Object)); +extern Lisp_Object ftfont_font_format (FcPattern *, Lisp_Object); +extern FcCharSet *ftfont_get_fc_charset (Lisp_Object); extern Lisp_Object QCantialias; static FcChar8 ascii_printable[95]; static void -xftfont_fix_match (pat, match) - FcPattern *pat, *match; +xftfont_fix_match (FcPattern *pat, FcPattern *match) { /* These values are not used for matching (except antialias), but for rendering, so make sure they are carried over to the match. @@ -238,9 +228,7 @@ xftfont_fix_match (pat, match) } static void -xftfont_add_rendering_parameters (pat, entity) - FcPattern *pat; - Lisp_Object entity; +xftfont_add_rendering_parameters (FcPattern *pat, Lisp_Object entity) { Lisp_Object tail; int ival; @@ -288,10 +276,7 @@ xftfont_add_rendering_parameters (pat, entity) } static Lisp_Object -xftfont_open (f, entity, pixel_size) - FRAME_PTR f; - Lisp_Object entity; - int pixel_size; +xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) { FcResult result; Display *display = FRAME_X_DISPLAY (f); @@ -429,7 +414,7 @@ xftfont_open (f, entity, pixel_size) ascii_printable[i] = ' ' + i; } BLOCK_INPUT; - if (spacing != FC_PROPORTIONAL) + if (spacing != FC_PROPORTIONAL && spacing != FC_DUAL) { font->min_width = font->average_width = font->space_width = xftfont->max_advance_width; @@ -510,9 +495,7 @@ xftfont_open (f, entity, pixel_size) } static void -xftfont_close (f, font) - FRAME_PTR f; - struct font *font; +xftfont_close (FRAME_PTR f, struct font *font) { struct xftfont_info *xftfont_info = (struct xftfont_info *) font; @@ -527,9 +510,7 @@ xftfont_close (f, font) } static int -xftfont_prepare_face (f, face) - FRAME_PTR f; - struct face *face; +xftfont_prepare_face (FRAME_PTR f, struct face *face) { struct xftface_info *xftface_info; @@ -552,9 +533,7 @@ xftfont_prepare_face (f, face) } static void -xftfont_done_face (f, face) - FRAME_PTR f; - struct face *face; +xftfont_done_face (FRAME_PTR f, struct face *face) { struct xftface_info *xftface_info; @@ -576,9 +555,7 @@ xftfont_done_face (f, face) extern Lisp_Object Qja, Qko; static int -xftfont_has_char (font, c) - Lisp_Object font; - int c; +xftfont_has_char (Lisp_Object font, int c) { struct xftfont_info *xftfont_info; struct charset *cs = NULL; @@ -600,9 +577,7 @@ xftfont_has_char (font, c) } static unsigned -xftfont_encode_char (font, c) - struct font *font; - int c; +xftfont_encode_char (struct font *font, int c) { struct xftfont_info *xftfont_info = (struct xftfont_info *) font; unsigned code = XftCharIndex (xftfont_info->display, xftfont_info->xftfont, @@ -612,11 +587,7 @@ xftfont_encode_char (font, c) } static int -xftfont_text_extents (font, code, nglyphs, metrics) - struct font *font; - unsigned *code; - int nglyphs; - struct font_metrics *metrics; +xftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct font_metrics *metrics) { struct xftfont_info *xftfont_info = (struct xftfont_info *) font; XGlyphInfo extents; @@ -637,8 +608,7 @@ xftfont_text_extents (font, code, nglyphs, metrics) } static XftDraw * -xftfont_get_xft_draw (f) - FRAME_PTR f; +xftfont_get_xft_draw (FRAME_PTR f) { XftDraw *xft_draw = font_get_frame_data (f, &xftfont_driver); @@ -658,9 +628,7 @@ xftfont_get_xft_draw (f) } static int -xftfont_draw (s, from, to, x, y, with_background) - struct glyph_string *s; - int from, to, x, y, with_background; +xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background) { FRAME_PTR f = s->f; struct face *face = s->face; @@ -703,8 +671,7 @@ xftfont_draw (s, from, to, x, y, with_background) } static int -xftfont_end_for_frame (f) - FRAME_PTR f; +xftfont_end_for_frame (FRAME_PTR f) { XftDraw *xft_draw; @@ -724,11 +691,7 @@ xftfont_end_for_frame (f) } static int -xftfont_cached_font_ok (f, font_object, entity) - struct frame *f; - Lisp_Object font_object; - Lisp_Object entity; - +xftfont_cached_font_ok (struct frame *f, Lisp_Object font_object, Lisp_Object entity) { struct xftfont_info *info = (struct xftfont_info *) XFONT_OBJECT (font_object); FcPattern *oldpat = info->xftfont->pattern; @@ -771,7 +734,7 @@ xftfont_cached_font_ok (f, font_object, entity) } void -syms_of_xftfont () +syms_of_xftfont (void) { DEFSYM (Qxft, "xft"); DEFSYM (QChinting, ":hinting"); diff --git a/src/xgselect.c b/src/xgselect.c index 42fff2d98da..56e14fe6e14 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -29,12 +29,8 @@ static GPollFD *gfds; static int gfds_size; int -xg_select (max_fds, rfds, wfds, efds, timeout) - int max_fds; - SELECT_TYPE *rfds; - SELECT_TYPE *wfds; - SELECT_TYPE *efds; - EMACS_TIME *timeout; +xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, + EMACS_TIME *timeout) { SELECT_TYPE all_rfds, all_wfds; EMACS_TIME tmo, *tmop = timeout; @@ -147,7 +143,7 @@ xg_select (max_fds, rfds, wfds, efds, timeout) #endif /* defined (USE_GTK) || defined (HAVE_GCONF) */ void -xgselect_initialize () +xgselect_initialize (void) { #if defined (USE_GTK) || defined (HAVE_GCONF) gfds_size = 128; diff --git a/src/xgselect.h b/src/xgselect.h index bae084f0d5c..f120d8866cf 100644 --- a/src/xgselect.h +++ b/src/xgselect.h @@ -24,13 +24,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "systime.h" #include "sysselect.h" -extern int xg_select P_ ((int max_fds, - SELECT_TYPE *rfds, - SELECT_TYPE *wfds, - SELECT_TYPE *efds, - EMACS_TIME *timeout)); +extern int xg_select (int max_fds, + SELECT_TYPE *rfds, + SELECT_TYPE *wfds, + SELECT_TYPE *efds, + EMACS_TIME *timeout); -extern void xgselect_initialize P_ ((void)); +extern void xgselect_initialize (void); #endif /* XGSELECT_H */ diff --git a/src/xmenu.c b/src/xmenu.c index 796dd3093e8..2fb39339b98 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -122,22 +122,22 @@ extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map; extern Lisp_Object Qmenu_bar_update_hook; #ifdef USE_X_TOOLKIT -extern void set_frame_menubar P_ ((FRAME_PTR, int, int)); +extern void set_frame_menubar (FRAME_PTR, int, int); extern XtAppContext Xt_app_con; -static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, Lisp_Object, - char **)); -static void popup_get_selection P_ ((XEvent *, struct x_display_info *, - LWLIB_ID, int)); +static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object, + char **); +static void popup_get_selection (XEvent *, struct x_display_info *, + LWLIB_ID, int); #endif /* USE_X_TOOLKIT */ #ifdef USE_GTK -extern void set_frame_menubar P_ ((FRAME_PTR, int, int)); -static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, Lisp_Object, - char **)); +extern void set_frame_menubar (FRAME_PTR, int, int); +static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object, + char **); #endif -static int update_frame_menubar P_ ((struct frame *)); +static int update_frame_menubar (struct frame *); /* Flag which when set indicates a dialog or menu has been posted by Xt on behalf of one of the widget sets. */ @@ -147,26 +147,17 @@ static int next_menubar_widget_id; /* For NS and NTGUI, these prototypes are defined in keyboard.h. */ #if defined (USE_X_TOOLKIT) || defined (USE_GTK) -extern widget_value *xmalloc_widget_value P_ ((void)); -extern widget_value *digest_single_submenu P_ ((int, int, int)); +extern widget_value *xmalloc_widget_value (void); +extern widget_value *digest_single_submenu (int, int, int); #endif -/* This is set nonzero after the user activates the menu bar, and set - to zero again after the menu bars are redisplayed by prepare_menu_bar. - While it is nonzero, all calls to set_frame_menubar go deep. - - I don't understand why this is needed, but it does seem to be - needed on Motif, according to Marcus Daniels <marcus@sysc.pdx.edu>. */ - -int pending_menu_activation; #ifdef USE_X_TOOLKIT /* Return the frame whose ->output_data.x->id equals ID, or 0 if none. */ static struct frame * -menubar_id_to_frame (id) - LWLIB_ID id; +menubar_id_to_frame (LWLIB_ID id) { Lisp_Object tail, frame; FRAME_PTR f; @@ -196,10 +187,7 @@ menubar_id_to_frame (id) the scroll bar or the edit window. Fx_popup_menu needs to be sure it is the edit window. */ void -mouse_position_for_popup (f, x, y) - FRAME_PTR f; - int *x; - int *y; +mouse_position_for_popup (FRAME_PTR f, int *x, int *y) { Window root, dummy_window; int dummy; @@ -263,8 +251,7 @@ otherwise it is "Question". If the user gets rid of the dialog box without making a valid choice, for instance using the window manager, then this produces a quit and `x-popup-dialog' does not return. */) - (position, contents, header) - Lisp_Object position, contents, header; + (Lisp_Object position, Lisp_Object contents, Lisp_Object header) { FRAME_PTR f = NULL; Lisp_Object window; @@ -391,8 +378,7 @@ for instance using the window manager, then this produces a quit and /* Set menu_items_inuse so no other popup menu or dialog is created. */ void -x_menu_set_in_use (in_use) - int in_use; +x_menu_set_in_use (int in_use) { menu_items_inuse = in_use ? Qt : Qnil; popup_activated_flag = in_use; @@ -461,11 +447,7 @@ x_menu_wait_for_event (void *data) with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */ static void -popup_get_selection (initial_event, dpyinfo, id, do_timers) - XEvent *initial_event; - struct x_display_info *dpyinfo; - LWLIB_ID id; - int do_timers; +popup_get_selection (XEvent *initial_event, struct x_display_info *dpyinfo, LWLIB_ID id, int do_timers) { XEvent event; @@ -522,8 +504,7 @@ arrow keys, select a menu entry with the return key or cancel with the escape key. If FRAME has no menu bar this function does nothing. If FRAME is nil or not given, use the selected frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { XEvent ev; FRAME_PTR f = check_x_frame (frame); @@ -601,8 +582,7 @@ arrow keys, select a menu entry with the return key or cancel with the escape key. If FRAME has no menu bar this function does nothing. If FRAME is nil or not given, use the selected frame. */) - (frame) - Lisp_Object frame; + (Lisp_Object frame) { GtkWidget *menubar; FRAME_PTR f; @@ -638,9 +618,7 @@ If FRAME is nil or not given, use the selected frame. */) Used for popup menus and dialogs. */ static void -popup_widget_loop (do_timers, widget) - int do_timers; - GtkWidget *widget; +popup_widget_loop (int do_timers, GtkWidget *widget) { ++popup_activated_flag; @@ -668,8 +646,7 @@ popup_widget_loop (do_timers, widget) execute Lisp code. */ void -x_activate_menubar (f) - FRAME_PTR f; +x_activate_menubar (FRAME_PTR f) { if (! FRAME_X_P (f)) abort (); @@ -685,18 +662,14 @@ x_activate_menubar (f) set_frame_menubar (f, 0, 1); BLOCK_INPUT; + popup_activated_flag = 1; #ifdef USE_GTK XPutBackEvent (f->output_data.x->display_info->display, f->output_data.x->saved_menu_event); - popup_activated_flag = 1; #else XtDispatchEvent (f->output_data.x->saved_menu_event); #endif UNBLOCK_INPUT; -#ifdef USE_MOTIF - if (f->output_data.x->saved_menu_event->type == ButtonRelease) - pending_menu_activation = 1; -#endif /* Ignore this if we get it a second time. */ f->output_data.x->saved_menu_event->type = 0; @@ -707,10 +680,7 @@ x_activate_menubar (f) #ifndef USE_GTK static void -popup_activate_callback (widget, id, client_data) - Widget widget; - LWLIB_ID id; - XtPointer client_data; +popup_activate_callback (Widget widget, LWLIB_ID id, XtPointer client_data) { popup_activated_flag = 1; #ifdef USE_X_TOOLKIT @@ -724,18 +694,13 @@ popup_activate_callback (widget, id, client_data) #ifdef USE_GTK static void -popup_deactivate_callback (widget, client_data) - GtkWidget *widget; - gpointer client_data; +popup_deactivate_callback (GtkWidget *widget, gpointer client_data) { popup_activated_flag = 0; } #else static void -popup_deactivate_callback (widget, id, client_data) - Widget widget; - LWLIB_ID id; - XtPointer client_data; +popup_deactivate_callback (Widget widget, LWLIB_ID id, XtPointer client_data) { popup_activated_flag = 0; } @@ -746,10 +711,7 @@ popup_deactivate_callback (widget, id, client_data) for that widget. F is the frame if known, or NULL if not known. */ static void -show_help_event (f, widget, help) - FRAME_PTR f; - xt_or_gtk_widget widget; - Lisp_Object help; +show_help_event (FRAME_PTR f, xt_or_gtk_widget widget, Lisp_Object help) { Lisp_Object frame; @@ -787,9 +749,7 @@ show_help_event (f, widget, help) #ifdef USE_GTK void -menu_highlight_callback (widget, call_data) - GtkWidget *widget; - gpointer call_data; +menu_highlight_callback (GtkWidget *widget, gpointer call_data) { xg_menu_item_cb_data *cb_data; Lisp_Object help; @@ -808,10 +768,7 @@ menu_highlight_callback (widget, call_data) } #else void -menu_highlight_callback (widget, id, call_data) - Widget widget; - LWLIB_ID id; - void *call_data; +menu_highlight_callback (Widget widget, LWLIB_ID id, void *call_data) { struct frame *f; Lisp_Object help; @@ -839,9 +796,7 @@ static int xg_crazy_callback_abort; Figure out what the user chose and put the appropriate events into the keyboard buffer. */ static void -menubar_selection_callback (widget, client_data) - GtkWidget *widget; - gpointer client_data; +menubar_selection_callback (GtkWidget *widget, gpointer client_data) { xg_menu_item_cb_data *cb_data = (xg_menu_item_cb_data*) client_data; @@ -884,10 +839,7 @@ menubar_selection_callback (widget, client_data) Figure out what the user chose and put the appropriate events into the keyboard buffer. */ static void -menubar_selection_callback (widget, id, client_data) - Widget widget; - LWLIB_ID id; - XtPointer client_data; +menubar_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data) { FRAME_PTR f; @@ -903,8 +855,7 @@ menubar_selection_callback (widget, id, client_data) changed. Value is non-zero if widgets were updated. */ static int -update_frame_menubar (f) - FRAME_PTR f; +update_frame_menubar (FRAME_PTR f) { #ifdef USE_GTK return xg_update_frame_menubar (f); @@ -954,8 +905,7 @@ update_frame_menubar (f) #ifdef USE_LUCID static void -apply_systemfont_to_dialog (w) - Widget w; +apply_systemfont_to_dialog (Widget w) { const char *fn = xsettings_get_system_normal_font (); if (fn) @@ -967,8 +917,7 @@ apply_systemfont_to_dialog (w) } static void -apply_systemfont_to_menu (w) - Widget w; +apply_systemfont_to_menu (Widget w) { const char *fn = xsettings_get_system_normal_font (); int defflt; @@ -995,10 +944,7 @@ apply_systemfont_to_menu (w) it is set the first time this is called, from initialize_frame_menubar. */ void -set_frame_menubar (f, first_time, deep_p) - FRAME_PTR f; - int first_time; - int deep_p; +set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) { xt_or_gtk_widget menubar_widget; #ifdef USE_X_TOOLKIT @@ -1025,8 +971,6 @@ set_frame_menubar (f, first_time, deep_p) if (! menubar_widget) deep_p = 1; - else if (pending_menu_activation && !deep_p) - deep_p = 1; /* Make the first call for any given frame always go deep. */ else if (!f->output_data.x->saved_menu_event && !deep_p) { @@ -1087,8 +1031,8 @@ set_frame_menubar (f, first_time, deep_p) /* Save the frame's previous menu bar contents data. */ if (previous_menu_items_used) - bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items, - previous_menu_items_used * sizeof (Lisp_Object)); + memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents, + previous_menu_items_used * sizeof (Lisp_Object)); /* Fill in menu_items with the current menu bar contents. This can evaluate Lisp code. */ @@ -1302,11 +1246,17 @@ set_frame_menubar (f, first_time, deep_p) /* Make menu pop down on C-g. */ XtOverrideTranslations (menubar_widget, override); +#ifdef USE_LUCID apply_systemfont_to_menu (menubar_widget); +#endif } { - int menubar_size + int menubar_size; + if (f->output_data.x->menubar_widget) + XtRealizeWidget (f->output_data.x->menubar_widget); + + menubar_size = (f->output_data.x->menubar_widget ? (f->output_data.x->menubar_widget->core.height + f->output_data.x->menubar_widget->core.border_width) @@ -1315,7 +1265,7 @@ set_frame_menubar (f, first_time, deep_p) #if 1 /* Experimentally, we now get the right results for -geometry -0-0 without this. 24 Aug 96, rms. Maybe so, but the menu bar size is missing the pixels so the - WM size hints are off by theses pixel. Jan D, oct 2009. */ + WM size hints are off by these pixels. Jan D, oct 2009. */ #ifdef USE_LUCID if (FRAME_EXTERNAL_MENU_BAR (f)) { @@ -1347,8 +1297,7 @@ set_frame_menubar (f, first_time, deep_p) is visible. */ void -initialize_frame_menubar (f) - FRAME_PTR f; +initialize_frame_menubar (FRAME_PTR f) { /* This function is called before the first chance to redisplay the frame. It has to be, so the frame will have the right size. */ @@ -1363,8 +1312,7 @@ initialize_frame_menubar (f) #ifndef USE_GTK void -free_frame_menubar (f) - FRAME_PTR f; +free_frame_menubar (FRAME_PTR f) { Widget menubar_widget; @@ -1399,15 +1347,15 @@ free_frame_menubar (f) lw_destroy_all_widgets ((LWLIB_ID) f->output_data.x->id); f->output_data.x->menubar_widget = NULL; -#ifdef USE_MOTIF if (f->output_data.x->widget) { +#ifdef USE_MOTIF XtVaGetValues (f->output_data.x->widget, XtNx, &x1, XtNy, &y1, NULL); if (x1 == 0 && y1 == 0) XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL); - } #endif - + x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); + } UNBLOCK_INPUT; } } @@ -1458,12 +1406,7 @@ struct next_popup_x_y Here only X and Y are used. */ static void -menu_position_func (menu, x, y, push_in, user_data) - GtkMenu *menu; - gint *x; - gint *y; - gboolean *push_in; - gpointer user_data; +menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data) { struct next_popup_x_y* data = (struct next_popup_x_y*)user_data; GtkRequisition req; @@ -1484,9 +1427,7 @@ menu_position_func (menu, x, y, push_in, user_data) } static void -popup_selection_callback (widget, client_data) - GtkWidget *widget; - gpointer client_data; +popup_selection_callback (GtkWidget *widget, gpointer client_data) { xg_menu_item_cb_data *cb_data = (xg_menu_item_cb_data*) client_data; @@ -1495,8 +1436,7 @@ popup_selection_callback (widget, client_data) } static Lisp_Object -pop_down_menu (arg) - Lisp_Object arg; +pop_down_menu (Lisp_Object arg) { struct Lisp_Save_Value *p = XSAVE_VALUE (arg); @@ -1511,13 +1451,7 @@ pop_down_menu (arg) menu pops down. menu_item_selection will be set to the selection. */ static void -create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp) - FRAME_PTR f; - widget_value *first_wv; - int x; - int y; - int for_click; - EMACS_UINT timestamp; +create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, int for_click, EMACS_UINT timestamp) { int i; GtkWidget *menu; @@ -1565,7 +1499,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp) record_unwind_protect (pop_down_menu, make_save_value (menu, 0)); - if (GTK_WIDGET_MAPPED (menu)) + if (gtk_widget_get_mapped (menu)) { /* Set this to one. popup_widget_loop increases it by one, so it becomes two. show_help_echo uses this to detect popup menus. */ @@ -1594,10 +1528,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp) LWLIB_ID widget_id_tick; static void -popup_selection_callback (widget, id, client_data) - Widget widget; - LWLIB_ID id; - XtPointer client_data; +popup_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data) { menu_item_selection = (Lisp_Object *) client_data; } @@ -1606,8 +1537,7 @@ popup_selection_callback (widget, id, client_data) as a Lisp object as (HIGHPART . LOWPART). */ static Lisp_Object -pop_down_menu (arg) - Lisp_Object arg; +pop_down_menu (Lisp_Object arg) { LWLIB_ID id = (XINT (XCAR (arg)) << 4 * sizeof (LWLIB_ID) | XINT (XCDR (arg))); @@ -1624,13 +1554,8 @@ pop_down_menu (arg) menu pops down. menu_item_selection will be set to the selection. */ static void -create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp) - FRAME_PTR f; - widget_value *first_wv; - int x; - int y; - int for_click; - EMACS_UINT timestamp; +create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, + int x, int y, int for_click, EMACS_UINT timestamp) { int i; Arg av[2]; @@ -1649,7 +1574,9 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp) popup_deactivate_callback, menu_highlight_callback); +#ifdef USE_LUCID apply_systemfont_to_menu (menu); +#endif dummy.type = ButtonPress; dummy.serial = 0; @@ -1977,9 +1904,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, #ifdef USE_GTK static void -dialog_selection_callback (widget, client_data) - GtkWidget *widget; - gpointer client_data; +dialog_selection_callback (GtkWidget *widget, gpointer client_data) { /* The EMACS_INT cast avoids a warning. There's no problem as long as pointers have enough bits to hold small integers. */ @@ -1993,9 +1918,7 @@ dialog_selection_callback (widget, client_data) dialog pops down. menu_item_selection will be set to the selection. */ static void -create_and_show_dialog (f, first_wv) - FRAME_PTR f; - widget_value *first_wv; +create_and_show_dialog (FRAME_PTR f, widget_value *first_wv) { GtkWidget *menu; @@ -2024,10 +1947,7 @@ create_and_show_dialog (f, first_wv) #else /* not USE_GTK */ static void -dialog_selection_callback (widget, id, client_data) - Widget widget; - LWLIB_ID id; - XtPointer client_data; +dialog_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data) { /* The EMACS_INT cast avoids a warning. There's no problem as long as pointers have enough bits to hold small integers. */ @@ -2045,9 +1965,7 @@ dialog_selection_callback (widget, id, client_data) dialog pops down. menu_item_selection will be set to the selection. */ static void -create_and_show_dialog (f, first_wv) - FRAME_PTR f; - widget_value *first_wv; +create_and_show_dialog (FRAME_PTR f, widget_value *first_wv) { LWLIB_ID dialog_id; @@ -2055,7 +1973,7 @@ create_and_show_dialog (f, first_wv) abort(); dialog_id = widget_id_tick++; -#ifdef HAVE_XFT +#ifdef USE_LUCID apply_systemfont_to_dialog (f->output_data.x->widget); #endif lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv, @@ -2092,11 +2010,7 @@ static char * button_names [] = { "button6", "button7", "button8", "button9", "button10" }; static Lisp_Object -xdialog_show (f, keymaps, title, header, error_name) - FRAME_PTR f; - int keymaps; - Lisp_Object title, header; - char **error_name; +xdialog_show (FRAME_PTR f, int keymaps, Lisp_Object title, Lisp_Object header, char **error_name) { int i, nb_buttons=0; char dialog_name[6]; @@ -2294,9 +2208,7 @@ static struct frame *menu_help_frame; keyboard events. */ static void -menu_help_callback (help_string, pane, item) - char *help_string; - int pane, item; +menu_help_callback (char *help_string, int pane, int item) { extern Lisp_Object Qmenu_item; Lisp_Object *first_item; @@ -2321,8 +2233,7 @@ menu_help_callback (help_string, pane, item) } static Lisp_Object -pop_down_menu (arg) - Lisp_Object arg; +pop_down_menu (Lisp_Object arg) { struct Lisp_Save_Value *p1 = XSAVE_VALUE (Fcar (arg)); struct Lisp_Save_Value *p2 = XSAVE_VALUE (Fcdr (arg)); @@ -2357,14 +2268,8 @@ pop_down_menu (arg) Lisp_Object -xmenu_show (f, x, y, for_click, keymaps, title, error, timestamp) - FRAME_PTR f; - int x, y; - int for_click; - int keymaps; - Lisp_Object title; - char **error; - EMACS_UINT timestamp; +xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, + Lisp_Object title, char **error, EMACS_UINT timestamp) { Window root; XMenu *menu; @@ -2495,12 +2400,10 @@ xmenu_show (f, x, y, for_click, keymaps, title, error, timestamp) item_data = (unsigned char *) alloca (maxwidth + SBYTES (descrip) + 1); - bcopy (SDATA (item_name), item_data, - SBYTES (item_name)); + memcpy (item_data, SDATA (item_name), SBYTES (item_name)); for (j = SCHARS (item_name); j < maxwidth; j++) item_data[j] = ' '; - bcopy (SDATA (descrip), item_data + j, - SBYTES (descrip)); + memcpy (item_data + j, SDATA (descrip), SBYTES (descrip)); item_data[j + SBYTES (descrip)] = 0; } else @@ -2658,7 +2561,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error, timestamp) /* Detect if a dialog or menu has been posted. */ int -popup_activated () +popup_activated (void) { return popup_activated_flag; } @@ -2667,7 +2570,7 @@ popup_activated () DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0, doc: /* Return t if a menu or popup dialog is active. */) - () + (void) { #ifdef HAVE_MENUS return (popup_activated ()) ? Qt : Qnil; @@ -2677,7 +2580,7 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_ } void -syms_of_xmenu () +syms_of_xmenu (void) { Qdebug_on_next_call = intern_c_string ("debug-on-next-call"); staticpro (&Qdebug_on_next_call); diff --git a/src/xrdb.c b/src/xrdb.c index bd3474c0466..513768e3cde 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -50,7 +50,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "lisp.h" -extern char *getenv (); +extern char *getenv (const char *); /* This does cause trouble on AIX. I'm going to take the comment at face value. */ @@ -64,11 +64,11 @@ extern short getuid (); /* If this causes portability problems, extern struct passwd *getpwuid (uid_t); extern struct passwd *getpwnam (const char *); #else -extern struct passwd *getpwuid (); -extern struct passwd *getpwnam (); +extern struct passwd *getpwuid (uid_t); +extern struct passwd *getpwnam (const char *); #endif -extern char *get_system_name (); +extern char *get_system_name (void); /* Make sure not to #include anything after these definitions. Let's not step on anyone's prototypes. */ @@ -82,8 +82,8 @@ extern char *get_system_name (); #define free xfree #endif -char *x_get_string_resource (); -static int file_p (); +char *x_get_string_resource (XrmDatabase rdb, char *name, char *class); +static int file_p (char *filename); /* X file search path processing. */ @@ -98,9 +98,7 @@ char *x_customization_string; resource, for later use in search path decoding. If we find no such resource, return zero. */ char * -x_get_customization_string (db, name, class) - XrmDatabase db; - char *name, *class; +x_get_customization_string (XrmDatabase db, char *name, char *class) { char *full_name = (char *) alloca (strlen (name) + sizeof ("customization") + 3); @@ -155,10 +153,7 @@ x_get_customization_string (db, name, class) Return NULL otherwise. */ static char * -magic_file_p (string, string_len, class, escaped_suffix, suffix) - char *string; - int string_len; - char *class, *escaped_suffix, *suffix; +magic_file_p (char *string, int string_len, char *class, char *escaped_suffix, char *suffix) { char *lang = getenv ("LANG"); @@ -238,7 +233,7 @@ magic_file_p (string, string_len, class, escaped_suffix, suffix) path = (char *) realloc (path, path_size); } - bcopy (next, path + path_len, next_len); + memcpy (path + path_len, next, next_len); path_len += next_len; p++; @@ -264,7 +259,7 @@ magic_file_p (string, string_len, class, escaped_suffix, suffix) path = (char *) realloc (path, path_size); } - bcopy (suffix, path + path_len, suffix_len); + memcpy (path + path_len, suffix, suffix_len); path_len += suffix_len; } @@ -281,7 +276,7 @@ magic_file_p (string, string_len, class, escaped_suffix, suffix) static char * -gethomedir () +gethomedir (void) { struct passwd *pw; char *ptr; @@ -311,8 +306,7 @@ gethomedir () static int -file_p (filename) - char *filename; +file_p (char *filename) { struct stat status; @@ -327,8 +321,7 @@ file_p (filename) the path name of the one we found otherwise. */ static char * -search_magic_path (search_path, class, escaped_suffix, suffix) - char *search_path, *class, *escaped_suffix, *suffix; +search_magic_path (char *search_path, char *class, char *escaped_suffix, char *suffix) { register char *s, *p; @@ -363,8 +356,7 @@ search_magic_path (search_path, class, escaped_suffix, suffix) /* Producing databases for individual sources. */ static XrmDatabase -get_system_app (class) - char *class; +get_system_app (char *class) { XrmDatabase db = NULL; char *path; @@ -384,16 +376,14 @@ get_system_app (class) static XrmDatabase -get_fallback (display) - Display *display; +get_fallback (Display *display) { return NULL; } static XrmDatabase -get_user_app (class) - char *class; +get_user_app (char *class) { char *path; char *file = 0; @@ -428,8 +418,7 @@ get_user_app (class) static XrmDatabase -get_user_db (display) - Display *display; +get_user_db (Display *display) { XrmDatabase db; char *xdefs; @@ -470,7 +459,7 @@ get_user_db (display) } static XrmDatabase -get_environ_db () +get_environ_db (void) { XrmDatabase db; char *p; @@ -505,9 +494,7 @@ XrmRepresentation x_rm_string; /* Quark representation */ /* Load X resources based on the display and a possible -xrm option. */ XrmDatabase -x_load_resources (display, xrm_string, myname, myclass) - Display *display; - char *xrm_string, *myname, *myclass; +x_load_resources (Display *display, char *xrm_string, char *myname, char *myclass) { XrmDatabase user_database; XrmDatabase rdb; @@ -641,11 +628,7 @@ x_load_resources (display, xrm_string, myname, myclass) and of type TYPE from database RDB. The value is returned in RET_VALUE. */ int -x_get_resource (rdb, name, class, expected_type, ret_value) - XrmDatabase rdb; - char *name, *class; - XrmRepresentation expected_type; - XrmValue *ret_value; +x_get_resource (XrmDatabase rdb, char *name, char *class, XrmRepresentation expected_type, XrmValue *ret_value) { XrmValue value; XrmName namelist[100]; @@ -661,7 +644,7 @@ x_get_resource (rdb, name, class, expected_type, ret_value) if (type == x_rm_string) ret_value->addr = (char *) value.addr; else - bcopy (value.addr, ret_value->addr, ret_value->size); + memcpy (ret_value->addr, value.addr, ret_value->size); return value.size; } @@ -673,9 +656,7 @@ x_get_resource (rdb, name, class, expected_type, ret_value) database RDB. */ char * -x_get_string_resource (rdb, name, class) - XrmDatabase rdb; - char *name, *class; +x_get_string_resource (XrmDatabase rdb, char *name, char *class) { XrmValue value; diff --git a/src/xselect.c b/src/xselect.c index e2027736855..cd0307344ab 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -45,44 +45,44 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ struct prop_location; -static Lisp_Object x_atom_to_symbol P_ ((Display *dpy, Atom atom)); -static Atom symbol_to_x_atom P_ ((struct x_display_info *, Display *, - Lisp_Object)); -static void x_own_selection P_ ((Lisp_Object, Lisp_Object)); -static Lisp_Object x_get_local_selection P_ ((Lisp_Object, Lisp_Object, int)); -static void x_decline_selection_request P_ ((struct input_event *)); -static Lisp_Object x_selection_request_lisp_error P_ ((Lisp_Object)); -static Lisp_Object queue_selection_requests_unwind P_ ((Lisp_Object)); -static Lisp_Object some_frame_on_display P_ ((struct x_display_info *)); -static Lisp_Object x_catch_errors_unwind P_ ((Lisp_Object)); -static void x_reply_selection_request P_ ((struct input_event *, int, - unsigned char *, int, Atom)); -static int waiting_for_other_props_on_window P_ ((Display *, Window)); -static struct prop_location *expect_property_change P_ ((Display *, Window, - Atom, int)); -static void unexpect_property_change P_ ((struct prop_location *)); -static Lisp_Object wait_for_property_change_unwind P_ ((Lisp_Object)); -static void wait_for_property_change P_ ((struct prop_location *)); -static Lisp_Object x_get_foreign_selection P_ ((Lisp_Object, - Lisp_Object, - Lisp_Object)); -static void x_get_window_property P_ ((Display *, Window, Atom, - unsigned char **, int *, - Atom *, int *, unsigned long *, int)); -static void receive_incremental_selection P_ ((Display *, Window, Atom, - Lisp_Object, unsigned, - unsigned char **, int *, - Atom *, int *, unsigned long *)); -static Lisp_Object x_get_window_property_as_lisp_data P_ ((Display *, - Window, Atom, - Lisp_Object, Atom)); -static Lisp_Object selection_data_to_lisp_data P_ ((Display *, unsigned char *, - int, Atom, int)); -static void lisp_data_to_selection_data P_ ((Display *, Lisp_Object, - unsigned char **, Atom *, - unsigned *, int *, int *)); -static Lisp_Object clean_local_selection_data P_ ((Lisp_Object)); -static void initialize_cut_buffers P_ ((Display *, Window)); +static Lisp_Object x_atom_to_symbol (Display *dpy, Atom atom); +static Atom symbol_to_x_atom (struct x_display_info *, Display *, + Lisp_Object); +static void x_own_selection (Lisp_Object, Lisp_Object); +static Lisp_Object x_get_local_selection (Lisp_Object, Lisp_Object, int); +static void x_decline_selection_request (struct input_event *); +static Lisp_Object x_selection_request_lisp_error (Lisp_Object); +static Lisp_Object queue_selection_requests_unwind (Lisp_Object); +static Lisp_Object some_frame_on_display (struct x_display_info *); +static Lisp_Object x_catch_errors_unwind (Lisp_Object); +static void x_reply_selection_request (struct input_event *, int, + unsigned char *, int, Atom); +static int waiting_for_other_props_on_window (Display *, Window); +static struct prop_location *expect_property_change (Display *, Window, + Atom, int); +static void unexpect_property_change (struct prop_location *); +static Lisp_Object wait_for_property_change_unwind (Lisp_Object); +static void wait_for_property_change (struct prop_location *); +static Lisp_Object x_get_foreign_selection (Lisp_Object, + Lisp_Object, + Lisp_Object); +static void x_get_window_property (Display *, Window, Atom, + unsigned char **, int *, + Atom *, int *, unsigned long *, int); +static void receive_incremental_selection (Display *, Window, Atom, + Lisp_Object, unsigned, + unsigned char **, int *, + Atom *, int *, unsigned long *); +static Lisp_Object x_get_window_property_as_lisp_data (Display *, + Window, Atom, + Lisp_Object, Atom); +static Lisp_Object selection_data_to_lisp_data (Display *, unsigned char *, + int, Atom, int); +static void lisp_data_to_selection_data (Display *, Lisp_Object, + unsigned char **, Atom *, + unsigned *, int *, int *); +static Lisp_Object clean_local_selection_data (Lisp_Object); +static void initialize_cut_buffers (Display *, Window); /* Printing traces to stderr. */ @@ -183,8 +183,7 @@ static int x_queue_selection_requests; /* Queue up an SELECTION_REQUEST_EVENT *EVENT, to be processed later. */ static void -x_queue_event (event) - struct input_event *event; +x_queue_event (struct input_event *event) { struct selection_event_queue *queue_tmp; @@ -192,7 +191,7 @@ x_queue_event (event) This only happens for large requests which uses the incremental protocol. */ for (queue_tmp = selection_queue; queue_tmp; queue_tmp = queue_tmp->next) { - if (!bcmp (&queue_tmp->event, event, sizeof (*event))) + if (!memcmp (&queue_tmp->event, event, sizeof (*event))) { TRACE1 ("DECLINE DUP SELECTION EVENT %08lx", (unsigned long)queue_tmp); x_decline_selection_request (event); @@ -215,7 +214,7 @@ x_queue_event (event) /* Start queuing SELECTION_REQUEST_EVENT events. */ static void -x_start_queuing_selection_requests () +x_start_queuing_selection_requests (void) { if (x_queue_selection_requests) abort (); @@ -227,7 +226,7 @@ x_start_queuing_selection_requests () /* Stop queuing SELECTION_REQUEST_EVENT events. */ static void -x_stop_queuing_selection_requests () +x_stop_queuing_selection_requests (void) { TRACE1 ("x_stop_queuing_selection_requests %d", x_queue_selection_requests); --x_queue_selection_requests; @@ -250,10 +249,7 @@ x_stop_queuing_selection_requests () roundtrip whenever possible. */ static Atom -symbol_to_x_atom (dpyinfo, display, sym) - struct x_display_info *dpyinfo; - Display *display; - Lisp_Object sym; +symbol_to_x_atom (struct x_display_info *dpyinfo, Display *display, Lisp_Object sym) { Atom val; if (NILP (sym)) return 0; @@ -297,9 +293,7 @@ symbol_to_x_atom (dpyinfo, display, sym) and calls to intern whenever possible. */ static Lisp_Object -x_atom_to_symbol (dpy, atom) - Display *dpy; - Atom atom; +x_atom_to_symbol (Display *dpy, Atom atom) { struct x_display_info *dpyinfo; char *str; @@ -382,8 +376,7 @@ x_atom_to_symbol (dpy, atom) our selection. */ static void -x_own_selection (selection_name, selection_value) - Lisp_Object selection_name, selection_value; +x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value) { struct frame *sf = SELECTED_FRAME (); Window selecting_window; @@ -449,9 +442,7 @@ x_own_selection (selection_name, selection_value) This calls random Lisp code, and may signal or gc. */ static Lisp_Object -x_get_local_selection (selection_symbol, target_type, local_request) - Lisp_Object selection_symbol, target_type; - int local_request; +x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type, int local_request) { Lisp_Object local_value; Lisp_Object handler_fn, value, type, check; @@ -561,8 +552,7 @@ x_get_local_selection (selection_symbol, target_type, local_request) meaning we were unable to do what they wanted. */ static void -x_decline_selection_request (event) - struct input_event *event; +x_decline_selection_request (struct input_event *event) { XSelectionEvent reply; @@ -597,8 +587,7 @@ static struct x_display_info *selection_request_dpyinfo; before we throw to top-level or go into the debugger or whatever. */ static Lisp_Object -x_selection_request_lisp_error (ignore) - Lisp_Object ignore; +x_selection_request_lisp_error (Lisp_Object ignore) { if (x_selection_current_request != 0 && selection_request_dpyinfo->display) @@ -607,8 +596,7 @@ x_selection_request_lisp_error (ignore) } static Lisp_Object -x_catch_errors_unwind (dummy) - Lisp_Object dummy; +x_catch_errors_unwind (Lisp_Object dummy) { BLOCK_INPUT; x_uncatch_errors (); @@ -634,10 +622,10 @@ struct prop_location struct prop_location *next; }; -static struct prop_location *expect_property_change (); -static void wait_for_property_change (); -static void unexpect_property_change (); -static int waiting_for_other_props_on_window (); +static struct prop_location *expect_property_change (Display *display, Window window, Atom property, int state); +static void wait_for_property_change (struct prop_location *location); +static void unexpect_property_change (struct prop_location *location); +static int waiting_for_other_props_on_window (Display *display, Window window); static int prop_location_identifier; @@ -648,8 +636,7 @@ static struct prop_location *property_change_reply_object; static struct prop_location *property_change_wait_list; static Lisp_Object -queue_selection_requests_unwind (tem) - Lisp_Object tem; +queue_selection_requests_unwind (Lisp_Object tem) { x_stop_queuing_selection_requests (); return Qnil; @@ -659,8 +646,7 @@ queue_selection_requests_unwind (tem) Return nil if there is none. */ static Lisp_Object -some_frame_on_display (dpyinfo) - struct x_display_info *dpyinfo; +some_frame_on_display (struct x_display_info *dpyinfo) { Lisp_Object list, frame; @@ -684,11 +670,7 @@ static int x_reply_selection_request_cnt; #endif /* TRACE_SELECTION */ static void -x_reply_selection_request (event, format, data, size, type) - struct input_event *event; - int format, size; - unsigned char *data; - Atom type; +x_reply_selection_request (struct input_event *event, int format, unsigned char *data, int size, Atom type) { XSelectionEvent reply; Display *display = SELECTION_EVENT_DISPLAY (event); @@ -881,8 +863,7 @@ x_reply_selection_request (event, format, data, size, type) This is called from keyboard.c when such an event is found in the queue. */ static void -x_handle_selection_request (event) - struct input_event *event; +x_handle_selection_request (struct input_event *event) { struct gcpro gcpro1, gcpro2, gcpro3; Lisp_Object local_selection_data; @@ -1002,8 +983,7 @@ x_handle_selection_request (event) This is called from keyboard.c when such an event is found in the queue. */ static void -x_handle_selection_clear (event) - struct input_event *event; +x_handle_selection_clear (struct input_event *event) { Display *display = SELECTION_EVENT_DISPLAY (event); Atom selection = SELECTION_EVENT_SELECTION (event); @@ -1085,8 +1065,7 @@ x_handle_selection_clear (event) } void -x_handle_selection_event (event) - struct input_event *event; +x_handle_selection_event (struct input_event *event) { TRACE0 ("x_handle_selection_event"); @@ -1106,8 +1085,7 @@ x_handle_selection_event (event) We do this when about to delete a frame. */ void -x_clear_frame_selections (f) - FRAME_PTR f; +x_clear_frame_selections (FRAME_PTR f) { Lisp_Object frame; Lisp_Object rest; @@ -1168,9 +1146,7 @@ x_clear_frame_selections (f) are on the list of what we are waiting for. */ static int -waiting_for_other_props_on_window (display, window) - Display *display; - Window window; +waiting_for_other_props_on_window (Display *display, Window window) { struct prop_location *rest = property_change_wait_list; while (rest) @@ -1187,11 +1163,7 @@ waiting_for_other_props_on_window (display, window) this awaited property change. */ static struct prop_location * -expect_property_change (display, window, property, state) - Display *display; - Window window; - Atom property; - int state; +expect_property_change (Display *display, Window window, Atom property, int state) { struct prop_location *pl = (struct prop_location *) xmalloc (sizeof *pl); pl->identifier = ++prop_location_identifier; @@ -1209,8 +1181,7 @@ expect_property_change (display, window, property, state) IDENTIFIER is the number that uniquely identifies the entry. */ static void -unexpect_property_change (location) - struct prop_location *location; +unexpect_property_change (struct prop_location *location) { struct prop_location *prev = 0, *rest = property_change_wait_list; while (rest) @@ -1232,8 +1203,7 @@ unexpect_property_change (location) /* Remove the property change expectation element for IDENTIFIER. */ static Lisp_Object -wait_for_property_change_unwind (loc) - Lisp_Object loc; +wait_for_property_change_unwind (Lisp_Object loc) { struct prop_location *location = XSAVE_VALUE (loc)->pointer; @@ -1247,8 +1217,7 @@ wait_for_property_change_unwind (loc) IDENTIFIER should be the value that expect_property_change returned. */ static void -wait_for_property_change (location) - struct prop_location *location; +wait_for_property_change (struct prop_location *location) { int secs, usecs; int count = SPECPDL_INDEX (); @@ -1286,8 +1255,7 @@ wait_for_property_change (location) /* Called from XTread_socket in response to a PropertyNotify event. */ void -x_handle_property_notify (event) - XPropertyEvent *event; +x_handle_property_notify (XPropertyEvent *event) { struct prop_location *prev = 0, *rest = property_change_wait_list; @@ -1378,8 +1346,7 @@ static Window reading_selection_window; Converts this to Lisp data and returns it. */ static Lisp_Object -x_get_foreign_selection (selection_symbol, target_type, time_stamp) - Lisp_Object selection_symbol, target_type, time_stamp; +x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type, Lisp_Object time_stamp) { struct frame *sf = SELECTED_FRAME (); Window requestor_window; @@ -1486,18 +1453,10 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp) /* Use xfree, not XFree, to free the data obtained with this function. */ static void -x_get_window_property (display, window, property, data_ret, bytes_ret, - actual_type_ret, actual_format_ret, actual_size_ret, - delete_p) - Display *display; - Window window; - Atom property; - unsigned char **data_ret; - int *bytes_ret; - Atom *actual_type_ret; - int *actual_format_ret; - unsigned long *actual_size_ret; - int delete_p; +x_get_window_property (Display *display, Window window, Atom property, + unsigned char **data_ret, int *bytes_ret, + Atom *actual_type_ret, int *actual_format_ret, + unsigned long *actual_size_ret, int delete_p) { int total_size; unsigned long bytes_remaining; @@ -1567,7 +1526,7 @@ x_get_window_property (display, window, property, data_ret, bytes_ret, elements." This applies even if long is more than 32 bits, the X library converts from 32 bit elements received from the X server to long - and passes the long array to us. Thus, for that case bcopy can not + and passes the long array to us. Thus, for that case memcpy can not be used. We convert to a 32 bit type here, because so much code assume on that. @@ -1589,7 +1548,7 @@ x_get_window_property (display, window, property, data_ret, bytes_ret, else { *actual_size_ret *= *actual_format_ret / 8; - bcopy (tmp_data, (*data_ret) + offset, *actual_size_ret); + memcpy ((*data_ret) + offset, tmp_data, *actual_size_ret); offset += *actual_size_ret; } @@ -1605,19 +1564,12 @@ x_get_window_property (display, window, property, data_ret, bytes_ret, /* Use xfree, not XFree, to free the data obtained with this function. */ static void -receive_incremental_selection (display, window, property, target_type, - min_size_bytes, data_ret, size_bytes_ret, - type_ret, format_ret, size_ret) - Display *display; - Window window; - Atom property; - Lisp_Object target_type; /* for error messages only */ - unsigned int min_size_bytes; - unsigned char **data_ret; - int *size_bytes_ret; - Atom *type_ret; - unsigned long *size_ret; - int *format_ret; +receive_incremental_selection (Display *display, Window window, Atom property, + Lisp_Object target_type, + unsigned int min_size_bytes, + unsigned char **data_ret, int *size_bytes_ret, + Atom *type_ret, int *format_ret, + unsigned long *size_ret) { int offset = 0; struct prop_location *wait_object; @@ -1691,7 +1643,7 @@ receive_incremental_selection (display, window, property, target_type, *data_ret = (unsigned char *) xrealloc (*data_ret, *size_bytes_ret); } - bcopy (tmp_data, (*data_ret) + offset, tmp_size_bytes); + memcpy ((*data_ret) + offset, tmp_data, tmp_size_bytes); offset += tmp_size_bytes; /* Use xfree, not XFree, because x_get_window_property @@ -1706,13 +1658,10 @@ receive_incremental_selection (display, window, property, target_type, TARGET_TYPE and SELECTION_ATOM are used in error message if this fails. */ static Lisp_Object -x_get_window_property_as_lisp_data (display, window, property, target_type, - selection_atom) - Display *display; - Window window; - Atom property; - Lisp_Object target_type; /* for error messages only */ - Atom selection_atom; /* for error messages only */ +x_get_window_property_as_lisp_data (Display *display, Window window, + Atom property, + Lisp_Object target_type, + Atom selection_atom) { Atom actual_type; int actual_format; @@ -1809,11 +1758,7 @@ x_get_window_property_as_lisp_data (display, window, property, target_type, static Lisp_Object -selection_data_to_lisp_data (display, data, size, type, format) - Display *display; - unsigned char *data; - Atom type; - int size, format; +selection_data_to_lisp_data (Display *display, unsigned char *data, int size, Atom type, int format) { struct x_display_info *dpyinfo = x_display_info_for_display (display); @@ -1906,16 +1851,10 @@ selection_data_to_lisp_data (display, data, size, type, format) /* Use xfree, not XFree, to free the data obtained with this function. */ static void -lisp_data_to_selection_data (display, obj, - data_ret, type_ret, size_ret, - format_ret, nofree_ret) - Display *display; - Lisp_Object obj; - unsigned char **data_ret; - Atom *type_ret; - unsigned int *size_ret; - int *format_ret; - int *nofree_ret; +lisp_data_to_selection_data (Display *display, Lisp_Object obj, + unsigned char **data_ret, Atom *type_ret, + unsigned int *size_ret, + int *format_ret, int *nofree_ret) { Lisp_Object type = Qnil; struct x_display_info *dpyinfo = x_display_info_for_display (display); @@ -2071,8 +2010,7 @@ lisp_data_to_selection_data (display, obj, } static Lisp_Object -clean_local_selection_data (obj) - Lisp_Object obj; +clean_local_selection_data (Lisp_Object obj) { if (CONSP (obj) && INTEGERP (XCAR (obj)) @@ -2112,8 +2050,7 @@ clean_local_selection_data (obj) We store t there if the reply is successful, lambda if not. */ void -x_handle_selection_notify (event) - XSelectionEvent *event; +x_handle_selection_notify (XSelectionEvent *event) { if (event->requestor != reading_selection_window) return; @@ -2133,8 +2070,7 @@ TYPE is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. \(Those are literal upper-case symbol names, since that's what X expects.) VALUE is typically a string, or a cons of two markers, but may be anything that the functions on `selection-converter-alist' know about. */) - (selection_name, selection_value) - Lisp_Object selection_name, selection_value; + (Lisp_Object selection_name, Lisp_Object selection_value) { check_x (); CHECK_SYMBOL (selection_name); @@ -2156,8 +2092,7 @@ SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. TYPE is the type of data desired, typically `STRING'. TIME_STAMP is the time to use in the XConvertSelection call for foreign selections. If omitted, defaults to the time for the last event. */) - (selection_symbol, target_type, time_stamp) - Lisp_Object selection_symbol, target_type, time_stamp; + (Lisp_Object selection_symbol, Lisp_Object target_type, Lisp_Object time_stamp) { Lisp_Object val = Qnil; struct gcpro gcpro1, gcpro2; @@ -2202,9 +2137,7 @@ DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal, Sx_disown_selection_internal, 1, 2, 0, doc: /* If we own the selection SELECTION, disown it. Disowning it means there is no such selection. */) - (selection, time) - Lisp_Object selection; - Lisp_Object time; + (Lisp_Object selection, Lisp_Object time) { Time timestamp; Atom selection_atom; @@ -2254,8 +2187,7 @@ Disowning it means there is no such selection. */) This is used when we kill a buffer. */ void -x_disown_buffer_selections (buffer) - Lisp_Object buffer; +x_disown_buffer_selections (Lisp_Object buffer) { Lisp_Object tail; struct buffer *buf = XBUFFER (buffer); @@ -2279,8 +2211,7 @@ the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. \(Those are literal upper-case symbol names, since that's what X expects.) For convenience, the symbol nil is the same as `PRIMARY', and t is the same as `SECONDARY'. */) - (selection) - Lisp_Object selection; + (Lisp_Object selection) { check_x (); CHECK_SYMBOL (selection); @@ -2300,8 +2231,7 @@ the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. \(Those are literal upper-case symbol names, since that's what X expects.) For convenience, the symbol nil is the same as `PRIMARY', and t is the same as `SECONDARY'. */) - (selection) - Lisp_Object selection; + (Lisp_Object selection) { Window owner; Atom atom; @@ -2332,9 +2262,7 @@ and t is the same as `SECONDARY'. */) /* Ensure that all 8 cut buffers exist. ICCCM says we gotta... */ static void -initialize_cut_buffers (display, window) - Display *display; - Window window; +initialize_cut_buffers (Display *display, Window window) { unsigned char *data = (unsigned char *) ""; BLOCK_INPUT; @@ -2365,8 +2293,7 @@ initialize_cut_buffers (display, window) DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal, Sx_get_cut_buffer_internal, 1, 1, 0, doc: /* Returns the value of the named cut buffer (typically CUT_BUFFER0). */) - (buffer) - Lisp_Object buffer; + (Lisp_Object buffer) { Window window; Atom buffer_atom; @@ -2416,8 +2343,7 @@ DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal, DEFUN ("x-store-cut-buffer-internal", Fx_store_cut_buffer_internal, Sx_store_cut_buffer_internal, 2, 2, 0, doc: /* Sets the value of the named cut buffer (typically CUT_BUFFER0). */) - (buffer, string) - Lisp_Object buffer, string; + (Lisp_Object buffer, Lisp_Object string) { Window window; Atom buffer_atom; @@ -2482,8 +2408,7 @@ DEFUN ("x-rotate-cut-buffers-internal", Fx_rotate_cut_buffers_internal, Sx_rotate_cut_buffers_internal, 1, 1, 0, doc: /* Rotate the values of the cut buffers by N steps. Positive N means shift the values forward, negative means backward. */) - (n) - Lisp_Object n; + (Lisp_Object n) { Window window; Atom props[8]; @@ -2530,8 +2455,7 @@ Positive N means shift the values forward, negative means backward. */) bit parts of a 32 bit number). */ int -x_check_property_data (data) - Lisp_Object data; +x_check_property_data (Lisp_Object data) { Lisp_Object iter; int size = 0; @@ -2564,11 +2488,7 @@ x_check_property_data (data) XClientMessageEvent). */ void -x_fill_property_data (dpy, data, ret, format) - Display *dpy; - Lisp_Object data; - void *ret; - int format; +x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format) { long val; long *d32 = (long *) ret; @@ -2620,12 +2540,7 @@ x_fill_property_data (dpy, data, ret, format) Also see comment for selection_data_to_lisp_data above. */ Lisp_Object -x_property_data_to_lisp (f, data, type, format, size) - struct frame *f; - unsigned char *data; - Atom type; - int format; - unsigned long size; +x_property_data_to_lisp (struct frame *f, unsigned char *data, Atom type, int format, long unsigned int size) { return selection_data_to_lisp_data (FRAME_X_DISPLAY (f), data, size*format/8, type, format); @@ -2634,10 +2549,7 @@ x_property_data_to_lisp (f, data, type, format, size) /* Get the mouse position in frame relative coordinates. */ static void -mouse_position_for_drop (f, x, y) - FRAME_PTR f; - int *x; - int *y; +mouse_position_for_drop (FRAME_PTR f, int *x, int *y) { Window root, dummy_window; int dummy; @@ -2679,8 +2591,7 @@ the cdr is the lower 16 bits of a 32 bit value. Use the display for FRAME or the current frame if FRAME is not given or nil. If the value is 0 or the atom is not known, return the empty string. */) - (value, frame) - Lisp_Object value, frame; + (Lisp_Object value, Lisp_Object frame) { struct frame *f = check_x_frame (frame); char *name = 0; @@ -2720,8 +2631,7 @@ DEFUN ("x-register-dnd-atom", Fx_register_dnd_atom, doc: /* Request that dnd events are made for ClientMessages with ATOM. ATOM can be a symbol or a string. The ATOM is interned on the display that FRAME is on. If FRAME is nil, the selected frame is used. */) - (atom, frame) - Lisp_Object atom, frame; + (Lisp_Object atom, Lisp_Object frame) { Atom x_atom; struct frame *f = check_x_frame (frame); @@ -2759,11 +2669,7 @@ FRAME is on. If FRAME is nil, the selected frame is used. */) /* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. */ int -x_handle_dnd_message (f, event, dpyinfo, bufp) - struct frame *f; - XClientMessageEvent *event; - struct x_display_info *dpyinfo; - struct input_event *bufp; +x_handle_dnd_message (struct frame *f, XClientMessageEvent *event, struct x_display_info *dpyinfo, struct input_event *bufp) { Lisp_Object vec; Lisp_Object frame; @@ -2842,8 +2748,7 @@ the Atom is sent. If a value is a cons, it is converted to a 32 bit number with the high 16 bits from the car and the lower 16 bit from the cdr. If more values than fits into the event is given, the excessive values are ignored. */) - (display, dest, from, message_type, format, values) - Lisp_Object display, dest, from, message_type, format, values; + (Lisp_Object display, Lisp_Object dest, Lisp_Object from, Lisp_Object message_type, Lisp_Object format, Lisp_Object values) { struct x_display_info *dpyinfo = check_x_display_info (display); Window wdest; @@ -2935,7 +2840,7 @@ are ignored. */) void -syms_of_xselect () +syms_of_xselect (void) { defsubr (&Sx_get_selection_internal); defsubr (&Sx_own_selection_internal); diff --git a/src/xsettings.c b/src/xsettings.c index 8cfcafe126d..c02c850ac85 100644 --- a/src/xsettings.c +++ b/src/xsettings.c @@ -54,9 +54,7 @@ static GConfClient *gconf_client; static void -store_config_changed_event (arg, display_name) - Lisp_Object arg; - Lisp_Object display_name; +store_config_changed_event (Lisp_Object arg, Lisp_Object display_name) { struct input_event event; EVENT_INIT (event); @@ -102,11 +100,10 @@ struct xsettings that is SYSTEM_MONO_FONT. */ static void -something_changedCB (client, cnxn_id, entry, user_data) - GConfClient *client; - guint cnxn_id; - GConfEntry *entry; - gpointer user_data; +something_changedCB (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + gpointer user_data) { GConfValue *v = gconf_entry_get_value (entry); @@ -114,7 +111,6 @@ something_changedCB (client, cnxn_id, entry, user_data) if (v->type == GCONF_VALUE_STRING) { const char *value = gconf_value_get_string (v); - int i; if (current_mono_font != NULL && strcmp (value, current_mono_font) == 0) return; /* No change. */ @@ -156,8 +152,7 @@ something_changedCB (client, cnxn_id, entry, user_data) /* Find the window that contains the XSETTINGS property values. */ static void -get_prop_window (dpyinfo) - struct x_display_info *dpyinfo; +get_prop_window (struct x_display_info *dpyinfo) { Display *dpy = dpyinfo->display; @@ -229,10 +224,9 @@ get_prop_window (dpyinfo) */ static int -parse_settings (prop, bytes, settings) - unsigned char *prop; - unsigned long bytes; - struct xsettings *settings; +parse_settings (unsigned char *prop, + long unsigned int bytes, + struct xsettings *settings) { Lisp_Object byteorder = Fbyteorder (); int my_bo = XFASTINT (byteorder) == 'B' ? MSBFirst : LSBFirst; @@ -402,11 +396,8 @@ parse_settings (prop, bytes, settings) } static int -read_settings (dpyinfo, settings) - struct x_display_info *dpyinfo; - struct xsettings *settings; +read_settings (struct x_display_info *dpyinfo, struct xsettings *settings) { - long long_len; Atom act_type; int act_form; unsigned long nitems, bytes_after; @@ -435,10 +426,9 @@ read_settings (dpyinfo, settings) static void -apply_xft_settings (dpyinfo, send_event_p, settings) - struct x_display_info *dpyinfo; - int send_event_p; - struct xsettings *settings; +apply_xft_settings (struct x_display_info *dpyinfo, + int send_event_p, + struct xsettings *settings) { #ifdef HAVE_XFT FcPattern *pat; @@ -546,9 +536,7 @@ apply_xft_settings (dpyinfo, send_event_p, settings) } static void -read_and_apply_settings (dpyinfo, send_event_p) - struct x_display_info *dpyinfo; - int send_event_p; +read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p) { struct xsettings settings; Lisp_Object dpyname = XCAR (dpyinfo->name_list_element); @@ -592,9 +580,7 @@ read_and_apply_settings (dpyinfo, send_event_p) } void -xft_settings_event (dpyinfo, event) - struct x_display_info *dpyinfo; - XEvent *event; +xft_settings_event (struct x_display_info *dpyinfo, XEvent *event) { int check_window_p = 0; int apply_settings = 0; @@ -636,10 +622,9 @@ xft_settings_event (dpyinfo, event) static void -init_gconf () +init_gconf (void) { #if defined (HAVE_GCONF) && defined (HAVE_XFT) - int i; char *s; g_type_init (); @@ -669,8 +654,7 @@ init_gconf () } static void -init_xsettings (dpyinfo) - struct x_display_info *dpyinfo; +init_xsettings (struct x_display_info *dpyinfo) { char sel[64]; Display *dpy = dpyinfo->display; @@ -696,8 +680,7 @@ init_xsettings (dpyinfo) } void -xsettings_initialize (dpyinfo) - struct x_display_info *dpyinfo; +xsettings_initialize (struct x_display_info *dpyinfo) { if (first_dpyinfo == NULL) first_dpyinfo = dpyinfo; init_gconf (); @@ -705,13 +688,13 @@ xsettings_initialize (dpyinfo) } const char * -xsettings_get_system_font () +xsettings_get_system_font (void) { return current_mono_font; } const char * -xsettings_get_system_normal_font () +xsettings_get_system_normal_font (void) { return current_font; } @@ -719,20 +702,20 @@ xsettings_get_system_normal_font () DEFUN ("font-get-system-normal-font", Ffont_get_system_normal_font, Sfont_get_system_normal_font, 0, 0, 0, - doc: /* Get the system default font. */) - () + doc: /* Get the system default application font. */) + (void) { - return current_font && use_system_font + return current_font ? make_string (current_font, strlen (current_font)) : Qnil; } DEFUN ("font-get-system-font", Ffont_get_system_font, Sfont_get_system_font, 0, 0, 0, - doc: /* Get the system default monospaced font. */) - () + doc: /* Get the system default fixed width font. */) + (void) { - return current_mono_font && use_system_font + return current_mono_font ? make_string (current_mono_font, strlen (current_mono_font)) : Qnil; } @@ -742,7 +725,7 @@ DEFUN ("tool-bar-get-system-style", Ftool_bar_get_system_style, Stool_bar_get_sy doc: /* Get the system tool bar style. If no system tool bar style is known, return `tool-bar-style' if set to a known style. Otherwise return image. */) - () + (void) { if (EQ (Vtool_bar_style, Qimage) || EQ (Vtool_bar_style, Qtext) @@ -755,7 +738,7 @@ known style. Otherwise return image. */) } void -syms_of_xsettings () +syms_of_xsettings (void) { current_mono_font = NULL; current_font = NULL; @@ -774,7 +757,10 @@ syms_of_xsettings () defsubr (&Sfont_get_system_normal_font); DEFVAR_BOOL ("font-use-system-font", &use_system_font, - doc: /* *Non-nil means to use the system defined font. */); + doc: /* *Non-nil means to apply the system defined font dynamically. +When this is non-nil and the system defined fixed width font changes, we +update frames dynamically. +If this variable is nil, Emacs ignores system font changes. */); use_system_font = 0; DEFVAR_LISP ("xft-settings", &Vxft_settings, diff --git a/src/xsettings.h b/src/xsettings.h index 53fca2ad6b5..50819d456c8 100644 --- a/src/xsettings.h +++ b/src/xsettings.h @@ -24,11 +24,11 @@ EXFUN (Ffont_get_system_font, 0); EXFUN (Ffont_get_system_normal_font, 0); EXFUN (Ftool_bar_get_system_style, 0); -extern void xsettings_initialize P_ ((struct x_display_info *dpyinfo)); -extern void xft_settings_event P_ ((struct x_display_info *dpyinfo, - XEvent *)); -extern const char *xsettings_get_system_font P_ ((void)); -extern const char *xsettings_get_system_normal_font P_ ((void)); +extern void xsettings_initialize (struct x_display_info *dpyinfo); +extern void xft_settings_event (struct x_display_info *dpyinfo, + XEvent *); +extern const char *xsettings_get_system_font (void); +extern const char *xsettings_get_system_normal_font (void); #endif /* XSETTINGS_H */ diff --git a/src/xsmfns.c b/src/xsmfns.c index 78d7d9f6523..cb3773f7c40 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c @@ -42,6 +42,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "termopts.h" #include "xterm.h" +/* Avoid "differ in sign" warnings */ +#define SSDATA(x) ((char *) SDATA (x)) + /* The user login name. */ extern Lisp_Object Vuser_login_name; @@ -95,7 +98,7 @@ Lisp_Object Vx_session_previous_id; #define CHDIR_OPT "--chdir=" static void -ice_connection_closed () +ice_connection_closed (void) { if (ice_fd >= 0) delete_keyboard_wait_descriptor (ice_fd); @@ -108,8 +111,7 @@ ice_connection_closed () Otherwise returns 1 if SAVE_SESSION_EVENT is stored in buffer BUFP. */ int -x_session_check_input (bufp) - struct input_event *bufp; +x_session_check_input (struct input_event *bufp) { SELECT_TYPE read_fds; EMACS_TIME tmout; @@ -152,7 +154,7 @@ x_session_check_input (bufp) /* Check if smc_interact_CB was called and we shall generate a SAVE_SESSION_EVENT. */ if (emacs_event.kind != NO_EVENT) - bcopy (&emacs_event, bufp, sizeof (struct input_event)); + memcpy (bufp, &emacs_event, sizeof (struct input_event)); return emacs_event.kind != NO_EVENT ? 1 : 0; } @@ -160,7 +162,7 @@ x_session_check_input (bufp) /* Return non-zero if we have a connection to a session manager. */ int -x_session_have_connection () +x_session_have_connection (void) { return ice_fd != -1; } @@ -170,9 +172,7 @@ x_session_have_connection () Then lisp code can interact with the user. */ static void -smc_interact_CB (smcConn, clientData) - SmcConn smcConn; - SmPointer clientData; +smc_interact_CB (SmcConn smcConn, SmPointer clientData) { doing_interact = True; emacs_event.kind = SAVE_SESSION_EVENT; @@ -187,18 +187,12 @@ smc_interact_CB (smcConn, clientData) we do so, because we don't know what the lisp code might do. */ static void -smc_save_yourself_CB (smcConn, - clientData, - saveType, - shutdown, - interactStyle, - fast) - SmcConn smcConn; - SmPointer clientData; - int saveType; - Bool shutdown; - int interactStyle; - Bool fast; +smc_save_yourself_CB (SmcConn smcConn, + SmPointer clientData, + int saveType, + Bool shutdown, + int interactStyle, + Bool fast) { #define NR_PROPS 5 @@ -228,7 +222,7 @@ smc_save_yourself_CB (smcConn, props[props_idx]->type = SmARRAY8; props[props_idx]->num_vals = 1; props[props_idx]->vals = &values[val_idx++]; - props[props_idx]->vals[0].length = strlen (SDATA (Vinvocation_name)); + props[props_idx]->vals[0].length = strlen (SSDATA (Vinvocation_name)); props[props_idx]->vals[0].value = SDATA (Vinvocation_name); ++props_idx; @@ -272,7 +266,7 @@ smc_save_yourself_CB (smcConn, props[props_idx]->type = SmARRAY8; props[props_idx]->num_vals = 1; props[props_idx]->vals = &values[val_idx++]; - props[props_idx]->vals[0].length = strlen (SDATA (Vuser_login_name)); + props[props_idx]->vals[0].length = strlen (SSDATA (Vuser_login_name)); props[props_idx]->vals[0].value = SDATA (Vuser_login_name); ++props_idx; @@ -311,9 +305,7 @@ smc_save_yourself_CB (smcConn, /* According to the SM specification, this shall close the connection. */ static void -smc_die_CB (smcConn, clientData) - SmcConn smcConn; - SmPointer clientData; +smc_die_CB (SmcConn smcConn, SmPointer clientData) { SmcCloseConnection (smcConn, 0, 0); ice_connection_closed (); @@ -326,17 +318,13 @@ smc_die_CB (smcConn, clientData) even seem necessary. */ static void -smc_save_complete_CB (smcConn, clientData) - SmcConn smcConn; - SmPointer clientData; +smc_save_complete_CB (SmcConn smcConn, SmPointer clientData) { /* Empty */ } static void -smc_shutdown_cancelled_CB (smcConn, clientData) - SmcConn smcConn; - SmPointer clientData; +smc_shutdown_cancelled_CB (SmcConn smcConn, SmPointer clientData) { /* Empty */ } @@ -345,47 +333,32 @@ smc_shutdown_cancelled_CB (smcConn, clientData) because there is some error in the session management. */ static void -smc_error_handler (smcConn, - swap, - offendingMinorOpcode, - offendingSequence, - errorClass, - severity, - values) - SmcConn smcConn; - Bool swap; - int offendingMinorOpcode; - unsigned long offendingSequence; - int errorClass; - int severity; - SmPointer values; +smc_error_handler (SmcConn smcConn, + Bool swap, + int offendingMinorOpcode, + unsigned long offendingSequence, + int errorClass, + int severity, + SmPointer values) { /* Empty */ } static void -ice_error_handler (iceConn, - swap, - offendingMinorOpcode, - offendingSequence, - errorClass, - severity, - values) - IceConn iceConn; - Bool swap; - int offendingMinorOpcode; - unsigned long offendingSequence; - int errorClass; - int severity; - IcePointer values; +ice_error_handler (IceConn iceConn, + Bool swap, + int offendingMinorOpcode, + unsigned long offendingSequence, + int errorClass, + int severity, + IcePointer values) { /* Empty */ } static void -ice_io_error_handler (iceConn) - IceConn iceConn; +ice_io_error_handler (IceConn iceConn) { /* Connection probably gone. */ ice_connection_closed (); @@ -395,11 +368,7 @@ ice_io_error_handler (iceConn) uses ICE as it transport protocol. */ static void -ice_conn_watch_CB (iceConn, clientData, opening, watchData) - IceConn iceConn; - IcePointer clientData; - Bool opening; - IcePointer *watchData; +ice_conn_watch_CB (IceConn iceConn, IcePointer clientData, int opening, IcePointer *watchData) { if (! opening) { @@ -422,10 +391,9 @@ ice_conn_watch_CB (iceConn, clientData, opening, watchData) /* Create the client leader window. */ +#ifndef USE_GTK static void -create_client_leader_window (dpyinfo, client_id) - struct x_display_info *dpyinfo; - char *client_id; +create_client_leader_window (struct x_display_info *dpyinfo, char *client_id) { Window w; XClassHint class_hints; @@ -443,16 +411,17 @@ create_client_leader_window (dpyinfo, client_id) sm_id = XInternAtom (dpyinfo->display, "SM_CLIENT_ID", False); XChangeProperty (dpyinfo->display, w, sm_id, XA_STRING, 8, PropModeReplace, - client_id, strlen (client_id)); + (unsigned char *)client_id, strlen (client_id)); dpyinfo->client_leader_window = w; } +#endif /* ! USE_GTK */ + /* Try to open a connection to the session manager. */ void -x_session_initialize (dpyinfo) - struct x_display_info *dpyinfo; +x_session_initialize (struct x_display_info *dpyinfo) { #define SM_ERRORSTRING_LEN 512 char errorstring[SM_ERRORSTRING_LEN]; @@ -466,12 +435,12 @@ x_session_initialize (dpyinfo) /* Check if we where started by the session manager. If so, we will have a previous id. */ if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id)) - previous_id = SDATA (Vx_session_previous_id); + previous_id = SSDATA (Vx_session_previous_id); /* Construct the path to the Emacs program. */ if (! EQ (Vinvocation_directory, Qnil)) - name_len += strlen (SDATA (Vinvocation_directory)); - name_len += strlen (SDATA (Vinvocation_name)); + name_len += strlen (SSDATA (Vinvocation_directory)); + name_len += strlen (SSDATA (Vinvocation_name)); /* This malloc will not be freed, but it is only done once, and hopefully not very large */ @@ -479,8 +448,8 @@ x_session_initialize (dpyinfo) emacs_program[0] = '\0'; if (! EQ (Vinvocation_directory, Qnil)) - strcpy (emacs_program, SDATA (Vinvocation_directory)); - strcat (emacs_program, SDATA (Vinvocation_name)); + strcpy (emacs_program, SSDATA (Vinvocation_directory)); + strcat (emacs_program, SSDATA (Vinvocation_name)); /* The SM protocol says all callbacks are mandatory, so set up all here and in the mask passed to SmcOpenConnection. */ @@ -532,7 +501,7 @@ x_session_initialize (dpyinfo) /* Ensure that the session manager is not contacted again. */ void -x_session_close () +x_session_close (void) { ice_connection_closed (); } @@ -550,8 +519,7 @@ from `emacs-session-save' If the return value is non-nil the session manager is told to abort the window system shutdown. Do not call this function yourself. */) - (event) - Lisp_Object event; + (Lisp_Object event) { /* Check doing_interact so that we don't do anything if someone called this at the wrong time. */ @@ -575,7 +543,7 @@ Do not call this function yourself. */) Initialization ***********************************************************************/ void -syms_of_xsmfns () +syms_of_xsmfns (void) { DEFVAR_LISP ("x-session-id", &Vx_session_id, doc: /* The session id Emacs got from the session manager for this session. diff --git a/src/xterm.c b/src/xterm.c index f195c4fbbd5..ddc7a167684 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -104,13 +104,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #endif #ifdef USE_LUCID -extern int xlwmenu_window_p P_ ((Widget w, Window window)); -extern void xlwmenu_redisplay P_ ((Widget)); +extern int xlwmenu_window_p (Widget w, Window window); +extern void xlwmenu_redisplay (Widget); #endif #if defined (USE_X_TOOLKIT) || defined (USE_GTK) -extern void free_frame_menubar P_ ((struct frame *)); +extern void free_frame_menubar (struct frame *); #endif #ifdef USE_X_TOOLKIT @@ -332,61 +332,60 @@ Lisp_Object Qx_gtk_map_stock; extern Lisp_Object Vinhibit_redisplay; -extern XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *)); -extern int x_bitmap_mask P_ ((FRAME_PTR, int)); +extern XrmDatabase x_load_resources (Display *, char *, char *, char *); +extern int x_bitmap_mask (FRAME_PTR, int); -static int x_alloc_nearest_color_1 P_ ((Display *, Colormap, XColor *)); -static void x_set_window_size_1 P_ ((struct frame *, int, int, int)); -static const XColor *x_color_cells P_ ((Display *, int *)); -static void x_update_window_end P_ ((struct window *, int, int)); +static int x_alloc_nearest_color_1 (Display *, Colormap, XColor *); +static void x_set_window_size_1 (struct frame *, int, int, int); +static const XColor *x_color_cells (Display *, int *); +static void x_update_window_end (struct window *, int, int); -static int x_io_error_quitter P_ ((Display *)); -static struct terminal *x_create_terminal P_ ((struct x_display_info *)); -void x_delete_terminal P_ ((struct terminal *)); -static void x_update_end P_ ((struct frame *)); -static void XTframe_up_to_date P_ ((struct frame *)); -static void XTset_terminal_modes P_ ((struct terminal *)); -static void XTreset_terminal_modes P_ ((struct terminal *)); -static void x_clear_frame P_ ((struct frame *)); -static void frame_highlight P_ ((struct frame *)); -static void frame_unhighlight P_ ((struct frame *)); -static void x_new_focus_frame P_ ((struct x_display_info *, struct frame *)); -static void x_focus_changed P_ ((int, int, struct x_display_info *, - struct frame *, struct input_event *)); -static void x_detect_focus_change P_ ((struct x_display_info *, - XEvent *, struct input_event *)); -static void XTframe_rehighlight P_ ((struct frame *)); -static void x_frame_rehighlight P_ ((struct x_display_info *)); -static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *)); -static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int, - enum text_cursor_kinds)); +static int x_io_error_quitter (Display *); +static struct terminal *x_create_terminal (struct x_display_info *); +void x_delete_terminal (struct terminal *); +static void x_update_end (struct frame *); +static void XTframe_up_to_date (struct frame *); +static void XTset_terminal_modes (struct terminal *); +static void XTreset_terminal_modes (struct terminal *); +static void x_clear_frame (struct frame *); +static void frame_highlight (struct frame *); +static void frame_unhighlight (struct frame *); +static void x_new_focus_frame (struct x_display_info *, struct frame *); +static void x_focus_changed (int, int, struct x_display_info *, + struct frame *, struct input_event *); +static void x_detect_focus_change (struct x_display_info *, + XEvent *, struct input_event *); +static void XTframe_rehighlight (struct frame *); +static void x_frame_rehighlight (struct x_display_info *); +static void x_draw_hollow_cursor (struct window *, struct glyph_row *); +static void x_draw_bar_cursor (struct window *, struct glyph_row *, int, + enum text_cursor_kinds); -static void x_clip_to_row P_ ((struct window *, struct glyph_row *, int, GC)); -static void x_flush P_ ((struct frame *f)); -static void x_update_begin P_ ((struct frame *)); -static void x_update_window_begin P_ ((struct window *)); -static void x_after_update_window_line P_ ((struct glyph_row *)); -static struct scroll_bar *x_window_to_scroll_bar P_ ((Display *, Window)); -static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *, - enum scroll_bar_part *, - Lisp_Object *, Lisp_Object *, - unsigned long *)); -static void x_handle_net_wm_state P_ ((struct frame *, XPropertyEvent *)); -static void x_check_fullscreen P_ ((struct frame *)); -static void x_check_expected_move P_ ((struct frame *, int, int)); -static void x_sync_with_move P_ ((struct frame *, int, int, int)); -static int handle_one_xevent P_ ((struct x_display_info *, XEvent *, - int *, struct input_event *)); +static void x_clip_to_row (struct window *, struct glyph_row *, int, GC); +static void x_flush (struct frame *f); +static void x_update_begin (struct frame *); +static void x_update_window_begin (struct window *); +static void x_after_update_window_line (struct glyph_row *); +static struct scroll_bar *x_window_to_scroll_bar (Display *, Window); +static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *, + enum scroll_bar_part *, + Lisp_Object *, Lisp_Object *, + unsigned long *); +static void x_handle_net_wm_state (struct frame *, XPropertyEvent *); +static void x_check_fullscreen (struct frame *); +static void x_check_expected_move (struct frame *, int, int); +static void x_sync_with_move (struct frame *, int, int, int); +static int handle_one_xevent (struct x_display_info *, XEvent *, + int *, struct input_event *); /* Don't declare this NO_RETURN because we want no interference with debugging failing X calls. */ -static SIGTYPE x_connection_closed P_ ((Display *, char *)); +static SIGTYPE x_connection_closed (Display *, char *); /* Flush display of frame F, or of all frames if F is null. */ static void -x_flush (f) - struct frame *f; +x_flush (struct frame *f) { /* Don't call XFlush when it is not safe to redisplay; the X connection may be broken. */ @@ -455,8 +454,7 @@ record_event (locus, type) /* Return the struct x_display_info corresponding to DPY. */ struct x_display_info * -x_display_info_for_display (dpy) - Display *dpy; +x_display_info_for_display (Display *dpy) { struct x_display_info *dpyinfo; @@ -471,8 +469,7 @@ x_display_info_for_display (dpy) #define OPACITY "_NET_WM_WINDOW_OPACITY" void -x_set_frame_alpha (f) - struct frame *f; +x_set_frame_alpha (struct frame *f) { struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); Display *dpy = FRAME_X_DISPLAY (f); @@ -484,7 +481,7 @@ x_set_frame_alpha (f) if (FRAME_X_DISPLAY_INFO (f)->root_window != FRAME_X_OUTPUT (f)->parent_desc) /* Since the WM decoration lies under the FRAME_OUTER_WINDOW, we must treat the former instead of the latter. */ - win = FRAME_X_OUTPUT(f)->parent_desc; + win = FRAME_X_OUTPUT (f)->parent_desc; if (dpyinfo->x_highlight_frame == f) alpha = f->alpha[0]; @@ -513,10 +510,10 @@ x_set_frame_alpha (f) unsigned long n, left; x_catch_errors (dpy); - rc = XGetWindowProperty(dpy, win, XInternAtom(dpy, OPACITY, False), - 0L, 1L, False, XA_CARDINAL, - &actual, &format, &n, &left, - &data); + rc = XGetWindowProperty (dpy, win, XInternAtom(dpy, OPACITY, False), + 0L, 1L, False, XA_CARDINAL, + &actual, &format, &n, &left, + &data); if (rc == Success && actual != None) if (*(unsigned long *)data == opac) @@ -538,15 +535,13 @@ x_set_frame_alpha (f) } int -x_display_pixel_height (dpyinfo) - struct x_display_info *dpyinfo; +x_display_pixel_height (struct x_display_info *dpyinfo) { return HeightOfScreen (dpyinfo->screen); } int -x_display_pixel_width (dpyinfo) - struct x_display_info *dpyinfo; +x_display_pixel_width (struct x_display_info *dpyinfo) { return WidthOfScreen (dpyinfo->screen); } @@ -563,8 +558,7 @@ x_display_pixel_width (dpyinfo) because all interesting stuff is done on a window basis. */ static void -x_update_begin (f) - struct frame *f; +x_update_begin (struct frame *f) { /* Nothing to do. */ } @@ -575,8 +569,7 @@ x_update_begin (f) position of W. */ static void -x_update_window_begin (w) - struct window *w; +x_update_window_begin (struct window *w) { struct frame *f = XFRAME (WINDOW_FRAME (w)); struct x_display_info *display_info = FRAME_X_DISPLAY_INFO (f); @@ -604,9 +597,7 @@ x_update_window_begin (w) /* Draw a vertical window border from (x,y0) to (x,y1) */ static void -x_draw_vertical_window_border (w, x, y0, y1) - struct window *w; - int x, y0, y1; +x_draw_vertical_window_border (struct window *w, int x, int y0, int y1) { struct frame *f = XFRAME (WINDOW_FRAME (w)); struct face *face; @@ -634,9 +625,7 @@ x_draw_vertical_window_border (w, x, y0, y1) here. */ static void -x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p) - struct window *w; - int cursor_on_p, mouse_face_overwritten_p; +x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p) { struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); @@ -672,8 +661,7 @@ x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p) update_end. */ static void -x_update_end (f) - struct frame *f; +x_update_end (struct frame *f) { /* Mouse highlight may be displayed again. */ FRAME_X_DISPLAY_INFO (f)->mouse_face_defer = 0; @@ -691,8 +679,7 @@ x_update_end (f) updated_window is not available here. */ static void -XTframe_up_to_date (f) - struct frame *f; +XTframe_up_to_date (struct frame *f) { if (FRAME_X_P (f)) { @@ -721,8 +708,7 @@ XTframe_up_to_date (f) between bitmaps to be drawn between current row and DESIRED_ROW. */ static void -x_after_update_window_line (desired_row) - struct glyph_row *desired_row; +x_after_update_window_line (struct glyph_row *desired_row) { struct window *w = updated_window; struct frame *f; @@ -760,34 +746,16 @@ x_after_update_window_line (desired_row) } static void -x_draw_fringe_bitmap (w, row, p) - struct window *w; - struct glyph_row *row; - struct draw_fringe_bitmap_params *p; +x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fringe_bitmap_params *p) { struct frame *f = XFRAME (WINDOW_FRAME (w)); Display *display = FRAME_X_DISPLAY (f); Window window = FRAME_X_WINDOW (f); GC gc = f->output_data.x->normal_gc; struct face *face = p->face; - int rowY; /* Must clip because of partially visible lines. */ - rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); - if (p->y < rowY) - { - /* Adjust position of "bottom aligned" bitmap on partially - visible last row. */ - int oldY = row->y; - int oldVH = row->visible_height; - row->visible_height = p->h; - row->y -= rowY - p->y; - x_clip_to_row (w, row, -1, gc); - row->y = oldY; - row->visible_height = oldVH; - } - else - x_clip_to_row (w, row, -1, gc); + x_clip_to_row (w, row, -1, gc); if (!p->overlay_p) { @@ -931,37 +899,37 @@ XTreset_terminal_modes (struct terminal *terminal) -static void x_set_glyph_string_clipping P_ ((struct glyph_string *)); -static void x_set_glyph_string_gc P_ ((struct glyph_string *)); -static void x_draw_glyph_string_background P_ ((struct glyph_string *, - int)); -static void x_draw_glyph_string_foreground P_ ((struct glyph_string *)); -static void x_draw_composite_glyph_string_foreground P_ ((struct glyph_string *)); -static void x_draw_glyph_string_box P_ ((struct glyph_string *)); -static void x_draw_glyph_string P_ ((struct glyph_string *)); -static void x_compute_glyph_string_overhangs P_ ((struct glyph_string *)); -static void x_set_cursor_gc P_ ((struct glyph_string *)); -static void x_set_mode_line_face_gc P_ ((struct glyph_string *)); -static void x_set_mouse_face_gc P_ ((struct glyph_string *)); -static int x_alloc_lighter_color P_ ((struct frame *, Display *, Colormap, - unsigned long *, double, int)); -static void x_setup_relief_color P_ ((struct frame *, struct relief *, - double, int, unsigned long)); -static void x_setup_relief_colors P_ ((struct glyph_string *)); -static void x_draw_image_glyph_string P_ ((struct glyph_string *)); -static void x_draw_image_relief P_ ((struct glyph_string *)); -static void x_draw_image_foreground P_ ((struct glyph_string *)); -static void x_draw_image_foreground_1 P_ ((struct glyph_string *, Pixmap)); -static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int, - int, int, int)); -static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int, - int, int, int, int, int, int, - XRectangle *)); -static void x_draw_box_rect P_ ((struct glyph_string *, int, int, int, int, - int, int, int, XRectangle *)); +static void x_set_glyph_string_clipping (struct glyph_string *); +static void x_set_glyph_string_gc (struct glyph_string *); +static void x_draw_glyph_string_background (struct glyph_string *, + int); +static void x_draw_glyph_string_foreground (struct glyph_string *); +static void x_draw_composite_glyph_string_foreground (struct glyph_string *); +static void x_draw_glyph_string_box (struct glyph_string *); +static void x_draw_glyph_string (struct glyph_string *); +static void x_compute_glyph_string_overhangs (struct glyph_string *); +static void x_set_cursor_gc (struct glyph_string *); +static void x_set_mode_line_face_gc (struct glyph_string *); +static void x_set_mouse_face_gc (struct glyph_string *); +static int x_alloc_lighter_color (struct frame *, Display *, Colormap, + unsigned long *, double, int); +static void x_setup_relief_color (struct frame *, struct relief *, + double, int, unsigned long); +static void x_setup_relief_colors (struct glyph_string *); +static void x_draw_image_glyph_string (struct glyph_string *); +static void x_draw_image_relief (struct glyph_string *); +static void x_draw_image_foreground (struct glyph_string *); +static void x_draw_image_foreground_1 (struct glyph_string *, Pixmap); +static void x_clear_glyph_string_rect (struct glyph_string *, int, + int, int, int); +static void x_draw_relief_rect (struct frame *, int, int, int, int, + int, int, int, int, int, int, + XRectangle *); +static void x_draw_box_rect (struct glyph_string *, int, int, int, int, + int, int, int, XRectangle *); #if GLYPH_DEBUG -static void x_check_font P_ ((struct frame *, struct font *)); +static void x_check_font (struct frame *, struct font *); #endif @@ -969,8 +937,7 @@ static void x_check_font P_ ((struct frame *, struct font *)); face. */ static void -x_set_cursor_gc (s) - struct glyph_string *s; +x_set_cursor_gc (struct glyph_string *s) { if (s->font == FRAME_FONT (s->f) && s->face->background == FRAME_BACKGROUND_PIXEL (s->f) @@ -1021,8 +988,7 @@ x_set_cursor_gc (s) /* Set up S->gc of glyph string S for drawing text in mouse face. */ static void -x_set_mouse_face_gc (s) - struct glyph_string *s; +x_set_mouse_face_gc (struct glyph_string *s) { int face_id; struct face *face; @@ -1073,8 +1039,7 @@ x_set_mouse_face_gc (s) matrix was built, so there isn't much to do, here. */ static INLINE void -x_set_mode_line_face_gc (s) - struct glyph_string *s; +x_set_mode_line_face_gc (struct glyph_string *s) { s->gc = s->face->gc; } @@ -1085,8 +1050,7 @@ x_set_mode_line_face_gc (s) pattern. */ static INLINE void -x_set_glyph_string_gc (s) - struct glyph_string *s; +x_set_glyph_string_gc (struct glyph_string *s) { PREPARE_FACE_FOR_DISPLAY (s->f, s->face); @@ -1131,8 +1095,7 @@ x_set_glyph_string_gc (s) line or menu if we don't have X toolkit support. */ static INLINE void -x_set_glyph_string_clipping (s) - struct glyph_string *s; +x_set_glyph_string_clipping (struct glyph_string *s) { XRectangle *r = s->clip; int n = get_glyph_string_clip_rects (s, r, 2); @@ -1148,8 +1111,7 @@ x_set_glyph_string_clipping (s) the area of SRC. */ static void -x_set_glyph_string_clipping_exactly (src, dst) - struct glyph_string *src, *dst; +x_set_glyph_string_clipping_exactly (struct glyph_string *src, struct glyph_string *dst) { XRectangle r; @@ -1167,8 +1129,7 @@ x_set_glyph_string_clipping_exactly (src, dst) Compute left and right overhang of glyph string S. */ static void -x_compute_glyph_string_overhangs (s) - struct glyph_string *s; +x_compute_glyph_string_overhangs (struct glyph_string *s) { if (s->cmp == NULL && (s->first_glyph->type == CHAR_GLYPH @@ -1207,9 +1168,7 @@ x_compute_glyph_string_overhangs (s) /* Fill rectangle X, Y, W, H with background color of glyph string S. */ static INLINE void -x_clear_glyph_string_rect (s, x, y, w, h) - struct glyph_string *s; - int x, y, w, h; +x_clear_glyph_string_rect (struct glyph_string *s, int x, int y, int w, int h) { XGCValues xgcv; XGetGCValues (s->display, s->gc, GCForeground | GCBackground, &xgcv); @@ -1226,9 +1185,7 @@ x_clear_glyph_string_rect (s, x, y, w, h) contains the first component of a composition. */ static void -x_draw_glyph_string_background (s, force_p) - struct glyph_string *s; - int force_p; +x_draw_glyph_string_background (struct glyph_string *s, int force_p) { /* Nothing to do if background has already been drawn or if it shouldn't be drawn in the first place. */ @@ -1264,8 +1221,7 @@ x_draw_glyph_string_background (s, force_p) /* Draw the foreground of glyph string S. */ static void -x_draw_glyph_string_foreground (s) - struct glyph_string *s; +x_draw_glyph_string_foreground (struct glyph_string *s) { int i, x; @@ -1313,8 +1269,7 @@ x_draw_glyph_string_foreground (s) /* Draw the foreground of composite glyph string S. */ static void -x_draw_composite_glyph_string_foreground (s) - struct glyph_string *s; +x_draw_composite_glyph_string_foreground (struct glyph_string *s) { int i, j, x; struct font *font = s->font; @@ -1401,19 +1356,18 @@ x_draw_composite_glyph_string_foreground (s) #ifdef USE_X_TOOLKIT -static struct frame *x_frame_of_widget P_ ((Widget)); -static Boolean cvt_string_to_pixel P_ ((Display *, XrmValue *, Cardinal *, - XrmValue *, XrmValue *, XtPointer *)); -static void cvt_pixel_dtor P_ ((XtAppContext, XrmValue *, XtPointer, - XrmValue *, Cardinal *)); +static struct frame *x_frame_of_widget (Widget); +static Boolean cvt_string_to_pixel (Display *, XrmValue *, Cardinal *, + XrmValue *, XrmValue *, XtPointer *); +static void cvt_pixel_dtor (XtAppContext, XrmValue *, XtPointer, + XrmValue *, Cardinal *); /* Return the frame on which widget WIDGET is used.. Abort if frame cannot be determined. */ static struct frame * -x_frame_of_widget (widget) - Widget widget; +x_frame_of_widget (Widget widget) { struct x_display_info *dpyinfo; Lisp_Object tail; @@ -1449,10 +1403,7 @@ x_frame_of_widget (widget) if successful. This is called from lwlib. */ int -x_alloc_nearest_color_for_widget (widget, cmap, color) - Widget widget; - Colormap cmap; - XColor *color; +x_alloc_nearest_color_for_widget (Widget widget, Colormap cmap, XColor *color) { struct frame *f = x_frame_of_widget (widget); return x_alloc_nearest_color (f, cmap, color); @@ -1467,13 +1418,8 @@ x_alloc_nearest_color_for_widget (widget, cmap, color) Value is non-zero if successful. */ int -x_alloc_lighter_color_for_widget (widget, display, cmap, pixel, factor, delta) - Widget widget; - Display *display; - Colormap cmap; - unsigned long *pixel; - double factor; - int delta; +x_alloc_lighter_color_for_widget (Widget widget, Display *display, Colormap cmap, + unsigned long *pixel, double factor, int delta) { struct frame *f = x_frame_of_widget (widget); return x_alloc_lighter_color (f, display, cmap, pixel, factor, delta); @@ -1516,12 +1462,9 @@ static Pixel cvt_string_to_pixel_value; Value is True if successful, False otherwise. */ static Boolean -cvt_string_to_pixel (dpy, args, nargs, from, to, closure_ret) - Display *dpy; - XrmValue *args; - Cardinal *nargs; - XrmValue *from, *to; - XtPointer *closure_ret; +cvt_string_to_pixel (Display *dpy, XrmValue *args, Cardinal *nargs, + XrmValue *from, XrmValue *to, + XtPointer *closure_ret) { Screen *screen; Colormap cmap; @@ -1605,12 +1548,8 @@ cvt_string_to_pixel (dpy, args, nargs, from, to, closure_ret) ARGS and NARGS are like for cvt_string_to_pixel. */ static void -cvt_pixel_dtor (app, to, closure, args, nargs) - XtAppContext app; - XrmValuePtr to; - XtPointer closure; - XrmValuePtr args; - Cardinal *nargs; +cvt_pixel_dtor (XtAppContext app, XrmValuePtr to, XtPointer closure, XrmValuePtr args, + Cardinal *nargs) { if (*nargs != 2) { @@ -1639,9 +1578,7 @@ cvt_pixel_dtor (app, to, closure, args, nargs) say a 24-bit TrueColor map. */ static const XColor * -x_color_cells (dpy, ncells) - Display *dpy; - int *ncells; +x_color_cells (Display *dpy, int *ncells) { struct x_display_info *dpyinfo = x_display_info_for_display (dpy); @@ -1672,10 +1609,7 @@ x_color_cells (dpy, ncells) colors in COLORS. Use cached information, if available. */ void -x_query_colors (f, colors, ncolors) - struct frame *f; - XColor *colors; - int ncolors; +x_query_colors (struct frame *f, XColor *colors, int ncolors) { struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); @@ -1699,9 +1633,7 @@ x_query_colors (f, colors, ncolors) COLOR. Use cached information, if available. */ void -x_query_color (f, color) - struct frame *f; - XColor *color; +x_query_color (struct frame *f, XColor *color) { x_query_colors (f, color, 1); } @@ -1713,10 +1645,7 @@ x_query_color (f, color) allocated. */ static int -x_alloc_nearest_color_1 (dpy, cmap, color) - Display *dpy; - Colormap cmap; - XColor *color; +x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color) { int rc; @@ -1786,10 +1715,7 @@ x_alloc_nearest_color_1 (dpy, cmap, color) allocated. */ int -x_alloc_nearest_color (f, cmap, color) - struct frame *f; - Colormap cmap; - XColor *color; +x_alloc_nearest_color (struct frame *f, Colormap cmap, XColor *color) { gamma_correct (f, color); return x_alloc_nearest_color_1 (FRAME_X_DISPLAY (f), cmap, color); @@ -1801,9 +1727,7 @@ x_alloc_nearest_color (f, cmap, color) get color reference counts right. */ unsigned long -x_copy_color (f, pixel) - struct frame *f; - unsigned long pixel; +x_copy_color (struct frame *f, long unsigned int pixel) { XColor color; @@ -1824,10 +1748,7 @@ x_copy_color (f, pixel) get color reference counts right. */ unsigned long -x_copy_dpy_color (dpy, cmap, pixel) - Display *dpy; - Colormap cmap; - unsigned long pixel; +x_copy_dpy_color (Display *dpy, Colormap cmap, long unsigned int pixel) { XColor color; @@ -1865,13 +1786,7 @@ x_copy_dpy_color (dpy, cmap, pixel) Value is non-zero if successful. */ static int -x_alloc_lighter_color (f, display, cmap, pixel, factor, delta) - struct frame *f; - Display *display; - Colormap cmap; - unsigned long *pixel; - double factor; - int delta; +x_alloc_lighter_color (struct frame *f, Display *display, Colormap cmap, long unsigned int *pixel, double factor, int delta) { XColor color, new; long bright; @@ -1947,12 +1862,7 @@ x_alloc_lighter_color (f, display, cmap, pixel, factor, delta) be allocated, use DEFAULT_PIXEL, instead. */ static void -x_setup_relief_color (f, relief, factor, delta, default_pixel) - struct frame *f; - struct relief *relief; - double factor; - int delta; - unsigned long default_pixel; +x_setup_relief_color (struct frame *f, struct relief *relief, double factor, int delta, long unsigned int default_pixel) { XGCValues xgcv; struct x_output *di = f->output_data.x; @@ -2000,8 +1910,7 @@ x_setup_relief_color (f, relief, factor, delta, default_pixel) /* Set up colors for the relief lines around glyph string S. */ static void -x_setup_relief_colors (s) - struct glyph_string *s; +x_setup_relief_colors (struct glyph_string *s) { struct x_output *di = s->f->output_data.x; unsigned long color; @@ -2042,12 +1951,10 @@ x_setup_relief_colors (s) when drawing. */ static void -x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, - raised_p, top_p, bot_p, left_p, right_p, clip_rect) - struct frame *f; - int left_x, top_y, right_x, bottom_y, width; - int top_p, bot_p, left_p, right_p, raised_p; - XRectangle *clip_rect; +x_draw_relief_rect (struct frame *f, + int left_x, int top_y, int right_x, int bottom_y, int width, + int raised_p, int top_p, int bot_p, int left_p, int right_p, + XRectangle *clip_rect) { Display *dpy = FRAME_X_DISPLAY (f); Window window = FRAME_X_WINDOW (f); @@ -2105,11 +2012,9 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, rectangle to use when drawing. */ static void -x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width, - left_p, right_p, clip_rect) - struct glyph_string *s; - int left_x, top_y, right_x, bottom_y, width, left_p, right_p; - XRectangle *clip_rect; +x_draw_box_rect (struct glyph_string *s, + int left_x, int top_y, int right_x, int bottom_y, int width, + int left_p, int right_p, XRectangle *clip_rect) { XGCValues xgcv; @@ -2143,8 +2048,7 @@ x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width, /* Draw a box around glyph string S. */ static void -x_draw_glyph_string_box (s) - struct glyph_string *s; +x_draw_glyph_string_box (struct glyph_string *s) { int width, left_x, right_x, top_y, bottom_y, last_x, raised_p; int left_p, right_p; @@ -2195,8 +2099,7 @@ x_draw_glyph_string_box (s) /* Draw foreground of image glyph string S. */ static void -x_draw_image_foreground (s) - struct glyph_string *s; +x_draw_image_foreground (struct glyph_string *s) { int x = s->x; int y = s->ybase - image_ascent (s->img, s->face, &s->slice); @@ -2286,8 +2189,7 @@ x_draw_image_foreground (s) /* Draw a relief around the image glyph string S. */ static void -x_draw_image_relief (s) - struct glyph_string *s; +x_draw_image_relief (struct glyph_string *s) { int x0, y0, x1, y1, thick, raised_p, extra; XRectangle r; @@ -2322,7 +2224,7 @@ x_draw_image_relief (s) extra = s->face->id == TOOL_BAR_FACE_ID ? XINT (Vtool_bar_button_margin) : 0; - + x0 = x - thick - extra; y0 = y - thick - extra; x1 = x + s->slice.width + thick - 1 + extra; @@ -2342,9 +2244,7 @@ x_draw_image_relief (s) /* Draw the foreground of image glyph string S to PIXMAP. */ static void -x_draw_image_foreground_1 (s, pixmap) - struct glyph_string *s; - Pixmap pixmap; +x_draw_image_foreground_1 (struct glyph_string *s, Pixmap pixmap) { int x = 0; int y = s->ybase - s->y - image_ascent (s->img, s->face, &s->slice); @@ -2420,9 +2320,7 @@ x_draw_image_foreground_1 (s, pixmap) give the rectangle to draw. */ static void -x_draw_glyph_string_bg_rect (s, x, y, w, h) - struct glyph_string *s; - int x, y, w, h; +x_draw_glyph_string_bg_rect (struct glyph_string *s, int x, int y, int w, int h) { if (s->stippled_p) { @@ -2451,8 +2349,7 @@ x_draw_glyph_string_bg_rect (s, x, y, w, h) */ static void -x_draw_image_glyph_string (s) - struct glyph_string *s; +x_draw_image_glyph_string (struct glyph_string *s) { int box_line_hwidth = eabs (s->face->box_line_width); int box_line_vwidth = max (s->face->box_line_width, 0); @@ -2556,8 +2453,7 @@ x_draw_image_glyph_string (s) /* Draw stretch glyph string S. */ static void -x_draw_stretch_glyph_string (s) - struct glyph_string *s; +x_draw_stretch_glyph_string (struct glyph_string *s) { xassert (s->first_glyph->type == STRETCH_GLYPH); @@ -2640,8 +2536,7 @@ x_draw_stretch_glyph_string (s) /* Draw glyph string S. */ static void -x_draw_glyph_string (s) - struct glyph_string *s; +x_draw_glyph_string (struct glyph_string *s) { int relief_drawn_p = 0; @@ -2895,9 +2790,7 @@ x_draw_glyph_string (s) /* Shift display to make room for inserted glyphs. */ void -x_shift_glyphs_for_insert (f, x, y, width, height, shift_by) - struct frame *f; - int x, y, width, height, shift_by; +x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, int shift_by) { XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_WINDOW (f), f->output_data.x->normal_gc, @@ -2909,9 +2802,7 @@ x_shift_glyphs_for_insert (f, x, y, width, height, shift_by) for X frames. */ static void -x_delete_glyphs (f, n) - struct frame *f; - register int n; +x_delete_glyphs (struct frame *f, register int n) { abort (); } @@ -2921,12 +2812,7 @@ x_delete_glyphs (f, n) If they are <= 0, this is probably an error. */ void -x_clear_area (dpy, window, x, y, width, height, exposures) - Display *dpy; - Window window; - int x, y; - int width, height; - int exposures; +x_clear_area (Display *dpy, Window window, int x, int y, int width, int height, int exposures) { xassert (width > 0 && height > 0); XClearArea (dpy, window, x, y, width, height, exposures); @@ -2958,7 +2844,7 @@ x_clear_frame (struct frame *f) redisplay, do it here. */ gtk_widget_queue_draw (FRAME_GTK_WIDGET (f)); #endif - + XFlush (FRAME_X_DISPLAY (f)); UNBLOCK_INPUT; @@ -2978,8 +2864,7 @@ x_clear_frame (struct frame *f) *RESULT. Return 1 if the difference is negative, otherwise 0. */ static int -timeval_subtract (result, x, y) - struct timeval *result, x, y; +timeval_subtract (struct timeval *result, struct timeval x, struct timeval y) { /* Perform the carry for the later subtraction by updating y. This is safer because on some systems the tv_sec member is unsigned. */ @@ -3008,8 +2893,7 @@ timeval_subtract (result, x, y) } void -XTflash (f) - struct frame *f; +XTflash (struct frame *f) { BLOCK_INPUT; @@ -3017,18 +2901,16 @@ XTflash (f) #ifdef USE_GTK /* Use Gdk routines to draw. This way, we won't draw over scroll bars when the scroll bars and the edit widget share the same X window. */ + GdkWindow *window = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); GdkGCValues vals; GdkGC *gc; vals.foreground.pixel = (FRAME_FOREGROUND_PIXEL (f) ^ FRAME_BACKGROUND_PIXEL (f)); vals.function = GDK_XOR; - gc = gdk_gc_new_with_values (FRAME_GTK_WIDGET (f)->window, - &vals, - GDK_GC_FUNCTION - | GDK_GC_FOREGROUND); + gc = gdk_gc_new_with_values (window, + &vals, GDK_GC_FUNCTION | GDK_GC_FOREGROUND); #define XFillRectangle(d, win, gc, x, y, w, h) \ - gdk_draw_rectangle (FRAME_GTK_WIDGET (f)->window, \ - gc, TRUE, x, y, w, h) + gdk_draw_rectangle (window, gc, TRUE, x, y, w, h) #else GC gc; @@ -3166,12 +3048,10 @@ XTflash (f) static void -XTtoggle_invisible_pointer (f, invisible) - FRAME_PTR f; - int invisible; +XTtoggle_invisible_pointer (FRAME_PTR f, int invisible) { BLOCK_INPUT; - if (invisible) + if (invisible) { if (FRAME_X_DISPLAY_INFO (f)->invisible_cursor != 0) XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), @@ -3188,10 +3068,8 @@ XTtoggle_invisible_pointer (f, invisible) /* Make audible bell. */ void -XTring_bell () +XTring_bell (struct frame *f) { - struct frame *f = SELECTED_FRAME (); - if (FRAME_X_DISPLAY (f)) { #if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT) @@ -3215,8 +3093,7 @@ XTring_bell () that is bounded by calls to x_update_begin and x_update_end. */ static void -XTset_terminal_window (n) - register int n; +XTset_terminal_window (struct frame *f, int n) { /* This function intentionally left blank. */ } @@ -3231,9 +3108,7 @@ XTset_terminal_window (n) lines or deleting -N lines at vertical position VPOS. */ static void -x_ins_del_lines (f, vpos, n) - struct frame *f; - int vpos, n; +x_ins_del_lines (struct frame *f, int vpos, int n) { abort (); } @@ -3242,9 +3117,7 @@ x_ins_del_lines (f, vpos, n) /* Scroll part of the display as described by RUN. */ static void -x_scroll_run (w, run) - struct window *w; - struct run *run; +x_scroll_run (struct window *w, struct run *run) { struct frame *f = XFRAME (w->frame); int x, y, width, height, from_y, to_y, bottom_y; @@ -3301,8 +3174,7 @@ x_scroll_run (w, run) static void -frame_highlight (f) - struct frame *f; +frame_highlight (struct frame *f) { /* We used to only do this if Vx_no_window_manager was non-nil, but the ICCCM (section 4.1.6) says that the window's border pixmap @@ -3317,8 +3189,7 @@ frame_highlight (f) } static void -frame_unhighlight (f) - struct frame *f; +frame_unhighlight (struct frame *f) { /* We used to only do this if Vx_no_window_manager was non-nil, but the ICCCM (section 4.1.6) says that the window's border pixmap @@ -3339,9 +3210,7 @@ frame_unhighlight (f) Lisp code can tell when the switch took place by examining the events. */ static void -x_new_focus_frame (dpyinfo, frame) - struct x_display_info *dpyinfo; - struct frame *frame; +x_new_focus_frame (struct x_display_info *dpyinfo, struct frame *frame) { struct frame *old_focus = dpyinfo->x_focus_frame; @@ -3368,12 +3237,7 @@ x_new_focus_frame (dpyinfo, frame) a FOCUS_IN_EVENT into *BUFP. */ static void -x_focus_changed (type, state, dpyinfo, frame, bufp) - int type; - int state; - struct x_display_info *dpyinfo; - struct frame *frame; - struct input_event *bufp; +x_focus_changed (int type, int state, struct x_display_info *dpyinfo, struct frame *frame, struct input_event *bufp) { if (type == FocusIn) { @@ -3425,10 +3289,7 @@ x_focus_changed (type, state, dpyinfo, frame, bufp) Returns FOCUS_IN_EVENT event in *BUFP. */ static void -x_detect_focus_change (dpyinfo, event, bufp) - struct x_display_info *dpyinfo; - XEvent *event; - struct input_event *bufp; +x_detect_focus_change (struct x_display_info *dpyinfo, XEvent *event, struct input_event *bufp) { struct frame *frame; @@ -3477,8 +3338,7 @@ x_detect_focus_change (dpyinfo, event, bufp) /* Handle an event saying the mouse has moved out of an Emacs frame. */ void -x_mouse_leave (dpyinfo) - struct x_display_info *dpyinfo; +x_mouse_leave (struct x_display_info *dpyinfo) { x_new_focus_frame (dpyinfo, dpyinfo->x_focus_event_frame); } @@ -3492,15 +3352,13 @@ x_mouse_leave (dpyinfo) the appropriate X display info. */ static void -XTframe_rehighlight (frame) - struct frame *frame; +XTframe_rehighlight (struct frame *frame) { x_frame_rehighlight (FRAME_X_DISPLAY_INFO (frame)); } static void -x_frame_rehighlight (dpyinfo) - struct x_display_info *dpyinfo; +x_frame_rehighlight (struct x_display_info *dpyinfo) { struct frame *old_highlight = dpyinfo->x_highlight_frame; @@ -3534,8 +3392,7 @@ x_frame_rehighlight (dpyinfo) /* Initialize mode_switch_bit and modifier_meaning. */ static void -x_find_modifier_meanings (dpyinfo) - struct x_display_info *dpyinfo; +x_find_modifier_meanings (struct x_display_info *dpyinfo) { int min_code, max_code; KeySym *syms; @@ -3646,9 +3503,7 @@ x_find_modifier_meanings (dpyinfo) Emacs uses. */ unsigned int -x_x_to_emacs_modifiers (dpyinfo, state) - struct x_display_info *dpyinfo; - unsigned int state; +x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, unsigned int state) { EMACS_UINT mod_meta = meta_modifier; EMACS_UINT mod_alt = alt_modifier; @@ -3675,9 +3530,7 @@ x_x_to_emacs_modifiers (dpyinfo, state) } static unsigned int -x_emacs_to_x_modifiers (dpyinfo, state) - struct x_display_info *dpyinfo; - unsigned int state; +x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, unsigned int state) { EMACS_UINT mod_meta = meta_modifier; EMACS_UINT mod_alt = alt_modifier; @@ -3707,8 +3560,7 @@ x_emacs_to_x_modifiers (dpyinfo, state) /* Convert a keysym to its name. */ char * -x_get_keysym_name (keysym) - KeySym keysym; +x_get_keysym_name (int keysym) { char *value; @@ -3729,10 +3581,7 @@ x_get_keysym_name (keysym) the mouse. */ static Lisp_Object -construct_mouse_click (result, event, f) - struct input_event *result; - XButtonEvent *event; - struct frame *f; +construct_mouse_click (struct input_event *result, XButtonEvent *event, struct frame *f) { /* Make the event type NO_EVENT; we'll change that when we decide otherwise. */ @@ -3765,9 +3614,7 @@ static XMotionEvent last_mouse_motion_event; static Lisp_Object last_mouse_motion_frame; static int -note_mouse_movement (frame, event) - FRAME_PTR frame; - XMotionEvent *event; +note_mouse_movement (FRAME_PTR frame, XMotionEvent *event) { last_mouse_movement_time = event->time; last_mouse_motion_event = *event; @@ -3811,7 +3658,7 @@ note_mouse_movement (frame, event) ************************************************************************/ static void -redo_mouse_highlight () +redo_mouse_highlight (void) { if (!NILP (last_mouse_motion_frame) && FRAME_LIVE_P (XFRAME (last_mouse_motion_frame))) @@ -3843,13 +3690,7 @@ redo_mouse_highlight () movement. */ static void -XTmouse_position (fp, insist, bar_window, part, x, y, time) - FRAME_PTR *fp; - int insist; - Lisp_Object *bar_window; - enum scroll_bar_part *part; - Lisp_Object *x, *y; - unsigned long *time; +XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, long unsigned int *time) { FRAME_PTR f1; @@ -4051,9 +3892,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) bits. */ static struct scroll_bar * -x_window_to_scroll_bar (display, window_id) - Display *display; - Window window_id; +x_window_to_scroll_bar (Display *display, Window window_id) { Lisp_Object tail; @@ -4098,8 +3937,7 @@ x_window_to_scroll_bar (display, window_id) if WINDOW is not part of a menu bar. */ static Widget -x_window_to_menu_bar (window) - Window window; +x_window_to_menu_bar (Window window) { Lisp_Object tail; @@ -4127,12 +3965,12 @@ x_window_to_menu_bar (window) #ifdef USE_TOOLKIT_SCROLL_BARS -static void x_scroll_bar_to_input_event P_ ((XEvent *, struct input_event *)); -static void x_send_scroll_bar_event P_ ((Lisp_Object, int, int, int)); -static void x_create_toolkit_scroll_bar P_ ((struct frame *, - struct scroll_bar *)); -static void x_set_toolkit_scroll_bar_thumb P_ ((struct scroll_bar *, - int, int, int)); +static void x_scroll_bar_to_input_event (XEvent *, struct input_event *); +static void x_send_scroll_bar_event (Lisp_Object, int, int, int); +static void x_create_toolkit_scroll_bar (struct frame *, + struct scroll_bar *); +static void x_set_toolkit_scroll_bar_thumb (struct scroll_bar *, + int, int, int); /* Lisp window being scrolled. Set when starting to interact with @@ -4166,14 +4004,8 @@ static Boolean xaw3d_pick_top; a `end-scroll' SCROLL_BAR_CLICK_EVENT' event if so. */ static void -xt_action_hook (widget, client_data, action_name, event, params, - num_params) - Widget widget; - XtPointer client_data; - String action_name; - XEvent *event; - String *params; - Cardinal *num_params; +xt_action_hook (Widget widget, XtPointer client_data, String action_name, + XEvent *event, String *params, Cardinal *num_params) { int scroll_bar_p; char *end_action; @@ -4224,9 +4056,7 @@ static int scroll_bar_windows_size; amount to scroll of a whole of WHOLE. */ static void -x_send_scroll_bar_event (window, part, portion, whole) - Lisp_Object window; - int part, portion, whole; +x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole) { XEvent event; XClientMessageEvent *ev = (XClientMessageEvent *) &event; @@ -4259,7 +4089,7 @@ x_send_scroll_bar_event (window, part, portion, whole) scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows, nbytes); - bzero (&scroll_bar_windows[i], nbytes - old_nbytes); + memset (&scroll_bar_windows[i], 0, nbytes - old_nbytes); scroll_bar_windows_size = new_size; } @@ -4288,9 +4118,7 @@ x_send_scroll_bar_event (window, part, portion, whole) in *IEVENT. */ static void -x_scroll_bar_to_input_event (event, ievent) - XEvent *event; - struct input_event *ievent; +x_scroll_bar_to_input_event (XEvent *event, struct input_event *ievent) { XClientMessageEvent *ev = (XClientMessageEvent *) event; Lisp_Object window; @@ -4331,9 +4159,7 @@ x_scroll_bar_to_input_event (event, ievent) CALL_DATA is a pointer to a XmScrollBarCallbackStruct. */ static void -xm_scroll_callback (widget, client_data, call_data) - Widget widget; - XtPointer client_data, call_data; +xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data) { struct scroll_bar *bar = (struct scroll_bar *) client_data; XmScrollBarCallbackStruct *cs = (XmScrollBarCallbackStruct *) call_data; @@ -4428,7 +4254,8 @@ xg_scroll_callback (GtkRange *range, && FRAME_X_DISPLAY_INFO (f)->grabbed < (1 << 4)) { part = scroll_bar_handle; - whole = adj->upper - adj->page_size; + whole = gtk_adjustment_get_upper (adj) - + gtk_adjustment_get_page_size (adj); portion = min ((int)position, whole); bar->dragging = make_number ((int)portion); } @@ -4489,9 +4316,7 @@ xg_end_scroll_callback (GtkWidget *widget, the thumb is. */ static void -xaw_jump_callback (widget, client_data, call_data) - Widget widget; - XtPointer client_data, call_data; +xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data) { struct scroll_bar *bar = (struct scroll_bar *) client_data; float top = *(float *) call_data; @@ -4533,9 +4358,7 @@ xaw_jump_callback (widget, client_data, call_data) Values < height of scroll bar mean line-wise movement. */ static void -xaw_scroll_callback (widget, client_data, call_data) - Widget widget; - XtPointer client_data, call_data; +xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data) { struct scroll_bar *bar = (struct scroll_bar *) client_data; /* The position really is stored cast to a pointer. */ @@ -4573,9 +4396,7 @@ xaw_scroll_callback (widget, client_data, call_data) #ifdef USE_GTK static void -x_create_toolkit_scroll_bar (f, bar) - struct frame *f; - struct scroll_bar *bar; +x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar) { char *scroll_bar_name = SCROLL_BAR_NAME; @@ -4589,9 +4410,7 @@ x_create_toolkit_scroll_bar (f, bar) #else /* not USE_GTK */ static void -x_create_toolkit_scroll_bar (f, bar) - struct frame *f; - struct scroll_bar *bar; +x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar) { Window xwindow; Widget widget; @@ -4684,7 +4503,7 @@ x_create_toolkit_scroll_bar (f, bar) if (f->output_data.x->scroll_bar_top_shadow_pixel == -1) { pixel = f->output_data.x->scroll_bar_background_pixel; - if (pixel != -1) + if (pixel != -1) { if (!x_alloc_lighter_color (f, FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), @@ -4696,7 +4515,7 @@ x_create_toolkit_scroll_bar (f, bar) if (f->output_data.x->scroll_bar_bottom_shadow_pixel == -1) { pixel = f->output_data.x->scroll_bar_background_pixel; - if (pixel != -1) + if (pixel != -1) { if (!x_alloc_lighter_color (f, FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), @@ -4791,18 +4610,15 @@ x_create_toolkit_scroll_bar (f, bar) #ifdef USE_GTK static void -x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) - struct scroll_bar *bar; - int portion, position, whole; +x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int position, int whole) { xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole); } #else /* not USE_GTK */ static void -x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) - struct scroll_bar *bar; - int portion, position, whole; +x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int position, + int whole) { struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); @@ -4917,9 +4733,7 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) scroll bar. */ static struct scroll_bar * -x_scroll_bar_create (w, top, left, width, height) - struct window *w; - int top, left, width, height; +x_scroll_bar_create (struct window *w, int top, int left, int width, int height) { struct frame *f = XFRAME (w->frame); struct scroll_bar *bar @@ -4998,7 +4812,6 @@ x_scroll_bar_create (w, top, left, width, height) left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, max (height, 1)); - xg_show_scroll_bar (bar->x_window); #else /* not USE_GTK */ Widget scroll_bar = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); XtConfigureWidget (scroll_bar, @@ -5034,10 +4847,7 @@ x_scroll_bar_create (w, top, left, width, height) to move to the very end of the buffer. */ static void -x_scroll_bar_set_handle (bar, start, end, rebuild) - struct scroll_bar *bar; - int start, end; - int rebuild; +x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, int rebuild) { int dragging = ! NILP (bar->dragging); Window w = bar->x_window; @@ -5135,8 +4945,7 @@ x_scroll_bar_set_handle (bar, start, end, rebuild) nil. */ static void -x_scroll_bar_remove (bar) - struct scroll_bar *bar; +x_scroll_bar_remove (struct scroll_bar *bar) { struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); BLOCK_INPUT; @@ -5164,9 +4973,7 @@ x_scroll_bar_remove (bar) create one. */ static void -XTset_vertical_scroll_bar (w, portion, whole, position) - struct window *w; - int portion, whole, position; +XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int position) { struct frame *f = XFRAME (w->frame); struct scroll_bar *bar; @@ -5383,8 +5190,7 @@ XTset_vertical_scroll_bar (w, portion, whole, position) `*redeem_scroll_bar_hook' is applied to its window before the judgment. */ static void -XTcondemn_scroll_bars (frame) - FRAME_PTR frame; +XTcondemn_scroll_bars (FRAME_PTR frame) { /* Transfer all the scroll bars to FRAME_CONDEMNED_SCROLL_BARS. */ while (! NILP (FRAME_SCROLL_BARS (frame))) @@ -5405,8 +5211,7 @@ XTcondemn_scroll_bars (frame) Note that WINDOW isn't necessarily condemned at all. */ static void -XTredeem_scroll_bar (window) - struct window *window; +XTredeem_scroll_bar (struct window *window) { struct scroll_bar *bar; struct frame *f; @@ -5451,8 +5256,7 @@ XTredeem_scroll_bar (window) last call to `*condemn_scroll_bars_hook'. */ static void -XTjudge_scroll_bars (f) - FRAME_PTR f; +XTjudge_scroll_bars (FRAME_PTR f) { Lisp_Object bar, next; @@ -5485,9 +5289,7 @@ XTjudge_scroll_bars (f) mark bits. */ static void -x_scroll_bar_expose (bar, event) - struct scroll_bar *bar; - XEvent *event; +x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event) { Window w = bar->x_window; FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); @@ -5529,10 +5331,7 @@ x_scroll_bar_expose (bar, event) static void -x_scroll_bar_handle_click (bar, event, emacs_event) - struct scroll_bar *bar; - XEvent *event; - struct input_event *emacs_event; +x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_event *emacs_event) { if (! WINDOWP (bar->window)) abort (); @@ -5590,9 +5389,7 @@ x_scroll_bar_handle_click (bar, event, emacs_event) mark bits. */ static void -x_scroll_bar_note_movement (bar, event) - struct scroll_bar *bar; - XEvent *event; +x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event) { FRAME_PTR f = XFRAME (XWINDOW (bar->window)->frame); @@ -5622,12 +5419,7 @@ x_scroll_bar_note_movement (bar, event) on the scroll bar. */ static void -x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) - FRAME_PTR *fp; - Lisp_Object *bar_window; - enum scroll_bar_part *part; - Lisp_Object *x, *y; - unsigned long *time; +x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, long unsigned int *time) { struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); Window w = bar->x_window; @@ -5699,8 +5491,7 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) redraw them. */ void -x_scroll_bar_clear (f) - FRAME_PTR f; +x_scroll_bar_clear (FRAME_PTR f) { #ifndef USE_TOOLKIT_SCROLL_BARS Lisp_Object bar; @@ -5753,22 +5544,18 @@ struct x_display_info *XTread_socket_fake_io_error; static struct x_display_info *next_noop_dpyinfo; -#define SET_SAVED_MENU_EVENT(size) \ +#define SET_SAVED_BUTTON_EVENT \ do \ { \ if (f->output_data.x->saved_menu_event == 0) \ f->output_data.x->saved_menu_event \ = (XEvent *) xmalloc (sizeof (XEvent)); \ - bcopy (&event, f->output_data.x->saved_menu_event, size); \ + *f->output_data.x->saved_menu_event = event; \ inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; \ XSETFRAME (inev.ie.frame_or_window, f); \ } \ while (0) -#define SET_SAVED_BUTTON_EVENT SET_SAVED_MENU_EVENT (sizeof (XButtonEvent)) -#define SET_SAVED_KEY_EVENT SET_SAVED_MENU_EVENT (sizeof (XKeyEvent)) - - enum { X_EVENT_NORMAL, @@ -5786,9 +5573,7 @@ enum #ifdef HAVE_X_I18N static int -x_filter_event (dpyinfo, event) - struct x_display_info *dpyinfo; - XEvent *event; +x_filter_event (struct x_display_info *dpyinfo, XEvent *event) { /* XFilterEvent returns non-zero if the input method has consumed the event. We pass the frame's X window to @@ -5811,10 +5596,7 @@ static struct input_event *current_hold_quit; It is invoked before the XEvent is translated to a GdkEvent, so we have a chance to act on the event before GTK. */ static GdkFilterReturn -event_handler_gdk (gxev, ev, data) - GdkXEvent *gxev; - GdkEvent *ev; - gpointer data; +event_handler_gdk (GdkXEvent *gxev, GdkEvent *ev, gpointer data) { XEvent *xev = (XEvent *) gxev; @@ -5867,11 +5649,7 @@ event_handler_gdk (gxev, ev, data) We return the number of characters stored into the buffer. */ static int -handle_one_xevent (dpyinfo, eventp, finish, hold_quit) - struct x_display_info *dpyinfo; - XEvent *eventp; - int *finish; - struct input_event *hold_quit; +handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, struct input_event *hold_quit) { union { struct input_event ie; @@ -5889,10 +5667,10 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) EVENT_INIT (inev.ie); inev.ie.kind = NO_EVENT; inev.ie.arg = Qnil; - + if (pending_event_wait.eventtype == event.type) pending_event_wait.eventtype = 0; /* Indicates we got it. */ - + switch (event.type) { case ClientMessage: @@ -6405,7 +6183,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) this enables ComposeCharacter to work whether or not it is combined with Meta. */ if (modifiers & dpyinfo->meta_mod_mask) - bzero (&compose_status, sizeof (compose_status)); + memset (&compose_status, 0, sizeof (compose_status)); #ifdef HAVE_X_I18N if (FRAME_XIC (f)) @@ -6453,7 +6231,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) if (compose_status.chars_matched > 0 && nbytes == 0) break; - bzero (&compose_status, sizeof (compose_status)); + memset (&compose_status, 0, sizeof (compose_status)); orig_keysym = keysym; /* Common for all keysym input events. */ @@ -6812,7 +6590,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) event.xconfigure.height); f = 0; } -#endif +#endif if (f) { #ifndef USE_X_TOOLKIT @@ -6846,7 +6624,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) /* GTK creates windows but doesn't map them. Only get real positions when mapped. */ if (FRAME_GTK_OUTER_WIDGET (f) - && GTK_WIDGET_MAPPED (FRAME_GTK_OUTER_WIDGET (f))) + && gtk_widget_get_mapped (FRAME_GTK_OUTER_WIDGET (f))) #endif { x_real_positions (f, &f->left_pos, &f->top_pos); @@ -6867,7 +6645,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) by the rest of Emacs, we put it here. */ int tool_bar_p = 0; - bzero (&compose_status, sizeof (compose_status)); + memset (&compose_status, 0, sizeof (compose_status)); last_mouse_glyph_frame = 0; last_user_time = event.xbutton.time; @@ -6965,20 +6743,18 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) f->mouse_moved = 0; #if defined (USE_X_TOOLKIT) || defined (USE_GTK) - f = x_menubar_window_to_frame (dpyinfo, event.xbutton.window); + f = x_menubar_window_to_frame (dpyinfo, &event); /* For a down-event in the menu bar, don't pass it to Xt right now. Instead, save it away and we will pass it to Xt from kbd_buffer_get_event. That way, we can run some Lisp code first. */ - if ( + if (! popup_activated () #ifdef USE_GTK - ! popup_activated () /* Gtk+ menus only react to the first three buttons. */ && event.xbutton.button < 3 - && #endif - f && event.type == ButtonPress + && f && event.type == ButtonPress /* Verify the event is really within the menu bar and not just sent to it due to grabbing. */ && event.xbutton.x >= 0 @@ -6989,30 +6765,13 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) { SET_SAVED_BUTTON_EVENT; XSETFRAME (last_mouse_press_frame, f); -#ifdef USE_GTK *finish = X_EVENT_DROP; -#endif } else if (event.type == ButtonPress) { last_mouse_press_frame = Qnil; goto OTHER; } - -#ifdef USE_MOTIF /* This should do not harm for Lucid, - but I am trying to be cautious. */ - else if (event.type == ButtonRelease) - { - if (!NILP (last_mouse_press_frame)) - { - f = XFRAME (last_mouse_press_frame); - if (f->output_data.x) - SET_SAVED_BUTTON_EVENT; - } - else - goto OTHER; - } -#endif /* USE_MOTIF */ else goto OTHER; #endif /* USE_X_TOOLKIT || USE_GTK */ @@ -7098,9 +6857,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) Returns the value handle_one_xevent sets in the finish argument. */ int -x_dispatch_event (event, display) - XEvent *event; - Display *display; +x_dispatch_event (XEvent *event, Display *display) { struct x_display_info *dpyinfo; int finish = X_EVENT_NORMAL; @@ -7126,10 +6883,7 @@ x_dispatch_event (event, display) EXPECTED is nonzero if the caller knows input is available. */ static int -XTread_socket (terminal, expected, hold_quit) - struct terminal *terminal; - int expected; - struct input_event *hold_quit; +XTread_socket (struct terminal *terminal, int expected, struct input_event *hold_quit) { int count = 0; XEvent event; @@ -7280,11 +7034,7 @@ XTread_socket (terminal, expected, hold_quit) mode lines must be clipped to the whole window. */ static void -x_clip_to_row (w, row, area, gc) - struct window *w; - struct glyph_row *row; - int area; - GC gc; +x_clip_to_row (struct window *w, struct glyph_row *row, int area, GC gc) { struct frame *f = XFRAME (WINDOW_FRAME (w)); XRectangle clip_rect; @@ -7305,9 +7055,7 @@ x_clip_to_row (w, row, area, gc) /* Draw a hollow box cursor on window W in glyph row ROW. */ static void -x_draw_hollow_cursor (w, row) - struct window *w; - struct glyph_row *row; +x_draw_hollow_cursor (struct window *w, struct glyph_row *row) { struct frame *f = XFRAME (WINDOW_FRAME (w)); struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); @@ -7352,11 +7100,7 @@ x_draw_hollow_cursor (w, row) --gerd. */ static void -x_draw_bar_cursor (w, row, width, kind) - struct window *w; - struct glyph_row *row; - int width; - enum text_cursor_kinds kind; +x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text_cursor_kinds kind) { struct frame *f = XFRAME (w->frame); struct glyph *cursor_glyph; @@ -7447,9 +7191,7 @@ x_draw_bar_cursor (w, row, width, kind) /* RIF: Define cursor CURSOR on frame F. */ static void -x_define_frame_cursor (f, cursor) - struct frame *f; - Cursor cursor; +x_define_frame_cursor (struct frame *f, Cursor cursor) { if (!f->pointer_invisible && f->output_data.x->current_cursor != cursor) @@ -7461,9 +7203,7 @@ x_define_frame_cursor (f, cursor) /* RIF: Clear area on frame F. */ static void -x_clear_frame_area (f, x, y, width, height) - struct frame *f; - int x, y, width, height; +x_clear_frame_area (struct frame *f, int x, int y, int width, int height) { x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), x, y, width, height, False); @@ -7478,12 +7218,7 @@ x_clear_frame_area (f, x, y, width, height) /* RIF: Draw cursor on window W. */ static void -x_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, active_p) - struct window *w; - struct glyph_row *glyph_row; - int x, y; - int cursor_type, cursor_width; - int on_p, active_p; +x_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, int y, int cursor_type, int cursor_width, int on_p, int active_p) { struct frame *f = XFRAME (WINDOW_FRAME (w)); @@ -7547,9 +7282,7 @@ x_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, activ /* Make the x-window of frame F use the gnu icon bitmap. */ int -x_bitmap_icon (f, file) - struct frame *f; - Lisp_Object file; +x_bitmap_icon (struct frame *f, Lisp_Object file) { int bitmap_id; @@ -7626,9 +7359,7 @@ x_bitmap_icon (f, file) Use ICON_NAME as the text. */ int -x_text_icon (f, icon_name) - struct frame *f; - char *icon_name; +x_text_icon (struct frame *f, char *icon_name) { if (FRAME_X_WINDOW (f) == 0) return 1; @@ -7671,9 +7402,7 @@ static struct x_error_message_stack *x_error_message; x_catch_errors is in effect. */ static void -x_error_catcher (display, error) - Display *display; - XErrorEvent *error; +x_error_catcher (Display *display, XErrorEvent *error) { XGetErrorText (display, error->error_code, x_error_message->string, @@ -7693,11 +7422,10 @@ x_error_catcher (display, error) Calling x_uncatch_errors resumes the normal error handling. */ -void x_check_errors (); +void x_check_errors (Display *dpy, char *format); void -x_catch_errors (dpy) - Display *dpy; +x_catch_errors (Display *dpy) { struct x_error_message_stack *data = xmalloc (sizeof (*data)); @@ -7714,7 +7442,7 @@ x_catch_errors (dpy) DPY should be the display that was passed to x_catch_errors. */ void -x_uncatch_errors () +x_uncatch_errors (void) { struct x_error_message_stack *tmp; @@ -7736,9 +7464,7 @@ x_uncatch_errors () sprintf (a buffer, FORMAT, the x error message text) as the text. */ void -x_check_errors (dpy, format) - Display *dpy; - char *format; +x_check_errors (Display *dpy, char *format) { /* Make sure to catch any errors incurred so far. */ XSync (dpy, False); @@ -7746,7 +7472,7 @@ x_check_errors (dpy, format) if (x_error_message->string[0]) { char string[X_ERROR_MESSAGE_SIZE]; - bcopy (x_error_message->string, string, X_ERROR_MESSAGE_SIZE); + memcpy (string, x_error_message->string, X_ERROR_MESSAGE_SIZE); x_uncatch_errors (); error (format, string); } @@ -7756,8 +7482,7 @@ x_check_errors (dpy, format) since we did x_catch_errors on DPY. */ int -x_had_errors_p (dpy) - Display *dpy; +x_had_errors_p (Display *dpy) { /* Make sure to catch any errors incurred so far. */ XSync (dpy, False); @@ -7768,8 +7493,7 @@ x_had_errors_p (dpy) /* Forget about any errors we have had, since we did x_catch_errors on DPY. */ void -x_clear_errors (dpy) - Display *dpy; +x_clear_errors (Display *dpy) { x_error_message->string[0] = 0; } @@ -7779,7 +7503,7 @@ x_clear_errors (dpy) /* Close off all unclosed x_catch_errors calls. */ void -x_fully_uncatch_errors () +x_fully_uncatch_errors (void) { while (x_error_message) x_uncatch_errors (); @@ -7789,14 +7513,14 @@ x_fully_uncatch_errors () /* Nonzero if x_catch_errors has been done and not yet canceled. */ int -x_catching_errors () +x_catching_errors (void) { return x_error_message != 0; } #if 0 static unsigned int x_wire_count; -x_trace_wire () +x_trace_wire (void) { fprintf (stderr, "Lib call: %d\n", ++x_wire_count); } @@ -7810,8 +7534,8 @@ x_trace_wire () which will do the appropriate cleanup for us. */ static SIGTYPE -x_connection_signal (signalnum) /* If we don't have an argument, */ - int signalnum; /* some compilers complain in signal calls. */ +x_connection_signal (int signalnum) /* If we don't have an argument, */ + /* some compilers complain in signal calls. */ { #ifdef USG /* USG systems forget handlers when they are used; @@ -7834,7 +7558,7 @@ static char *error_msg; instead of dumping core when XtCloseDisplay fails. */ static void -x_fatal_error_signal () +x_fatal_error_signal (void) { fprintf (stderr, "%s\n", error_msg); exit (70); @@ -7844,9 +7568,7 @@ x_fatal_error_signal () the text of an error message that lead to the connection loss. */ static SIGTYPE -x_connection_closed (dpy, error_message) - Display *dpy; - char *error_message; +x_connection_closed (Display *dpy, char *error_message) { struct x_display_info *dpyinfo = x_display_info_for_display (dpy); Lisp_Object frame, tail; @@ -7921,7 +7643,7 @@ x_connection_closed (dpy, error_message) /* If DPYINFO is null, this means we didn't open the display in the first place, so don't try to close it. */ { - extern void (*fatal_error_signal_hook) P_ ((void)); + extern void (*fatal_error_signal_hook) (void); fatal_error_signal_hook = x_fatal_error_signal; XtCloseDisplay (dpy); fatal_error_signal_hook = NULL; @@ -7982,15 +7704,13 @@ x_connection_closed (dpy, error_message) /* We specifically use it before defining it, so that gcc doesn't inline it, otherwise gdb doesn't know how to properly put a breakpoint on it. */ -static void x_error_quitter P_ ((Display *, XErrorEvent *)); +static void x_error_quitter (Display *, XErrorEvent *); /* This is the first-level handler for X protocol errors. It calls x_error_quitter or x_error_catcher. */ static int -x_error_handler (display, error) - Display *display; - XErrorEvent *error; +x_error_handler (Display *display, XErrorEvent *error) { if (x_error_message) x_error_catcher (display, error); @@ -8021,9 +7741,7 @@ x_error_handler (display, error) after x_error_handler prevents inlining into the former. */ static void NO_INLINE -x_error_quitter (display, error) - Display *display; - XErrorEvent *error; +x_error_quitter (Display *display, XErrorEvent *error) { char buf[256], buf1[356]; @@ -8048,8 +7766,7 @@ x_error_quitter (display, error) If that was the only one, it prints an error message and kills Emacs. */ static int -x_io_error_quitter (display) - Display *display; +x_io_error_quitter (Display *display) { char buf[256]; @@ -8066,10 +7783,7 @@ x_io_error_quitter (display) FONT-OBJECT. */ Lisp_Object -x_new_font (f, font_object, fontset) - struct frame *f; - Lisp_Object font_object; - int fontset; +x_new_font (struct frame *f, Lisp_Object font_object, int fontset) { struct font *font = XFONT_OBJECT (font_object); @@ -8138,10 +7852,7 @@ x_new_font (f, font_object, fontset) pointer to the x_display_info structure corresponding to XIM. */ static void -xim_destroy_callback (xim, client_data, call_data) - XIM xim; - XPointer client_data; - XPointer call_data; +xim_destroy_callback (XIM xim, XPointer client_data, XPointer call_data) { struct x_display_info *dpyinfo = (struct x_display_info *) client_data; Lisp_Object frame, tail; @@ -8169,16 +7880,14 @@ xim_destroy_callback (xim, client_data, call_data) #ifdef HAVE_X11R6 /* This isn't prototyped in OSF 5.0 or 5.1a. */ -extern char *XSetIMValues P_ ((XIM, ...)); +extern char *XSetIMValues (XIM, ...); #endif /* Open the connection to the XIM server on display DPYINFO. RESOURCE_NAME is the resource name Emacs uses. */ static void -xim_open_dpy (dpyinfo, resource_name) - struct x_display_info *dpyinfo; - char *resource_name; +xim_open_dpy (struct x_display_info *dpyinfo, char *resource_name) { XIM xim; @@ -8222,10 +7931,7 @@ xim_open_dpy (dpyinfo, resource_name) when the callback was registered. */ static void -xim_instantiate_callback (display, client_data, call_data) - Display *display; - XPointer client_data; - XPointer call_data; +xim_instantiate_callback (Display *display, XPointer client_data, XPointer call_data) { struct xim_inst_t *xim_inst = (struct xim_inst_t *) client_data; struct x_display_info *dpyinfo = xim_inst->dpyinfo; @@ -8275,9 +7981,7 @@ xim_instantiate_callback (display, client_data, call_data) in the XIM instantiate callback function. */ static void -xim_initialize (dpyinfo, resource_name) - struct x_display_info *dpyinfo; - char *resource_name; +xim_initialize (struct x_display_info *dpyinfo, char *resource_name) { dpyinfo->xim = NULL; #ifdef HAVE_XIM @@ -8292,7 +7996,7 @@ xim_initialize (dpyinfo, resource_name) xim_inst->dpyinfo = dpyinfo; len = strlen (resource_name); xim_inst->resource_name = (char *) xmalloc (len + 1); - bcopy (resource_name, xim_inst->resource_name, len + 1); + memcpy (xim_inst->resource_name, resource_name, len + 1); XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, resource_name, EMACS_CLASS, xim_instantiate_callback, @@ -8311,8 +8015,7 @@ xim_initialize (dpyinfo, resource_name) /* Close the connection to the XIM server on display DPYINFO. */ static void -xim_close_dpy (dpyinfo) - struct x_display_info *dpyinfo; +xim_close_dpy (struct x_display_info *dpyinfo) { #ifdef HAVE_XIM if (use_xim) @@ -8341,8 +8044,7 @@ xim_close_dpy (dpyinfo) from its current recorded position values and gravity. */ void -x_calc_absolute_position (f) - struct frame *f; +x_calc_absolute_position (struct frame *f) { int flags = f->size_hint_flags; @@ -8394,10 +8096,7 @@ x_calc_absolute_position (f) which means, do adjust for borders but don't change the gravity. */ void -x_set_offset (f, xoff, yoff, change_gravity) - struct frame *f; - register int xoff, yoff; - int change_gravity; +x_set_offset (struct frame *f, register int xoff, register int yoff, int change_gravity) { int modified_top, modified_left; @@ -8466,9 +8165,7 @@ x_set_offset (f, xoff, yoff, change_gravity) http://freedesktop.org/wiki/Specifications/wm-spec. */ static int -wm_supports (f, atomname) - struct frame *f; - const char *atomname; +wm_supports (struct frame *f, const char *atomname) { Atom actual_type; unsigned long actual_size, bytes_remaining; @@ -8557,11 +8254,7 @@ wm_supports (f, atomname) } static void -set_wm_state (frame, add, what, what2) - Lisp_Object frame; - int add; - const char *what; - const char *what2; +set_wm_state (Lisp_Object frame, int add, const char *what, const char *what2) { const char *atom = "_NET_WM_STATE"; Fx_send_client_event (frame, make_number (0), frame, @@ -8579,9 +8272,7 @@ set_wm_state (frame, add, what, what2) } void -x_set_sticky (f, new_value, old_value) - struct frame *f; - Lisp_Object new_value, old_value; +x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { Lisp_Object frame; @@ -8593,8 +8284,7 @@ x_set_sticky (f, new_value, old_value) /* Do fullscreen as specified in extended window manager hints */ static int -do_ewmh_fullscreen (f) - struct frame *f; +do_ewmh_fullscreen (struct frame *f) { int have_net_atom = wm_supports (f, "_NET_WM_STATE"); @@ -8615,7 +8305,7 @@ do_ewmh_fullscreen (f) set_wm_state (frame, 0, fs, NULL); set_wm_state (frame, 0, fh, NULL); set_wm_state (frame, 0, fw, NULL); - + /* If there are _NET_ atoms we assume we have extended window manager hints. */ switch (f->want_fullscreen) @@ -8642,8 +8332,7 @@ do_ewmh_fullscreen (f) } static void -XTfullscreen_hook (f) - FRAME_PTR f; +XTfullscreen_hook (FRAME_PTR f) { if (f->async_visible) { @@ -8656,9 +8345,7 @@ XTfullscreen_hook (f) static void -x_handle_net_wm_state (f, event) - struct frame *f; - XPropertyEvent *event; +x_handle_net_wm_state (struct frame *f, XPropertyEvent *event) { Atom actual_type; unsigned long actual_size, bytes_remaining; @@ -8691,7 +8378,7 @@ x_handle_net_wm_state (f, event) for (i = 0; i < actual_size; ++i) { Atom a = ((Atom*)tmp_data)[i]; - if (a == dpyinfo->Xatom_net_wm_state_maximized_horz) + if (a == dpyinfo->Xatom_net_wm_state_maximized_horz) { if (value == FULLSCREEN_HEIGHT) value = FULLSCREEN_MAXIMIZED; @@ -8712,7 +8399,7 @@ x_handle_net_wm_state (f, event) } lval = Qnil; - switch (value) + switch (value) { case FULLSCREEN_WIDTH: lval = Qfullwidth; @@ -8727,7 +8414,7 @@ x_handle_net_wm_state (f, event) lval = Qmaximized; break; } - + store_frame_param (f, Qfullscreen, lval); store_frame_param (f, Qsticky, sticky ? Qt : Qnil); @@ -8738,8 +8425,7 @@ x_handle_net_wm_state (f, event) /* Check if we need to resize the frame due to a fullscreen request. If so needed, resize the frame. */ static void -x_check_fullscreen (f) - struct frame *f; +x_check_fullscreen (struct frame *f) { if (do_ewmh_fullscreen (f)) return; @@ -8766,7 +8452,7 @@ x_check_fullscreen (f) case FULLSCREEN_HEIGHT: height = x_display_pixel_height (dpyinfo); } - + if (FRAME_COLS (f) != width || FRAME_LINES (f) != height) { change_frame_size (f, height, width, 0, 1, 0); @@ -8785,10 +8471,7 @@ x_check_fullscreen (f) compensate by moving the window right and down by the proper amount. */ static void -x_check_expected_move (f, expected_left, expected_top) - struct frame *f; - int expected_left; - int expected_top; +x_check_expected_move (struct frame *f, int expected_left, int expected_top) { int current_left = 0, current_top = 0; @@ -8833,9 +8516,7 @@ x_check_expected_move (f, expected_left, expected_top) of an exact comparison. */ static void -x_sync_with_move (f, left, top, fuzzy) - struct frame *f; - int left, top, fuzzy; +x_sync_with_move (struct frame *f, int left, int top, int fuzzy) { int count = 0; @@ -8872,9 +8553,7 @@ x_sync_with_move (f, left, top, fuzzy) /* Wait for an event on frame F matching EVENTTYPE. */ void -x_wait_for_event (f, eventtype) - struct frame *f; - int eventtype; +x_wait_for_event (struct frame *f, int eventtype) { int level = interrupt_input_blocked; @@ -8901,7 +8580,7 @@ x_wait_for_event (f, eventtype) FD_ZERO (&fds); FD_SET (fd, &fds); - + EMACS_GET_TIME (time_now); EMACS_SUB_TIME (tmo, tmo_at, time_now); @@ -8919,10 +8598,7 @@ x_wait_for_event (f, eventtype) size changes. Otherwise we leave the window gravity unchanged. */ static void -x_set_window_size_1 (f, change_gravity, cols, rows) - struct frame *f; - int change_gravity; - int cols, rows; +x_set_window_size_1 (struct frame *f, int change_gravity, int cols, int rows) { int pixelwidth, pixelheight; @@ -8930,9 +8606,7 @@ x_set_window_size_1 (f, change_gravity, cols, rows) f->scroll_bar_actual_width = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) ? 0 - : FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0 - ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) - : (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f))); + : FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)); compute_fringe_widths (f, 0); @@ -8987,17 +8661,14 @@ x_set_window_size_1 (f, change_gravity, cols, rows) Otherwise we leave the window gravity unchanged. */ void -x_set_window_size (f, change_gravity, cols, rows) - struct frame *f; - int change_gravity; - int cols, rows; +x_set_window_size (struct frame *f, int change_gravity, int cols, int rows) { BLOCK_INPUT; if (NILP (tip_frame) || XFRAME (tip_frame) != f) { int r, c; - + /* When the frame is maximized/fullscreen or running under for example Xmonad, x_set_window_size_1 will be a no-op. In that case, the right thing to do is extend rows/cols to @@ -9046,9 +8717,7 @@ x_set_window_size (f, change_gravity, cols, rows) /* Mouse warping. */ void -x_set_mouse_position (f, x, y) - struct frame *f; - int x, y; +x_set_mouse_position (struct frame *f, int x, int y) { int pix_x, pix_y; @@ -9071,9 +8740,7 @@ x_set_mouse_position (f, x, y) /* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */ void -x_set_mouse_pixel_position (f, pix_x, pix_y) - struct frame *f; - int pix_x, pix_y; +x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) { BLOCK_INPUT; @@ -9085,8 +8752,7 @@ x_set_mouse_pixel_position (f, pix_x, pix_y) /* focus shifting, raising and lowering. */ void -x_focus_on_frame (f) - struct frame *f; +x_focus_on_frame (struct frame *f) { #if 0 /* I don't think that the ICCCM allows programs to do things like this @@ -9098,8 +8764,7 @@ x_focus_on_frame (f) } void -x_unfocus_frame (f) - struct frame *f; +x_unfocus_frame (struct frame *f) { #if 0 /* Look at the remarks in x_focus_on_frame. */ @@ -9112,8 +8777,7 @@ x_unfocus_frame (f) /* Raise frame F. */ void -x_raise_frame (f) - struct frame *f; +x_raise_frame (struct frame *f) { BLOCK_INPUT; if (f->async_visible) @@ -9126,8 +8790,7 @@ x_raise_frame (f) /* Lower frame F. */ void -x_lower_frame (f) - struct frame *f; +x_lower_frame (struct frame *f) { if (f->async_visible) { @@ -9141,8 +8804,7 @@ x_lower_frame (f) /* Activate frame with Extended Window Manager Hints */ void -x_ewmh_activate_frame (f) - FRAME_PTR f; +x_ewmh_activate_frame (FRAME_PTR f) { /* See Window Manager Specification/Extended Window Manager Hints at http://freedesktop.org/wiki/Specifications/wm-spec */ @@ -9162,9 +8824,7 @@ x_ewmh_activate_frame (f) } static void -XTframe_raise_lower (f, raise_flag) - FRAME_PTR f; - int raise_flag; +XTframe_raise_lower (FRAME_PTR f, int raise_flag) { if (raise_flag) x_raise_frame (f); @@ -9175,9 +8835,7 @@ XTframe_raise_lower (f, raise_flag) /* XEmbed implementation. */ void -xembed_set_info (f, flags) - struct frame *f; - enum xembed_info flags; +xembed_set_info (struct frame *f, enum xembed_info flags) { Atom atom; unsigned long data[2]; @@ -9192,13 +8850,7 @@ xembed_set_info (f, flags) } void -xembed_send_message (f, time, message, detail, data1, data2) - struct frame *f; - Time time; - enum xembed_message message; - long detail; - long data1; - long data2; +xembed_send_message (struct frame *f, Time time, enum xembed_message message, long int detail, long int data1, long int data2) { XEvent event; @@ -9227,8 +8879,7 @@ xembed_send_message (f, time, message, detail, data1, data2) finishes with it. */ void -x_make_frame_visible (f) - struct frame *f; +x_make_frame_visible (struct frame *f) { Lisp_Object type; int original_top, original_left; @@ -9359,7 +9010,7 @@ x_make_frame_visible (f) /* It could be confusing if a real alarm arrives while processing the fake one. Turn it off and let the handler reset it. */ - extern void poll_for_input_1 P_ ((void)); + extern void poll_for_input_1 (void); int old_poll_suppress_count = poll_suppress_count; poll_suppress_count = 1; poll_for_input_1 (); @@ -9391,8 +9042,7 @@ x_make_frame_visible (f) /* Make the frame visible (mapped and not iconified). */ void -x_make_frame_invisible (f) - struct frame *f; +x_make_frame_invisible (struct frame *f) { Window window; @@ -9449,8 +9099,7 @@ x_make_frame_invisible (f) /* Change window state from mapped to iconified. */ void -x_iconify_frame (f) - struct frame *f; +x_iconify_frame (struct frame *f) { int result; Lisp_Object type; @@ -9576,8 +9225,7 @@ x_iconify_frame (f) /* Free X resources of frame F. */ void -x_free_frame_resources (f) - struct frame *f; +x_free_frame_resources (struct frame *f) { struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); Lisp_Object bar; @@ -9700,8 +9348,7 @@ x_free_frame_resources (f) /* Destroy the X window of frame F. */ void -x_destroy_window (f) - struct frame *f; +x_destroy_window (struct frame *f) { struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); @@ -9725,10 +9372,7 @@ x_destroy_window (f) #ifndef USE_GTK void -x_wm_set_size_hint (f, flags, user_position) - struct frame *f; - long flags; - int user_position; +x_wm_set_size_hint (struct frame *f, long flags, int user_position) { XSizeHints size_hints; Window window = FRAME_OUTER_WINDOW (f); @@ -9828,9 +9472,7 @@ x_wm_set_size_hint (f, flags, user_position) /* Used for IconicState or NormalState */ void -x_wm_set_window_state (f, state) - struct frame *f; - int state; +x_wm_set_window_state (struct frame *f, int state) { #ifdef USE_X_TOOLKIT Arg al[1]; @@ -9848,9 +9490,7 @@ x_wm_set_window_state (f, state) } void -x_wm_set_icon_pixmap (f, pixmap_id) - struct frame *f; - int pixmap_id; +x_wm_set_icon_pixmap (struct frame *f, int pixmap_id) { Pixmap icon_pixmap, icon_mask; @@ -9898,9 +9538,7 @@ x_wm_set_icon_pixmap (f, pixmap_id) } void -x_wm_set_icon_position (f, icon_x, icon_y) - struct frame *f; - int icon_x, icon_y; +x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y) { Window window = FRAME_OUTER_WINDOW (f); @@ -9922,9 +9560,7 @@ x_wm_set_icon_position (f, icon_x, icon_y) font table. */ static void -x_check_font (f, font) - struct frame *f; - struct font *font; +x_check_font (struct frame *f, struct font *font) { Lisp_Object frame; @@ -9973,8 +9609,7 @@ static int x_session_initialized; /* Test whether two display-name strings agree up to the dot that separates the screen number from the server number. */ static int -same_x_server (name1, name2) - const char *name1, *name2; +same_x_server (const char *name1, const char *name2) { int seen_colon = 0; const unsigned char *system_name = SDATA (Vsystem_name); @@ -10021,10 +9656,7 @@ same_x_server (name1, name2) get to the first bit. With MASK 0x7e0, *BITS is set to 6, and *OFFSET to 5. */ static void -get_bits_and_offset (mask, bits, offset) - unsigned long mask; - int *bits; - int *offset; +get_bits_and_offset (long unsigned int mask, int *bits, int *offset) { int nr = 0; int off = 0; @@ -10049,8 +9681,7 @@ get_bits_and_offset (mask, bits, offset) But don't permanently open it, just test its availability. */ int -x_display_ok (display) - const char *display; +x_display_ok (const char *display) { int dpy_ok = 1; Display *dpy; @@ -10065,26 +9696,19 @@ x_display_ok (display) #ifdef USE_GTK static void -my_log_handler (log_domain, log_level, message, user_data) - const gchar *log_domain; - GLogLevelFlags log_level; - const gchar *message; - gpointer user_data; +my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) { if (!strstr (message, "g_set_prgname")) fprintf (stderr, "%s-WARNING **: %s\n", log_domain, message); } #endif - + /* Open a connection to X display DISPLAY_NAME, and return the structure that describes the open display. If we cannot contact the display, return null. */ struct x_display_info * -x_term_init (display_name, xrm_option, resource_name) - Lisp_Object display_name; - char *xrm_option; - char *resource_name; +x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) { int connection; Display *dpy; @@ -10110,20 +9734,10 @@ x_term_init (display_name, xrm_option, resource_name) char *argv[NUM_ARGV]; char **argv2 = argv; guint id; -#ifndef HAVE_GTK_MULTIDISPLAY - if (!EQ (Vinitial_window_system, Qx)) - error ("Sorry, you cannot connect to X servers with the GTK toolkit"); -#endif if (x_initialized++ > 1) { -#ifdef HAVE_GTK_MULTIDISPLAY - /* Opening another display. If xg_display_open returns less - than zero, we are probably on GTK 2.0, which can only handle - one display. GTK 2.2 or later can handle more than one. */ - if (xg_display_open (SDATA (display_name), &dpy) < 0) -#endif - error ("Sorry, this version of GTK can only handle one display"); + xg_display_open (SDATA (display_name), &dpy); } else { @@ -10227,7 +9841,7 @@ x_term_init (display_name, xrm_option, resource_name) /* We have definitely succeeded. Record the new connection. */ dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info)); - bzero (dpyinfo, sizeof *dpyinfo); + memset (dpyinfo, 0, sizeof *dpyinfo); terminal = x_create_terminal (dpyinfo); @@ -10505,7 +10119,11 @@ x_term_init (display_name, xrm_option, resource_name) = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE", False); dpyinfo->Xatom_net_window_type_tooltip = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE_TOOLTIP", False); - + dpyinfo->Xatom_net_wm_icon_name + = XInternAtom (dpyinfo->display, "_NET_WM_ICON_NAME", False); + dpyinfo->Xatom_net_wm_name + = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False); + dpyinfo->cut_buffers_initialized = 0; dpyinfo->x_dnd_atoms_size = 8; @@ -10536,11 +10154,9 @@ x_term_init (display_name, xrm_option, resource_name) xsettings_initialize (dpyinfo); -#ifdef subprocesses /* This is only needed for distinguishing keyboard and process input. */ if (connection != 0) add_keyboard_wait_descriptor (connection); -#endif #ifdef F_SETOWN fcntl (connection, F_SETOWN, getpid ()); @@ -10622,8 +10238,7 @@ x_term_init (display_name, xrm_option, resource_name) and without sending any more commands to the X server. */ void -x_delete_display (dpyinfo) - struct x_display_info *dpyinfo; +x_delete_display (struct x_display_info *dpyinfo) { struct terminal *t; @@ -10635,7 +10250,7 @@ x_delete_display (dpyinfo) #ifdef HAVE_X_SM /* Close X session management when we close its display. */ if (t->id == 1 && x_session_have_connection ()) - x_session_close(); + x_session_close (); #endif delete_terminal (t); break; @@ -10692,8 +10307,7 @@ x_delete_display (dpyinfo) that slows us down. */ static void -x_process_timeouts (timer) - struct atimer *timer; +x_process_timeouts (struct atimer *timer) { BLOCK_INPUT; x_timeout_atimer_activated_flag = 0; @@ -10716,7 +10330,7 @@ x_process_timeouts (timer) processed, these widgets don't behave normally. */ void -x_activate_timeout_atimer () +x_activate_timeout_atimer (void) { BLOCK_INPUT; if (!x_timeout_atimer_activated_flag) @@ -10892,7 +10506,7 @@ x_create_terminal (struct x_display_info *dpyinfo) } void -x_initialize () +x_initialize (void) { baud_rate = 19200; @@ -10950,7 +10564,7 @@ x_initialize () void -syms_of_xterm () +syms_of_xterm (void) { x_error_message = NULL; diff --git a/src/xterm.h b/src/xterm.h index a766f863c4d..5c1213d2bf1 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -370,6 +370,9 @@ struct x_display_info /* XSettings atoms and windows. */ Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr; Window xsettings_window; + + /* Frame name and icon name */ + Atom Xatom_net_wm_name, Xatom_net_wm_icon_name; }; #ifdef HAVE_X_I18N @@ -378,13 +381,16 @@ extern int use_xim; #endif /* This checks to make sure we have a display. */ -extern void check_x P_ ((void)); -extern struct frame *x_window_to_frame P_ ((struct x_display_info *, int)); +extern void check_x (void); -extern struct frame *x_any_window_to_frame P_ ((struct x_display_info *, int)); -extern struct frame *x_menubar_window_to_frame P_ ((struct x_display_info *, int)); -extern struct frame *x_top_window_to_frame P_ ((struct x_display_info *, int)); +extern struct frame *x_window_to_frame (struct x_display_info *, int); + +extern struct frame *x_any_window_to_frame (struct x_display_info *, int); +extern struct frame *x_menubar_window_to_frame (struct x_display_info *, + XEvent *); + +extern struct frame *x_top_window_to_frame (struct x_display_info *, int); #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) #define x_any_window_to_frame x_window_to_frame @@ -403,14 +409,14 @@ extern Lisp_Object x_display_name_list; /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */ extern Lisp_Object Vx_pixel_size_width_font_regexp; -extern struct x_display_info *x_display_info_for_display P_ ((Display *)); -extern struct x_display_info *x_display_info_for_name P_ ((Lisp_Object)); -extern void x_set_frame_alpha P_ ((struct frame *)); +extern struct x_display_info *x_display_info_for_display (Display *); +extern struct x_display_info *x_display_info_for_name (Lisp_Object); +extern void x_set_frame_alpha (struct frame *); -extern struct x_display_info *x_term_init P_ ((Lisp_Object, char *, char *)); -extern int x_display_ok P_ ((const char *)); +extern struct x_display_info *x_term_init (Lisp_Object, char *, char *); +extern int x_display_ok (const char *); -extern void select_visual P_ ((struct x_display_info *)); +extern void select_visual (struct x_display_info *); struct font; @@ -661,8 +667,22 @@ enum FRAME_X_WINDOW (f)) #else #ifdef USE_GTK +/* Functions not present in older Gtk+ */ + +#ifndef HAVE_GTK_WIDGET_GET_WINDOW +#define gtk_widget_get_window(w) ((w)->window) +#endif +#ifndef HAVE_GTK_WIDGET_GET_MAPPED +#define gtk_widget_get_mapped(w) (GTK_WIDGET_MAPPED (w)) +#endif +#ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE +#define gtk_adjustment_get_page_size(w) ((w)->page_size) +#define gtk_adjustment_get_upper(w) ((w)->upper) +#endif + #define GTK_WIDGET_TO_X_WIN(w) \ - ((w) && (w)->window ? GDK_WINDOW_XWINDOW ((w)->window) : 0) + ((w) && gtk_widget_get_window (w) \ + ? GDK_WINDOW_XWINDOW (gtk_widget_get_window (w)) : 0) #define FRAME_GTK_OUTER_WIDGET(f) ((f)->output_data.x->widget) #define FRAME_GTK_WIDGET(f) ((f)->output_data.x->edit_widget) @@ -901,168 +921,168 @@ struct image; /* From xselect.c. */ -void x_handle_selection_notify P_ ((XSelectionEvent *)); -void x_handle_property_notify P_ ((XPropertyEvent *)); +void x_handle_selection_notify (XSelectionEvent *); +void x_handle_property_notify (XPropertyEvent *); /* From xfns.c. */ -Lisp_Object display_x_get_resource P_ ((struct x_display_info *, - Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object)); -struct frame *check_x_frame P_ ((Lisp_Object)); +Lisp_Object display_x_get_resource (struct x_display_info *, + Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object); +struct frame *check_x_frame (Lisp_Object); EXFUN (Fx_display_color_p, 1); EXFUN (Fx_display_grayscale_p, 1); -extern void x_free_gcs P_ ((struct frame *)); +extern void x_free_gcs (struct frame *); /* From xrdb.c. */ -char *x_get_customization_string P_ ((XrmDatabase, char *, char *)); -XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *)); -int x_get_resource P_ ((XrmDatabase, char *, char *, - XrmRepresentation, XrmValue *)); -void x_delete_display P_ ((struct x_display_info *)); -void x_make_frame_visible P_ ((struct frame *)); -void x_iconify_frame P_ ((struct frame *)); -void x_wm_set_size_hint P_ ((struct frame *, long, int)); -int x_text_icon P_ ((struct frame *, char *)); -int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); -void x_set_window_size P_ ((struct frame *, int, int, int)); -void x_wm_set_window_state P_ ((struct frame *, int)); -int x_alloc_nearest_color P_ ((struct frame *, Colormap, XColor *)); +char *x_get_customization_string (XrmDatabase, char *, char *); +XrmDatabase x_load_resources (Display *, char *, char *, char *); +int x_get_resource (XrmDatabase, char *, char *, + XrmRepresentation, XrmValue *); +void x_delete_display (struct x_display_info *); +void x_make_frame_visible (struct frame *); +void x_iconify_frame (struct frame *); +void x_wm_set_size_hint (struct frame *, long, int); +int x_text_icon (struct frame *, char *); +int x_bitmap_icon (struct frame *, Lisp_Object); +void x_set_window_size (struct frame *, int, int, int); +void x_wm_set_window_state (struct frame *, int); +int x_alloc_nearest_color (struct frame *, Colormap, XColor *); /* Defined in xterm.c */ -extern void cancel_mouse_face P_ ((struct frame *)); -extern void x_scroll_bar_clear P_ ((struct frame *)); -extern int x_text_icon P_ ((struct frame *, char *)); -extern int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); -extern void x_catch_errors P_ ((Display *)); -extern void x_check_errors P_ ((Display *, char *)); -extern int x_had_errors_p P_ ((Display *)); -extern int x_catching_errors P_ ((void)); -extern void x_uncatch_errors P_ ((void)); -extern void x_clear_errors P_ ((Display *)); -extern void x_set_window_size P_ ((struct frame *, int, int, int)); -extern void x_set_mouse_position P_ ((struct frame *, int, int)); -extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int)); -extern void x_ewmh_activate_frame P_ ((struct frame *)); -extern void x_raise_frame P_ ((struct frame *)); -extern void x_lower_frame P_ ((struct frame *)); -extern void x_make_frame_visible P_ ((struct frame *)); -extern void x_make_frame_invisible P_ ((struct frame *)); -extern void x_iconify_frame P_ ((struct frame *)); -extern void x_free_frame_resources P_ ((struct frame *)); -extern void x_destroy_window P_ ((struct frame *)); -extern void x_wm_set_size_hint P_ ((struct frame *, long, int)); -extern void x_wm_set_window_state P_ ((struct frame *, int)); -extern void x_wm_set_icon_pixmap P_ ((struct frame *, int)); -extern void x_delete_display P_ ((struct x_display_info *)); -extern void x_delete_terminal P_ ((struct terminal *terminal)); -extern void x_initialize P_ ((void)); -extern unsigned long x_copy_color P_ ((struct frame *, unsigned long)); +extern void cancel_mouse_face (struct frame *); +extern void x_scroll_bar_clear (struct frame *); +extern int x_text_icon (struct frame *, char *); +extern int x_bitmap_icon (struct frame *, Lisp_Object); +extern void x_catch_errors (Display *); +extern void x_check_errors (Display *, char *); +extern int x_had_errors_p (Display *); +extern int x_catching_errors (void); +extern void x_uncatch_errors (void); +extern void x_clear_errors (Display *); +extern void x_set_window_size (struct frame *, int, int, int); +extern void x_set_mouse_position (struct frame *, int, int); +extern void x_set_mouse_pixel_position (struct frame *, int, int); +extern void x_ewmh_activate_frame (struct frame *); +extern void x_raise_frame (struct frame *); +extern void x_lower_frame (struct frame *); +extern void x_make_frame_visible (struct frame *); +extern void x_make_frame_invisible (struct frame *); +extern void x_iconify_frame (struct frame *); +extern void x_free_frame_resources (struct frame *); +extern void x_destroy_window (struct frame *); +extern void x_wm_set_size_hint (struct frame *, long, int); +extern void x_wm_set_window_state (struct frame *, int); +extern void x_wm_set_icon_pixmap (struct frame *, int); +extern void x_delete_display (struct x_display_info *); +extern void x_delete_terminal (struct terminal *terminal); +extern void x_initialize (void); +extern unsigned long x_copy_color (struct frame *, unsigned long); #ifdef USE_X_TOOLKIT extern XtAppContext Xt_app_con; -extern int x_alloc_lighter_color_for_widget __P ((Widget, Display*, Colormap, - unsigned long *, - double, int)); -extern void x_activate_timeout_atimer P_ ((void)); +extern int x_alloc_lighter_color_for_widget (Widget, Display*, Colormap, + unsigned long *, + double, int); +extern void x_activate_timeout_atimer (void); #endif -extern void x_query_colors P_ ((struct frame *f, XColor *, int)); -extern void x_query_color P_ ((struct frame *f, XColor *)); -extern void x_clear_area P_ ((Display *, Window, int, int, int, int, int)); -extern void set_vertical_scroll_bar P_ ((struct window *)); +extern void x_query_colors (struct frame *f, XColor *, int); +extern void x_query_color (struct frame *f, XColor *); +extern void x_clear_area (Display *, Window, int, int, int, int, int); +extern void set_vertical_scroll_bar (struct window *); -extern int x_dispatch_event P_ ((XEvent *, Display *)); -extern unsigned int x_x_to_emacs_modifiers P_ ((struct x_display_info *, - unsigned)); -extern int x_display_pixel_height P_ ((struct x_display_info *)); -extern int x_display_pixel_width P_ ((struct x_display_info *)); +extern int x_dispatch_event (XEvent *, Display *); +extern unsigned int x_x_to_emacs_modifiers (struct x_display_info *, + unsigned); +extern int x_display_pixel_height (struct x_display_info *); +extern int x_display_pixel_width (struct x_display_info *); -extern void x_set_sticky P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern void x_wait_for_event P_ ((struct frame *, int)); +extern void x_set_sticky (struct frame *, Lisp_Object, Lisp_Object); +extern void x_wait_for_event (struct frame *, int); /* Defined in xselect.c */ -extern void x_handle_property_notify P_ ((XPropertyEvent *)); -extern void x_handle_selection_notify P_ ((XSelectionEvent *)); -extern void x_handle_selection_event P_ ((struct input_event *)); -extern void x_clear_frame_selections P_ ((struct frame *)); +extern void x_handle_property_notify (XPropertyEvent *); +extern void x_handle_selection_notify (XSelectionEvent *); +extern void x_handle_selection_event (struct input_event *); +extern void x_clear_frame_selections (struct frame *); -extern int x_handle_dnd_message P_ ((struct frame *, - XClientMessageEvent *, - struct x_display_info *, - struct input_event *bufp)); -extern int x_check_property_data P_ ((Lisp_Object)); -extern void x_fill_property_data P_ ((Display *, - Lisp_Object, - void *, - int)); -extern Lisp_Object x_property_data_to_lisp P_ ((struct frame *, - unsigned char *, - Atom, - int, - unsigned long)); +extern int x_handle_dnd_message (struct frame *, + XClientMessageEvent *, + struct x_display_info *, + struct input_event *bufp); +extern int x_check_property_data (Lisp_Object); +extern void x_fill_property_data (Display *, + Lisp_Object, + void *, + int); +extern Lisp_Object x_property_data_to_lisp (struct frame *, + unsigned char *, + Atom, + int, + unsigned long); /* Defined in xfns.c */ -extern struct x_display_info * check_x_display_info P_ ((Lisp_Object frame)); +extern struct x_display_info * check_x_display_info (Lisp_Object frame); #ifdef USE_GTK -extern int xg_set_icon P_ ((struct frame *, Lisp_Object)); -extern int xg_set_icon_from_xpm_data P_ ((struct frame *, char**)); +extern int xg_set_icon (struct frame *, Lisp_Object); +extern int xg_set_icon_from_xpm_data (struct frame *, char**); #endif /* USE_GTK */ -extern void x_real_positions P_ ((struct frame *, int *, int *)); -extern int defined_color P_ ((struct frame *, char *, XColor *, int)); -extern void x_set_border_pixel P_ ((struct frame *, int)); -extern void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern void x_implicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); -extern void xic_free_xfontset P_ ((struct frame *)); -extern void create_frame_xic P_ ((struct frame *)); -extern void destroy_frame_xic P_ ((struct frame *)); -extern void xic_set_preeditarea P_ ((struct window *, int, int)); -extern void xic_set_statusarea P_ ((struct frame *)); -extern void xic_set_xfontset P_ ((struct frame *, char *)); -extern int x_pixel_width P_ ((struct frame *)); -extern int x_pixel_height P_ ((struct frame *)); -extern int x_char_width P_ ((struct frame *)); -extern int x_char_height P_ ((struct frame *)); -extern int x_screen_planes P_ ((struct frame *)); -extern void x_sync P_ ((struct frame *)); -extern int x_defined_color P_ ((struct frame *, char *, XColor *, int)); +extern void x_real_positions (struct frame *, int *, int *); +extern int defined_color (struct frame *, char *, XColor *, int); +extern void x_set_border_pixel (struct frame *, int); +extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); +extern void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); +extern void xic_free_xfontset (struct frame *); +extern void create_frame_xic (struct frame *); +extern void destroy_frame_xic (struct frame *); +extern void xic_set_preeditarea (struct window *, int, int); +extern void xic_set_statusarea (struct frame *); +extern void xic_set_xfontset (struct frame *, char *); +extern int x_pixel_width (struct frame *); +extern int x_pixel_height (struct frame *); +extern int x_char_width (struct frame *); +extern int x_char_height (struct frame *); +extern int x_screen_planes (struct frame *); +extern void x_sync (struct frame *); +extern int x_defined_color (struct frame *, char *, XColor *, int); #ifdef HAVE_X_I18N -extern void free_frame_xic P_ ((struct frame *)); +extern void free_frame_xic (struct frame *); #endif -extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); +extern void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object); /* Defined in xfaces.c */ -extern int compute_glyph_face P_ ((struct frame *, int, int)); -extern int compute_glyph_face_1 P_ ((struct frame *, Lisp_Object, int)); -extern void x_free_dpy_colors P_ ((Display *, Screen *, Colormap, - unsigned long *, int)); +extern int compute_glyph_face (struct frame *, int, int); +extern int compute_glyph_face_1 (struct frame *, Lisp_Object, int); +extern void x_free_dpy_colors (Display *, Screen *, Colormap, + unsigned long *, int); /* Defined in xmenu.c */ -extern void x_menu_set_in_use P_ ((int)); -extern void x_menu_wait_for_event P_ ((void *data)); -extern void x_activate_menubar P_ ((struct frame *)); -extern int popup_activated P_ ((void)); -extern void initialize_frame_menubar P_ ((struct frame *)); -extern void free_frame_menubar P_ ((struct frame *)); +extern void x_menu_set_in_use (int); +extern void x_menu_wait_for_event (void *data); +extern void x_activate_menubar (struct frame *); +extern int popup_activated (void); +extern void initialize_frame_menubar (struct frame *); +extern void free_frame_menubar (struct frame *); /* Defined in widget.c */ #ifdef USE_X_TOOLKIT -extern void widget_store_internal_border P_ ((Widget)); +extern void widget_store_internal_border (Widget); #endif /* Defined in xsmfns.c */ #ifdef HAVE_X_SM -extern void x_session_initialize P_ ((struct x_display_info *dpyinfo)); -extern int x_session_check_input P_ ((struct input_event *bufp)); -extern int x_session_have_connection P_ ((void)); -extern void x_session_close P_ ((void)); +extern void x_session_initialize (struct x_display_info *dpyinfo); +extern int x_session_check_input (struct input_event *bufp); +extern int x_session_have_connection (void); +extern void x_session_close (void); #endif /* XEmbed implementation. */ @@ -1115,10 +1135,10 @@ enum xembed_accelerator /* Defined in xterm.c */ -extern void xembed_set_info P_ ((struct frame *f, enum xembed_info flags)); -extern void xembed_send_message P_ ((struct frame *f, Time time, - enum xembed_message message, - long detail, long data1, long data2)); +extern void xembed_set_info (struct frame *f, enum xembed_info flags); +extern void xembed_send_message (struct frame *f, Time time, + enum xembed_message message, + long detail, long data1, long data2); /* Is the frame embedded into another application? */ diff --git a/test/ChangeLog b/test/ChangeLog index d1825c0d169..c23b46a0715 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2010-06-25 Chong Yidong <cyd@stupidchicken.com> + + * redisplay-testsuite.el (test-redisplay-3): New test. + 2010-06-11 Chong Yidong <cyd@stupidchicken.com> * comint-testsuite.el: New file. diff --git a/test/redisplay-testsuite.el b/test/redisplay-testsuite.el index 889504c9fa8..c7616fea67d 100644 --- a/test/redisplay-testsuite.el +++ b/test/redisplay-testsuite.el @@ -110,13 +110,72 @@ (propertize "XXX\n" 'face 'highlight) "\n Test: ") (test-insert-overlay "XXX\n" 'mouse-face 'highlight) - (insert "\n")) + (insert "\n\n")) + +(defun test-redisplay-3 () + (insert "Test 3: Overlay with before/after strings and images:\n\n") + (let ((img-data "#define x_width 8 +#define x_height 8 +static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff };")) + ;; Control + (insert " Expected: AB" + (propertize "X" 'display `(image :data ,img-data :type xbm)) + "CD\n") + + ;; Overlay with before, after, and image display string. + (insert " Result 1: ") + (let ((opoint (point))) + (insert "AXD\n") + (let ((ov (make-overlay (1+ opoint) (+ 2 opoint)))) + (overlay-put ov 'before-string "B") + (overlay-put ov 'after-string "C") + (overlay-put ov 'display + `(image :data ,img-data :type xbm)))) + + ;; Overlay with before and after string, and image text prop. + (insert " Result 2: ") + (let ((opoint (point))) + (insert "AXD\n") + (let ((ov (make-overlay (1+ opoint) (+ 2 opoint)))) + (overlay-put ov 'before-string "B") + (overlay-put ov 'after-string "C") + (put-text-property (1+ opoint) (+ 2 opoint) 'display + `(image :data ,img-data :type xbm)))) + + ;; Overlays with adjacent before and after strings, and image text + ;; prop. + (insert " Result 3: ") + (let ((opoint (point))) + (insert "AXD\n") + (let ((ov1 (make-overlay opoint (1+ opoint))) + (ov2 (make-overlay (+ 2 opoint) (+ 3 opoint)))) + (overlay-put ov1 'after-string "B") + (overlay-put ov2 'before-string "C") + (put-text-property (1+ opoint) (+ 2 opoint) 'display + `(image :data ,img-data :type xbm)))) + + ;; Three overlays. + (insert " Result 4: ") + (let ((opoint (point))) + (insert "AXD\n\n") + (let ((ov1 (make-overlay opoint (1+ opoint))) + (ov2 (make-overlay (+ 2 opoint) (+ 3 opoint))) + (ov3 (make-overlay (1+ opoint) (+ 2 opoint)))) + (overlay-put ov1 'after-string "B") + (overlay-put ov2 'before-string "C") + (overlay-put ov3 'display `(image :data ,img-data :type xbm)))))) + (defun test-redisplay () (interactive) - (pop-to-buffer (generate-new-buffer "*Redisplay Test*")) - (test-redisplay-1) - (test-redisplay-2) - (goto-char (point-min))) + (let ((buf (get-buffer "*Redisplay Test*"))) + (if buf + (kill-buffer buf)) + (pop-to-buffer (get-buffer-create "*Redisplay Test*")) + (erase-buffer) + (test-redisplay-1) + (test-redisplay-2) + (test-redisplay-3) + (goto-char (point-min)))) ;; arch-tag: fcee53c8-024f-403d-9154-61ae3ce0bfb8