commit 43bc45ba1697b60c4589cb0c8e30cf1618275582 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Sun Apr 9 00:53:27 2017 -0700 Merge from gnulib (Bug#26398) This incorporates: 2017-04-08 getopt: prefer - to _ in new file names 2017-04-08 getopt: port recent getopt changes to macOS * .gitignore: Add lib/getopt-cdefs.h. * lib/getopt-cdefs.in.h: Rename from lib/getopt_cdefs.in.h. * lib/getopt-core.h: Rename from lib/getopt_core.h. * lib/getopt-ext.h: Rename from lib/getopt_ext.h. * lib/getopt-pfx-core.h: Rename from lib/getopt_pfx_core.h. * lib/getopt-pfx-ext.h: Rename from lib/getopt_pfx_ext.h. * lib/getopt.in.h, lib/unistd.in.h, m4/getopt.m4: Copy from Gnulib. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. diff --git a/.gitignore b/.gitignore index aa9e1ff709..fa9353453c 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,7 @@ lib/errno.h lib/execinfo.h lib/fcntl.h lib/getopt.h +lib/getopt-cdefs.h lib/inttypes.h lib/libgnu.a lib/limits.h diff --git a/lib/getopt_cdefs.in.h b/lib/getopt-cdefs.in.h similarity index 88% rename from lib/getopt_cdefs.in.h rename to lib/getopt-cdefs.in.h index 18f9fb4f98..c71a4f11f6 100644 --- a/lib/getopt_cdefs.in.h +++ b/lib/getopt-cdefs.in.h @@ -25,7 +25,7 @@ unistd.h instead. It does not have a protective #error, because the guard macro for getopt.h in gnulib is not fixed. */ -/* getopt_core.h and getopt_ext.h are shared with GNU libc, and expect +/* getopt-core.h and getopt-ext.h are shared with GNU libc, and expect a number of the internal macros supplied to GNU libc's headers by sys/cdefs.h. Provide fallback definitions for all of them. */ #if @HAVE_SYS_CDEFS_H@ @@ -64,12 +64,4 @@ # endif #endif -#ifndef __nonnull -# if __GNUC_PREREQ (3,3) -# define __nonnull(params) __attribute__ ((__nonnull__ params)) -# else -# define __nonnull(params) -# endif -#endif - -#endif /* getopt_cdefs.h */ +#endif /* _GETOPT_CDEFS_H */ diff --git a/lib/getopt_core.h b/lib/getopt-core.h similarity index 98% rename from lib/getopt_core.h rename to lib/getopt-core.h index d6ef8a6b78..d315891aef 100644 --- a/lib/getopt_core.h +++ b/lib/getopt-core.h @@ -89,8 +89,8 @@ extern int optopt; writable. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) - __THROW __nonnull ((2, 3)); + __THROW _GL_ARG_NONNULL ((2, 3)); __END_DECLS -#endif /* getopt_core.h */ +#endif /* _GETOPT_CORE_H */ diff --git a/lib/getopt_ext.h b/lib/getopt-ext.h similarity index 96% rename from lib/getopt_ext.h rename to lib/getopt-ext.h index 79b7a670d5..e4da22f54f 100644 --- a/lib/getopt_ext.h +++ b/lib/getopt-ext.h @@ -66,12 +66,12 @@ struct option extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) - __THROW __nonnull ((2, 3)); + __THROW _GL_ARG_NONNULL ((2, 3)); extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) - __THROW __nonnull ((2, 3)); + __THROW _GL_ARG_NONNULL ((2, 3)); __END_DECLS -#endif /* getopt_ext.h */ +#endif /* _GETOPT_EXT_H */ diff --git a/lib/getopt_pfx_core.h b/lib/getopt-pfx-core.h similarity index 94% rename from lib/getopt_pfx_core.h rename to lib/getopt-pfx-core.h index d585a08ce9..4dc427dc3e 100644 --- a/lib/getopt_pfx_core.h +++ b/lib/getopt-pfx-core.h @@ -27,7 +27,7 @@ /* Standalone applications should #define __GETOPT_PREFIX to an identifier that prefixes the external functions and variables - defined in getopt_core.h and getopt_ext.h. Systematically + defined in getopt-core.h and getopt-ext.h. Systematically rename identifiers so that they do not collide with the system functions and variables. Renaming avoids problems with some compilers and linkers. */ @@ -49,6 +49,6 @@ # define optopt __GETOPT_ID (optopt) #endif -#include +#include -#endif /* getopt_pfx_core.h */ +#endif /* _GETOPT_PFX_CORE_H */ diff --git a/lib/getopt_pfx_ext.h b/lib/getopt-pfx-ext.h similarity index 95% rename from lib/getopt_pfx_ext.h rename to lib/getopt-pfx-ext.h index 3da156a09b..bc6052a1dd 100644 --- a/lib/getopt_pfx_ext.h +++ b/lib/getopt-pfx-ext.h @@ -27,7 +27,7 @@ /* Standalone applications should #define __GETOPT_PREFIX to an identifier that prefixes the external functions and variables - defined in getopt_core.h and getopt_ext.h. Systematically + defined in getopt-core.h and getopt-ext.h. Systematically rename identifiers so that they do not collide with the system functions and variables. Renaming avoids problems with some compilers and linkers. */ @@ -59,6 +59,6 @@ # endif #endif -#include +#include -#endif /* getopt_pfx_ext.h */ +#endif /* _GETOPT_PFX_EXT_H */ diff --git a/lib/getopt.in.h b/lib/getopt.in.h index 91e086c020..4ce1eb485a 100644 --- a/lib/getopt.in.h +++ b/lib/getopt.in.h @@ -38,7 +38,7 @@ /* Standalone applications should #define __GETOPT_PREFIX to an identifier that prefixes the external functions and variables - defined in getopt_core.h and getopt_ext.h. When this happens, + defined in getopt-core.h and getopt-ext.h. When this happens, include the headers that might declare getopt so that they will not cause confusion if included after this file (if the system had , we have already included it). */ @@ -52,8 +52,10 @@ # endif #endif -#include -#include -#include +/* The definition of _GL_ARG_NONNULL is copied here. */ + +#include +#include +#include #endif /* _@GUARD_PREFIX@_GETOPT_H */ diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 38adf2a9f7..08f48c2ca3 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -922,6 +922,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -1527,21 +1528,22 @@ getopt.h: getopt.in.h $(top_builddir)/config.status -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ < $(srcdir)/getopt.in.h; \ } > $@-t && \ mv -f $@-t $@ -getopt_cdefs.h: getopt_cdefs.in.h $(top_builddir)/config.status +getopt-cdefs.h: getopt-cdefs.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \ - < $(srcdir)/getopt_cdefs.in.h; \ + < $(srcdir)/getopt-cdefs.in.h; \ } > $@-t && \ mv -f $@-t $@ -MOSTLYCLEANFILES += getopt.h getopt.h-t getopt_cdefs.h getopt_cdefs.h-t +MOSTLYCLEANFILES += getopt.h getopt.h-t getopt-cdefs.h getopt-cdefs.h-t -EXTRA_DIST += getopt.c getopt.in.h getopt1.c getopt_cdefs.in.h getopt_core.h getopt_ext.h getopt_int.h getopt_pfx_core.h getopt_pfx_ext.h +EXTRA_DIST += getopt-cdefs.in.h getopt-core.h getopt-ext.h getopt-pfx-core.h getopt-pfx-ext.h getopt.c getopt.in.h getopt1.c getopt_int.h EXTRA_libgnu_a_SOURCES += getopt.c getopt1.c diff --git a/lib/unistd.in.h b/lib/unistd.in.h index ed175bf8f2..cb9321e502 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -127,11 +127,18 @@ # include #endif +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + /* Get getopt(), optarg, optind, opterr, optopt. But avoid namespace pollution on glibc systems. */ #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT -# include -# include +# include +# include #endif #ifndef _GL_INLINE_HEADER_BEGIN @@ -142,13 +149,6 @@ _GL_INLINE_HEADER_BEGIN # define _GL_UNISTD_INLINE _GL_INLINE #endif -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ - -/* The definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - - /* Hide some function declarations from . */ #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ diff --git a/m4/getopt.m4 b/m4/getopt.m4 index d90076922b..ac3b38e385 100644 --- a/m4/getopt.m4 +++ b/m4/getopt.m4 @@ -1,4 +1,4 @@ -# getopt.m4 serial 45 +# getopt.m4 serial 46 dnl Copyright (C) 2002-2006, 2008-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -364,7 +364,7 @@ AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], [Define to rpl_ if the getopt replacement functions and variables should be used.]) GETOPT_H=getopt.h - GETOPT_CDEFS_H=getopt_cdefs.h + GETOPT_CDEFS_H=getopt-cdefs.h AC_SUBST([GETOPT_H]) AC_SUBST([GETOPT_CDEFS_H]) ]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 5aea057c5d..bfac944ea0 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -899,15 +899,15 @@ AC_DEFUN([gl_FILE_LIST], [ lib/getdtablesize.c lib/getgroups.c lib/getloadavg.c + lib/getopt-cdefs.in.h + lib/getopt-core.h + lib/getopt-ext.h + lib/getopt-pfx-core.h + lib/getopt-pfx-ext.h lib/getopt.c lib/getopt.in.h lib/getopt1.c - lib/getopt_cdefs.in.h - lib/getopt_core.h - lib/getopt_ext.h lib/getopt_int.h - lib/getopt_pfx_core.h - lib/getopt_pfx_ext.h lib/gettext.h lib/gettime.c lib/gettimeofday.c commit 440bafef7cce6044d4f9d6ca3c3e0856ee9732b7 Author: Ken Raeburn Date: Sun Apr 9 02:13:43 2017 -0400 Write updated loaddefs to a temporary file and rename into place. In a parallel build, byte compilation can be running at the same times as loaddefs.el is being regenerated. However, in a CANNOT_DUMP build, loaddefs.el is read at startup and must always be in a usable state. * lisp/Makefile.in ($(lisp)/loaddefs.el): Write generated output to loaddefs.el.new and then rename it to loaddefs.el. diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 185554ca63..63d593c7e6 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -179,14 +179,18 @@ $(lisp)/finder-inf.el: # Note that we set no-update-autoloads in _generated_ leim files. # If you want to allow autoloads in such files, remove that, # and make this depend on leim. +# +# Write to a temporary file in case we're doing a parallel build and a +# CANNOT_DUMP-mode Emacs needs to read loaddefs at startup. autoloads .PHONY: $(lisp)/loaddefs.el $(lisp)/loaddefs.el: $(LOADDEFS) @echo Directories for loaddefs: ${SUBDIRS_ALMOST} $(AM_V_GEN)$(emacs) -l autoload \ --eval '(setq autoload-ensure-writable t)' \ --eval '(setq autoload-builtin-package-versions t)' \ - --eval '(setq generated-autoload-file (expand-file-name (unmsys--file-name "$@")))' \ + --eval '(setq generated-autoload-file (expand-file-name (unmsys--file-name "$(lisp)/loaddefs.tmp")))' \ -f batch-update-autoloads ${SUBDIRS_ALMOST} + mv -f $(lisp)/loaddefs.tmp $@ # autoloads only runs when loaddefs.el is nonexistent, although it # generates a number of different files. Provide a force option to enable commit e3c15342a5459135765789a7e19a70b1e655fd1e Author: Glenn Morris Date: Sat Apr 8 19:35:38 2017 -0700 In the manual, mention pops and imaps * doc/emacs/rmail.texi (Movemail, Remote Mailboxes): Mention pops and imaps protocols. diff --git a/doc/emacs/rmail.texi b/doc/emacs/rmail.texi index 59955ca7c2..046087ef45 100644 --- a/doc/emacs/rmail.texi +++ b/doc/emacs/rmail.texi @@ -1388,7 +1388,7 @@ command line syntax and the same basic subset of options. However, the Mailutils version offers additional features. The Emacs version of @command{movemail} can retrieve mail from the -usual Unix mailbox formats. Although it can also use the POP3 +usual Unix mailbox formats. @strong{Warning}: Although it can also use the POP3 protocol, this is not recommended because it does not support POP3 via encrypted TLS channels. @@ -1454,18 +1454,24 @@ Any local mailbox format. Its actual format is detected automatically by @command{movemail}. @item pop +@itemx pops A remote mailbox to be accessed via POP3 protocol. @var{user} specifies the remote user name to use, @var{pass} may be used to specify the user password, @var{host-or-file-name} is the name or IP address of the remote mail server to connect to, and @var{port} is the port number; e.g., @code{pop://smith:guessme@@remote.server.net:995}. +If the server supports it, @command{movemail} tries to use an +encrypted connection---use the @samp{pops} form to require one. @item imap +@itemx imaps A remote mailbox to be accessed via IMAP4 protocol. @var{user} specifies the remote user name to use, @var{pass} may be used to specify the user password, @var{host-or-file-name} is the name or IP address of the remote mail server to connect to, and @var{port} is the port number; e.g., @code{imap://smith:guessme@@remote.server.net:993}. +If the server supports it, @command{movemail} tries to use an +encrypted connection---use the @samp{imaps} form to require one. @end table Alternatively, you can specify the file name of the mailbox to use. @@ -1491,10 +1497,11 @@ listed in @code{rmail-movemail-search-path}, then in @code{exec-path} Some sites use a method called POP for accessing users' inbox data instead of storing the data in inbox files. The Mailutils @command{movemail} by default supports POP with TLS encryption. -Although the @command{Emacs movemail} supports unencrypted POP, this -is not recommended due to the lack of encryption. Both versions of -@command{movemail} work only with POP3, not with older versions of -POP. +@strong{Warning:} Although the @command{Emacs movemail} supports POP, +its use for this is not recommended since it does not support encrypted +connections---the Mailutils version does. +Both versions of @command{movemail} work only with POP3, not with +older versions of POP. @cindex @env{MAILHOST} environment variable @cindex POP mailboxes @@ -1510,6 +1517,8 @@ Additionally, you may specify the password in the mailbox @acronym{URL}: case, @var{password} takes preference over the one set by @code{rmail-remote-password} (see below). This is especially useful if you have several remote mailboxes with different passwords. +If using Mailutils @command{movemail}, you may wish to use +@samp{pops} in place of @samp{pop}. For backward compatibility, Rmail also supports an alternative way of specifying remote POP mailboxes. Specifying an inbox name in the form @@ -1523,7 +1532,8 @@ the machine on which to look for the POP server. supported only by the Mailutils @command{movemail}. To specify an IMAP mailbox in the inbox list, use the following mailbox @acronym{URL}: @samp{imap://@var{username}[:@var{password}]@@@var{hostname}:@var{port}}. The -@var{password} part is optional, as described above. +@var{password} part is optional, as described above. You may wish to +use @samp{imaps} in place of @samp{imap}. @vindex rmail-remote-password @vindex rmail-remote-password-required commit e9fc0ce7bef1c698639b9008bdb1524f24f29972 Author: Glenn Morris Date: Sat Apr 8 19:24:13 2017 -0700 * doc/emacs/rmail.texi: Prefer @command to @code for movemail. diff --git a/doc/emacs/rmail.texi b/doc/emacs/rmail.texi index 15ed3c7fed..59955ca7c2 100644 --- a/doc/emacs/rmail.texi +++ b/doc/emacs/rmail.texi @@ -329,7 +329,7 @@ adding or removing this attribute. @xref{Rmail Attributes}. When you receive mail locally, the operating system places incoming mail for you in a file that we call your @dfn{inbox}. When you start -up Rmail, it runs a C program called @code{movemail} to copy the new +up Rmail, it runs a C program called @command{movemail} to copy the new messages from your local inbox into your primary Rmail file, which also contains other messages saved from previous Rmail sessions. It is in this file that you actually read the mail with Rmail. This @@ -397,7 +397,7 @@ check your mail via POP while traveling, so that your mail will remain on the server and you can save it later on your workstation. In some cases, Rmail copies the new mail from the inbox file -indirectly. First it runs the @code{movemail} program to move the mail +indirectly. First it runs the @command{movemail} program to move the mail from the inbox to an intermediate file called @file{.newmail-@var{inboxname}}, in the same directory as the Rmail file. Then Rmail merges the new mail from that file, saves the Rmail @@ -1373,13 +1373,13 @@ rot13-other-window}. This displays the current buffer in another window which applies the code when displaying the text. @node Movemail -@section @code{movemail} program -@cindex @code{movemail} program +@section @command{movemail} program +@cindex @command{movemail} program - Rmail uses the @code{movemail} program to move mail from your inbox to + Rmail uses the @command{movemail} program to move mail from your inbox to your Rmail file (@pxref{Rmail Inbox}). When loaded for the first time, -Rmail attempts to locate the @code{movemail} program and determine its -version. There are two versions of the @code{movemail} program: the +Rmail attempts to locate the @command{movemail} program and determine its +version. There are two versions of the @command{movemail} program: the GNU Mailutils version (@pxref{movemail,,,mailutils,GNU mailutils}), and an Emacs-specific version that is built and installed unless Emacs was configured using the @option{--with-mailutils} option. @@ -1451,7 +1451,7 @@ denotes the name of @code{maildir} mailbox, e.g., @item file Any local mailbox format. Its actual format is detected automatically -by @code{movemail}. +by @command{movemail}. @item pop A remote mailbox to be accessed via POP3 protocol. @var{user} @@ -1478,9 +1478,9 @@ This is equivalent to specifying the @samp{file} protocol: @vindex rmail-movemail-program @vindex rmail-movemail-search-path The variable @code{rmail-movemail-program} controls which version of -@code{movemail} to use. If that is a string, it specifies the -absolute file name of the @code{movemail} executable. If it is -@code{nil}, Rmail searches for @code{movemail} in the directories +@command{movemail} to use. If that is a string, it specifies the +absolute file name of the @command{movemail} executable. If it is +@code{nil}, Rmail searches for @command{movemail} in the directories listed in @code{rmail-movemail-search-path}, then in @code{exec-path} (@pxref{Shell}), then in @code{exec-directory}. @@ -1520,7 +1520,7 @@ the machine on which to look for the POP server. @cindex IMAP mailboxes Another method for accessing remote mailboxes is IMAP@. This method is -supported only by the Mailutils @code{movemail}. To specify an IMAP +supported only by the Mailutils @command{movemail}. To specify an IMAP mailbox in the inbox list, use the following mailbox @acronym{URL}: @samp{imap://@var{username}[:@var{password}]@@@var{hostname}:@var{port}}. The @var{password} part is optional, as described above. @@ -1545,13 +1545,13 @@ Otherwise, Rmail will ask you for the password to use. @end enumerate @vindex rmail-movemail-flags - If you need to pass additional command-line flags to @code{movemail}, + If you need to pass additional command-line flags to @command{movemail}, set the variable @code{rmail-movemail-flags} a list of the flags you wish to use. Do not use this variable to pass the @samp{-p} flag to preserve your inbox contents; use @code{rmail-preserve-inbox} instead. @cindex Kerberos POP authentication - The @code{movemail} program installed at your site may support + The @command{movemail} program installed at your site may support Kerberos authentication. If it is supported, it is used by default whenever you attempt to retrieve POP mail when @code{rmail-remote-password} and @code{rmail-remote-password-required} @@ -1560,21 +1560,21 @@ are unset. @cindex reverse order in POP inboxes Some POP servers store messages in reverse order. If your server does this, and you would rather read your mail in the order in which it was -received, you can tell @code{movemail} to reverse the order of +received, you can tell @command{movemail} to reverse the order of downloaded messages by adding the @samp{-r} flag to @code{rmail-movemail-flags}. @cindex TLS encryption (Rmail) - Mailutils @code{movemail} supports TLS encryption. If you wish to + Mailutils @command{movemail} supports TLS encryption. If you wish to use it, add the @samp{--tls} flag to @code{rmail-movemail-flags}. @node Other Mailbox Formats @section Retrieving Mail from Local Mailboxes in Various Formats If your incoming mail is stored on a local machine in a format other -than Unix mailbox, you will need the Mailutils @code{movemail} to +than Unix mailbox, you will need the Mailutils @command{movemail} to retrieve it. @xref{Movemail}, for the detailed description of -@code{movemail} versions. For example, to access mail from a inbox in +@command{movemail} versions. For example, to access mail from a inbox in @code{maildir} format located in @file{/var/spool/mail/in}, you would include the following in the Rmail inbox list: commit 48536f67e009bb8c5e2d5a0ee38f50cd546a84c6 Author: Sergey Poznyakoff Date: Sat Apr 8 18:40:53 2017 -0700 Fix rmail handling of movemail protocols (bug#18278) * lisp/mail/rmail.el (rmail-remote-proto-p): New function. (rmail-parse-url): Return protocol in second list element. Only use passwords with remote mailboxes. (rmail-insert-inbox-text): Handle non-simple local mailboxes (maildir, MH, etc.). diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 4b72b3562d..209b5a7140 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -1884,14 +1884,19 @@ not be a new one). It returns non-nil if it got any new messages." (setq result (> new-messages 0)) result)))) +(defun rmail-remote-proto-p (proto) + "Return non-nil if string PROTO refers to a remote mailbox protocol." + (string-match-p "^\\(imap\\|pop\\)s?$" proto)) + (defun rmail-parse-url (file) - "Parse the supplied URL. Return (list MAILBOX-NAME REMOTE PASSWORD GOT-PASSWORD) -WHERE MAILBOX-NAME is the name of the mailbox suitable as argument to the -actual version of `movemail', REMOTE is non-nil if MAILBOX-NAME refers to -a remote mailbox, PASSWORD is the password if it should be -supplied as a separate argument to `movemail' or nil otherwise, GOT-PASSWORD -is non-nil if the user has supplied the password interactively. -" + "Parse a mailbox URL string FILE. +Return (MAILBOX-NAME PROTO PASSWORD GOT-PASSWORD), where MAILBOX-NAME is +the name of the mailbox suitable as argument to the actual version of +`movemail', PROTO is the movemail protocol (use `rmail-remote-proto-p' +to see if it refers to a remote mailbox), PASSWORD is the password if it +should be supplied as a separate argument to `movemail' or nil otherwise, +and GOT-PASSWORD is non-nil if the user has supplied the password +interactively." (cond ((string-match "^\\([^:]+\\)://\\(\\([^:@]+\\)\\(:\\([^@]+\\)\\)?@\\)?.*" file) (let (got-password supplied-password @@ -1901,24 +1906,26 @@ is non-nil if the user has supplied the password interactively. (host (substring file (or (match-end 2) (+ 3 (match-end 1)))))) - (if (not pass) - (when rmail-remote-password-required - (setq got-password (not (rmail-have-password))) - (setq supplied-password (rmail-get-remote-password - (string-equal proto "imap")))) - ;; The password is embedded. Strip it out since movemail - ;; does not really like it, in spite of the movemail spec. - (setq file (concat proto "://" user "@" host))) + (if (rmail-remote-proto-p proto) + (if (not pass) + (when rmail-remote-password-required + (setq got-password (not (rmail-have-password))) + (setq supplied-password (rmail-get-remote-password + (string-match "^imaps?" proto)))) + ;; FIXME + ;; The password is embedded. Strip it out since movemail + ;; does not really like it, in spite of the movemail spec. + (setq file (concat proto "://" user "@" host)))) (if (rmail-movemail-variant-p 'emacs) (if (string-equal proto "pop") (list (concat "po:" user ":" host) - t + proto (or pass supplied-password) got-password) (error "Emacs movemail does not support %s protocol" proto)) (list file - (or (string-equal proto "pop") (string-equal proto "imap")) + proto (or supplied-password pass) got-password)))) @@ -1981,18 +1988,18 @@ Value is the size of the newly read mail after conversion." size)) (defun rmail-insert-inbox-text (files renamep) - (let (file tofile delete-files popmail got-password password) + (let (file tofile delete-files proto got-password password) (while files ;; Handle remote mailbox names specially; don't expand as filenames ;; in case the userid contains a directory separator. (setq file (car files)) (let ((url-data (rmail-parse-url file))) (setq file (nth 0 url-data)) - (setq popmail (nth 1 url-data)) + (setq proto (nth 1 url-data)) (setq password (nth 2 url-data)) (setq got-password (nth 3 url-data))) - (if popmail + (if proto (setq renamep t) (setq file (file-truename (substitute-in-file-name (expand-file-name file))))) @@ -2013,14 +2020,17 @@ Value is the size of the newly read mail after conversion." (expand-file-name buffer-file-name)))) ;; Always use movemail to rename the file, ;; since there can be mailboxes in various directories. - (when (not popmail) + (when (not proto) ;; On some systems, /usr/spool/mail/foo is a directory ;; and the actual inbox is /usr/spool/mail/foo/foo. (if (file-directory-p file) (setq file (expand-file-name (user-login-name) file)))) - (cond (popmail - (message "Getting mail from the remote server ...")) + (cond (proto + (message "Getting mail from %s..." + (if (rmail-remote-proto-p proto) + "the remote server" + proto))) ((and (file-exists-p tofile) (/= 0 (nth 7 (file-attributes tofile)))) (message "Getting mail from %s..." tofile)) @@ -2031,7 +2041,7 @@ Value is the size of the newly read mail after conversion." ;; rename or copy the file FILE to TOFILE if and as appropriate. (cond ((not renamep) (setq tofile file)) - ((or (file-exists-p tofile) (and (not popmail) + ((or (file-exists-p tofile) (and (not proto) (not (file-exists-p file)))) nil) (t @@ -2066,9 +2076,10 @@ Value is the size of the newly read mail after conversion." ;; If we just read the password, most likely it is ;; wrong. Otherwise, see if there is a specific ;; reason to think that the problem is a wrong passwd. - (if (or got-password - (re-search-forward rmail-remote-password-error - nil t)) + (if (and (rmail-remote-proto-p proto) + (or got-password + (re-search-forward rmail-remote-password-error + nil t))) (rmail-set-remote-password nil)) ;; If using Mailutils, remove initial error code commit 79b1669c24fc57d6613e0ae660b277a1b37d724a Author: Glenn Morris Date: Sat Apr 8 18:10:10 2017 -0700 Fix typos in manual re movemail local mailboxes * doc/emacs/rmail.texi (Movemail, Other Mailbox Formats): Fix examples of local mailbox urls. diff --git a/doc/emacs/rmail.texi b/doc/emacs/rmail.texi index 99b7bc1dc5..15ed3c7fed 100644 --- a/doc/emacs/rmail.texi +++ b/doc/emacs/rmail.texi @@ -1436,18 +1436,18 @@ Optional port number, if not the default for that protocol. @item mbox Usual Unix mailbox format. In this case, @var{user}, @var{pass} and @var{port} are not used, and @var{host-or-file-name} denotes the file -name of the mailbox file, e.g., @code{mbox://var/spool/mail/smith}. +name of the mailbox file, e.g., @code{mbox:///var/spool/mail/smith}. @item mh A local mailbox in the @acronym{MH} format. @var{user}, @var{pass} and @var{port} are not used. @var{host-or-file-name} denotes the name -of @acronym{MH} folder, e.g., @code{mh://Mail/inbox}. +of @acronym{MH} folder, e.g., @code{mh:///Mail/inbox}. @item maildir A local mailbox in the @acronym{maildir} format. @var{user}, @var{pass} and @var{port} are not used, and @var{host-or-file-name} denotes the name of @code{maildir} mailbox, e.g., -@code{maildir://mail/inbox}. +@code{maildir:///mail/inbox}. @item file Any local mailbox format. Its actual format is detected automatically @@ -1472,7 +1472,7 @@ port number; e.g., @code{imap://smith:guessme@@remote.server.net:993}. This is equivalent to specifying the @samp{file} protocol: @smallexample -/var/spool/mail/@var{user} @equiv{} file://var/spool/mail/@var{user} +/var/spool/mail/@var{user} @equiv{} file:///var/spool/mail/@var{user} @end smallexample @vindex rmail-movemail-program @@ -1579,5 +1579,5 @@ retrieve it. @xref{Movemail}, for the detailed description of include the following in the Rmail inbox list: @smallexample -maildir://var/spool/mail/in +maildir:///var/spool/mail/in @end smallexample commit f4bb93fabc64dedac157087836e3c9e4a6a98140 Author: Glenn Morris Date: Sat Apr 8 13:45:55 2017 -0700 * lisp/gnus/nnmail.el (nnmail-crosspost-link-function): Simplify. diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el index 3f2e08171e..71d9631776 100644 --- a/lisp/gnus/nnmail.el +++ b/lisp/gnus/nnmail.el @@ -263,7 +263,7 @@ It scans low-level sorted spools even when not required." :type 'function) (defcustom nnmail-crosspost-link-function - (if (string-match "windows-nt" (symbol-name system-type)) + (if (eq 'windows-nt system-type) 'copy-file 'add-name-to-file) "Function called to create a copy of a file. commit bca1fde85f44d0cb04aec25b0a93d37bbd757460 Author: Glenn Morris Date: Sat Apr 8 13:16:08 2017 -0700 Remove references to OS/2 in code, doc, and comments * lisp/gnus/nnheader.el (nnheader-read-timeout) (nnheader-file-name-translation-alist): Remove OS/2 case, and simplify. * lisp/emulation/viper-util.el (viper-color-defined-p): * lisp/net/pop3.el (pop3-read-timeout): * lisp/net/imap.el (imap-read-timeout): * lisp/url/url-privacy.el (url-setup-privacy-info): Remove OS/2 case. * lisp/emulation/viper-ex.el (viper-glob-function): * lisp/vc/ediff-util.el (ediff-submit-report): Doc fix. * lisp/cus-edit.el (custom-display): Remove "pm" (OS/2). * doc/emacs/msdos-xtra.texi (MS-DOS): * doc/misc/gnus.texi (Various Various): * doc/misc/viper.texi (Rudimentary Changes): Remove mentions of OS/2. ; * lisp/url/url.el, lisp/url/url-vars.el: ; * lisp/progmodes/cperl-mode.el: Remove old comments. diff --git a/doc/emacs/msdos-xtra.texi b/doc/emacs/msdos-xtra.texi index 4ac734ed3d..0d98dc81c1 100644 --- a/doc/emacs/msdos-xtra.texi +++ b/doc/emacs/msdos-xtra.texi @@ -22,7 +22,7 @@ current operating systems Windows is in @end ifnottex If you build Emacs for MS-DOS, the binary will also run on Windows -3.X, Windows NT, Windows 9X/ME, Windows 2000/XP, or OS/2 as a DOS +3.X, Windows NT, Windows 9X/ME, or Windows 2000/XP as a DOS application; all of this chapter applies for all of those systems, if you use an Emacs that was built for MS-DOS. diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index ceeb42b918..f60a6a4377 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -26378,7 +26378,7 @@ read when doing the operation described above. @cindex characters in file names This is an alist that says how to translate characters in file names. For instance, if @samp{:} is invalid as a file character in file names -on your system (you OS/2 user you), you could say something like: +on your system (you MS Windows user you), you could say something like: @lisp @group @@ -26387,7 +26387,7 @@ on your system (you OS/2 user you), you could say something like: @end group @end lisp -In fact, this is the default value for this variable on OS/2 and MS +In fact, this is (part of) the default value for this variable on MS Windows (phooey) systems. @item gnus-hidden-properties diff --git a/doc/misc/viper.texi b/doc/misc/viper.texi index 3e944d99e7..745d5fadf6 100644 --- a/doc/misc/viper.texi +++ b/doc/misc/viper.texi @@ -1767,7 +1767,7 @@ Function used by the command @kbd{#c} to spell. @item viper-glob-function The value of this variable is the function symbol used to expand wildcard symbols. This is platform-dependent. The default tries to set this variable -to work with most shells, MS Windows, OS/2, etc. However, if it +to work with most shells, MS Windows, etc. However, if it doesn't work the way you expect, you should write your own. Use @code{viper-glob-unix-files} and @code{viper-glob-mswindows-files} in @file{viper-util.el} as examples. diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index fac9c77e12..f408e83576 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -3246,10 +3246,6 @@ Only match the specified window systems.") :sibling-args (:help-echo "\ The X11 Window System.") x) - (const :format "PM " - :sibling-args (:help-echo "\ -OS/2 Presentation Manager.") - pm) (const :format "W32 " :sibling-args (:help-echo "\ MS Windows.") diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el index edc71ea859..ca067033e6 100644 --- a/lisp/emulation/viper-ex.el +++ b/lisp/emulation/viper-ex.el @@ -326,8 +326,7 @@ Don't put `-c' here, as it is added automatically." (t 'viper-glob-unix-files) ; presumably UNIX ) "Expand the file spec containing wildcard symbols. -The default tries to set this variable to work with Unix, Windows, -and OS/2. +The default tries to set this variable to work with Unix or MS Windows. However, if it doesn't work right for some types of Unix shells or some OS, the user should supply the appropriate function and set this variable to the diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index e6fd6095dc..e32b41f575 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el @@ -29,7 +29,6 @@ ;; Compiler pacifier (defvar viper-overriding-map) -(defvar pm-color-alist) (defvar viper-minibuffer-current-face) (defvar viper-minibuffer-insert-face) (defvar viper-minibuffer-vi-face) @@ -132,12 +131,6 @@ Otherwise return the normal value." (if fp (cdr fp) ,variable))))) -;; OS/2 -(cond ((eq (viper-device-type) 'pm) - (fset 'viper-color-defined-p - (lambda (color) (assoc color pm-color-alist))))) - - ;; cursor colors (defun viper-change-cursor-color (new-color &optional frame) (if (and (viper-window-display-p) (viper-color-display-p) diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el index 648485b4f6..cc3dccea25 100644 --- a/lisp/gnus/nnheader.el +++ b/lisp/gnus/nnheader.el @@ -82,8 +82,7 @@ Integer values will in effect be rounded up to the nearest multiple of :type 'integer) (defvar nnheader-read-timeout - (if (string-match "windows-nt\\|os/2\\|cygwin" - (symbol-name system-type)) + (if (memq system-type '(windows-nt cygwin)) ;; http://thread.gmane.org/v9655t3pjo.fsf@marauder.physik.uni-ulm.de ;; ;; IIRC, values lower than 1.0 didn't/don't work on Windows/DOS. @@ -105,17 +104,8 @@ Integer values will in effect be rounded up to the nearest multiple of Shorter values mean quicker response, but are more CPU intensive.") (defcustom nnheader-file-name-translation-alist - (let ((case-fold-search t)) - (cond - ((string-match "windows-nt\\|os/2\\|cygwin" - (symbol-name system-type)) - (append (mapcar (lambda (c) (cons c ?_)) - '(?: ?* ?\" ?< ?> ??)) - (if (string-match "windows-nt\\|cygwin" - (symbol-name system-type)) - nil - '((?+ . ?-))))) - (t nil))) + (if (memq system-type '(windows-nt cygwin)) + (mapcar (lambda (c) (cons c ?_)) '(?: ?* ?\" ?< ?> ??))) "Alist that says how to translate characters in file names. For instance, if \":\" is invalid as a file character in file names on your system, you could say something like: diff --git a/lisp/net/imap.el b/lisp/net/imap.el index ada2c477e9..7b293921a4 100644 --- a/lisp/net/imap.el +++ b/lisp/net/imap.el @@ -249,9 +249,7 @@ See also `imap-log'." :group 'imap :type 'string) -(defcustom imap-read-timeout (if (string-match - "windows-nt\\|os/2\\|cygwin" - (symbol-name system-type)) +(defcustom imap-read-timeout (if (memq system-type '(windows-nt cygwin)) 1.0 0.1) "How long to wait between checking for the end of output. diff --git a/lisp/net/pop3.el b/lisp/net/pop3.el index 6230a15c85..2ef6321725 100644 --- a/lisp/net/pop3.el +++ b/lisp/net/pop3.el @@ -159,8 +159,7 @@ Used for APOP authentication.") (defalias 'pop3-accept-process-output 'nnheader-accept-process-output) ;; Borrowed from `nnheader.el': (defvar pop3-read-timeout - (if (string-match "windows-nt\\|os/2\\|cygwin" - (symbol-name system-type)) + (if (memq system-type '(windows-nt cygwin)) 1.0 0.01) "How long pop3 should wait between checking for the end of output. diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index f4cb478e02..23ea91fe95 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -1922,10 +1922,7 @@ or as help on variables `cperl-tips', `cperl-problems', (perldb (read-from-minibuffer "Run perldb (like this): " (if (consp gud-perldb-history) (car gud-perldb-history) - (concat "perl " ;;(file-name-nondirectory - ;; I have problems - ;; in OS/2 - ;; otherwise + (concat "perl " (buffer-file-name))) nil nil '(gud-perldb-history . 1)))) @@ -6644,7 +6641,6 @@ Customized by setting variables `cperl-shrink-wrap-info-frame', (if not-loner (/ (* (- frheight 3) cperl-max-help-size) 100) (setq char-height (frame-char-height)) - ;; Non-functioning under OS/2: (if (eq char-height 1) (setq char-height 18)) ;; Title, menubar, + 2 for slack (- (/ (display-pixel-height) char-height) 4))) @@ -7010,7 +7006,7 @@ Does not move point." (setq pos (point)) (goto-char 1) (setq rel file) - ;; On case-preserving filesystems (EMX on OS/2) case might be encoded in properties + ;; On case-preserving filesystems case might be encoded in properties (set-text-properties 0 (length rel) nil rel) (and (equal topdir (substring rel 0 (length topdir))) (setq rel (substring file (length topdir)))) @@ -7103,7 +7099,7 @@ Use as (t (goto-char 1) (setq rel file) - ;; On case-preserving filesystems (EMX on OS/2) case might be encoded in properties + ;; On case-preserving filesystems case might be encoded in properties (set-text-properties 0 (length rel) nil rel) (and (equal topdir (substring rel 0 (length topdir))) (setq rel (substring file (length topdir)))) diff --git a/lisp/url/url-privacy.el b/lisp/url/url-privacy.el index b27d76bab5..90dfb27513 100644 --- a/lisp/url/url-privacy.el +++ b/lisp/url/url-privacy.el @@ -43,7 +43,6 @@ ((eq system-type 'windows-nt) "Windows-NT; 32bit") ((eq system-type 'ms-dos) "MS-DOS; 32bit") ((memq (url-device-type) '(win32 w32)) "Windows; 32bit") - ((eq (url-device-type) 'pm) "OS/2; 32bit") (t (pcase (url-device-type) (`x "X11") diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el index d6c4667da4..f08779f695 100644 --- a/lisp/url/url-vars.el +++ b/lisp/url/url-vars.el @@ -410,10 +410,6 @@ Should be one of: :group 'url :type 'hook) -;;; Make OS/2 happy - yeeks -;; (defvar tcp-binary-process-input-services nil -;; "*Make OS/2 happy with our CRLF pairs...") - (defconst url-working-buffer " *url-work") (defvar url-gateway-unplugged nil diff --git a/lisp/url/url.el b/lisp/url/url.el index 75cf77deaa..be6377ceb3 100644 --- a/lisp/url/url.el +++ b/lisp/url/url.el @@ -58,9 +58,6 @@ This is to avoid conflict with user settings if URL is dumped with Emacs." (unless url-setup-done - ;; Make OS/2 happy - ;;(push '("http" "80") tcp-binary-process-input-services) - (mailcap-parse-mailcaps) (mailcap-parse-mimetypes) diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index 549066e1ec..aea5f76d4f 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -3277,16 +3277,14 @@ Hit \\[ediff-recenter] to reset the windows afterward." file)) -;; Quote metacharacters (using \) when executing diff in Unix, but not in -;; EMX OS/2 +;; Quote metacharacters (using \) when executing diff in Unix. ;;(defun ediff-protect-metachars (str) -;; (or (memq system-type '(emx)) -;; (let ((limit 0)) -;; (while (string-match ediff-metachars str limit) -;; (setq str (concat (substring str 0 (match-beginning 0)) -;; "\\" -;; (substring str (match-beginning 0)))) -;; (setq limit (1+ (match-end 0)))))) +;; (let ((limit 0)) +;; (while (string-match ediff-metachars str limit) +;; (setq str (concat (substring str 0 (match-beginning 0)) +;; "\\" +;; (substring str (match-beginning 0)))) +;; (setq limit (1+ (match-end 0))))) ;; str) ;; Make sure the current buffer (for a file) has the same contents as the @@ -4059,7 +4057,7 @@ interfaces to several other packages and runs under Emacs and XEmacs, byte-compilation may produce output like this: While compiling toplevel forms in file ediff.el: - ** reference to free variable pm-color-alist + ** reference to free variable zzz ........................ While compiling the end of the data: ** The following functions are not known to be defined: commit b7d61609bd2a5a97b63733a4c16194850e48de2a Author: Michael Albinus Date: Sat Apr 8 18:35:06 2017 +0200 Tune Tramp syntax * lisp/net/tramp-cmds.el (tramp-change-syntax): Use `tramp-syntax-values'. * lisp/net/tramp-compat.el (tramp-compat-tramp-syntax): New defsubst. * lisp/net/tramp.el (tramp-syntax): Rename possible values. (tramp-syntax-values): New defun. (tramp-prefix-format, tramp-method-regexp) (tramp-postfix-method-format, tramp-prefix-ipv6-format) (tramp-postfix-ipv6-format, tramp-postfix-host-format) (tramp-completion-file-name-regexp): Use `tramp-compat-tramp-syntax' and changed values. (tramp-completion-file-name-regexp-default): Rename from `tramp-completion-file-name-regexp-unified'. Adapt docstring. (tramp-completion-file-name-regexp-simplified): Rename from `tramp-completion-file-name-regexp-old-style'. Adapt docstring. (tramp-initial-completion-file-name-regexp): Use `tramp-completion-file-name-regexp-default'. (tramp-run-real-handler): Do not autoload any longer. diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index df6a5c507f..99fc0cc709 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -40,11 +40,11 @@ ;;;###autoload (defun tramp-change-syntax (&optional syntax) "Change Tramp syntax. -SYNTAX can be one of the symbols `def' (default), `ftp' (ange-ftp like) -or `sep' (XEmacs like)." +SYNTAX can be one of the symbols `default' (default), +`simplified' (ange-ftp like) or `separate' (XEmacs like)." (interactive (let ((input (completing-read - "Enter Tramp syntax: " '(def ftp sep) nil t + "Enter Tramp syntax: " (tramp-syntax-values) nil t (symbol-name tramp-syntax)))) (unless (string-equal input "") (list (intern input))))) diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 8f346eb440..732922b60e 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -379,6 +379,14 @@ If NAME is a remote file name, the local part of NAME is unquoted." (if (= (length localname) 2) "/" "") nil t localname))) (concat (file-remote-p name) localname)))))) +;; `tramp-syntax' has changed its meaning in Emacs 26. We still +;; support old settings. +(defsubst tramp-compat-tramp-syntax () + "Return proper value of `tramp-syntax'." + (cond ((eq tramp-syntax 'ftp) 'default) + ((eq tramp-syntax 'sep) 'separate) + (t tramp-syntax))) + (provide 'tramp-compat) ;;; TODO: diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index a6d3e78cfe..818054676e 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -662,29 +662,26 @@ Useful for \"rsync\" like methods.") (put 'tramp-temp-buffer-file-name 'permanent-local t) ;;;###autoload -(defcustom tramp-syntax 'def +(defcustom tramp-syntax 'default "Tramp filename syntax to be used. It can have the following values: - `def' -- Default syntax - `ftp' -- Ange-FTP like syntax - `sep' -- Syntax as defined for XEmacs originally." + `default' -- Default syntax + `simplified' -- Ange-FTP like syntax + `separate' -- Syntax as defined for XEmacs originally." :group 'tramp :version "26.1" :package-version '(Tramp . "2.3.2") - :type '(choice (const :tag "Default" def) - (const :tag "Ange-FTP" ftp) - (const :tag "XEmacs" sep)) + :type '(choice (const :tag "Default" default) + (const :tag "Ange-FTP" simplified) + (const :tag "XEmacs" separate)) :require 'tramp :initialize 'custom-initialize-set :set (lambda (symbol value) ;; Check allowed values. - (let ((values (cdr (get symbol 'custom-type)))) - (setq values (mapcar 'last values) - values (mapcar 'car values)) - (unless (member value values) - (user-error "Wrong `tramp-syntax' %s defined" tramp-syntax))) + (unless (memq value (tramp-syntax-values)) + (user-error "Wrong `tramp-syntax' %s" tramp-syntax)) ;; Cleanup existing buffers. (unless (eq (symbol-value symbol) value) (tramp-cleanup-all-buffers)) @@ -693,13 +690,19 @@ It can have the following values: ;; Rearrange file name handlers. (tramp-register-file-name-handlers))) +(defun tramp-syntax-values () + "Return possible values of `tramp-syntax', a list" + (let ((values (cdr (get 'tramp-syntax 'custom-type)))) + (setq values (mapcar 'last values) + values (mapcar 'car values)))) + (defun tramp-prefix-format () "String matching the very beginning of Tramp file names. Used in `tramp-make-tramp-file-name'." - (cond ((eq tramp-syntax 'def) "/") - ((eq tramp-syntax 'ftp) "/") - ((eq tramp-syntax 'sep) "/[") - (t (error "Wrong `tramp-syntax' %s defined" tramp-syntax)))) + (cond ((eq (tramp-compat-tramp-syntax) 'default) "/") + ((eq (tramp-compat-tramp-syntax) 'simplified) "/") + ((eq (tramp-compat-tramp-syntax) 'separate) "/[") + (t (error "Wrong `tramp-syntax' %s" tramp-syntax)))) (defun tramp-prefix-regexp () "Regexp matching the very beginning of Tramp file names. @@ -709,16 +712,16 @@ Should always start with \"^\". Derived from `tramp-prefix-format'." (defun tramp-method-regexp () "Regexp matching methods identifiers. The `ftp' syntax does not support methods." - (if (eq tramp-syntax 'ftp) "" "[a-zA-Z0-9-]+")) + (if (eq (tramp-compat-tramp-syntax) 'simplified) "" "[a-zA-Z0-9-]+")) (defun tramp-postfix-method-format () "String matching delimiter between method and user or host names. The `ftp' syntax does not support methods. Used in `tramp-make-tramp-file-name'." - (cond ((eq tramp-syntax 'def) ":") - ((eq tramp-syntax 'ftp) "") - ((eq tramp-syntax 'sep) "/") - (t (error "Wrong `tramp-syntax' %s defined" tramp-syntax)))) + (cond ((eq (tramp-compat-tramp-syntax) 'default) ":") + ((eq (tramp-compat-tramp-syntax) 'simplified) "") + ((eq (tramp-compat-tramp-syntax) 'separate) "/") + (t (error "Wrong `tramp-syntax' %s" tramp-syntax)))) (defun tramp-postfix-method-regexp () "Regexp matching delimiter between method and user or host names. @@ -762,10 +765,10 @@ Derived from `tramp-postfix-user-format'.") (defun tramp-prefix-ipv6-format () "String matching left hand side of IPv6 addresses. Used in `tramp-make-tramp-file-name'." - (cond ((eq tramp-syntax 'def) "[") - ((eq tramp-syntax 'ftp) "[") - ((eq tramp-syntax 'sep) "") - (t (error "Wrong `tramp-syntax' %s defined" tramp-syntax)))) + (cond ((eq (tramp-compat-tramp-syntax) 'default) "[") + ((eq (tramp-compat-tramp-syntax) 'simplified) "[") + ((eq (tramp-compat-tramp-syntax) 'separate) "") + (t (error "Wrong `tramp-syntax' %s" tramp-syntax)))) (defun tramp-prefix-ipv6-regexp () "Regexp matching left hand side of IPv6 addresses. @@ -782,10 +785,10 @@ Derived from `tramp-prefix-ipv6-format'." (defun tramp-postfix-ipv6-format () "String matching right hand side of IPv6 addresses. Used in `tramp-make-tramp-file-name'." - (cond ((eq tramp-syntax 'def) "]") - ((eq tramp-syntax 'ftp) "]") - ((eq tramp-syntax 'sep) "") - (t (error "Wrong `tramp-syntax' %s defined" tramp-syntax)))) + (cond ((eq (tramp-compat-tramp-syntax) 'default) "]") + ((eq (tramp-compat-tramp-syntax) 'simplified) "]") + ((eq (tramp-compat-tramp-syntax) 'separate) "") + (t (error "Wrong `tramp-syntax' %s" tramp-syntax)))) (defun tramp-postfix-ipv6-regexp () "Regexp matching right hand side of IPv6 addresses. @@ -820,10 +823,10 @@ Derived from `tramp-postfix-hop-format'.") (defun tramp-postfix-host-format () "String matching delimiter between host names and localnames. Used in `tramp-make-tramp-file-name'." - (cond ((eq tramp-syntax 'def) ":") - ((eq tramp-syntax 'ftp) ":") - ((eq tramp-syntax 'sep) "]") - (t (error "Wrong `tramp-syntax' %s defined" tramp-syntax)))) + (cond ((eq (tramp-compat-tramp-syntax) 'default) ":") + ((eq (tramp-compat-tramp-syntax) 'simplified) ":") + ((eq (tramp-compat-tramp-syntax) 'separate) "]") + (t (error "Wrong `tramp-syntax' %s" tramp-syntax)))) (defun tramp-postfix-host-regexp () "Regexp matching delimiter between host names and localnames. @@ -890,7 +893,7 @@ This regexp should match Tramp file names but no other file names." It must match the initial `tramp-syntax' settings.") ;;;###autoload -(defconst tramp-completion-file-name-regexp-unified +(defconst tramp-completion-file-name-regexp-default (concat "\\`/\\(" ;; Optional multi hop. @@ -904,12 +907,12 @@ It must match the initial `tramp-syntax' settings.") ;; Method separator, user name and host name. "\\(:[^/|:]*\\)?" "\\)?\\'") - "Value for `tramp-completion-file-name-regexp' for unified remoting. + "Value for `tramp-completion-file-name-regexp' for default remoting. See `tramp-file-name-structure' for more explanations. On W32 systems, the volume letter must be ignored.") -(defconst tramp-completion-file-name-regexp-old-style +(defconst tramp-completion-file-name-regexp-simplified (concat "\\`/\\(" ;; Optional multi hop. @@ -921,7 +924,7 @@ On W32 systems, the volume letter must be ignored.") ;; At least one character. "[^/|:]+") "\\)?\\'") - "Value for `tramp-completion-file-name-regexp' for ange-ftp style remoting. + "Value for `tramp-completion-file-name-regexp' for simplified style remoting. See `tramp-file-name-structure' for more explanations. On W32 systems, the volume letter must be ignored.") @@ -941,14 +944,17 @@ before loading tramp.el. Alternatively, `file-name-handler-alist' can be updated after changing this variable. Also see `tramp-file-name-structure'." - (cond ((eq tramp-syntax 'def) tramp-completion-file-name-regexp-unified) - ((eq tramp-syntax 'ftp) tramp-completion-file-name-regexp-old-style) - ((eq tramp-syntax 'sep) tramp-completion-file-name-regexp-separate) - (t (error "Wrong `tramp-syntax' %s defined" tramp-syntax)))) + (cond ((eq (tramp-compat-tramp-syntax) 'default) + tramp-completion-file-name-regexp-default) + ((eq (tramp-compat-tramp-syntax) 'simplified) + tramp-completion-file-name-regexp-simplified) + ((eq (tramp-compat-tramp-syntax) 'separate) + tramp-completion-file-name-regexp-separate) + (t (error "Wrong `tramp-syntax' %s" tramp-syntax)))) ;;;###autoload (defconst tramp-initial-completion-file-name-regexp - tramp-completion-file-name-regexp-unified + tramp-completion-file-name-regexp-default "Value for `tramp-completion-file-name-regexp' for autoload. It must match the initial `tramp-syntax' settings.") @@ -1911,8 +1917,7 @@ coding system might not be determined. This function repairs it." ;; as regexp. (push (cons (regexp-quote tmpname) (cdr elt)) result))))) -;;;###autoload -(progn (defun tramp-run-real-handler (operation args) +(defun tramp-run-real-handler (operation args) "Invoke normal file name handler for OPERATION. First arg specifies the OPERATION, second arg is a list of arguments to pass to the OPERATION." @@ -1926,7 +1931,7 @@ pass to the OPERATION." ,(and (eq inhibit-file-name-operation operation) inhibit-file-name-handlers))) (inhibit-file-name-operation operation)) - (apply operation args)))) + (apply operation args))) ;; We handle here all file primitives. Most of them have the file ;; name as first parameter; nevertheless we check for them explicitly commit c5f319eb3a2e0ad97867c8dc61bfc140333fb11d Author: Mark Oteiza Date: Sat Apr 8 11:34:17 2017 -0400 Replace more nested ifs with cond This is a continuation of d526047 "Replace more nested ifs with cond". * lisp/play/dunnet.el (dun-firstword, dun-firstwordl, dun-cat): Use when and cond where appropriate. diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index 8f013bb09f..6acdf36d72 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el @@ -2199,16 +2199,14 @@ for a moment, then straighten yourself up.\n") ;;; Get the first non-ignored word from a list. (defun dun-firstword (list) - (if (not (car list)) - nil - (while (and list (member (intern (car list)) dun-ignore)) + (when (car list) + (while (and list (memq (intern (car list)) dun-ignore)) (setq list (cdr list))) (car list))) (defun dun-firstwordl (list) - (if (not (car list)) - nil - (while (and list (member (intern (car list)) dun-ignore)) + (when (car list) + (while (and list (memq (intern (car list)) dun-ignore)) (setq list (cdr list))) list)) @@ -2820,28 +2818,25 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") (setq dun-badcd t)) (defun dun-cat (args) - (let (doto checklist) - (if (not (setq args (car args))) - (dun-mprincl "Usage: cat ") - (if (string-match "/" args) - (dun-mprincl "cat: only files in current directory allowed.") - (if (and (> dun-cdroom 0) (string= args "description")) - (dun-mprincl (car (nth dun-cdroom dun-rooms))) - (if (setq doto (string-match "\\.o" args)) - (progn - (if (= dun-cdroom -10) - (setq checklist dun-inventory) - (setq checklist (nth dun-cdroom dun-room-objects))) - (if (not (member (cdr - (assq (intern - (substring args 0 doto)) - dun-objnames)) - checklist)) - (dun-mprincl "File not found.") - (dun-mprincl "Ascii files only."))) - (if (assq (intern args) dun-unix-verbs) - (dun-mprincl "Ascii files only.") - (dun-mprincl "File not found.")))))))) + (cond + ((null (setq args (car args))) + (dun-mprincl "Usage: cat ")) + ((string-match-p "/" args) + (dun-mprincl "cat: only files in current directory allowed.")) + ((and (> dun-cdroom 0) (string= args "description")) + (dun-mprincl (car (nth dun-cdroom dun-rooms)))) + ((string-match "\\.o" args) + (let ((doto (match-beginning 0)) checklist) + (if (= dun-cdroom -10) + (setq checklist dun-inventory) + (setq checklist (nth dun-cdroom dun-room-objects))) + (if (member (cdr (assq (intern (substring args 0 doto)) dun-objnames)) + checklist) + (dun-mprincl "Ascii files only.") + (dun-mprincl "File not found.")))) + ((assq (intern args) dun-unix-verbs) + (dun-mprincl "Ascii files only.")) + (t (dun-mprincl "File not found.")))) (defun dun-rlogin-endgame () (if (not (= (dun-score nil) 90)) commit fd4b83ca7c20a68060772ec13aadbe29db612b3f Author: Mark Oteiza Date: Sat Apr 8 11:30:36 2017 -0400 Adjust the edebug spec of if-let* This was fixed in Bug#24748, but now looking more closely, using gate in the spec seems correct. See (info "(elisp) Backtracking"). * lisp/emacs-lisp/subr-x.el (if-let*): Use gate in edebug spec. diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 1d729f9409..5ad482d1ea 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -126,7 +126,8 @@ In the special case you only want to bind a single value, VARLIST can just be a plain tuple. \n(fn VARLIST THEN ELSE...)" (declare (indent 2) - (debug ([&or (&rest [&or symbolp (symbolp form)]) (symbolp form)] + (debug ([&or (&rest &or symbolp (gate symbolp &optional form)) + (symbolp form)] form body))) (when (and (<= (length bindings) 2) (not (listp (car bindings)))) commit 1c69215c511789ddcdeab60192087733c521652b Author: Mark Oteiza Date: Sat Apr 8 11:27:17 2017 -0400 Replace some uses of cl-member-if with apply From the mhtml-mode series. Some of the uses of cl-lib are not necessary. * lisp/align.el: Don't require cl-lib. (align-region): Use apply instead of cl-member-if. * lisp/emulation/viper.el: Don't require cl-lib. (viper-mode, this-major-mode-requires-vi-state): Use apply instead of cl-member-if. diff --git a/lisp/align.el b/lisp/align.el index 102f009a2d..081f587d4b 100644 --- a/lisp/align.el +++ b/lisp/align.el @@ -118,8 +118,6 @@ ;;; Code: -(require 'cl-lib) - (defgroup align nil "Align text to a specific column, by regexp." :version "21.1" @@ -1324,8 +1322,7 @@ aligner would have dealt with are." (modes (assq 'modes rule))) ;; unless the `run-if' form tells us not to, look for the ;; rule.. - (unless (or (and modes (not (cl-member-if #'derived-mode-p - (eval (cdr modes))))) + (unless (or (and modes (not (apply #'derived-mode-p (eval (cdr modes))))) (and run-if (not (funcall (cdr run-if))))) (let* ((case-fold-search case-fold-search) (case-fold (assq 'case-fold rule)) diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index 4b4b4be897..bded174b0d 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el @@ -14,8 +14,6 @@ ;; filed in the Emacs bug reporting system against this file, a copy ;; of the bug report be sent to the maintainer's email address. -(require 'cl-lib) - (defconst viper-version "3.14.2 of July 4, 2013" "The current version of Viper") @@ -594,10 +592,8 @@ This startup message appears whenever you load Viper, unless you type `y' now." )) (viper-set-expert-level 'dont-change-unless))) - (or (cl-member-if #'derived-mode-p - viper-emacs-state-mode-list) ; don't switch to Vi - (cl-member-if #'derived-mode-p - viper-insert-state-mode-list) ; don't switch + (or (apply #'derived-mode-p viper-emacs-state-mode-list) ; don't switch to Vi + (apply #'derived-mode-p viper-insert-state-mode-list) ; don't switch (viper-change-state-to-vi)) )) @@ -609,13 +605,10 @@ This startup message appears whenever you load Viper, unless you type `y' now." ;; Apply a little heuristic to invoke vi state on major-modes ;; that are not listed in viper-vi-state-mode-list (defun this-major-mode-requires-vi-state (mode) - (let ((check (lambda (one-mode) - (provided-mode-derived-p mode one-mode)))) - (cond ((cl-member-if check viper-vi-state-mode-list) t) - ((cl-member-if check viper-emacs-state-mode-list) - nil) - ((cl-member-if check viper-insert-state-mode-list) - nil) + (let ((major-mode mode)) + (cond ((apply #'derived-mode-p viper-vi-state-mode-list) t) + ((apply #'derived-mode-p viper-emacs-state-mode-list) nil) + ((apply #'derived-mode-p viper-insert-state-mode-list) nil) (t (and (eq (key-binding "a") 'self-insert-command) (eq (key-binding " ") 'self-insert-command)))))) commit 98bfac68b98e051425c41873edc48f9af5c92361 Author: Philipp Stephani Date: Sun Mar 26 20:53:43 2017 +0200 Validate SPEC of `dolist', cf. Bug#25477. * lisp/subr.el (dolist): Test type and length of SPEC. * test/lisp/subr-tests.el (subr-tests--dolist--wrong-number-of-args): Add unit test. diff --git a/lisp/subr.el b/lisp/subr.el index 13567d8753..1dd5d2ffef 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -190,6 +190,10 @@ Then evaluate RESULT to get return value, default nil. \(fn (VAR LIST [RESULT]) BODY...)" (declare (indent 1) (debug ((symbolp form &optional form) body))) + (unless (consp spec) + (signal 'wrong-type-argument (list 'consp spec))) + (unless (<= 2 (length spec) 3) + (signal 'wrong-number-of-arguments (list '(2 . 3) (length spec)))) ;; It would be cleaner to create an uninterned symbol, ;; but that uses a lot more space when many functions in many files ;; use dolist. diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index a3b08e9697..0d243cc5d8 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -281,5 +281,15 @@ indirectly `mapbacktrace'." (should (equal (string-match-p "\\`[[:blank:]]\\'" "\u3000") 0)) (should-not (string-match-p "\\`[[:blank:]]\\'" "\N{LINE SEPARATOR}"))) +(ert-deftest subr-tests--dolist--wrong-number-of-args () + "Test that `dolist' doesn't accept wrong types or length of SPEC, +cf. Bug#25477." + (should-error (eval '(dolist (a))) + :type 'wrong-number-of-arguments) + (should-error (eval '(dolist (a () 'result 'invalid)) t) + :type 'wrong-number-of-arguments) + (should-error (eval '(dolist "foo") t) + :type 'wrong-type-argument)) + (provide 'subr-tests) ;;; subr-tests.el ends here commit 5ea696fd24c2bd8006050866fba0ccab1c0ff931 Author: Philipp Stephani Date: Sat Apr 8 16:55:56 2017 +0200 Add unit test for Bug#26378 * test/lisp/vc/ediff-diff-tests.el (ediff-diff-tests--ediff-exec-process--nil): New unit test. diff --git a/test/lisp/vc/ediff-diff-tests.el b/test/lisp/vc/ediff-diff-tests.el index aacc8bfed2..566f592f84 100644 --- a/test/lisp/vc/ediff-diff-tests.el +++ b/test/lisp/vc/ediff-diff-tests.el @@ -41,4 +41,15 @@ (should (equal call-process-args `(("diff" nil ,(current-buffer) nil "/a" "/b"))))))) +(ert-deftest ediff-diff-tests--ediff-exec-process--nil () + "Check that Bug#26378 is fixed." + (cl-letf* ((call-process-args ()) + ((symbol-function #'call-process) + (lambda (&rest args) (push args call-process-args) 0))) + (with-temp-buffer + (ediff-exec-process "diff" (current-buffer) :synchronous "" + "foo" nil "") + (should (equal call-process-args + `(("diff" nil ,(current-buffer) nil "foo"))))))) + ;;; ediff-diff-tests.el ends here