Now on revision 111705. ------------------------------------------------------------ revno: 111705 fixes bug: http://debbugs.gnu.org/13340 committer: Chong Yidong branch nick: trunk timestamp: Sat 2013-02-09 13:52:20 +0800 message: Bind view-echo-area-messages in minibuffer-inactive-mode-map. * help.el (view-echo-area-messages): Use display-buffer. * minibuffer.el (minibuffer-inactive-mode-map): Bind mouse-1 to view-echo-area-messages. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-09 05:09:02 +0000 +++ lisp/ChangeLog 2013-02-09 05:52:20 +0000 @@ -1,5 +1,10 @@ 2013-02-09 Chong Yidong + * minibuffer.el (minibuffer-inactive-mode-map): Bind mouse-1 to + view-echo-area-messages (Bug#13340). + + * help.el (view-echo-area-messages): Use display-buffer. + * dired-x.el (dired-do-run-mail): Prompt for confirmation (Bug#13561). === modified file 'lisp/help.el' --- lisp/help.el 2013-01-01 09:11:05 +0000 +++ lisp/help.el 2013-02-09 05:52:20 +0000 @@ -412,7 +412,9 @@ The number of messages retained in that buffer is specified by the variable `message-log-max'." (interactive) - (switch-to-buffer (get-buffer-create "*Messages*"))) + (with-current-buffer (get-buffer-create "*Messages*") + (goto-char (point-max)) + (display-buffer (current-buffer)))) (defun view-order-manuals () "Display the Emacs ORDERS file." === modified file 'lisp/minibuffer.el' --- lisp/minibuffer.el 2013-01-02 16:13:04 +0000 +++ lisp/minibuffer.el 2013-02-09 05:52:20 +0000 @@ -2045,10 +2045,7 @@ (define-key map "i" 'info) (define-key map "m" 'mail) (define-key map "n" 'make-frame) - (define-key map [mouse-1] (lambda () (interactive) - (with-current-buffer "*Messages*" - (goto-char (point-max)) - (display-buffer (current-buffer))))) + (define-key map [mouse-1] 'view-echo-area-messages) ;; So the global down-mouse-1 binding doesn't clutter the execution of the ;; above mouse-1 binding. (define-key map [down-mouse-1] #'ignore) ------------------------------------------------------------ revno: 111704 fixes bug: http://debbugs.gnu.org/13561 committer: Chong Yidong branch nick: trunk timestamp: Sat 2013-02-09 13:09:02 +0800 message: * dired-x.el (dired-do-run-mail): Prompt for confirmation. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-08 16:17:18 +0000 +++ lisp/ChangeLog 2013-02-09 05:09:02 +0000 @@ -1,3 +1,8 @@ +2013-02-09 Chong Yidong + + * dired-x.el (dired-do-run-mail): Prompt for confirmation + (Bug#13561). + 2013-02-08 Stefan Monnier * emacs-lisp/byte-run.el (eval-when-compile, eval-and-compile): === modified file 'lisp/dired-x.el' --- lisp/dired-x.el 2013-01-02 16:13:04 +0000 +++ lisp/dired-x.el 2013-02-09 05:09:02 +0000 @@ -1344,13 +1344,20 @@ (rmail (dired-get-filename))) (defun dired-do-run-mail () - "If `dired-bind-vm' is non-nil, call `dired-vm', else call `dired-rmail'." + "Visit the current file as a mailbox, using VM or RMAIL. +Prompt for confirmation first; if the user says yes, call +`dired-vm' if `dired-bind-vm' is non-nil, `dired-rmail' +otherwise." (interactive) - (if dired-bind-vm - ;; Read mail folder using vm. - (dired-vm) - ;; Read mail folder using rmail. - (dired-rmail))) + (let ((file (dired-get-filename t))) + (if dired-bind-vm + (if (y-or-n-p (concat "Visit `" file + "' as a mail folder with VM?")) + (dired-vm)) + ;; Read mail folder using rmail. + (if (y-or-n-p (concat "Visit `" file + "' as a mailbox with RMAIL?")) + (dired-rmail))))) ;;; MISCELLANEOUS INTERNAL FUNCTIONS. === modified file 'lisp/dired.el' --- lisp/dired.el 2013-01-19 20:38:13 +0000 +++ lisp/dired.el 2013-02-09 05:09:02 +0000 @@ -4297,7 +4297,7 @@ ;;;*** ;;;### (autoloads (dired-do-relsymlink dired-jump-other-window dired-jump) -;;;;;; "dired-x" "dired-x.el" "cdaacce7c861256289ba48493dd6d0ec") +;;;;;; "dired-x" "dired-x.el" "90ba5245f6f5df3bdbda6303c725ef45") ;;; Generated autoloads from dired-x.el (autoload 'dired-jump "dired-x" "\ ------------------------------------------------------------ revno: 111703 committer: Paul Eggert branch nick: trunk timestamp: Fri 2013-02-08 15:45:43 -0800 message: * sedlibmk.inp: Sync with changes in lib/Makefile.in. (HAVE_SECURE_GETENV, GNULIB_SECURE_GETENV): Edit to appropriate values. diff: === modified file 'msdos/ChangeLog' --- msdos/ChangeLog 2013-01-02 16:13:04 +0000 +++ msdos/ChangeLog 2013-02-08 23:45:43 +0000 @@ -1,3 +1,8 @@ +2013-02-08 Paul Eggert + + * sedlibmk.inp: Sync with changes in lib/Makefile.in. + (HAVE_SECURE_GETENV, GNULIB_SECURE_GETENV): Edit to appropriate values. + 2012-12-30 Eli Zaretskii * sed1v2.inp (TEMACS_LDFLAGS2): Remove editing. === modified file 'msdos/sedlibmk.inp' --- msdos/sedlibmk.inp 2013-01-01 09:11:05 +0000 +++ msdos/sedlibmk.inp 2013-02-08 23:45:43 +0000 @@ -271,6 +271,7 @@ /^GNULIB_RMDIR *=/s/@GNULIB_RMDIR@/0/ /^GNULIB_RPMATCH *=/s/@GNULIB_RPMATCH@/0/ /^GNULIB_SCANF *=/s/@GNULIB_SCANF@/0/ +/^GNULIB_SECURE_GETENV *=/s/@GNULIB_SECURE_GETENV@/0/ /^GNULIB_SELECT *=/s/@GNULIB_SELECT@/0/ /^GNULIB_SETENV *=/s/@GNULIB_SETENV@/0/ /^GNULIB_SETHOSTNAME *=/s/@GNULIB_SETHOSTNAME@/0/ @@ -405,6 +406,7 @@ /^HAVE_REALPATH *=/s/@HAVE_REALPATH@/0/ /^HAVE_RENAMEAT *=/s/@HAVE_RENAMEAT@/0/ /^HAVE_RPMATCH *=/s/@HAVE_RPMATCH@/0/ +/^HAVE_SECURE_GETENV *=/s/@HAVE_SECURE_GETENV@/0/ /^HAVE_SETENV *=/s/@HAVE_SETENV@/1/ /^HAVE_SETHOSTNAME *=/s/@HAVE_SETHOSTNAME@/0/ /^HAVE_SIGACTION *=/s/@HAVE_SIGACTION@/1/ ------------------------------------------------------------ revno: 111702 committer: Paul Eggert branch nick: trunk timestamp: Fri 2013-02-08 15:37:17 -0800 message: Merge from gnulib. diff: === modified file 'ChangeLog' --- ChangeLog 2013-02-01 06:30:51 +0000 +++ ChangeLog 2013-02-08 23:37:17 +0000 @@ -1,3 +1,14 @@ +2013-02-08 Paul Eggert + + Merge from gnulib, incorporating: + 2013-02-08 careadlinkat: stop exporting careadlinkatcwd + The MS-Windows port can remove careadlinkatcwd at its convenience. + 2013-02-08 extensions: port better to HP-UX + 2013-02-06 extensions: port better to MINIX 3, HP-UX, autoheader 2.62 + 2013-02-06 unistd: avoid namespace pollution on non-glibc systems + 2013-02-04 secure_getenv: new module [module not used by Emacs] + 2013-01-30 sys_time: port to Solaris 2.6 + 2013-02-01 Paul Eggert Use fdopendir, fstatat and readlinkat, for efficiency (Bug#13539). === modified file 'doc/misc/texinfo.tex' --- doc/misc/texinfo.tex 2013-01-02 16:37:04 +0000 +++ doc/misc/texinfo.tex 2013-02-08 23:37:17 +0000 @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2013-01-01.15} +\def\texinfoversion{2013-02-01.11} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -2496,7 +2496,7 @@ \let-\codedash \let_\codeunder \else - \let-\realdash + \let-\normaldash \let_\realunder \fi \codex @@ -2505,7 +2505,7 @@ \def\codex #1{\tclose{#1}\endgroup} -\def\realdash{-} +\def\normaldash{-} \def\codedash{-\discretionary{}{}{}} \def\codeunder{% % this is all so @math{@code{var_name}+1} can work. In math mode, _ @@ -2520,9 +2520,9 @@ } % An additional complication: the above will allow breaks after, e.g., -% each of the four underscores in __typeof__. This is undesirable in -% some manuals, especially if they don't have long identifiers in -% general. @allowcodebreaks provides a way to control this. +% each of the four underscores in __typeof__. This is bad. +% @allowcodebreaks provides a document-level way to turn breaking at - +% and _ on and off. % \newif\ifallowcodebreaks \allowcodebreakstrue @@ -4188,7 +4188,7 @@ % ..., but we might end up with active ones in the argument if % we're called from @code, as @code{@value{foo-bar_}}, though. % So \let them to their normal equivalents. - \let-\realdash \let_\normalunderscore + \let-\normaldash \let_\normalunderscore } } @@ -9993,22 +9993,26 @@ @gdef@otherbackslash{@let\=@realbackslash} % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of -% the literal character `\'. +% the literal character `\'. Also revert - to its normal character, in +% case the active - from code has slipped in. % -@def@normalturnoffactive{% - @let"=@normaldoublequote - @let$=@normaldollar %$ font-lock fix - @let+=@normalplus - @let<=@normalless - @let>=@normalgreater - @let\=@normalbackslash - @let^=@normalcaret - @let_=@normalunderscore - @let|=@normalverticalbar - @let~=@normaltilde - @markupsetuplqdefault - @markupsetuprqdefault - @unsepspaces +{@catcode`- = @active + @gdef@normalturnoffactive{% + @let-=@normaldash + @let"=@normaldoublequote + @let$=@normaldollar %$ font-lock fix + @let+=@normalplus + @let<=@normalless + @let>=@normalgreater + @let\=@normalbackslash + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let~=@normaltilde + @markupsetuplqdefault + @markupsetuprqdefault + @unsepspaces + } } % Make _ and + \other characters, temporarily. === modified file 'lib/careadlinkat.c' --- lib/careadlinkat.c 2013-02-01 06:30:51 +0000 +++ lib/careadlinkat.c 2013-02-08 23:37:17 +0000 @@ -25,6 +25,7 @@ #include #include #include +#include /* Define this independently so that stdint.h is not a prerequisite. */ #ifndef SIZE_MAX === modified file 'lib/careadlinkat.h' --- lib/careadlinkat.h 2013-02-01 06:30:51 +0000 +++ lib/careadlinkat.h 2013-02-08 23:37:17 +0000 @@ -52,15 +52,12 @@ ssize_t (*preadlinkat) (int, char const *, char *, size_t)); -/* Suitable value for careadlinkat's FD argument, - when doing a plain readlink: - Pass FD = AT_FDCWD. */ +/* Suitable value for careadlinkat's FD argument. */ #if HAVE_READLINKAT /* AT_FDCWD is declared in . */ #else /* Define AT_FDCWD independently, so that the careadlinkat module does - not depend on the fcntl-h module. The value does not matter, since - careadlinkatcwd ignores it, but we might as well use the same value + not depend on the fcntl-h module. We might as well use the same value as fcntl-h. */ # ifndef AT_FDCWD # define AT_FDCWD (-3041965) === modified file 'lib/gnulib.mk' --- lib/gnulib.mk 2013-02-01 06:30:51 +0000 +++ lib/gnulib.mk 2013-02-08 23:37:17 +0000 @@ -1032,6 +1032,7 @@ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \ + -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \ -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \ -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \ -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \ @@ -1060,6 +1061,7 @@ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ + -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \ -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ === modified file 'lib/stdlib.in.h' --- lib/stdlib.in.h 2013-01-10 02:19:44 +0000 +++ lib/stdlib.in.h 2013-02-08 23:37:17 +0000 @@ -767,6 +767,22 @@ # endif #endif +#if @GNULIB_SECURE_GETENV@ +/* Look up NAME in the environment, returning 0 in insecure situations. */ +# if !@HAVE_SECURE_GETENV@ +_GL_FUNCDECL_SYS (secure_getenv, char *, + (char const *name) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (secure_getenv, int, (char const *name)); +_GL_CXXALIASWARN (secure_getenv); +#elif defined GNULIB_POSIXCHECK +# undef secure_getenv +# if HAVE_RAW_DECL_SECURE_GETENV +_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " + "use gnulib module secure_getenv for portability"); +# endif +#endif + #if @GNULIB_SETENV@ /* Set NAME to VALUE in the environment. If REPLACE is nonzero, overwrite an existing value. */ === modified file 'lib/sys_select.in.h' --- lib/sys_select.in.h 2013-01-01 09:11:05 +0000 +++ lib/sys_select.in.h 2013-02-08 23:37:17 +0000 @@ -19,14 +19,25 @@ # endif @PRAGMA_COLUMNS@ -/* On OSF/1, and include . +/* On OSF/1 and Solaris 2.6, and + both include . Simply delegate to the system's header in this case. */ -#if @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TYPES_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H) && defined _OSF_SOURCE +#if (@HAVE_SYS_SELECT_H@ \ + && ((defined __osf__ && defined _SYS_TYPES_H_ && defined _OSF_SOURCE) \ + || (defined __sun && defined _SYS_TYPES_H \ + && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \ + || defined __EXTENSIONS__))) \ + && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H) # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ -#elif @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TIME_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H) && defined _OSF_SOURCE +#elif (@HAVE_SYS_SELECT_H@ \ + && ((defined __osf__ && defined _SYS_TIME_H_ && defined _OSF_SOURCE) \ + || (defined __sun && defined _SYS_TIME_H \ + && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \ + || defined __EXTENSIONS__))) \ + && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H) # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ === modified file 'lib/sys_time.in.h' --- lib/sys_time.in.h 2013-01-01 09:11:05 +0000 +++ lib/sys_time.in.h 2013-02-08 23:37:17 +0000 @@ -17,37 +17,34 @@ /* Written by Paul Eggert. */ +#ifndef _@GUARD_PREFIX@_SYS_TIME_H + #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ -#if defined _@GUARD_PREFIX@_SYS_TIME_H - -/* Simply delegate to the system's header, without adding anything. */ -# if @HAVE_SYS_TIME_H@ -# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ -# endif - -#else - -# define _@GUARD_PREFIX@_SYS_TIME_H - -# if @HAVE_SYS_TIME_H@ -# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ -# else -# include -# endif +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_SYS_TIME_H@ +# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ +#endif + +#ifndef _@GUARD_PREFIX@_SYS_TIME_H +#define _@GUARD_PREFIX@_SYS_TIME_H + +#if ! @HAVE_SYS_TIME_H@ +# include +#endif /* On native Windows with MSVC, get the 'struct timeval' type. Also, on native Windows with a 64-bit time_t, where we are overriding the 'struct timeval' type, get all declarations of system functions whose signature contains 'struct timeval'. */ -# if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H -# define _GL_INCLUDING_WINSOCK2_H -# include -# undef _GL_INCLUDING_WINSOCK2_H -# endif +#if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H +# define _GL_INCLUDING_WINSOCK2_H +# include +# undef _GL_INCLUDING_WINSOCK2_H +#endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ @@ -55,112 +52,112 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ -# ifdef __cplusplus +#ifdef __cplusplus extern "C" { +#endif + +#if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@ + +# if @REPLACE_STRUCT_TIMEVAL@ +# define timeval rpl_timeval # endif -# if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@ - -# if @REPLACE_STRUCT_TIMEVAL@ -# define timeval rpl_timeval -# endif - -# if !GNULIB_defined_struct_timeval +# if !GNULIB_defined_struct_timeval struct timeval { time_t tv_sec; long int tv_usec; }; -# define GNULIB_defined_struct_timeval 1 -# endif - +# define GNULIB_defined_struct_timeval 1 # endif -# ifdef __cplusplus +#endif + +#ifdef __cplusplus } -# endif +#endif -# if @GNULIB_GETTIMEOFDAY@ -# if @REPLACE_GETTIMEOFDAY@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef gettimeofday -# define gettimeofday rpl_gettimeofday -# endif +#if @GNULIB_GETTIMEOFDAY@ +# if @REPLACE_GETTIMEOFDAY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef gettimeofday +# define gettimeofday rpl_gettimeofday +# endif _GL_FUNCDECL_RPL (gettimeofday, int, (struct timeval *restrict, void *restrict) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (gettimeofday, int, (struct timeval *restrict, void *restrict)); -# else -# if !@HAVE_GETTIMEOFDAY@ +# else +# if !@HAVE_GETTIMEOFDAY@ _GL_FUNCDECL_SYS (gettimeofday, int, (struct timeval *restrict, void *restrict) _GL_ARG_NONNULL ((1))); -# endif +# endif /* Need to cast, because on glibc systems, by default, the second argument is struct timezone *. */ _GL_CXXALIAS_SYS_CAST (gettimeofday, int, (struct timeval *restrict, void *restrict)); -# endif +# endif _GL_CXXALIASWARN (gettimeofday); -# elif defined GNULIB_POSIXCHECK -# undef gettimeofday -# if HAVE_RAW_DECL_GETTIMEOFDAY +#elif defined GNULIB_POSIXCHECK +# undef gettimeofday +# if HAVE_RAW_DECL_GETTIMEOFDAY _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - " "use gnulib module gettimeofday for portability"); -# endif # endif +#endif /* Hide some function declarations from . */ -# if defined _MSC_VER && @HAVE_WINSOCK2_H@ -# if !defined _@GUARD_PREFIX@_UNISTD_H -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef close -# define close close_used_without_including_unistd_h -# else +#if defined _MSC_VER && @HAVE_WINSOCK2_H@ +# if !defined _@GUARD_PREFIX@_UNISTD_H +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef close +# define close close_used_without_including_unistd_h +# else _GL_WARN_ON_USE (close, "close() used without including "); -# endif -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef gethostname -# define gethostname gethostname_used_without_including_unistd_h -# else +# endif +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef gethostname +# define gethostname gethostname_used_without_including_unistd_h +# else _GL_WARN_ON_USE (gethostname, "gethostname() used without including "); -# endif # endif -# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef socket -# define socket socket_used_without_including_sys_socket_h -# undef connect -# define connect connect_used_without_including_sys_socket_h -# undef accept -# define accept accept_used_without_including_sys_socket_h -# undef bind -# define bind bind_used_without_including_sys_socket_h -# undef getpeername -# define getpeername getpeername_used_without_including_sys_socket_h -# undef getsockname -# define getsockname getsockname_used_without_including_sys_socket_h -# undef getsockopt -# define getsockopt getsockopt_used_without_including_sys_socket_h -# undef listen -# define listen listen_used_without_including_sys_socket_h -# undef recv -# define recv recv_used_without_including_sys_socket_h -# undef send -# define send send_used_without_including_sys_socket_h -# undef recvfrom -# define recvfrom recvfrom_used_without_including_sys_socket_h -# undef sendto -# define sendto sendto_used_without_including_sys_socket_h -# undef setsockopt -# define setsockopt setsockopt_used_without_including_sys_socket_h -# undef shutdown -# define shutdown shutdown_used_without_including_sys_socket_h -# else +# endif +# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef socket +# define socket socket_used_without_including_sys_socket_h +# undef connect +# define connect connect_used_without_including_sys_socket_h +# undef accept +# define accept accept_used_without_including_sys_socket_h +# undef bind +# define bind bind_used_without_including_sys_socket_h +# undef getpeername +# define getpeername getpeername_used_without_including_sys_socket_h +# undef getsockname +# define getsockname getsockname_used_without_including_sys_socket_h +# undef getsockopt +# define getsockopt getsockopt_used_without_including_sys_socket_h +# undef listen +# define listen listen_used_without_including_sys_socket_h +# undef recv +# define recv recv_used_without_including_sys_socket_h +# undef send +# define send send_used_without_including_sys_socket_h +# undef recvfrom +# define recvfrom recvfrom_used_without_including_sys_socket_h +# undef sendto +# define sendto sendto_used_without_including_sys_socket_h +# undef setsockopt +# define setsockopt setsockopt_used_without_including_sys_socket_h +# undef shutdown +# define shutdown shutdown_used_without_including_sys_socket_h +# else _GL_WARN_ON_USE (socket, "socket() used without including "); _GL_WARN_ON_USE (connect, @@ -189,17 +186,18 @@ "setsockopt() used without including "); _GL_WARN_ON_USE (shutdown, "shutdown() used without including "); -# endif # endif -# if !defined _@GUARD_PREFIX@_SYS_SELECT_H -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef select -# define select select_used_without_including_sys_select_h -# else +# endif +# if !defined _@GUARD_PREFIX@_SYS_SELECT_H +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef select +# define select select_used_without_including_sys_select_h +# else _GL_WARN_ON_USE (select, "select() used without including "); -# endif # endif # endif +#endif #endif /* _@GUARD_PREFIX@_SYS_TIME_H */ +#endif /* _@GUARD_PREFIX@_SYS_TIME_H */ === modified file 'lib/unistd.in.h' --- lib/unistd.in.h 2013-01-23 01:47:44 +0000 +++ lib/unistd.in.h 2013-02-08 23:37:17 +0000 @@ -110,6 +110,7 @@ /* Get getopt(), optarg, optind, opterr, optopt. But avoid namespace pollution on glibc systems. */ #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT +# define __need_getopt # include #endif === modified file 'm4/extensions.m4' --- m4/extensions.m4 2013-01-01 09:11:05 +0000 +++ m4/extensions.m4 2013-02-08 23:37:17 +0000 @@ -1,4 +1,4 @@ -# serial 12 -*- Autoconf -*- +# serial 13 -*- Autoconf -*- # Enable extensions on systems that normally disable them. # Copyright (C) 2003, 2006-2013 Free Software Foundation, Inc. @@ -8,7 +8,7 @@ # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS # Autoconf. Perhaps we can remove this once we can assume Autoconf -# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly +# 2.70 or later everywhere, but since Autoconf mutates rapidly # enough in this area it's likely we'll need to redefine # AC_USE_SYSTEM_EXTENSIONS for quite some time. @@ -30,6 +30,7 @@ # ------------------------ # Enable extensions on systems that normally disable them, # typically due to standards-conformance issues. +# # Remember that #undef in AH_VERBATIM gets replaced with #define by # AC_DEFINE. The goal here is to define all known feature-enabling # macros, then, if reports of conflicts are made, disable macros that @@ -38,8 +39,6 @@ [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl AC_BEFORE([$0], [AC_RUN_IFELSE])dnl - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) if test "$MINIX" = yes; then AC_DEFINE([_POSIX_SOURCE], [1], @@ -50,24 +49,18 @@ except with this defined.]) AC_DEFINE([_MINIX], [1], [Define to 1 if on MINIX.]) + AC_DEFINE([_NETBSD_SOURCE], [1], + [Define to 1 to make NetBSD features available. MINIX 3 needs this.]) fi - dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, - dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already - dnl provided. - case "$host_os" in - hpux*) - AC_DEFINE([_XOPEN_SOURCE], [500], - [Define to 500 only on HP-UX.]) - ;; - esac - - AH_VERBATIM([__EXTENSIONS__], +dnl Use a different key than __EXTENSIONS__, as that name broke existing +dnl configure.ac when using autoheader 2.62. + AH_VERBATIM([USE_SYSTEM_EXTENSIONS], [/* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif -/* Enable general extensions on Mac OS X. */ +/* Enable general extensions on OS X. */ #ifndef _DARWIN_C_SOURCE # undef _DARWIN_C_SOURCE #endif @@ -83,6 +76,12 @@ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif +/* Enable X/Open extensions if necessary. HP-UX 11.11 defines + mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of + whether compiling with -Ae or -D_HPUX_SOURCE=1. */ +#ifndef _XOPEN_SOURCE +# undef _XOPEN_SOURCE +#endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ @@ -103,6 +102,22 @@ AC_DEFINE([_GNU_SOURCE]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) AC_DEFINE([_TANDEM_SOURCE]) + AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], + [ac_cv_should_define__xopen_source], + [ac_cv_should_define__xopen_source=no + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #include + mbstate_t x;]])], + [], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #define _XOPEN_SOURCE 500 + #include + mbstate_t x;]])], + [ac_cv_should_define__xopen_source=yes])])]) + test $ac_cv_should_define__xopen_source = yes && + AC_DEFINE([_XOPEN_SOURCE], [500]) ])# AC_USE_SYSTEM_EXTENSIONS # gl_USE_SYSTEM_EXTENSIONS === modified file 'm4/stdlib_h.m4' --- m4/stdlib_h.m4 2013-01-01 09:11:05 +0000 +++ m4/stdlib_h.m4 2013-02-08 23:37:17 +0000 @@ -1,4 +1,4 @@ -# stdlib_h.m4 serial 41 +# stdlib_h.m4 serial 42 dnl Copyright (C) 2007-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -22,7 +22,7 @@ ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps posix_openpt ptsname ptsname_r random random_r realpath rpmatch - setenv setstate setstate_r srandom srandom_r + secure_getenv setenv setstate setstate_r srandom srandom_r strtod strtoll strtoull unlockpt unsetenv]) ]) @@ -60,6 +60,7 @@ GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH]) GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) + GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV]) GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) @@ -88,6 +89,7 @@ HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) + HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV]) HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV]) HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) ------------------------------------------------------------ revno: 111701 committer: Paul Eggert branch nick: trunk timestamp: Fri 2013-02-08 15:28:29 -0800 message: * movemail.c (getenv): Remove decl (unused since 1994). diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2013-01-15 21:26:01 +0000 +++ lib-src/ChangeLog 2013-02-08 23:28:29 +0000 @@ -1,3 +1,7 @@ +2013-02-08 Paul Eggert + + * movemail.c (getenv): Remove decl (unused since 1994). + 2013-01-15 Paul Eggert * make-docfile.c (write_globals): Make it a bit clearer (Bug#13448). === modified file 'lib-src/movemail.c' --- lib-src/movemail.c 2013-01-02 16:13:04 +0000 +++ lib-src/movemail.c 2013-02-08 23:28:29 +0000 @@ -665,7 +665,6 @@ register int i; int mbfi; FILE *mbf; - char *getenv (const char *); popserver server; int start, end, increment; char *user, *hostname; ------------------------------------------------------------ revno: 111700 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12598 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2013-02-08 12:42:09 -0500 message: * src/lread.c (skip_dyn_bytes): New function. (read1): Use it. Use getc instead of READCHAR to read bytes. (load_each_byte): Remove. Update users. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-02-08 14:44:53 +0000 +++ src/ChangeLog 2013-02-08 17:42:09 +0000 @@ -1,3 +1,9 @@ +2013-02-08 Stefan Monnier + + * lread.c (skip_dyn_bytes): New function (bug#12598). + (read1): Use it. Use getc instead of READCHAR to read bytes. + (load_each_byte): Remove. Update users. + 2013-02-08 Dmitry Antipov * search.c (scan_buffer): Calculate end byte position just once. === modified file 'src/doc.c' --- src/doc.c 2013-01-02 16:13:04 +0000 +++ src/doc.c 2013-02-08 17:42:09 +0000 @@ -176,9 +176,9 @@ if (space_left <= 0) { ptrdiff_t in_buffer = p - get_doc_string_buffer; - get_doc_string_buffer = - xpalloc (get_doc_string_buffer, &get_doc_string_buffer_size, - 16 * 1024, -1, 1); + get_doc_string_buffer + = xpalloc (get_doc_string_buffer, &get_doc_string_buffer_size, + 16 * 1024, -1, 1); p = get_doc_string_buffer + in_buffer; space_left = (get_doc_string_buffer_size - 1 - (p - get_doc_string_buffer)); @@ -279,10 +279,10 @@ else { /* The data determines whether the string is multibyte. */ - ptrdiff_t nchars = - multibyte_chars_in_text (((unsigned char *) get_doc_string_buffer - + offset), - to - (get_doc_string_buffer + offset)); + ptrdiff_t nchars + = multibyte_chars_in_text (((unsigned char *) get_doc_string_buffer + + offset), + to - (get_doc_string_buffer + offset)); return make_string_from_bytes (get_doc_string_buffer + offset, nchars, to - (get_doc_string_buffer + offset)); === modified file 'src/lread.c' --- src/lread.c 2013-01-17 06:29:40 +0000 +++ src/lread.c 2013-02-08 17:42:09 +0000 @@ -96,11 +96,6 @@ It must be set to nil before all top-level calls to read0. */ static Lisp_Object read_objects; -/* True means READCHAR should read bytes one by one (not character) - when READCHARFUN is Qget_file_char or Qget_emacs_mule_file_char. - This is set by read1 temporarily while handling #@NUMBER. */ -static bool load_each_byte; - /* List of descriptors now open for Fload. */ static Lisp_Object load_descriptor_list; @@ -328,7 +323,7 @@ return c; } c = (*readbyte) (-1, readcharfun); - if (c < 0 || load_each_byte) + if (c < 0) return c; if (multibyte) *multibyte = 1; @@ -353,6 +348,30 @@ return STRING_CHAR (buf); } +static void +skip_dyn_bytes (Lisp_Object readcharfun, ptrdiff_t n) +{ + if (EQ (readcharfun, Qget_file_char) + || EQ (readcharfun, Qget_emacs_mule_file_char)) + { + block_input (); /* FIXME: Not sure if it's needed. */ + fseek (instream, n, SEEK_CUR); + unblock_input (); + } + else + { /* We're not reading directly from a file. In that case, it's difficult + to reliably count bytes, since these are usually meant for the file's + encoding, whereas we're now typically in the internal encoding. + But luckily, skip_dyn_bytes is used to skip over a single + dynamic-docstring (or dynamic byte-code) which is always quoted such + that \037 is the final char. */ + int c; + do { + c = READCHAR; + } while (c >= 0 && c != '\037'); + } +} + /* Unread the character C in the way appropriate for the stream READCHARFUN. If the stream is a user function, call it with the char as argument. */ @@ -407,14 +426,7 @@ else if (EQ (readcharfun, Qget_file_char) || EQ (readcharfun, Qget_emacs_mule_file_char)) { - if (load_each_byte) - { - block_input (); - ungetc (c, instream); - unblock_input (); - } - else - unread_char = c; + unread_char = c; } else call1 (readcharfun, make_number (c)); @@ -2388,7 +2400,6 @@ bool multibyte; *pch = 0; - load_each_byte = 0; retry: @@ -2598,7 +2609,7 @@ return tmp; } - /* #@NUMBER is used to skip NUMBER following characters. + /* #@NUMBER is used to skip NUMBER following bytes. That's used in .elc files to skip over doc strings and function definitions. */ if (c == '@') @@ -2606,7 +2617,6 @@ enum { extra = 100 }; ptrdiff_t i, nskip = 0; - load_each_byte = 1; /* Read a decimal integer. */ while ((c = READCHAR) >= 0 && c >= '0' && c <= '9') @@ -2616,8 +2626,15 @@ nskip *= 10; nskip += c - '0'; } - UNREAD (c); - + if (nskip > 0) + /* We can't use UNREAD here, because in the code below we side-step + READCHAR. Instead, assume the first char after #@NNN occupies + a single byte, which is the case normally since it's just + a space. */ + nskip--; + else + UNREAD (c); + if (load_force_doc_strings && (EQ (readcharfun, Qget_file_char) || EQ (readcharfun, Qget_emacs_mule_file_char))) @@ -2659,19 +2676,17 @@ saved_doc_string_position = file_tell (instream); /* Copy that many characters into saved_doc_string. */ + block_input (); for (i = 0; i < nskip && c >= 0; i++) - saved_doc_string[i] = c = READCHAR; + saved_doc_string[i] = c = getc (instream); + unblock_input (); saved_doc_string_length = i; } else - { - /* Skip that many characters. */ - for (i = 0; i < nskip && c >= 0; i++) - c = READCHAR; - } + /* Skip that many bytes. */ + skip_dyn_bytes (readcharfun, nskip); - load_each_byte = 0; goto retry; } if (c == '!') ------------------------------------------------------------ revno: 111699 [merge] committer: Glenn Morris branch nick: trunk timestamp: Fri 2013-02-08 09:23:24 -0800 message: Merge from emacs-24; up to r111236 diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2013-01-19 20:38:13 +0000 +++ doc/lispref/ChangeLog 2013-02-08 17:23:24 +0000 @@ -1,3 +1,8 @@ +2013-02-08 Glenn Morris + + * keymaps.texi (Active Keymaps, Searching Keymaps): + Remove confusing mention of "symbolic prefix". (Bug#13643) + 2013-01-19 Glenn Morris * macros.texi (Indenting Macros): Fix order of an indent === modified file 'doc/lispref/keymaps.texi' --- doc/lispref/keymaps.texi 2013-01-05 21:18:01 +0000 +++ doc/lispref/keymaps.texi 2013-02-08 17:23:24 +0000 @@ -634,8 +634,8 @@ input key sequence in all these keymaps. @xref{Searching Keymaps}, for more details of this procedure. - When the key sequence starts with a mouse event (optionally preceded -by a symbolic prefix), the active keymaps are determined based on the + When the key sequence starts with a mouse event, +the active keymaps are determined based on the position in that event. If the event happened on a string embedded with a @code{display}, @code{before-string}, or @code{after-string} property (@pxref{Special Properties}), the non-@code{nil} map @@ -766,8 +766,7 @@ @var{find-in} and @var{find-in-any} are pseudo functions that search in one keymap and in an alist of keymaps, respectively. (Searching a single keymap for a binding is called @dfn{key lookup}; see @ref{Key -Lookup}.) If the key sequence starts with a mouse event, or a -symbolic prefix event followed by a mouse event, that event's position +Lookup}.) If the key sequence starts with a mouse event, that event's position is used instead of point and the current buffer. Mouse events on an embedded string use non-@code{nil} text properties from that string instead of the buffer. @var{temp-map} is a pseudo variable that === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2013-02-07 08:31:21 +0000 +++ doc/misc/ChangeLog 2013-02-08 17:23:24 +0000 @@ -1,3 +1,7 @@ +2013-02-08 Aidan Gauland + + * eshell.texi: Fill most of the missing sections. + 2013-02-07 Bastien Guerry * org.texi (References): Clarify an example. === modified file 'doc/misc/eshell.texi' --- doc/misc/eshell.texi 2013-01-05 21:18:01 +0000 +++ doc/misc/eshell.texi 2013-02-08 17:23:24 +0000 @@ -2,6 +2,7 @@ @c %**start of header @setfilename ../../info/eshell @settitle Eshell: The Emacs Shell +@defindex cm @synindex vr fn @c %**end of header @@ -42,7 +43,7 @@ @c -release- @end ignore @sp 3 -@center John Wiegley +@center John Wiegley & Aidan Gauland @c -date- @page @@ -75,16 +76,15 @@ * What is Eshell?:: A brief introduction to the Emacs Shell. * Command basics:: The basics of command usage. * Commands:: -* Arguments:: +* Expansion:: * Input/Output:: -* Process control:: * Extension modules:: -* Extras and Goodies:: * Bugs and ideas:: Known problems, and future ideas. * GNU Free Documentation License:: The license for this documentation. * Concept Index:: * Function and Variable Index:: * Key Index:: +* Command Index:: @end menu @node What is Eshell? @@ -278,83 +278,56 @@ @node Commands @chapter Commands +In a command shell, everything is done by invoking commands. This +chapter covers command invocations in Eshell, including the command +history and invoking commands in a script file. + @menu * Invocation:: -* Completion:: +* Arguments:: +* Variables:: +* Built-ins:: * Aliases:: * History:: +* Completion:: +* for loop:: * Scripts:: -* Built-ins:: @end menu -Essentially, a command shell is all about invoking commands---and -everything that entails. So understanding how Eshell invokes commands -is the key to comprehending how it all works. - @node Invocation @section Invocation - Unlike regular system shells, Eshell never invokes kernel functions directly, such as @code{exec(3)}. Instead, it uses the Lisp functions available in the Emacs Lisp library. It does this by transforming the -command you specify into a callable Lisp form.@footnote{To see the Lisp -form that will be invoked, type: @samp{eshell-parse-command "echo -hello"}} - -This transformation, from the string of text typed at the command -prompt, to the ultimate invocation of either a Lisp function or external -command, follows these steps: - -@enumerate -@item Parse the command string into separate arguments. -@item -@end enumerate - -@node Completion -@section Completion - -@node Aliases -@section Aliases - -@node History -@section History - -Eshell knows a few built-in variables: - -@table @code - -@item $+ -@vindex $+ -This variable always contains the current working directory. - -@item $- -@vindex $- -This variable always contains the previous working directory (the -current working directory from before the last @code{cd} command). - -@item $_ -@vindex $_ -It refers to the last argument of the last command. - -@item $$ -@vindex $$ -This is the result of the last command. In case of an external -command, it is @code{t} or @code{nil}. - -@item $? -@vindex $? -This variable contains the exit code of the last command (0 or 1 for -Lisp functions, based on successful completion). - -@end table - -@node Scripts -@section Scripts - +input line into a callable Lisp form.@footnote{To see the Lisp form that will be invoked, type: @samp{eshell-parse-command "echo hello"}} + +The command can be either an Elisp function or an external command. +Eshell looks first for an @ref{Aliases, alias} with the same name as the +command, then a @ref{Built-ins, built-in command} or a function with the +same name; if there is no match, it then tries to execute it as an +external command. + +The semicolon (@code{;}) can be used to separate multiple command +invocations on a single line. A command invocation followed by an +ampersand (@code{&}) will be run in the background. Eshell has no job +control, so you can not suspend or background the current process, or +bring a background process into the foreground. That said, background +processes invoked from Eshell can be controlled the same way as any +other background process in Emacs. + +@node Arguments +@section Arguments +Command arguments are passed to the functions as either strings or +numbers, depending on what the parser thinks they look like. If you +need to use a function that takes some other data type, you will need to +call it in an Elisp expression (which can also be used with +@ref{Expansion, expansions}). As with other shells, you can +escape special characters and spaces with the backslash (@code{\}) and +the single (@code{''}) and double (@code{""}) quotes. @node Built-ins + @section Built-in commands - Several commands are built-in in Eshell. In order to call the external variant of a built-in command @code{foo}, you could call @code{*foo}. Usually, this should not be necessary. You can check @@ -368,7 +341,7 @@ @end example If you want to discard a given built-in command, you could declare an -alias, @ref{Aliases}. Eample: +alias, @ref{Aliases}. Example: @example ~ $ which sudo @@ -378,15 +351,96 @@ sudo is an alias, defined as "*sudo $*" @end example -Some of the built-in commands have a special behavior in Eshell: +@vindex eshell-prefer-lisp-functions +If you would prefer to use the built-in commands instead of the external +commands, set @var{eshell-prefer-lisp-functions} to @code{t}. + +Some of the built-in commands have different behaviour from their +external counterparts, and some have no external counterpart. Most of +these will print a usage message when given the @code{--help} option. @table @code +@item addpath +@cmindex addpath +Adds a given path or set of paths to the PATH environment variable, or, +with no arguments, prints the current paths in this variable. + +@item alias +@cmindex alias +Define an alias (@pxref{Aliases}). This does not add it to the aliases +file. + +@item date +@cmindex date +Similar to, but slightly different from, the GNU Coreutils +@command{date} command. + +@item define +@cmindex define +Define a varalias. @xref{Variable Aliases, , , elisp}. + +@item diff +@cmindex diff +Use Emacs's internal @code{diff} (not to be confused with +@code{ediff}). @xref{Comparing Files, , , elisp}. + +@item grep +@cmindex grep +@itemx agrep +@cmindex agrep +@itemx egrep +@cmindex egrep +@itemx fgrep +@cmindex fgrep +@itemx glimpse +@cmindex glimpse +The @command{grep} commands are compatible with GNU @command{grep}, but +use Emacs's internal @code{grep} instead. + +@item info +@cmindex info +Same as the external @command{info} command, but uses Emacs's internal +Info reader. + +@item jobs +@cmindex jobs +List subprocesses of the Emacs process, if any, using the function +@code{list-processes}. + +@item kill +@cmindex kill +Kill processes. Takes a PID or a process object and an optional +signal specifier. + +@item listify +@cmindex listify +Eshell version of @code{list}. Allows you to create a list using Eshell +syntax, rather than Elisp syntax. For example, @samp{listify foo bar} +and @code{("foo" "bar")} both evaluate to @code{("foo" "bar")}. + +@item locate +@cmindex locate +Alias to Emacs's @code{locate} function, which simply runs the external +@command{locate} command and parses the results. @xref{Dired and `find', , , elisp}. + +@item make +@cmindex make +Run @command{make} through @code{compile}. @xref{Running Compilations under Emacs, , , elisp}. + +@item occur +@cmindex occur +Alias to Emacs's @code{occur}. @xref{Other Search-and-Loop Commands, , , elisp}. + +@item printnl +@cmindex printnl +Print the arguments separated by newlines. + @item cd -@findex cd +@cmindex cd This command changes the current working directory. Usually, it is -invoked as @samp{cd foo} where @file{foo} is the new working -directory. But @code{cd} knows about a few special arguments: +invoked as @samp{cd foo} where @file{foo} is the new working directory. +But @command{cd} knows about a few special arguments: When it receives no argument at all, it changes to the home directory. @@ -396,14 +450,73 @@ The command @samp{cd =} shows the directory stack. Each line is numbered. -With @samp{cd =foo}, Eshell searches the directory stack for a -directory matching the regular expression @samp{foo} and changes to -that directory. +With @samp{cd =foo}, Eshell searches the directory stack for a directory +matching the regular expression @samp{foo} and changes to that +directory. With @samp{cd -42}, you can access the directory stack by number. -@item history -@findex history +@item su +@cmindex su +@itemx sudo +@cmindex sudo +Uses TRAMP's @command{su} or @command{sudo} method to run a command via +@command{su} or @command{sudo}. + +@end table + +@section Built-in variables +Eshell knows a few built-in variables: + +@table @code + +@item $+ +@vindex $+ +This variable always contains the current working directory. + +@item $- +@vindex $- +This variable always contains the previous working directory (the +current working directory from before the last @code{cd} command). + +@item $_ +@vindex $_ +It refers to the last argument of the last command. + +@item $$ +@vindex $$ +This is the result of the last command. In case of an external +command, it is @code{t} or @code{nil}. + +@item $? +@vindex $? +This variable contains the exit code of the last command (0 or 1 for +Lisp functions, based on successful completion). + +@end table + +@node Variables +@section Variables +Since Eshell is just an Emacs REPL@footnote{Read-Eval-Print Loop}, it +does not have its own scope, and simply stores variables the same you +would in an Elisp program. Eshell provides a command version of +@code{setq} for convenience. + +@node Aliases +@section Aliases + +Aliases are commands that expand to a longer input line. For example, +@command{ll} is a common alias for @code{ls -l}, and would be defined +with the command invocation @samp{alias ll ls -l}; with this defined, +running @samp{ll foo} in Eshell will actually run @samp{ls -l foo}. +Aliases defined (or deleted) by the @command{alias} command are +automatically written to the file named by @var{eshell-aliases-file}, +which you can also edit directly (although you will have to manually +reload it). + +@node History +@section History +@cmindex history The @samp{history} command shows all commands kept in the history ring as numbered list. If the history ring contains @code{eshell-history-size} commands, those numbers change after every @@ -419,70 +532,226 @@ argument of the last command beginning with @code{foo} is accessible by @code{!foo:n}. -@item su -@findex su -@itemx sudo -@findex sudo -@code{su} and @code{sudo} work as expected: they apply the following -commands (@code{su}), or the command being an argument (@code{sudo}) -under the permissions of somebody else. - -This does not work only on -the local host, but even on a remote one, when -@code{default-directory} is a remote file name. The necessary -proxy configuration of Tramp is performed -@ifinfo -automatically, @ref{Multi-hops, , , tramp}. -@end ifinfo -@ifnotinfo -automatically. -@end ifnotinfo -Example: +The history ring is loaded from a file at the start of every session, +and written back to the file at the end of every session. The file path +is specified in @var{eshell-history-file-name}. Unlike other shells, +such as Bash, Eshell can not be configured to keep a history ring of a +different size than that of the history file. + +Since the default buffer navigation and searching key-bindings are +still present in the Eshell buffer, the commands for history +navigation and searching are bound to different keys: + +@table @kbd +@item M-r +@itemx M-s +History I-search. + +@item M-p +@itemx M-n +Previous and next history line. If there is anything on the input +line when you run these commands, they will instead jump to the +precious or next line that begins with that string. +@end table + +@node Completion +@section Completion +Eshell uses the pcomplete package for programmable completion, similar +to that of other command shells. Argument completion differs depending +on the preceding command: for example, possible completions for +@command{rmdir} are only directories, while @command{rm} completions can +be directories @emph{and} files. Eshell provides predefined completions +for the built-in functions and some common external commands, and you +can define your own for any command. + +Eshell completion also works for lisp forms and glob patterns. If the +point is on a lisp form, then @key{TAB} will behave similarly to completion +in @code{elisp-mode} and @code{lisp-interaction-mode}. For glob +patterns, If there are few enough possible completions of the patterns, +they will be cycled when @key{TAB} is pressed, otherwise it will be removed +from the input line and the possible completions will be listed. + +If you want to see the entire list of possible completions when it's +below the cycling threshold, press @kbd{M-?}. + +@subsection pcomplete +Pcomplete, short for programmable completion, is the completion +library originally written for Eshell, but usable for command +completion@footnote{Command completion as opposed to code completion, +which is a beyond the scope of pcomplete.} in other modes. + +Completions are defined as functions (with @code{defun}) named +@code{pcomplete/COMMAND}, where @code{COMMAND} is the name of the +command for which this function provides completions; you can also name +the function @code{pcomplete/MAJOR-MODE/COMMAND} to define completions +for a specific major mode. + +@node for loop +@section @code{for} loop +Because Eshell commands can not (easily) be combined with lisp forms, +Eshell provides a command-oriented @command{for}-loop for convenience. +The syntax is as follows: @example -~ $ cd /ssh:otherhost:/etc -/ssh:user@@otherhost:/etc $ sudo find-file shadow +@code{for VAR in TOKENS @{ command invocation(s) @}} @end example -@end table - - -@node Arguments -@chapter Arguments +where @samp{TOKENS} is a space-separated sequence of values of +@var{VAR} for each iteration. This can even be the output of a +command if @samp{TOKENS} is replaced with @samp{@{ command invocation @}}. + +@node Scripts +@section Scripts +@cmindex source +@fnindex eshell-source-file +You can run Eshell scripts much like scripts for other shells; the main +difference is that since Eshell is not a system command, you have to run +it from within Emacs. An Eshell script is simply a file containing a +sequence of commands, as with almost any other shell script. Scripts +are invoked from Eshell with @command{source}, or from anywhere in Emacs +with @code{eshell-source-file}. + +@cmindex . +If you wish to load a script into your @emph{current} environment, +rather than in a subshell, use the @code{.} command. + +@node Expansion +@chapter Expansion +Expansion in a command shell is somewhat like macro expansion in macro +parsers (such as @command{cpp} and @command{m4}), but in a command +shell, they are less often used for constants, and usually for using +variables and string manipulation.@footnote{Eshell has no +string-manipulation expansions because the Elisp library already +provides many functions for this.} For example, @code{$var} on a line +expands to the value of the variable @code{var} when the line is +executed. Expansions are usually passed as arguments, but may also be +used as commands.@footnote{e.g. Entering just @samp{$var} at the prompt +is equivalent to entering the value of @code{var} at the prompt.} @menu -* The Parser:: -* Variables:: -* Substitution:: +* Dollars Expansion:: * Globbing:: -* Predicates:: @end menu -@node The Parser -@section The Parser - -@node Variables -@section Variables - -@node Substitution -@section Substitution +@node Dollars Expansion +@section Dollars Expansion +Eshell has different @code{$} expansion syntax from other shells. There +are some similarities, but don't let these lull you into a false sense +of familiarity. + +@table @code + +@item $var +Expands to the value bound to @code{var}. This is the main way to use +variables in command invocations. + +@item $#var +Expands to the length of the value bound to @code{var}. Raises an error +if the value is not a sequence (@pxref{Sequences Arrays and Vectors, Sequences, , elisp}). + +@item $(lisp) +Expands to the result of evaluating the S-expression @code{(lisp)}. On +its own, this is identical to just @code{(lisp)}, but with the @code{$}, +it can be used in a string, such as @samp{/some/path/$(lisp).txt}. + +@item $@{command@} +Returns the output of @command{command}, which can be any valid Eshell +command invocation, and may even contain expansions. + +@item $var[i] +Expands to the @code{i}th element of the value bound to @code{var}. If +the value is a string, it will be split at whitespace to make it a list. +Again, raises an error if the value is not a sequence. + +@item $var[: i] +As above, but now splitting occurs at the colon character. + +@item $var[: i j] +As above, but instead of returning just a string, it now returns a list +of two strings. If the result is being interpolated into a larger +string, this list will be flattened into one big string, with each +element separated by a space. + +@item $var["\\\\" i] +Separate on backslash characters. Actually, the first argument -- if it +doesn't have the form of a number, or a plain variable name -- can be +any regular expression. So to split on numbers, use @samp{$var["[0-9]+" 10 20]}. + +@item $var[hello] +Calls @code{assoc} on @code{var} with @code{"hello"}, expecting it to be +an alist (@pxref{Association List Type, Association Lists, , elisp}). + +@item $#var[hello] +Returns the length of the cdr of the element of @code{var} who car is equal +to @code{"hello"}. + +@end table @node Globbing @section Globbing - -@node Predicates -@section Predicates - +Eshell's globbing syntax is very similar to that of Zsh. Users coming +from Bash can still use Bash-style globbing, as there are no +incompatibilities. Most globbing is pattern-based expansion, but there +is also predicate-based expansion. See @ref{Filename Generation, , , zsh} +for full syntax. To customize the syntax and behaviour of globbing in +Eshell see the Customize@footnote{@xref{Customization Settings, Customize, , elisp}.} +groups ``eshell-glob'' and ``eshell-pred''. @node Input/Output @chapter Input/Output - -@node Process control -@chapter Process control - +Since Eshell does not communicate with a terminal like most command +shells, IO is a little different. If you try to run programs from +within Eshell that are not line-oriented, such as programs that use +ncurses, you will just get garbage output, since the Eshell buffer is +not a terminal emulator. Eshell solves this problem by running +specified commands in Emacs's terminal emulator; to let Eshell know +which commands need to be run in a terminal, add them to the list +@var{eshell-visual-commands}. + +Redirection is mostly the same in Eshell as it is in other command +shells. The output redirection operators @code{>} and @code{>>} as well +as pipes are supported, but there is not yet any support for input +redirection. Output can also be redirected to Elisp functions, using +virtual devices. + +@var{eshell-virtual-targets} is a list of mappings of virtual device +names to functions. Eshell comes with two virtual devices: +@file{/dev/kill}, which sends the text to the kill ring, and +@file{/dev/clip}, which sends text to the clipboard. + +You can, of course, define your own virtual targets. They are defined +by adding a list of the form @code{("/dev/name" function mode)} to +@var{eshell-virtual-targets}. The first element is the device name; +@code{function} may be either a lambda or a function name. If +@code{mode} is nil, then the function is the output function; if it is +non-nil, then the function is passed the redirection mode as a +symbol--@code{overwrite}, @code{append}, or @code{insert}--and the +function is expected to return the output function. + +The output function is called once on each line of output until +@code{nil} is passed, indicating end of output. @node Extension modules @chapter Extension modules +Eshell provides a facility for defining extension modules so that they +can be disabled and enabled without having to unload and reload them, +and to provide a common parent Customize group for the +modules.@footnote{ERC provides a similar module facility.} An Eshell +module is defined the same as any other library but one requirement: the +module must define a Customize@footnote{@xref{Customization Settings, Customize, , elisp}.} +group using @code{eshell-defgroup} (in place of @code{defgroup}) with +@code{eshell-module} as the parent group.@footnote{If the module has +no user-customizable options, then there is no need to define it as an +Eshell module.} You also need to load the following as shown: + +@example +(eval-when-compile + (require 'cl) + (require 'esh-mode) + (require 'eshell)) + +(require 'esh-util) +@end example @menu * Writing a module:: @@ -491,7 +760,6 @@ * Key rebinding:: * Smart scrolling:: * Terminal emulation:: -* Built-in UNIX commands:: @end menu @node Writing a module @@ -512,13 +780,6 @@ @node Terminal emulation @section Terminal emulation -@node Built-in UNIX commands -@section Built-in UNIX commands - - -@node Extras and Goodies -@chapter Extras and Goodies - @node Bugs and ideas @chapter Bugs and ideas @cindex reporting bugs and ideas @@ -527,6 +788,8 @@ @cindex email to the author @cindex FAQ @cindex problems, list of common +@cindex known bugs +@cindex bugs, known If you find a bug or misfeature, don't hesitate to let me know! Send email to @email{johnw@@gnu.org}. Feature requests should also be sent @@ -537,16 +800,7 @@ extensions to this package, I would like to hear from you. I hope you find this package useful! -@menu -* Known problems:: -@end menu - -@node Known problems -@section Known problems -@cindex known bugs -@cindex bugs, known - -Below is complete list of known problems with Eshell version 2.4.2, +Below is a complete list of known problems with Eshell version 2.4.2, which is the version included with Emacs 22. @table @asis @@ -554,7 +808,7 @@ @item Differentiate between aliases and functions -Allow for a bash-compatible syntax, such as: +Allow for a Bash-compatible syntax, such as: @example alias arg=blah @@ -838,7 +1092,7 @@ It would provide syntax, abbrev, highlighting and indenting support like @code{emacs-lisp-mode} and @code{shell-mode}. -@item In the history mechanism, finish the @command{bash}-style support +@item In the history mechanism, finish the Bash-style support This means @samp{!n}, @samp{!#}, @samp{!:%}, and @samp{!:1-} as separate from @samp{!:1*}. @@ -1008,6 +1262,11 @@ @printindex fn +@node Command Index +@unnumbered Command Index + +@printindex cm + @node Key Index @unnumbered Key Index === modified file 'etc/TODO' --- etc/TODO 2013-01-02 16:13:04 +0000 +++ etc/TODO 2013-02-08 17:23:24 +0000 @@ -269,18 +269,11 @@ * Other features we would like: -** Make longlines-mode wrap lines based on screen position instead - of character position, so that variable-width fonts can be handled - properly. - ** Allow frames(terminals) created by emacsclient to inherit their environment from the emacsclient process. ** Remove the default toggling behavior of minor modes when called from elisp rather than interactively. This a trivial one-liner in easy-mode.el. -** Create a category of errors called `user-error' for errors which are -typically due to pilot errors and should thus be in debug-ignored-errors. - ** Give Tar mode all the features of Archive mode. ** Create a category of errors called `process-error' === modified file 'src/xdisp.c' --- src/xdisp.c 2013-02-04 15:39:55 +0000 +++ src/xdisp.c 2013-02-08 17:23:24 +0000 @@ -21577,11 +21577,15 @@ } -/* Count up to COUNT lines starting from START_BYTE. - But don't go beyond LIMIT_BYTE. - Return the number of lines thus found (always nonnegative). +/* Count up to COUNT lines starting from START_BYTE. COUNT negative + means count lines back from START_BYTE. But don't go beyond + LIMIT_BYTE. Return the number of lines thus found (always + nonnegative). - Set *BYTE_POS_PTR to 1 if we found COUNT lines, 0 if we hit LIMIT. */ + Set *BYTE_POS_PTR to the byte position where we stopped. This is + either the position COUNT lines after/before START_BYTE, if we + found COUNT lines, or LIMIT_BYTE if we hit the limit before finding + COUNT lines. */ static ptrdiff_t display_count_lines (ptrdiff_t start_byte, ------------------------------------------------------------ revno: 111698 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13605 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2013-02-08 11:17:18 -0500 message: * lisp/emacs-lisp/byte-run.el (eval-when-compile, eval-and-compile): Eval body right away, now that we do eager macroexpansion. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-08 15:53:49 +0000 +++ lisp/ChangeLog 2013-02-08 16:17:18 +0000 @@ -1,5 +1,8 @@ 2013-02-08 Stefan Monnier + * emacs-lisp/byte-run.el (eval-when-compile, eval-and-compile): + Eval body right away, now that we do eager macroexpansion (bug#13605). + * simple.el (end-of-buffer): Don't touch unrelated windows (bug#13466). (fundamental-mode): Use run-mode-hooks. === modified file 'lisp/emacs-lisp/byte-run.el' --- lisp/emacs-lisp/byte-run.el 2013-01-03 02:37:57 +0000 +++ lisp/emacs-lisp/byte-run.el 2013-02-08 16:17:18 +0000 @@ -392,15 +392,15 @@ Thus, the result of the body appears to the compiler as a quoted constant. In interpreted code, this is entirely equivalent to `progn'." (declare (debug t) (indent 0)) - ;; Not necessary because we have it in b-c-initial-macro-environment - ;; (list 'quote (eval (cons 'progn body))) - (cons 'progn body)) + (list 'quote (eval (cons 'progn body) lexical-binding))) (defmacro eval-and-compile (&rest body) "Like `progn', but evaluates the body at compile time and at load time." (declare (debug t) (indent 0)) - ;; Remember, it's magic. - (cons 'progn body)) + ;; When the byte-compiler expands code, this macro is not used, so we're + ;; either about to run `body' (plain interpretation) or we're doing eager + ;; macroexpansion. + (list 'quote (eval (cons 'progn body) lexical-binding))) (put 'with-no-warnings 'lisp-indent-function 0) (defun with-no-warnings (&rest body) ------------------------------------------------------------ revno: 111697 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13466 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2013-02-08 10:53:49 -0500 message: * lisp/simple.el (end-of-buffer): Don't touch unrelated windows. (fundamental-mode): Use run-mode-hooks. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-08 15:47:07 +0000 +++ lisp/ChangeLog 2013-02-08 15:53:49 +0000 @@ -1,5 +1,8 @@ 2013-02-08 Stefan Monnier + * simple.el (end-of-buffer): Don't touch unrelated windows (bug#13466). + (fundamental-mode): Use run-mode-hooks. + * eshell/esh-proc.el (eshell/kill): Fix last change. * eshell/em-ls.el (eshell-ls-dir): Fix use of CL in last change. === modified file 'lisp/simple.el' --- lisp/simple.el 2013-02-02 06:04:06 +0000 +++ lisp/simple.el 2013-02-08 15:53:49 +0000 @@ -349,8 +349,7 @@ Other major modes are defined by comparison with this one." (interactive) (kill-all-local-variables) - (unless delay-mode-hooks - (run-hooks 'after-change-major-mode-hook))) + (run-mode-hooks)) ;; Special major modes to view specially formatted data rather than files. @@ -868,7 +867,8 @@ ;; If we went to a place in the middle of the buffer, ;; adjust it to the beginning of a line. (cond ((and arg (not (consp arg))) (forward-line 1)) - ((> (point) (window-end nil t)) + ((and (eq (current-buffer) (window-buffer)) + (> (point) (window-end nil t))) ;; If the end of the buffer is not already on the screen, ;; then scroll specially to put it near, but not at, the bottom. (overlay-recenter (point)) ------------------------------------------------------------ revno: 111696 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2013-02-08 10:48:36 -0500 message: * leim/quail/latin-ltx.el: Add greek superscripts. diff: === modified file 'leim/ChangeLog' --- leim/ChangeLog 2013-01-02 16:13:04 +0000 +++ leim/ChangeLog 2013-02-08 15:48:36 +0000 @@ -1,3 +1,7 @@ +2013-02-08 Stefan Monnier + + * quail/latin-ltx.el: Add greek superscripts. + 2012-12-04 Stefan Monnier * quail/latin-ltx.el: Avoid deprecated chars for \langle and \rangle. === modified file 'leim/quail/latin-ltx.el' --- leim/quail/latin-ltx.el 2013-01-02 16:13:04 +0000 +++ leim/quail/latin-ltx.el 2013-02-08 15:48:36 +0000 @@ -248,14 +248,18 @@ (string (if (match-end 2) ?^ ?_) basechar)))) "\\(.*\\)SU\\(?:B\\|\\(PER\\)\\)SCRIPT \\(.*\\)") - ("^\\gamma" ?ˠ) - ((lambda (name char) - (let* ((base (format "LATIN %s LETTER %s" - (match-string 1 name) (match-string 2 name))) - (basechar (cdr (assoc base (ucs-names))))) - (when (latin-ltx--ascii-p basechar) - (string ?^ basechar)))) + (let* ((basename (match-string 2 name)) + (lbase (format "LATIN %s LETTER %s" + (match-string 1 name) basename)) + (gbase (format "GREEK %s LETTER %s" + (match-string 1 name) basename)) + tmp) + (cond + ((assoc gbase (ucs-names)) (concat "^\\" (downcase basename))) + ((latin-ltx--ascii-p (setq tmp (cdr (assoc lbase (ucs-names))))) + (string ?^ tmp)) + (t (message "Unknown modifier letter %s" basename))))) "MODIFIER LETTER \\(SMALL\\|CAPITAL\\) \\(.*\\)") ;; ((lambda (name char) (format "^%s" (downcase (match-string 1 name)))) ------------------------------------------------------------ revno: 111695 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2013-02-08 10:47:07 -0500 message: * lisp/eshell/esh-proc.el (eshell/kill): Fix last change. * lisp/eshell/em-ls.el (eshell-ls-dir): Fix use of CL in last change. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-08 15:07:03 +0000 +++ lisp/ChangeLog 2013-02-08 15:47:07 +0000 @@ -1,3 +1,8 @@ +2013-02-08 Stefan Monnier + + * eshell/esh-proc.el (eshell/kill): Fix last change. + * eshell/em-ls.el (eshell-ls-dir): Fix use of CL in last change. + 2013-02-08 Aidan Gauland * eshell/esh-proc.el (eshell/kill): Rewrite. === modified file 'lisp/eshell/em-ls.el' --- lisp/eshell/em-ls.el 2013-02-08 15:07:03 +0000 +++ lisp/eshell/em-ls.el 2013-02-08 15:47:07 +0000 @@ -26,9 +26,8 @@ ;;; Code: -(eval-when-compile - (require 'cl-lib) - (require 'eshell)) +(eval-when-compile (require 'eshell)) +(require 'cl-lib) (require 'esh-util) (require 'esh-opt) @@ -564,11 +563,9 @@ (when (and show-almost-all (not show-all)) (setq entries - (remove-if + (cl-remove-if (lambda (entry) - (let ((filename (caar entry))) - (or (string= filename ".") - (string= filename "..")))) + (member (caar entry) '("." ".."))) entries))) (when (and (not show-all) eshell-ls-exclude-regexp) === modified file 'lisp/eshell/esh-proc.el' --- lisp/eshell/esh-proc.el 2013-02-08 15:07:03 +0000 +++ lisp/eshell/esh-proc.el 2013-02-08 15:47:07 +0000 @@ -170,33 +170,32 @@ Accepts PIDs and process objects." ;; If the first argument starts with a dash, treat it as the signal ;; specifier. -(let ((signum 'SIGINT)) - (let ((arg (car args)) - (case-fold-search nil)) - (when (stringp arg) - (cond - ((string-match "^-[[:digit:]]+$" arg) - (setq signum (abs (string-to-number arg))) - ((or (string-match "^-[[:upper:]]+$" arg) - (string-match "^-[[:lower:]]+$" arg)) - (setq signum (abs (string-to-number arg)))))) - (setq args (cdr args)))) - (while args - (let ((arg (if (eshell-processp (car args)) - (process-id (car args)) - (car args)))) - (when arg - (cond - ((null arg) - (error "kill: null pid. Process may actually be a network connection.")) - ((not (numberp arg)) - (error "kill: invalid argument type: %s" (type-of arg))) - ((and (numberp arg) - (<= arg 0)) - (error "kill: bad pid: %d" arg)) - (t - (signal-process arg signum))))) - (setq args (cdr args)))) + (let ((signum 'SIGINT)) + (let ((arg (car args)) + (case-fold-search nil)) + (when (stringp arg) + (cond + ((string-match "\\`-[[:digit:]]+\\'" arg) + (setq signum (abs (string-to-number arg)))) + ((string-match "\\`-\\([[:upper:]]+\\|[[:lower:]]+\\)\\'" arg) + (setq signum (abs (string-to-number arg))))) + (setq args (cdr args)))) + (while args + (let ((arg (if (eshell-processp (car args)) + (process-id (car args)) + (car args)))) + (when arg + (cond + ((null arg) + (error "kill: null pid. Process may actually be a network connection.")) + ((not (numberp arg)) + (error "kill: invalid argument type: %s" (type-of arg))) + ((and (numberp arg) + (<= arg 0)) + (error "kill: bad pid: %d" arg)) + (t + (signal-process arg signum))))) + (setq args (cdr args)))) nil) (defun eshell-read-process-name (prompt) ------------------------------------------------------------ revno: 111694 author: Aidan Gauland committer: Stefan Monnier branch nick: trunk timestamp: Fri 2013-02-08 10:07:03 -0500 message: * lisp/eshell: Minor fixes. * lisp/eshell/em-ls.el (show-almost-all): Declare. (eshell-do-ls): Add support for -A argument. * lisp/eshell/esh-proc.el (eshell/kill): Rewrite. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-08 07:53:55 +0000 +++ lisp/ChangeLog 2013-02-08 15:07:03 +0000 @@ -1,3 +1,10 @@ +2013-02-08 Aidan Gauland + + * eshell/esh-proc.el (eshell/kill): Rewrite. + + * eshell/em-ls.el (show-almost-all): Declare. + (eshell-do-ls): Add support for -A argument. + 2013-02-08 Jambunathan K * icomplete.el (icomplete-forward-completions) === modified file 'lisp/eshell/em-ls.el' --- lisp/eshell/em-ls.el 2013-01-01 09:11:05 +0000 +++ lisp/eshell/em-ls.el 2013-02-08 15:07:03 +0000 @@ -328,6 +328,7 @@ (defvar numeric-uid-gid) (defvar reverse-list) (defvar show-all) +(defvar show-almost-all) (defvar show-recursive) (defvar show-size) (defvar sort-method) @@ -337,13 +338,15 @@ (defun eshell-do-ls (&rest args) "Implementation of \"ls\" in Lisp, passing ARGS." (funcall flush-func -1) - ;; process the command arguments, and begin listing files + ;; Process the command arguments, and begin listing files. (eshell-eval-using-options "ls" (if eshell-ls-initial-args (list eshell-ls-initial-args args) args) `((?a "all" nil show-all - "show all files in directory") + "do not ignore entries starting with .") + (?A "almost-all" nil show-almost-all + "do not list implied . and ..") (?c nil by-ctime sort-method "sort by last status change time") (?d "directory" nil dir-literal @@ -558,7 +561,17 @@ ;; later when we are going to ;; display user and group names. (if numeric-uid-gid 'integer 'string)))) - (when (and (not show-all) eshell-ls-exclude-regexp) + (when (and show-almost-all + (not show-all)) + (setq entries + (remove-if + (lambda (entry) + (let ((filename (caar entry))) + (or (string= filename ".") + (string= filename "..")))) + entries))) + (when (and (not show-all) + eshell-ls-exclude-regexp) (while (and entries (string-match eshell-ls-exclude-regexp (caar entries))) (setq entries (cdr entries))) === modified file 'lisp/eshell/esh-proc.el' --- lisp/eshell/esh-proc.el 2013-01-01 09:11:05 +0000 +++ lisp/eshell/esh-proc.el 2013-02-08 15:07:03 +0000 @@ -165,43 +165,39 @@ (list-processes))) (defun eshell/kill (&rest args) - "Kill processes, buffers, symbol or files." - (let ((ptr args) - (signum 'SIGINT)) - (while ptr - (if (or (eshell-processp (car ptr)) - (and (stringp (car ptr)) - (string-match "^[A-Za-z/][A-Za-z0-9<>/]+$" - (car ptr)))) - ;; What about when $lisp-variable is possible here? - ;; It could very well name a process. - (setcar ptr (get-process (car ptr)))) - (setq ptr (cdr ptr))) - (while args - (let ((id (if (eshell-processp (car args)) - (process-id (car args)) - (car args)))) - (when id - (cond - ((null id) - (error "kill: bad signal spec")) - ((and (numberp id) (= id 0)) - (error "kill: bad signal spec `%d'" id)) - ((and (stringp id) - (string-match "^-?[0-9]+$" id)) - (setq signum (abs (string-to-number id)))) - ((stringp id) - (let (case-fold-search) - (if (string-match "^-\\([A-Z]+[12]?\\)$" id) - (setq signum - (intern (concat "SIG" (match-string 1 id)))) - (error "kill: bad signal spec `%s'" id)))) - ((< id 0) - (setq signum (abs id))) - (t - (signal-process id signum))))) - (setq args (cdr args))) - nil)) + "Kill processes. +Usage: kill [-] | ... +Accepts PIDs and process objects." + ;; If the first argument starts with a dash, treat it as the signal + ;; specifier. +(let ((signum 'SIGINT)) + (let ((arg (car args)) + (case-fold-search nil)) + (when (stringp arg) + (cond + ((string-match "^-[[:digit:]]+$" arg) + (setq signum (abs (string-to-number arg))) + ((or (string-match "^-[[:upper:]]+$" arg) + (string-match "^-[[:lower:]]+$" arg)) + (setq signum (abs (string-to-number arg)))))) + (setq args (cdr args)))) + (while args + (let ((arg (if (eshell-processp (car args)) + (process-id (car args)) + (car args)))) + (when arg + (cond + ((null arg) + (error "kill: null pid. Process may actually be a network connection.")) + ((not (numberp arg)) + (error "kill: invalid argument type: %s" (type-of arg))) + ((and (numberp arg) + (<= arg 0)) + (error "kill: bad pid: %d" arg)) + (t + (signal-process arg signum))))) + (setq args (cdr args)))) + nil) (defun eshell-read-process-name (prompt) "Read the name of a process from the minibuffer, using completion. ------------------------------------------------------------ revno: 111693 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2013-02-08 18:44:53 +0400 message: * search.c (scan_buffer): Calculate end byte position just once. (scan_newline): Do not recalculate start_byte. (search_command): Use eassert. * syntax.c (struct lisp_parse_state): New member location_byte. (scan_sexps_forward): Record from_byte and avoid redundant character to byte position calculation ... (Fparse_partial_sexp): ... here. Break too long line. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-02-08 05:28:52 +0000 +++ src/ChangeLog 2013-02-08 14:44:53 +0000 @@ -1,5 +1,15 @@ 2013-02-08 Dmitry Antipov + * search.c (scan_buffer): Calculate end byte position just once. + (scan_newline): Do not recalculate start_byte. + (search_command): Use eassert. + * syntax.c (struct lisp_parse_state): New member location_byte. + (scan_sexps_forward): Record from_byte and avoid redundant + character to byte position calculation ... + (Fparse_partial_sexp): ... here. Break too long line. + +2013-02-08 Dmitry Antipov + * lisp.h (make_uninit_vector): New function. * alloc.c (Fvector, Fmake_byte_code): * ccl.c (Fregister_ccl_program): === modified file 'src/search.c' --- src/search.c 2013-01-02 16:13:04 +0000 +++ src/search.c 2013-02-08 14:44:53 +0000 @@ -644,18 +644,23 @@ ptrdiff_t count, ptrdiff_t *shortage, bool allow_quit) { struct region_cache *newline_cache; + ptrdiff_t end_byte = -1; int direction; if (count > 0) { direction = 1; - if (! end) end = ZV; + if (!end) + end = ZV, end_byte = ZV_BYTE; } else { direction = -1; - if (! end) end = BEGV; + if (!end) + end = BEGV, end_byte = BEGV_BYTE; } + if (end_byte == -1) + end_byte = CHAR_TO_BYTE (end); newline_cache_on_off (current_buffer); newline_cache = current_buffer->newline_cache; @@ -673,7 +678,7 @@ the position of the last character before the next such obstacle --- the last character the dumb search loop should examine. */ - ptrdiff_t ceiling_byte = CHAR_TO_BYTE (end) - 1; + ptrdiff_t ceiling_byte = end_byte - 1; ptrdiff_t start_byte; ptrdiff_t tem; @@ -750,7 +755,7 @@ while (start > end) { /* The last character to check before the next obstacle. */ - ptrdiff_t ceiling_byte = CHAR_TO_BYTE (end); + ptrdiff_t ceiling_byte = end_byte; ptrdiff_t start_byte; ptrdiff_t tem; @@ -861,8 +866,6 @@ if (allow_quit) immediate_quit++; - start_byte = CHAR_TO_BYTE (start); - if (count > 0) { while (start_byte < limit_byte) @@ -1016,8 +1019,7 @@ if (!EQ (noerror, Qt)) { - if (lim < BEGV || lim > ZV) - emacs_abort (); + eassert (BEGV <= lim && lim <= ZV); SET_PT_BOTH (lim, lim_byte); return Qnil; #if 0 /* This would be clean, but maybe programs depend on @@ -1029,9 +1031,7 @@ return Qnil; } - if (np < BEGV || np > ZV) - emacs_abort (); - + eassert (BEGV <= np && np <= ZV); SET_PT (np); return make_number (np); === modified file 'src/syntax.c' --- src/syntax.c 2013-02-08 05:28:52 +0000 +++ src/syntax.c 2013-02-08 14:44:53 +0000 @@ -121,6 +121,7 @@ /* Char number of start of containing expression */ ptrdiff_t prevlevelstart; ptrdiff_t location; /* Char number at which parsing stopped. */ + ptrdiff_t location_byte; /* Corresponding byte position. */ ptrdiff_t comstr_start; /* Position of last comment/string starter. */ Lisp_Object levelstarts; /* Char numbers of starts-of-expression of levels (starting from outermost). */ @@ -3288,6 +3289,7 @@ state.prevlevelstart = (curlevel == levelstart) ? -1 : (curlevel - 1)->last; state.location = from; + state.location_byte = from_byte; state.levelstarts = Qnil; while (curlevel > levelstart) state.levelstarts = Fcons (make_number ((--curlevel)->last), @@ -3327,7 +3329,8 @@ 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. */) - (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth, Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop) + (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth, + Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop) { struct lisp_parse_state state; EMACS_INT target; @@ -3347,7 +3350,7 @@ (NILP (commentstop) ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1))); - SET_PT (state.location); + SET_PT_BOTH (state.location, state.location_byte); return Fcons (make_number (state.depth), Fcons (state.prevlevelstart < 0 ------------------------------------------------------------ revno: 111692 fixes bug: http://debbugs.gnu.org/13602 author: Jambunathan K committer: Juri Linkov branch nick: trunk timestamp: Fri 2013-02-08 09:53:55 +0200 message: * lisp/icomplete.el (icomplete-forward-completions) (icomplete-backward-completions): Handle corner case. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-07 08:50:04 +0000 +++ lisp/ChangeLog 2013-02-08 07:53:55 +0000 @@ -1,3 +1,8 @@ +2013-02-08 Jambunathan K + + * icomplete.el (icomplete-forward-completions) + (icomplete-backward-completions): Handle corner case (bug#13602). + 2013-02-07 Michael Albinus * vc/vc-hooks.el (vc-find-file-hook): `buffer-file-truename' can === modified file 'lisp/icomplete.el' --- lisp/icomplete.el 2013-01-04 08:20:49 +0000 +++ lisp/icomplete.el 2013-02-08 07:53:55 +0000 @@ -167,8 +167,9 @@ (interactive) (let* ((comps (completion-all-sorted-completions)) (last (last comps))) - (setcdr last (cons (car comps) (cdr last))) - (completion--cache-all-sorted-completions (cdr comps)))) + (when comps + (setcdr last (cons (car comps) (cdr last))) + (completion--cache-all-sorted-completions (cdr comps))))) (defun icomplete-backward-completions () "Step backward completions by one entry. @@ -178,7 +179,7 @@ (let* ((comps (completion-all-sorted-completions)) (last-but-one (last comps 2)) (last (cdr last-but-one))) - (when last + (when (consp last) ; At least two elements in comps (setcdr last-but-one (cdr last)) (push (car last) comps) (completion--cache-all-sorted-completions comps)))) ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.