1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-23 10:34:07 +00:00

Merge from origin/emacs-26

7f089aa5f6 Require seq in rmc.el
53aaad1dfc Make an example code introduced in the Gnus info work (bug...
7b29db222f Enable gnus-read-ephemeral-* to run multiple times (bug#29...
015f0bb2d8 Port thread.c to OpenBSD ARM
ad68bbd0da Fix another "wrong side of point" error in CC Mode.
646e56e150 Fix Bug#28959
685fd77959 Fix duplicate .o file on QNX
e562356c3f Fix two js indentation problems
b8cf159bbc Update documentation for windows build
46540a1c7a Fix a "wrong side of point" error in CC Mode.  Fixes bug #...
57ca409111 Fix autoload of flymake from elisp-mode during bootstrap (...
aee0bc8775 Fix non-native fullscreen on NS (bug#28872)
d6c1a9cb8a ; Fix author email address in test/lisp/url/url-tramp-test...
761c630766 Fix Bug#28982
628b653209 Fix windows build errors
e8a06a5f9a Fix compile warning for non-w32 builds
0c536a20fb Display commit in package description, if available (Bug#2...
1d83257a1d Port to QNX
19667f44ef * configure.ac: Tweak libcurses diagnostic.
3fc05cfaec Scripts to automate windows binary distribution
928a106939 Fix Edebug specs for map-let and with-maps-do
46f2ee0d4c * test/lisp/net/tramp-tests.el (tramp-test41-delay-load): ...
b51009d7f0 * admin/authors.el (authors-canonical-author-name): Ignore...
a015db90e3 * test/lisp/progmodes/sql-tests.el (sql-tests-postgres-lis...
529a9c09d3 Further work on Bug#28889
c6deabaf4d Improve Tramp backward compatibility
8093e82e42 Improve backward compatibility of tramp-tests.el
46cdc01daa Fix some ‘window-normalize-’ prefixed functions (Bug#28947)
6360611457 Port to OpenIndiana
a012ec766c Don't fill keywords after Emacs Lisp docstring
b7c4aa951c Refactor c-forward-token-2 with new function c-forward-ove...
3aee7be62e Avoid unnecessary rounding errors in timestamps
2bfa42855b Fix xdg timestamp error on 32-bit Emacs
237e96bc52 Test that advice doesn't trigger bytecomp warnings (Bug#28...
d719ea6ad5 Another fix for unsafe directory error message (Bug#865)
b060e091c3 Handle https url for debbugs mbox (Bug#28831)
9e4265ef91 Ignore string properties when saving eshell history (Bug#2...
0f286ca85a Fix Bug#28889
This commit is contained in:
Paul Eggert 2017-11-02 21:01:04 -07:00
commit c66a3944ed
50 changed files with 1202 additions and 272 deletions

View File

@ -62,6 +62,7 @@ Michael Albinus
lisp/url/url-tramp.el
doc/misc/tramp*.texi
test/lisp/net/tramp-tests.el
test/lisp/url/url-tramp-tests.el
D-Bus
src/dbusbind.c

View File

@ -1321,9 +1321,10 @@ it is found in `authors-fixed-case'."
(setq author (replace-regexp-in-string "[ \t]+" " " author))
;; NB this ignores the first name only case.
(unless (string-match "[-, \t]" author)
(push (format-message "%s:%d: ignored `%s'"
file (1+ (count-lines (point-min) pos)) author)
authors-ignored-names)
(or (authors-lax-changelog-p file)
(push (format-message "%s:%d: ignored `%s'"
file (1+ (count-lines (point-min) pos)) author)
authors-ignored-names))
(setq author ""))
(or (car (member author authors-fixed-case))
(capitalize author))))

View File

@ -0,0 +1,92 @@
Distribution Build Scripts for Windows
======================================
The scripts are used to build the binary distribution zip files for windows.
File System Organisation
------------------------
They are relatively strict about the file system organisation. In
general, they should work across several more than just the version of
Emacs they come with, as the dependencies of Emacs change relatively slowly.
The file system needs to be organised like so:
~/emacs-build/git
Contains a checkout of the Emacs git repository, organised according
to branches, with git worktree
~/emacs-build/git/emacs-$branch
A branch of the git repository containing the current release
branch. This has to be created by hand.
~/emacs-build/git/emacs-$version
A branch of the git repository containing the last release. The
build-zips.sh file will create this for you.
~/emacs-build/deps
A location for the dependencies. This needs to contain two zip files
with the dependencies. build-dep-zips.py will create these files for you.
~/emacs-build/deps/libXpm/i686
~/emacs-build/deps/libXpm/x86_64
Contain libXpm-noX4.dll. This file is used to load images for the
splash screen, menu items and so on. Emacs runs without it, but looks
horrible. The x86_64 comes from msys2, while the i686 comes from
ezwinports because it itself has no dependencies. These have to be
placed manually (but probably never need updating).
~/emacs-build/build/$version/i686
~/emacs-build/build/$version/x86_64
We build Emacs out-of-source here. This directory is created by
build-zips.sh. This directory can be freely deleted after zips have
been created
~/emacs-build/install/$version/i686
~/emacs-build/install/$version/x86_64
We install Emacs here. This directory is created by build-zips.sh.
This directory can and *should* be deleted after zips have been
created.
~/emacs-upload
Zips are created and moved here from where they can be, well,
uploaded.
Build Process
-------------
For each major version:
The dependencies files need to be created. This can be around the time
of the pre-tests, then used for all releases of that version, to
ensure the maximum stability.
To do this:
Update msys to the latest version with `pacman -Syu`.
Then run build-dep-zips.py, in this directory. Three zips will be
created, containing the 64bit and 32bit dependencies, as well as the
source for these.
For emacs release or pre-test version:
Run `build-zips.sh -g` in the release branch. This will create a worktree
with the tag of the last version.
Then run `build-zips.sh` in this worktree. Eventually, four new zip
files will be created in ~/emacs-upload from where they can be signed
and uploaded with `gnupload`.

View File

@ -0,0 +1,45 @@
Windows Binaries
================
Currently, we provide four different binary packages for Emacs, which
are:
emacs-$VERSION-x86_64.zip
Contains a 64-bit build of Emacs with dependencies. Mostly, this is
the best one to install.
emacs-$VERSION-x86_64-no-deps.zip
Contains a 64-bit build of Emacs without any dependencies. This may be
useful if you wish to install where the dependencies are already
available, or if you want the small possible Emacs.
emacs-$VERSION-i686.zip
Contains a 32-bit build of Emacs with dependencies. This is useful for
running on a 32-bit machine.
emacs-$VERSION-i686-no-deps.zip
Contains a 32-bit build of Emacs without dependencies
In addition, we provide the following files which will not be useful
for most end-users.
emacs-26-x86_64-deps.zip
The dependencies. Unzipping this file on top of
emacs-$VERSION-x86_64-no-deps.zip should result in the same install as
emacs-$VERSION-x86_64.zip.
emacs-26-i686-deps.zip
The 32-bit version of the dependencies.
emacs-26-deps-mingw-w64-src.zip
The source for the dependencies. Source for Emacs itself is available
in the main distribution tarball. These dependencies were produced
from an updated msys2 at the point of the first pre-test. It is not
intended that these will be updated after that point.

View File

@ -0,0 +1,223 @@
#!/usr/bin/python3
## Copyright (C) 2017 Free Software Foundation, Inc.
## This file is part of GNU Emacs.
## GNU Emacs is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
## GNU Emacs is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
## You should have received a copy of the GNU General Public License
## along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
import argparse
import multiprocessing as mp
import glob
import os
import shutil
import re
from subprocess import check_output
## Constants
EMACS_MAJOR_VERSION="26"
## Options
DRY_RUN=False
## Packages to fiddle with
SKIP_PKGS=["mingw-w64-gcc-libs"]
MUNGE_PKGS ={"mingw-w64-libwinpthread-git":"mingw-w64-winpthreads-git"}
ARCH_PKGS=["mingw-w64-mpc",
"mingw-w64-termcap",
"mingw-w64-xpm-nox"]
SRC_REPO="https://sourceforge.net/projects/msys2/files/REPOS/MINGW/Sources"
def check_output_maybe(*args,**kwargs):
if(DRY_RUN):
print("Calling: {}{}".format(args,kwargs))
else:
return check_output(*args,**kwargs)
def extract_deps():
# This list derives from the features we want Emacs to compile with.
PKG_REQ='''mingw-w64-x86_64-giflib
mingw-w64-x86_64-gnutls
mingw-w64-x86_64-libjpeg-turbo
mingw-w64-x86_64-libpng
mingw-w64-x86_64-librsvg
mingw-w64-x86_64-libtiff
mingw-w64-x86_64-libxml2
mingw-w64-x86_64-xpm-nox
mingw-w64-x86_64-lcms2'''.split()
# Get a list of all dependencies needed for packages mentioned above.
# Run `pactree -lu' for each elment of $PKG_REQ
pkgs = set()
for x in PKG_REQ:
pkgs.update(
check_output(["pactree", "-lu", x]).decode("utf-8").split()
)
return sorted(pkgs)
def gather_deps(deps, arch, directory):
os.mkdir(arch)
os.chdir(arch)
## Replace the architecture with the correct one
deps = [re.sub(r"x86_64",arch,x) for x in deps]
## find all files the transitive dependencies
deps_files = check_output(
["pacman", "-Ql"] + deps
).decode("utf-8").split("\n")
## Produces output like
## mingw-w64-x86_64-zlib /mingw64/lib/libminizip.a
## drop the package name
tmp = deps_files.copy()
deps_files=[]
for d in tmp:
slt = d.split()
if(not slt==[]):
deps_files.append(slt[1])
## sort uniq
deps_files = sorted(list(set(deps_files)))
## copy all files into local
print("Copying dependencies: {}".format(arch))
check_output_maybe(["rsync", "-R"] + deps_files + ["."])
## And package them up
os.chdir(directory)
print("Zipping: {}".format(arch))
check_output_maybe("zip -9r ../../emacs-26-{}-deps.zip *".format(arch),
shell=True)
os.chdir("../../")
def download_source(tarball):
print("Downloading {}...".format(tarball))
check_output_maybe(
"wget -a ../download.log -O {} {}/{}/download"
.format(tarball, SRC_REPO, tarball),
shell=True
)
print("Downloading {}... done".format(tarball))
def gather_source(deps):
## Source for gcc-libs is part of gcc
## Source for libwinpthread is in libwinpthreads
## mpc, termcap, xpm -- has x86_64, and i686 versions
## This needs to have been run first at the same time as the
## system was udpated.
os.mkdir("emacs-src")
os.chdir("emacs-src")
to_download = []
for pkg in deps:
pkg_name_and_version= \
check_output(["pacman","-Q", pkg]).decode("utf-8").strip()
## Produces output like:
## mingw-w64-x86_64-zlib 2.43.2
pkg_name_components = pkg_name_and_version.split()
pkg_name=pkg_name_components[0]
pkg_version=pkg_name_components[1]
## make a simple name to make lookup easier
simple_pkg_name = re.sub(r"x86_64-","",pkg_name)
if(simple_pkg_name in SKIP_PKGS):
continue
## Some packages have different source files for different
## architectures. For these we need two downloads.
if(simple_pkg_name in ARCH_PKGS):
downloads = [pkg_name,
re.sub(r"x86_64","i686",pkg_name)]
else:
downloads = [simple_pkg_name]
for d in downloads:
## Switch names if necessary
d = MUNGE_PKGS.get(d,d)
tarball = "{}-{}.src.tar.gz".format(d,pkg_version)
to_download.append(tarball)
## Download in parallel or it is just too slow
p = mp.Pool(16)
p.map(download_source,to_download)
print("Zipping")
check_output_maybe("zip -9 ../emacs-{}-deps-mingw-w64-src.zip *"
.format(EMACS_MAJOR_VERSION),
shell=True)
os.chdir("..")
def clean():
print("Cleaning")
os.path.isdir("emacs-src") and shutil.rmtree("emacs-src")
os.path.isdir("i686") and shutil.rmtree("i686")
os.path.isdir("x86_64") and shutil.rmtree("x86_64")
os.path.isfile("download.log") and os.remove("download.log")
if(os.environ["MSYSTEM"] != "MSYS"):
print("Run this script in an MSYS-shell!")
exit(1)
parser = argparse.ArgumentParser()
parser.add_argument("-t", help="32 bit deps only",
action="store_true")
parser.add_argument("-f", help="64 bit deps only",
action="store_true")
parser.add_argument("-s", help="source code only",
action="store_true")
parser.add_argument("-c", help="clean only",
action="store_true")
parser.add_argument("-d", help="dry run",
action="store_true")
args = parser.parse_args()
do_all=not (args.c or args.s or args.f or args.t)
deps=extract_deps()
DRY_RUN=args.d
if( do_all or args.t ):
gather_deps(deps,"i686","mingw32")
if( do_all or args.f ):
gather_deps(deps,"x86_64","mingw64")
if( do_all or args.s ):
gather_source(deps)
if( args.c ):
clean()

145
admin/nt/dist-build/build-zips.sh Executable file
View File

@ -0,0 +1,145 @@
#!/bin/bash
## Copyright (C) 2017 Free Software Foundation, Inc.
## This file is part of GNU Emacs.
## GNU Emacs is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
## GNU Emacs is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
## You should have received a copy of the GNU General Public License
## along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
function git_up {
echo Making git worktree for Emacs $VERSION
cd $HOME/emacs-build/git/emacs-$MAJOR_VERSION
git pull
git worktree add ../emacs-$BRANCH emacs-$BRANCH
cd ../emacs-$BRANCH
./autogen.sh
}
function build_zip {
ARCH=$1
PKG=$2
HOST=$3
echo Building Emacs-$VERSION for $ARCH
if [ $ARCH == "i686" ]
then
PATH=/mingw32/bin:$PATH
MSYSTEM=MINGW32
fi
mkdir --parents $HOME/emacs-build/build/emacs-$VERSION/$ARCH
cd $HOME/emacs-build/build/emacs-$VERSION/$ARCH
export PKG_CONFIG_PATH=$PKG
../../../git/emacs-$BRANCH/configure \
--without-dbus \
--host=$HOST --without-compress-install \
CFLAGS="-O2 -static -g3"
make -j 8 install \
prefix=$HOME/emacs-build/install/emacs-$VERSION/$ARCH
cd $HOME/emacs-build/install/emacs-$VERSION/$ARCH
cp $HOME/emacs-build/deps/libXpm/$ARCH/libXpm-noX4.dll bin
zip -r -9 emacs-$VERSION-$ARCH-no-deps.zip *
mv emacs-$VERSION-$ARCH-no-deps.zip $HOME/emacs-upload
rm bin/libXpm-noX4.dll
unzip $HOME/emacs-build/deps/emacs-26-$ARCH-deps.zip
zip -r -9 emacs-$VERSION-$ARCH.zip *
mv emacs-$VERSION-$ARCH.zip ~/emacs-upload
}
##set -o xtrace
set -o errexit
SNAPSHOT=
BUILD_32=1
BUILD_64=1
GIT_UP=0
while getopts "36ghsV:" opt; do
case $opt in
3)
BUILD_32=1
BUILD_64=0
GIT_UP=0
;;
6)
BUILD_32=0
BUILD_64=1
GIT_UP=0
;;
g)
BUILD_32=0
BUILD_64=0
GIT_UP=1
;;
V)
VERSION=$OPTARG
;;
s)
SNAPSHOT="-snapshot"
;;
h)
echo "build-zips.sh"
echo " -3 32 bit build only"
echo " -6 64 bit build only"
echo " -g git update and worktree only"
exit 0
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
if [ -z $VERSION ];
then
echo "doing version thing"
VERSION=`
sed -n 's/^AC_INIT(GNU Emacs,[ ]*\([^ ,)]*\).*/\1/p' < ../../../configure.ac
`
fi
if [ -z $VERSION ];
then
echo Cannot determine Emacs version
exit 1
fi
MAJOR_VERSION="$(echo $VERSION | cut -d'.' -f1)"
BRANCH=$VERSION
VERSION=$VERSION$SNAPSHOT
if (($GIT_UP))
then
git_up
fi
if (($BUILD_64))
then
build_zip x86_64 /mingw64/lib/pkgconfig x86_64-w64-mingw32
fi
## Do the 64 bit build first, because we reset some environment
## variables during the 32 bit which will break the build.
if (($BUILD_32))
then
build_zip i686 /mingw32/lib/pkgconfig i686-w64-mingw32
fi

View File

@ -699,6 +699,12 @@ case "${canonical}" in
esac
;;
## QNX Neutrino
*-nto-qnx* )
opsys=qnxnto
CFLAGS="$CFLAGS -D__NO_EXT_QNX"
;;
## Intel 386 machines where we don't care about the manufacturer.
i[3456]86-*-* )
case "${canonical}" in
@ -1507,6 +1513,8 @@ case "$opsys" in
hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
qnxnto) LIBS_SYSTEM="-lsocket" ;;
sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;;
## Motif needs -lgen.
@ -2210,7 +2218,8 @@ test "$CANNOT_DUMP" = yes ||
case "$opsys" in
## darwin ld insists on the use of malloc routines in the System framework.
darwin | mingw32 | nacl | sol2-10) ;;
cygwin) hybrid_malloc=yes
cygwin | qnxto)
hybrid_malloc=yes
system_malloc= ;;
*) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;;
esac
@ -4033,9 +4042,8 @@ AC_CACHE_CHECK([for library containing tputs], [emacs_cv_tputs_lib],
[if test "${opsys}" = "mingw32"; then
emacs_cv_tputs_lib='none required'
else
# Maybe curses should be tried earlier?
# See https://debbugs.gnu.org/9736#35
for tputs_library in '' tinfo ncurses terminfo termcap curses; do
# curses precedes termcap because of AIX (Bug#9736#35) and OpenIndiana.
for tputs_library in '' tinfo ncurses terminfo curses termcap; do
OLIBS=$LIBS
if test -z "$tputs_library"; then
emacs_cv_tputs_lib='none required'
@ -4054,7 +4062,7 @@ fi])
AS_CASE(["$emacs_cv_tputs_lib"],
[no], [AC_MSG_ERROR([The required function 'tputs' was not found in any library.
The following libraries were tried (in order):
libtinfo, libncurses, libterminfo, libtermcap, libcurses
libtinfo, libncurses, libterminfo, libcurses, libtermcap
Please try installing whichever of these libraries is most appropriate
for your system, together with its header files.
For example, a libncurses-dev(el) or similar package.])],
@ -4604,7 +4612,7 @@ case $opsys in
AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
;;
gnu | openbsd )
gnu | openbsd | qnxnto )
AC_DEFINE(FIRST_PTY_LETTER, ['p'])
;;

View File

@ -1046,7 +1046,8 @@ without further confirmation."
(or (not new-modtime) ; nothing to overwrite
(equal desktop-file-modtime new-modtime)
(yes-or-no-p (if desktop-file-modtime
(if (> (float-time new-modtime) (float-time desktop-file-modtime))
(if (time-less-p desktop-file-modtime
new-modtime)
"Desktop file is more recent than the one loaded. Save anyway? "
"Desktop file isn't the one loaded. Overwrite it? ")
"Current desktop was not loaded from a file. Overwrite this desktop file? "))

View File

@ -55,7 +55,7 @@
(defun ecomplete-add-item (type key text)
(let ((elems (assq type ecomplete-database))
(now (string-to-number (format "%.0f" (float-time))))
(now (string-to-number (format-time-string "%s")))
entry)
(unless elems
(push (setq elems (list type)) ecomplete-database))

View File

@ -1269,7 +1269,8 @@ and initial semicolons."
;; case). The `;' and `:' stop the paragraph being filled at following
;; comment lines and at keywords (e.g., in `defcustom'). Left parens are
;; escaped to keep font-locking, filling, & paren matching in the source
;; file happy.
;; file happy. The `:' must be preceded by whitespace so that keywords
;; inside of the docstring don't start new paragraphs (Bug#7751).
;;
;; `paragraph-separate': A clever regexp distinguishes the first line of
;; a docstring and identifies it as a paragraph separator, so that it
@ -1282,13 +1283,7 @@ and initial semicolons."
;; `emacs-lisp-docstring-fill-column' if that value is an integer.
(let ((paragraph-start
(concat paragraph-start
(format "\\|\\s-*\\([(;%s\"]\\|`(\\|#'(\\)"
;; If we're inside a string (like the doc
;; string), don't consider a colon to be
;; a paragraph-start character.
(if (nth 3 (syntax-ppss))
""
":"))))
"\\|\\s-*\\([(;\"]\\|\\s-:\\|`(\\|#'(\\)"))
(paragraph-separate
(concat paragraph-separate "\\|\\s-*\".*[,\\.]$"))
(fill-column (if (and (integerp emacs-lisp-docstring-fill-column)

View File

@ -73,7 +73,8 @@ KEYS can also be a list of (KEY VARNAME) pairs, in which case
KEY is an unquoted form.
MAP can be a list, hash-table or array."
(declare (indent 2) (debug t))
(declare (indent 2)
(debug ((&rest &or symbolp ([form symbolp])) form body)))
`(pcase-let ((,(map--make-pcase-patterns keys) ,map))
,@body))

View File

@ -2260,6 +2260,7 @@ Otherwise no newline is inserted."
(archive (if desc (package-desc-archive desc)))
(extras (and desc (package-desc-extras desc)))
(homepage (cdr (assoc :url extras)))
(commit (cdr (assoc :commit extras)))
(keywords (if desc (package-desc--keywords desc)))
(built-in (eq pkg-dir 'builtin))
(installable (and archive (not built-in)))
@ -2332,6 +2333,8 @@ Otherwise no newline is inserted."
(and version
(package--print-help-section "Version"
(package-version-join version)))
(when commit
(package--print-help-section "Commit" commit))
(when desc
(package--print-help-section "Summary"
(package-desc-summary desc)))

View File

@ -23,6 +23,8 @@
;;; Code:
(require 'seq)
;;;###autoload
(defun read-multiple-choice (prompt choices)
"Ask user a multiple choice question.

View File

@ -757,9 +757,8 @@ callback data (if any)."
;; Restore Emacs frame on text terminal, when pinentry-curses has terminated.
(if (with-current-buffer (process-buffer (epg-context-process context))
(and epg-agent-file
(> (float-time (or (nth 5 (file-attributes epg-agent-file))
'(0 0 0 0)))
(float-time epg-agent-mtime))))
(time-less-p epg-agent-mtime
(or (nth 5 (file-attributes epg-agent-file)) 0))))
(redraw-frame))
(epg-context-set-result-for
context 'error

View File

@ -444,7 +444,6 @@ line, with the most recent command last. See also
(ignore-dups eshell-hist-ignoredups))
(with-temp-buffer
(insert-file-contents file)
;; Save restriction in case file is already visited...
;; Watch for those date stamps in history files!
(goto-char (point-max))
(while (and (< count size)
@ -488,7 +487,9 @@ See also `eshell-read-history'."
(while (> index 0)
(setq index (1- index))
(let ((start (point)))
(insert (ring-ref ring index) ?\n)
;; Remove properties before inserting, to avoid trouble
;; with read-only strings (Bug#28700).
(insert (substring-no-properties (ring-ref ring index)) ?\n)
(subst-char-in-region start (1- (point)) ?\n ?\177)))
(eshell-with-private-file-modes
(write-region (point-min) (point-max) file append

View File

@ -3947,11 +3947,12 @@ This function returns either:
;; The entry MTIME should match the most recent
;; MTIME among matching files.
(and cached-files
(= (float-time (nth 2 dir-elt))
(apply #'max (mapcar (lambda (f)
(float-time
(nth 5 (file-attributes f))))
cached-files))))))
(equal (nth 2 dir-elt)
(let ((latest 0))
(dolist (f cached-files latest)
(let ((f-time (nth 5 (file-attributes f))))
(if (time-less-p latest f-time)
(setq latest f-time)))))))))
;; This cache entry is OK.
dir-elt
;; This cache entry is invalid; clear it.
@ -3973,10 +3974,15 @@ Return the new class name, which is a symbol named DIR."
(let* ((class-name (intern dir))
(files (dir-locals--all-files dir))
(read-circle nil)
(success nil)
;; If there was a problem, use the values we could get but
;; don't let the cache prevent future reads.
(latest 0) (success 0)
(variables))
(with-demoted-errors "Error reading dir-locals: %S"
(dolist (file files)
(let ((file-time (nth 5 (file-attributes file))))
(if (time-less-p latest file-time)
(setq latest file-time)))
(with-temp-buffer
(insert-file-contents file)
(condition-case-unless-debug nil
@ -3985,18 +3991,9 @@ Return the new class name, which is a symbol named DIR."
variables
(read (current-buffer))))
(end-of-file nil))))
(setq success t))
(setq success latest))
(dir-locals-set-class-variables class-name variables)
(dir-locals-set-directory-class
dir class-name
(seconds-to-time
(if success
(apply #'max (mapcar (lambda (file)
(float-time (nth 5 (file-attributes file))))
files))
;; If there was a problem, use the values we could get but
;; don't let the cache prevent future reads.
0)))
(dir-locals-set-directory-class dir class-name success)
class-name))
(define-obsolete-function-alias 'dir-locals-read-from-file

View File

@ -2373,7 +2373,10 @@ specified by `gnus-gmane-group-download-format'."
(with-temp-file tmpfile
(url-insert-file-contents
(format gnus-gmane-group-download-format
group start (+ start range)))
group start (+ start range))
t)
;; `url-insert-file-contents' sets this because of the 2nd arg.
(setq buffer-file-name nil)
(write-region (point-min) (point-max) tmpfile)
(gnus-group-read-ephemeral-group
(format "nndoc+ephemeral:%s.start-%s.range-%s" group start range)
@ -2463,13 +2466,11 @@ the bug number, and browsing the URL must return mbox output."
(if (and (not gnus-plugged)
(file-exists-p file))
(insert-file-contents file)
(url-insert-file-contents (format mbox-url id)))))
(url-insert-file-contents (format mbox-url id) t))))
;; Add the debbugs address so that we can respond to reports easily.
(let ((address
(format "%s@%s" (car ids)
(replace-regexp-in-string
"/.*$" ""
(replace-regexp-in-string "^http://" "" mbox-url)))))
(url-host (url-generic-parse-url mbox-url)))))
(goto-char (point-min))
(while (re-search-forward (concat "^" message-unix-mail-delimiter)
nil t)
@ -2490,7 +2491,9 @@ the bug number, and browsing the URL must return mbox output."
(insert ", " address))
(insert "To: " address "\n")))
(goto-char (point-max))
(widen)))))
(widen)))
;; `url-insert-file-contents' sets this because of the 2nd arg.
(setq buffer-file-name nil)))
(gnus-group-read-ephemeral-group
(format "nndoc+ephemeral:bug#%s"
(mapconcat 'number-to-string ids ","))
@ -2514,6 +2517,8 @@ the bug number, and browsing the URL must return mbox output."
(interactive (list (string-to-number
(read-string "Enter bug number: "
(thing-at-point 'word) nil))))
(when (stringp ids)
(setq ids (string-to-number ids)))
(unless (listp ids)
(setq ids (list ids)))
(gnus-read-ephemeral-bug-group

View File

@ -582,10 +582,11 @@ Create the thumbnails directory if it does not exist."
"Return the image descriptor for a thumbnail of image file FILE."
(unless (string-match (image-file-name-regexp) file)
(error "%s is not a valid image file" file))
(let ((thumb-file (image-dired-thumb-name file)))
(unless (and (file-exists-p thumb-file)
(<= (float-time (nth 5 (file-attributes file)))
(float-time (nth 5 (file-attributes thumb-file)))))
(let* ((thumb-file (image-dired-thumb-name file))
(thumb-attr (file-attributes thumb-file)))
(when (or (not thumb-attr)
(time-less-p (nth 5 thumb-attr)
(nth 5 (file-attributes file))))
(image-dired-create-thumb file thumb-file))
(create-image thumb-file)
;; (list 'image :type 'jpeg
@ -748,10 +749,8 @@ Increase at own risk.")
'image-dired-cmd-create-thumbnail-program)
(let* ((width (int-to-string (image-dired-thumb-size 'width)))
(height (int-to-string (image-dired-thumb-size 'height)))
(modif-time
(format "%.0f"
(ffloor (float-time
(nth 5 (file-attributes original-file))))))
(modif-time (format-time-string
"%s" (nth 5 (file-attributes original-file))))
(thumbnail-nq8-file (replace-regexp-in-string ".png\\'" "-nq8.png"
thumbnail-file))
(spec

View File

@ -649,7 +649,7 @@ Do the right thing if the file has been compressed or zipped."
(attribs-new (and (stringp fullname) (file-attributes fullname)))
(modtime-new (and attribs-new (nth 5 attribs-new))))
(when (and modtime-old modtime-new
(> (float-time modtime-new) (float-time modtime-old)))
(time-less-p modtime-old modtime-new))
(setq Info-index-nodes (remove (assoc (or Info-current-file filename)
Info-index-nodes)
Info-index-nodes))

View File

@ -111,6 +111,7 @@
;;; Code:
;; Customization:
(require 'replace)
(defgroup kmacro nil
"Simplified keyboard macro user interface."

View File

@ -76,6 +76,7 @@
(setq max-lisp-eval-depth 2200)
(setq load-path (list (expand-file-name "." dir)
(expand-file-name "emacs-lisp" dir)
(expand-file-name "progmodes" dir)
(expand-file-name "language" dir)
(expand-file-name "international" dir)
(expand-file-name "textmodes" dir)

View File

@ -567,6 +567,8 @@ Responds to the window width as ls should but may not!"
(setq list (cdr list)))
result))
(defvar w32-collate-ignore-punctuation) ; Declare for non-w32 builds.
(defsubst ls-lisp-string-lessp (s1 s2)
"Return t if string S1 should sort before string S2.
Case is significant if `ls-lisp-ignore-case' is nil.
@ -861,7 +863,7 @@ Use the same method as ls to decide whether to show time-of-day or year,
depending on distance between file date and the current time.
All ls time options, namely c, t and u, are handled."
(let* ((time (nth (or time-index 5) file-attr)) ; default is last modtime
(diff (- (float-time time) (float-time)))
(diff (time-subtract time nil))
;; Consider a time to be recent if it is within the past six
;; months. A Gregorian year has 365.2425 * 24 * 60 * 60 ==
;; 31556952 seconds on the average, and half of that is 15778476.
@ -878,7 +880,8 @@ All ls time options, namely c, t and u, are handled."
(if (member locale '("C" "POSIX"))
(setq locale nil))
(format-time-string
(if (and (<= past-cutoff diff) (<= diff 0))
(if (and (not (time-less-p diff past-cutoff))
(not (time-less-p 0 diff)))
(if (and locale (not ls-lisp-use-localized-time-format))
"%m-%d %H:%M"
(nth 0 ls-lisp-format-time-list))

View File

@ -3479,7 +3479,7 @@ system TYPE.")
(f2-mt (nth 5 (file-attributes f2))))
(cond ((null f1-mt) nil)
((null f2-mt) t)
(t (> (float-time f1-mt) (float-time f2-mt)))))
(t (time-less-p f2-mt f1-mt))))
(ange-ftp-real-file-newer-than-file-p f1 f2))))
(defun ange-ftp-file-writable-p (file)
@ -3561,7 +3561,7 @@ Value is (0 0) if the modification time cannot be determined."
(let ((file-mdtm (ange-ftp-file-modtime name))
(buf-mdtm (with-current-buffer buf (visited-file-modtime))))
(or (zerop (car file-mdtm))
(<= (float-time file-mdtm) (float-time buf-mdtm))))
(not (time-less-p buf-mdtm file-mdtm))))
(ange-ftp-real-verify-visited-file-modtime buf))))
(defun ange-ftp-file-size (file &optional ascii-mode)

View File

@ -2333,7 +2333,7 @@ With a prefix arg, prompt for new topic."
(defun rcirc-ctcp-sender-PING (process target _request)
"Send a CTCP PING message to TARGET."
(let ((timestamp (format "%.0f" (float-time))))
(let ((timestamp (format-time-string "%s")))
(rcirc-send-ctcp process target "PING" timestamp)))
(defun rcirc-cmd-me (args &optional process target)

View File

@ -235,6 +235,12 @@ If NAME is a remote file name, the local part of NAME is unquoted."
((eq tramp-syntax 'sep) 'separate)
(t tramp-syntax)))
;; `cl-struct-slot-info' has been introduced with Emacs 25.
(defmacro tramp-compat-tramp-file-name-slots ()
(if (fboundp 'cl-struct-slot-info)
`(cdr (mapcar 'car (cl-struct-slot-info 'tramp-file-name)))
`(cdr (mapcar 'car (get 'tramp-file-name 'cl-struct-slots)))))
(provide 'tramp-compat)
;;; TODO:

View File

@ -660,7 +660,7 @@ Useful for \"rsync\" like methods.")
(make-variable-buffer-local 'tramp-temp-buffer-file-name)
(put 'tramp-temp-buffer-file-name 'permanent-local t)
;;;###autoload
;;;###tramp-autoload
(defcustom tramp-syntax 'default
"Tramp filename syntax to be used.
@ -674,48 +674,54 @@ Do not change the value by `setq', it must be changed only by
`custom-set-variables'. See also `tramp-change-syntax'."
:group 'tramp
:version "26.1"
:package-version '(Tramp . "2.3.2")
:package-version '(Tramp . "2.3.3")
: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.
(unless (memq value (tramp-syntax-values))
(tramp-compat-user-error "Wrong `tramp-syntax' %s" tramp-syntax))
;; Cleanup existing buffers.
(unless (eq (symbol-value symbol) value)
(tramp-cleanup-all-buffers))
;; Set the value:
(set-default symbol value)
;; Reset the depending variables.
(with-no-warnings
(setq tramp-prefix-format (tramp-build-prefix-format)
tramp-prefix-regexp (tramp-build-prefix-regexp)
tramp-method-regexp (tramp-build-method-regexp)
tramp-postfix-method-format (tramp-build-postfix-method-format)
tramp-postfix-method-regexp (tramp-build-postfix-method-regexp)
tramp-prefix-ipv6-format (tramp-build-prefix-ipv6-format)
tramp-prefix-ipv6-regexp (tramp-build-prefix-ipv6-regexp)
tramp-postfix-ipv6-format (tramp-build-postfix-ipv6-format)
tramp-postfix-ipv6-regexp (tramp-build-postfix-ipv6-regexp)
tramp-postfix-host-format (tramp-build-postfix-host-format)
tramp-postfix-host-regexp (tramp-build-postfix-host-regexp)
tramp-remote-file-name-spec-regexp
(tramp-build-remote-file-name-spec-regexp)
tramp-file-name-structure (tramp-build-file-name-structure)
tramp-file-name-regexp (tramp-build-file-name-regexp)
tramp-completion-file-name-regexp
(tramp-build-completion-file-name-regexp)))
;; Rearrange file name handlers.
(tramp-register-file-name-handlers)))
:set 'tramp-set-syntax)
(defun tramp-set-syntax (symbol value)
"Set SYMBOL to value VALUE.
Used in user option `tramp-syntax'. There are further variables
to be set, depending on VALUE."
;; Check allowed values.
(unless (memq value (tramp-syntax-values))
(tramp-compat-user-error "Wrong `tramp-syntax' %s" tramp-syntax))
;; Cleanup existing buffers.
(unless (eq (symbol-value symbol) value)
(tramp-cleanup-all-buffers))
;; Set the value:
(set-default symbol value)
;; Reset the depending variables.
(with-no-warnings
(setq tramp-prefix-format (tramp-build-prefix-format)
tramp-prefix-regexp (tramp-build-prefix-regexp)
tramp-method-regexp (tramp-build-method-regexp)
tramp-postfix-method-format (tramp-build-postfix-method-format)
tramp-postfix-method-regexp (tramp-build-postfix-method-regexp)
tramp-prefix-ipv6-format (tramp-build-prefix-ipv6-format)
tramp-prefix-ipv6-regexp (tramp-build-prefix-ipv6-regexp)
tramp-postfix-ipv6-format (tramp-build-postfix-ipv6-format)
tramp-postfix-ipv6-regexp (tramp-build-postfix-ipv6-regexp)
tramp-postfix-host-format (tramp-build-postfix-host-format)
tramp-postfix-host-regexp (tramp-build-postfix-host-regexp)
tramp-remote-file-name-spec-regexp
(tramp-build-remote-file-name-spec-regexp)
tramp-file-name-structure (tramp-build-file-name-structure)
tramp-file-name-regexp (tramp-build-file-name-regexp)
tramp-completion-file-name-regexp
(tramp-build-completion-file-name-regexp)))
;; Rearrange file name handlers.
(tramp-register-file-name-handlers))
;; Initialize the Tramp syntax variables. We want to override initial
;; values of `tramp-file-name-regexp' and
;; `tramp-completion-file-name-regexp'.
;; value of `tramp-file-name-regexp'. Other Tramp syntax variables
;; must be initialized as well to proper values. We do not call
;; `custom-set-variable', this would load Tramp via custom.el.
(eval-after-load 'tramp
'(custom-set-variables `(tramp-syntax ',(tramp-compat-tramp-syntax))))
'(tramp-set-syntax 'tramp-syntax (tramp-compat-tramp-syntax)))
(defun tramp-syntax-values ()
"Return possible values of `tramp-syntax', a list"
@ -978,7 +984,6 @@ This regexp should match Tramp file names but no other file
names. When calling `tramp-register-file-name-handlers', the
initial value is overwritten by the car of `tramp-file-name-structure'.")
;;;###autoload
(defconst tramp-completion-file-name-regexp-default
(concat
"\\`/\\("
@ -1042,10 +1047,19 @@ updated after changing this variable.
Also see `tramp-file-name-structure'.")
;;;###autoload
(defconst tramp-initial-completion-file-name-regexp
tramp-completion-file-name-regexp-default
"Value for `tramp-completion-file-name-regexp' for autoload.
It must match the initial `tramp-syntax' settings.")
(defconst tramp-autoload-file-name-regexp
(concat
"\\`/"
(if (memq system-type '(cygwin windows-nt))
;; The method is either "-", or at least two characters.
"\\(-\\|[^/|:]\\{2,\\}\\)"
;; At least one character for method.
"[^/|:]+")
":\\'")
"Regular expression matching file names handled by Tramp autoload.
It must match the initial `tramp-syntax' settings. It should not
match file names at root of the underlying local file system,
like \"/sys\" or \"/C:\".")
;; Chunked sending kludge. We set this to 500 for black-listed constellations
;; known to have a bug in `process-send-string'; some ssh connections appear
@ -1186,7 +1200,6 @@ means to use always cached values for the directory contents."
(defvar tramp-current-connection nil
"Last connection timestamp.")
;;;###autoload
(defconst tramp-completion-file-name-handler-alist
'((file-name-all-completions
. tramp-completion-handle-file-name-all-completions)
@ -1740,20 +1753,20 @@ Second arg VAR is a symbol. It is used as a variable name to hold
the filename structure. It is also used as a prefix for the variables
holding the components. For example, if VAR is the symbol `foo', then
`foo' will be bound to the whole structure, `foo-method' will be bound to
the method component, and so on for `foo-user', `foo-host', `foo-localname',
`foo-hop'.
the method component, and so on for `foo-user', `foo-domain', `foo-host',
`foo-port', `foo-localname', `foo-hop'.
Remaining args are Lisp expressions to be evaluated (inside an implicit
`progn').
If VAR is nil, then we bind `v' to the structure and `method', `user',
`host', `localname', `hop' to the components."
`domain', `host', `port', `localname', `hop' to the components."
(let ((bindings
(mapcar (lambda (elem)
`(,(if var (intern (format "%s-%s" var elem)) elem)
(,(intern (format "tramp-file-name-%s" elem))
,(or var 'v))))
'(method user domain host port localname hop))))
`,(tramp-compat-tramp-file-name-slots))))
`(let* ((,(or var 'v) (tramp-dissect-file-name ,filename))
,@bindings)
;; We don't know which of those vars will be used, so we bind them all,
@ -2281,7 +2294,6 @@ Falls back to normal file name handler if no Tramp file name handler exists."
;; we don't do anything.
(tramp-run-real-handler operation args))))
;;;###autoload
(defun tramp-completion-file-name-handler (operation &rest args)
"Invoke Tramp file name completion handler.
Falls back to normal file name handler if no Tramp file name handler exists."
@ -2304,17 +2316,9 @@ Falls back to normal file name handler if no Tramp file name handler exists."
(progn (defun tramp-register-autoload-file-name-handlers ()
"Add Tramp file name handlers to `file-name-handler-alist' during autoload."
(add-to-list 'file-name-handler-alist
(cons tramp-initial-file-name-regexp
(cons tramp-autoload-file-name-regexp
'tramp-autoload-file-name-handler))
(put 'tramp-autoload-file-name-handler 'safe-magic t)
(add-to-list 'file-name-handler-alist
(cons tramp-initial-completion-file-name-regexp
'tramp-completion-file-name-handler))
(put 'tramp-completion-file-name-handler 'safe-magic t)
;; Mark `operations' the handler is responsible for.
(put 'tramp-completion-file-name-handler 'operations
(mapcar 'car tramp-completion-file-name-handler-alist))))
(put 'tramp-autoload-file-name-handler 'safe-magic t)))
;;;###autoload
(tramp-register-autoload-file-name-handlers)
@ -2455,7 +2459,8 @@ not in completion mode."
;; Method, host name and user name completion.
;; `tramp-completion-dissect-file-name' returns a list of
;; tramp-file-name structures. For all of them we return possible completions.
;; `tramp-file-name' structures. For all of them we return possible
;; completions.
(defun tramp-completion-handle-file-name-all-completions (filename directory)
"Like `file-name-all-completions' for partial Tramp files."
@ -2536,9 +2541,9 @@ not in completion mode."
(tramp-connectable-p (expand-file-name filename directory)))
(lambda (x) (funcall predicate (expand-file-name (car x) directory))))))
;; I misuse a little bit the tramp-file-name structure in order to
;; I misuse a little bit the `tramp-file-name' structure in order to
;; handle completion possibilities for partial methods / user names /
;; host names. Return value is a list of tramp-file-name structures
;; host names. Return value is a list of `tramp-file-name' structures
;; according to possible completions. If "localname" is non-nil it
;; means there shouldn't be a completion anymore.
@ -3221,9 +3226,9 @@ User is always nil."
(car x)
(if (and (stringp (cdr x))
(file-name-absolute-p (cdr x))
(not (tramp-file-name-p (cdr x))))
(not (tramp-tramp-file-p (cdr x))))
(tramp-make-tramp-file-name
method user domain host port (cdr x))
method user domain host port (cdr x) hop)
(cdr x))))
tramp-backup-directory-alist)
backup-directory-alist)))

View File

@ -1852,7 +1852,7 @@ with a brace block."
;; struct, union, enum, or similar:
((looking-at c-type-prefix-key)
(let ((key-pos (point)))
(c-forward-token-2 1) ; over "struct ".
(c-forward-over-token-and-ws) ; over "struct ".
(cond
((looking-at c-symbol-key) ; "struct foo { ..."
(buffer-substring-no-properties key-pos (match-end 0)))

View File

@ -4297,6 +4297,47 @@ comment at the start of cc-engine.el for more info."
"\\w\\|\\s_\\|\\s\"\\|\\s|"
"\\w\\|\\s_\\|\\s\""))
(defun c-forward-over-token-and-ws (&optional balanced)
"Move forward over a token and any following whitespace
Return t if we moved, nil otherwise (i.e. we were at EOB, or a
non-token or BALANCED is non-nil and we can't move). If we
are at syntactic whitespace, move over this in place of a token.
If BALANCED is non-nil move over any balanced parens we are at, and never move
out of an enclosing paren.
This function differs from `c-forward-token-2' in that it will move forward
over the final token in a buffer, up to EOB."
(let ((jump-syntax (if balanced
c-jump-syntax-balanced
c-jump-syntax-unbalanced))
(here (point)))
(when
(condition-case nil
(cond
((/= (point)
(progn (c-forward-syntactic-ws) (point)))
;; If we're at whitespace, count this as the token.
t)
((eobp) nil)
((looking-at jump-syntax)
(goto-char (scan-sexps (point) 1))
t)
((looking-at c-nonsymbol-token-regexp)
(goto-char (match-end 0))
t)
((save-restriction
(widen)
(looking-at c-nonsymbol-token-regexp))
nil)
(t
(forward-char)
t))
(error (goto-char here)
nil))
(c-forward-syntactic-ws)
t)))
(defun c-forward-token-2 (&optional count balanced limit)
"Move forward by tokens.
A token is defined as all symbols and identifiers which aren't
@ -4326,15 +4367,11 @@ comment at the start of cc-engine.el for more info."
(if (< count 0)
(- (c-backward-token-2 (- count) balanced limit))
(let ((jump-syntax (if balanced
c-jump-syntax-balanced
c-jump-syntax-unbalanced))
(last (point))
(prev (point)))
(if (zerop count)
;; If count is zero we should jump if in the middle of a token.
(c-end-of-current-token))
(let ((here (point))
(last (point)))
(when (zerop count)
;; If count is zero we should jump if in the middle of a token.
(c-end-of-current-token))
(save-restriction
(if limit (narrow-to-region (point-min) limit))
@ -4348,43 +4385,15 @@ comment at the start of cc-engine.el for more info."
;; Moved out of bounds. Make sure the returned count isn't zero.
(progn
(if (zerop count) (setq count 1))
(goto-char last))
;; Use `condition-case' to avoid having the limit tests
;; inside the loop.
(condition-case nil
(while (and
(> count 0)
(progn
(setq last (point))
(cond ((looking-at jump-syntax)
(goto-char (scan-sexps (point) 1))
t)
((looking-at c-nonsymbol-token-regexp)
(goto-char (match-end 0))
t)
;; `c-nonsymbol-token-regexp' above should always
;; match if there are correct tokens. Try to
;; widen to see if the limit was set in the
;; middle of one, else fall back to treating
;; the offending thing as a one character token.
((and limit
(save-restriction
(widen)
(looking-at c-nonsymbol-token-regexp)))
nil)
(t
(forward-char)
t))))
(c-forward-syntactic-ws)
(setq prev last
count (1- count)))
(error (goto-char last)))
(when (eobp)
(goto-char prev)
(setq count (1+ count)))))
(goto-char here))
(while (and
(> count 0)
(c-forward-over-token-and-ws balanced)
(not (eobp)))
(setq last (point)
count (1- count)))
(if (eobp)
(goto-char last))))
count)))
(defun c-backward-token-2 (&optional count balanced limit)
@ -6424,7 +6433,8 @@ comment at the start of cc-engine.el for more info."
(not (eq (c-get-char-property (point) 'c-type)
'c-decl-arg-start)))))))
(or (c-forward-<>-arglist nil)
(c-forward-token-2)))))
(c-forward-over-token-and-ws)
(goto-char c-new-END)))))
;; Functions to handle C++ raw strings.
@ -7142,7 +7152,7 @@ comment at the start of cc-engine.el for more info."
(let ((c-promote-possible-types t)
(c-record-found-types t))
(c-forward-type))
(c-forward-token-2))))
(c-forward-over-token-and-ws))))
(c-forward-syntactic-ws)
@ -8102,12 +8112,14 @@ comment at the start of cc-engine.el for more info."
;; initializing brace lists.
(let (found)
(while
(and (progn
(and (< (point) limit)
(progn
;; In the next loop, we keep searching forward whilst
;; we find ":"s which aren't single colons inside C++
;; "for" statements.
(while
(and
(< (point) limit)
(setq found
(c-syntactic-re-search-forward
"[;:,]\\|\\s)\\|\\(=\\|\\s(\\)"
@ -8129,7 +8141,7 @@ comment at the start of cc-engine.el for more info."
(c-go-up-list-forward))
(setq brackets-after-id t))
(when found (backward-char))
t))
(<= (point) limit)))
(list id-start id-end brackets-after-id (match-beginning 1) decorated)
(goto-char here)
@ -9722,8 +9734,8 @@ comment at the start of cc-engine.el for more info."
;; identifiers?
(progn
(goto-char before-lparen)
(c-forward-token-2) ; to first token inside parens
(and
(c-forward-over-token-and-ws) ; to first token inside parens
(setq id-start (c-on-identifier)) ; Must be at least one.
(catch 'id-list
(while
@ -9735,7 +9747,7 @@ comment at the start of cc-engine.el for more info."
ids)
(c-forward-syntactic-ws)
(eq (char-after) ?\,))
(c-forward-token-2)
(c-forward-over-token-and-ws)
(unless (setq id-start (c-on-identifier))
(throw 'id-list nil)))
(eq (char-after) ?\)))))
@ -10525,10 +10537,10 @@ comment at the start of cc-engine.el for more info."
((and after-type-id-pos
(save-excursion
(when (eq (char-after) ?\;)
(c-forward-token-2 1 t))
(c-forward-over-token-and-ws t))
(setq bufpos (point))
(when (looking-at c-opt-<>-sexp-key)
(c-forward-token-2)
(c-forward-over-token-and-ws)
(when (and (eq (char-after) ?<)
(c-get-char-property (point) 'syntax-table))
(c-go-list-forward nil after-type-id-pos)

View File

@ -292,12 +292,17 @@
nil)))))
res))))
(defun c-make-font-lock-search-form (regexp highlights)
(defun c-make-font-lock-search-form (regexp highlights &optional check-point)
;; Return a lisp form which will fontify every occurrence of REGEXP
;; (a regular expression, NOT a function) between POINT and `limit'
;; with HIGHLIGHTS, a list of highlighters as specified on page
;; "Search-based Fontification" in the elisp manual.
`(while (re-search-forward ,regexp limit t)
;; "Search-based Fontification" in the elisp manual. If CHECK-POINT
;; is non-nil, we will check (< (point) limit) in the main loop.
`(while
,(if check-point
`(and (< (point) limit)
(re-search-forward ,regexp limit t))
`(re-search-forward ,regexp limit t))
(unless (progn
(goto-char (match-beginning 0))
(c-skip-comments-and-strings limit))
@ -476,7 +481,9 @@
,(c-make-font-lock-search-form
regexp highlights)))))
state-stanzas)
,(c-make-font-lock-search-form (car normal) (cdr normal))
;; In the next form, check that point hasn't been moved beyond
;; `limit' in any of the above stanzas.
,(c-make-font-lock-search-form (car normal) (cdr normal) t)
nil))))
; (eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el.
@ -1062,7 +1069,7 @@ casts and declarations are fontified. Used on level 2 and higher."
;; The following `while' fontifies a single declarator id each time round.
;; It loops only when LIST is non-nil.
(while
(and pos (setq decl-res (c-forward-declarator limit)))
(and pos (setq decl-res (c-forward-declarator)))
(setq next-pos (point)
id-start (car decl-res)
id-face (if (and (eq (char-after) ?\()
@ -1091,7 +1098,7 @@ casts and declarations are fontified. Used on level 2 and higher."
(throw 'is-function nil))
((not (eq got-type 'maybe))
(throw 'is-function t)))
(c-forward-declarator limit t)
(c-forward-declarator nil t)
(eq (char-after) ?,))
(forward-char)
(c-forward-syntactic-ws))
@ -1730,7 +1737,7 @@ casts and declarations are fontified. Used on level 2 and higher."
(c-syntactic-skip-backward "^;{}" decl-search-lim)
(c-forward-syntactic-ws)
(setq in-typedef (looking-at c-typedef-key))
(if in-typedef (c-forward-token-2))
(if in-typedef (c-forward-over-token-and-ws))
(when (and c-opt-block-decls-with-vars-key
(looking-at c-opt-block-decls-with-vars-key))
(goto-char ps-elt)

View File

@ -1834,10 +1834,15 @@ This performs fontification according to `js--class-styles'."
(save-excursion
(back-to-indentation)
(if (js--looking-at-operator-p)
(or (not (memq (char-after) '(?- ?+)))
(progn
(forward-comment (- (point)))
(not (memq (char-before) '(?, ?\[ ?\()))))
(if (eq (char-after) ?/)
(prog1
(not (nth 3 (syntax-ppss (1+ (point)))))
(forward-char -1))
(or
(not (memq (char-after) '(?- ?+)))
(progn
(forward-comment (- (point)))
(not (memq (char-before) '(?, ?\[ ?\())))))
(and (js--find-newline-backward)
(progn
(skip-chars-backward " \t")
@ -1972,8 +1977,12 @@ statement spanning multiple lines; otherwise, return nil."
(save-excursion
(back-to-indentation)
(when (not (looking-at js--declaration-keyword-re))
(when (looking-at js--indent-operator-re)
(goto-char (match-end 0)))
(let ((pt (point)))
(when (looking-at js--indent-operator-re)
(goto-char (match-end 0)))
;; The "operator" is probably a regexp literal opener.
(when (nth 3 (syntax-ppss))
(goto-char pt)))
(while (and (not at-opening-bracket)
(not (bobp))
(let ((pos (point)))

View File

@ -28,6 +28,7 @@
;;; Code:
(require 'text-mode)
(eval-when-compile (require 'cl-lib))
(defcustom case-replace t

View File

@ -546,14 +546,15 @@ See variable `server-auth-dir' for details."
;; group recorded as the owner.
(/= uid 544) (/= (user-uid) 500)))
(format "it is not owned by you (owner = %s (%d))"
(user-full-name (user-uid)) (user-uid)))
(user-full-name uid) uid))
(w32 nil) ; on NTFS?
((/= 0 (logand ?\077 (file-modes dir)))
(format "it is accessible by others (%03o)"
(file-modes dir)))
(t nil))))
(when unsafe
(error "`%s' is not a safe directory because %s" dir unsafe)))))
(error "`%s' is not a safe directory because %s"
(expand-file-name dir) unsafe)))))
(defun server-generate-key ()
"Generate and return a random authentication key.

View File

@ -349,7 +349,7 @@ In which case `remember-mailbox' should be the name of the mailbox.
Each piece of pseudo-mail created will have an `X-Todo-Priority'
field, for the purpose of appropriate splitting."
(let ((who (read-string "Who is this item related to? "))
(moment (format "%.0f" (float-time)))
(moment (format-time-string "%s"))
(desc (remember-buffer-desc))
(text (buffer-string)))
(with-temp-buffer

View File

@ -210,7 +210,7 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead."
(let ((exp (url-cookie-expires cookie)))
(and (> (length exp) 0)
(condition-case ()
(> (float-time) (float-time (date-to-time exp)))
(time-less-p nil (date-to-time exp))
(error nil)))))
(defun url-cookie-retrieve (host &optional localpart secure)

View File

@ -37,33 +37,41 @@ They must also be covered by `url-handler-regexp'."
:type '(repeat string))
(defun url-tramp-convert-url-to-tramp (url)
"Convert URL to a Tramp file name."
(let ((obj (url-generic-parse-url (and (stringp url) url))))
(if (member (url-type obj) url-tramp-protocols)
(progn
(if (url-password obj)
(password-cache-add
(tramp-make-tramp-file-name
(url-type obj) (url-user obj) (url-host obj) "")
(url-password obj))
(tramp-make-tramp-file-name
(url-type obj) (url-user obj) (url-host obj) (url-filename obj))))
url)))
"Convert URL to a Tramp file name.
If URL contains a password, it will be added to the `password-data' cache.
In case URL is not convertable, nil is returned."
(let* ((obj (url-generic-parse-url (and (stringp url) url)))
(port
(and (natnump (url-portspec obj))
(number-to-string (url-portspec obj)))))
(when (member (url-type obj) url-tramp-protocols)
(when (url-password obj)
(password-cache-add
(tramp-make-tramp-file-name
(url-type obj) (url-user obj) nil
(url-host obj) port "")
(url-password obj)))
(tramp-make-tramp-file-name
(url-type obj) (url-user obj) nil
(url-host obj) port (url-filename obj)))))
(defun url-tramp-convert-tramp-to-url (file)
"Convert FILE, a Tramp file name, to a URL."
(let ((obj (ignore-errors (tramp-dissect-file-name file))))
(if (member (tramp-file-name-method obj) url-tramp-protocols)
(url-recreate-url
(url-parse-make-urlobj
(tramp-file-name-method obj)
(tramp-file-name-user obj)
nil ; password.
(tramp-file-name-host obj)
nil ; port.
(tramp-file-name-localname obj)
nil nil t)) ; target attributes fullness.
file)))
"Convert FILE, a Tramp file name, to a URL.
In case FILE is not convertable, nil is returned."
(let* ((obj (ignore-errors (tramp-dissect-file-name file)))
(port
(and (stringp (tramp-file-name-port obj))
(string-to-number (tramp-file-name-port obj)))))
(when (member (tramp-file-name-method obj) url-tramp-protocols)
(url-recreate-url
(url-parse-make-urlobj
(tramp-file-name-method obj)
(tramp-file-name-user obj)
nil ; password.
(tramp-file-name-host obj)
port
(tramp-file-name-localname obj)
nil nil t))))) ; target attributes fullness.
;;;###autoload
(defun url-tramp-file-handler (operation &rest args)

View File

@ -320,22 +320,34 @@ WINDOW can be any window."
(defun window-normalize-buffer (buffer-or-name)
"Return buffer specified by BUFFER-OR-NAME.
BUFFER-OR-NAME must be either a buffer or a string naming a live
buffer and defaults to the current buffer."
(cond
((not buffer-or-name)
(current-buffer))
((bufferp buffer-or-name)
(if (buffer-live-p buffer-or-name)
buffer-or-name
(error "Buffer %s is not a live buffer" buffer-or-name)))
((get-buffer buffer-or-name))
(t
(error "No such buffer %s" buffer-or-name))))
BUFFER-OR-NAME must be a live buffer, a string naming a live
buffer or nil which means to return the current buffer.
This function is commonly used to process the (usually optional)
\"BUFFER-OR-NAME\" argument of window related functions where nil
stands for the current buffer."
(let ((buffer
(cond
((not buffer-or-name)
(current-buffer))
((bufferp buffer-or-name)
buffer-or-name)
((stringp buffer-or-name)
(get-buffer buffer-or-name))
(t
(error "No such buffer %s" buffer-or-name)))))
(if (buffer-live-p buffer)
buffer
(error "No such live buffer %s" buffer-or-name))))
(defun window-normalize-frame (frame)
"Return frame specified by FRAME.
FRAME must be a live frame and defaults to the selected frame."
FRAME must be a live frame or nil which means to return the
selected frame.
This function is commonly used to process the (usually optional)
\"FRAME\" argument of window and frame related functions where
nil stands for the selected frame."
(if frame
(if (frame-live-p frame)
frame
@ -343,11 +355,15 @@ FRAME must be a live frame and defaults to the selected frame."
(selected-frame)))
(defun window-normalize-window (window &optional live-only)
"Return the window specified by WINDOW.
"Return window specified by WINDOW.
If WINDOW is nil, return the selected window. Otherwise, if
WINDOW is a live or an internal window, return WINDOW; if
LIVE-ONLY is non-nil, return WINDOW for a live window only.
Otherwise, signal an error."
Otherwise, signal an error.
This function is commonly used to process the (usually optional)
\"WINDOW\" argument of window related functions where nil stands
for the selected window."
(cond
((null window)
(selected-window))

View File

@ -94,8 +94,8 @@ file:///foo/bar.jpg"
(concat (md5 (xdg-thumb-uri filename)) ".png"))
(defun xdg-thumb-mtime (filename)
"Return modification time of FILENAME as integral seconds from the epoch."
(floor (float-time (nth 5 (file-attributes filename)))))
"Return modification time of FILENAME as an Emacs timestamp."
(file-attribute-modification-time (file-attributes filename)))
;; XDG User Directories

View File

@ -6804,14 +6804,19 @@ - (void) updateFrameSize: (BOOL) delay
if (! [self isFullscreen])
{
int toolbar_height;
#ifdef NS_IMPL_GNUSTEP
// GNUstep does not always update the tool bar height. Force it.
if (toolbar && [toolbar isVisible])
update_frame_tool_bar (emacsframe);
#endif
toolbar_height = FRAME_TOOLBAR_HEIGHT (emacsframe);
if (toolbar_height < 0)
toolbar_height = 35;
extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
+ FRAME_TOOLBAR_HEIGHT (emacsframe);
+ toolbar_height;
}
if (wait_for_tool_bar)
@ -6858,11 +6863,12 @@ - (void) updateFrameSize: (BOOL) delay
SET_FRAME_GARBAGED (emacsframe);
cancel_mouse_face (emacsframe);
/* The next two lines appear to be setting the frame to the same
size as it already is. Why are they there? */
// wr = NSMakeRect (0, 0, neww, newh);
// [view setFrame: wr];
/* The next two lines set the frame to the same size as we've
already set above. We need to do this when we switch back
from non-native fullscreen, in other circumstances it appears
to be a noop. (bug#28872) */
wr = NSMakeRect (0, 0, neww, newh);
[view setFrame: wr];
// to do: consider using [NSNotificationCenter postNotificationName:].
[self windowDidMove: // Update top/left.

View File

@ -26,7 +26,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include "coding.h"
#include "syssignal.h"
static struct thread_state main_thread;
static struct thread_state alignas (GCALIGNMENT) main_thread;
struct thread_state *current_thread = &main_thread;

View File

@ -58,9 +58,11 @@ what you give them. Help stamp out software-hoarding! */
#include <sys/types.h>
#include <unistd.h>
#if !defined (__NetBSD__) && !defined (__OpenBSD__)
#include <elf.h>
#endif /* not __NetBSD__ and not __OpenBSD__ */
#ifdef __QNX__
# include <sys/elf.h>
#elif !defined __NetBSD__ && !defined __OpenBSD__
# include <elf.h>
#endif
#include <sys/mman.h>
#if defined (_SYSTYPE_SYSV)
#include <sys/elf_mips.h>
@ -222,7 +224,6 @@ unexec (const char *new_name, const char *old_name)
{
int new_file, old_file;
off_t new_file_size;
void *new_break;
/* Pointers to the base of the image of the two files. */
caddr_t old_base, new_base;
@ -326,11 +327,13 @@ unexec (const char *new_name, const char *old_name)
if (old_bss_index == -1)
fatal ("no bss section found");
void *no_break = (void *) (intptr_t) -1;
void *new_break = no_break;
#ifdef HAVE_SBRK
new_break = sbrk (0);
#else
new_break = (byte *) old_bss_addr + old_bss_size;
#endif
if (new_break == no_break)
new_break = (byte *) old_bss_addr + old_bss_size;
new_bss_addr = (ElfW (Addr)) new_break;
bss_size_growth = new_bss_addr - old_bss_addr;
new_data2_size = bss_size_growth;

View File

@ -564,6 +564,17 @@ and will be removed soon. See (elisp)Backquote in the manual.")))))))
(byte-compile-file source t)
(should (equal bytecomp-tests--foobar (cons 1 2)))))
(ert-deftest bytecomp-tests--test-no-warnings-with-advice ()
(defun f ())
(define-advice f (:around (oldfun &rest args) test)
(apply oldfun args))
(with-current-buffer (get-buffer-create "*Compile-Log*")
(let ((inhibit-read-only t)) (erase-buffer)))
(test-byte-comp-compile-and-load t '(defun f ()))
(with-current-buffer (get-buffer-create "*Compile-Log*")
(goto-char (point-min))
(should-not (search-forward "Warning" nil t))))
;; Local Variables:
;; no-byte-compile: t
;; End:

View File

@ -589,5 +589,36 @@ region."
(should (= (point) before))
(should (= (mark) after))))
(ert-deftest lisp-fill-paragraph-colon ()
"Keywords below Emacs Lisp docstrings should not be filled (Bug#24622).
Keywords inside docstrings should be filled (Bug#7751)."
(elisp-tests-with-temp-buffer
"
\(defcustom custom value
\"First\n
Second\n
=!inside=Third line\"
=!keywords=:type 'sexp
:version \"26.1\"
:group 'lisp-tests)"
(goto-char inside)
(fill-paragraph)
(goto-char keywords)
(beginning-of-line)
(should (looking-at " :type 'sexp\n :version \"26.1\"\n :")))
(elisp-tests-with-temp-buffer
"
\(defun foo ()
\"Summary.
=!inside=Testing keywords: :one :two :three\"
(body))" ; FIXME: Remove parens around body to test Bug#28937 once it's fixed
(goto-char inside)
(let ((emacs-lisp-docstring-fill-column 30))
(fill-paragraph))
(forward-line)
(should (looking-at ":three"))
(end-of-line)
(should-not (eq (preceding-char) ?\)))))
(provide 'lisp-tests)
;;; lisp-tests.el ends here

View File

@ -36,7 +36,7 @@ Each map is built from the following alist data:
Evaluate BODY for each created map.
\(fn (var map) body)"
(declare (indent 1) (debug t))
(declare (indent 1) (debug (symbolp body)))
(let ((alist (make-symbol "alist"))
(vec (make-symbol "vec"))
(ht (make-symbol "ht")))

View File

@ -0,0 +1,41 @@
;;; rmc-tests.el --- Test suite for rmc.el -*- lexical-binding: t -*-
;; Copyright (C) 2017 Free Software Foundation, Inc.
;; Author: Tino Calancha <tino.calancha@gmail.com>
;; Keywords:
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(require 'ert)
(require 'rmc)
(eval-when-compile (require 'cl-lib))
(ert-deftest test-read-multiple-choice ()
(dolist (char '(?y ?n))
(cl-letf* (((symbol-function #'read-char) (lambda () char))
(str (if (eq char ?y) "yes" "no")))
(should (equal (list char str)
(read-multiple-choice "Do it? " '((?y "yes") (?n "no"))))))))
(provide 'rmc-tests)
;;; rmc-tests.el ends here

View File

@ -0,0 +1,39 @@
;;; tests/em-hist-tests.el --- em-hist test suite
;; Copyright (C) 2017 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Code:
(require 'ert)
(require 'em-hist)
(ert-deftest eshell-write-readonly-history ()
"Test that having read-only strings in history is okay."
(let ((histfile (make-temp-file "eshell-history"))
(eshell-history-ring (make-ring 2)))
(ring-insert eshell-history-ring
(propertize "echo foo" 'read-only t))
(ring-insert eshell-history-ring
(propertize "echo bar" 'read-only t))
(unwind-protect
(eshell-write-history histfile)
(delete-file histfile))))
(provide 'em-hist-test)
;;; em-hist-tests.el ends here

View File

@ -247,6 +247,6 @@ chars"
(goto-char eshell-last-input-start)
(string= (eshell-get-old-input) "echo alpha")))
(provide 'esh-test)
(provide 'eshell-tests)
;;; tests/eshell-tests.el ends here

View File

@ -3638,8 +3638,103 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(ignore-errors (delete-file tmp-name1))
(ignore-errors (delete-directory tmp-name2 'recursive))))))
(ert-deftest tramp-test34-find-backup-file-name ()
"Check `find-backup-file-name'."
(skip-unless (tramp--test-enabled))
(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil)))
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
(tmp-name2 (tramp--test-make-temp-name nil quoted))
;; These settings are not used by Tramp, so we ignore them.
version-control delete-old-versions
(kept-old-versions (default-toplevel-value 'kept-old-versions))
(kept-new-versions (default-toplevel-value 'kept-new-versions)))
(unwind-protect
;; Use default `backup-directory-alist' mechanism.
(let (backup-directory-alist tramp-backup-directory-alist)
(should
(equal
(find-backup-file-name tmp-name1)
(list
(funcall
(if quoted 'tramp-compat-file-name-quote 'identity)
(expand-file-name
(format "%s~" (file-name-nondirectory tmp-name1))
tramp-test-temporary-file-directory)))))))
(unwind-protect
;; Map `backup-directory-alist'.
(let ((backup-directory-alist `(("." . ,tmp-name2)))
tramp-backup-directory-alist)
(should
(equal
(find-backup-file-name tmp-name1)
(list
(funcall
(if quoted 'tramp-compat-file-name-quote 'identity)
(expand-file-name
(format
"%s~"
;; This is taken from `make-backup-file-name-1'.
(subst-char-in-string
?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1)))
tmp-name2)))))
;; The backup directory is created.
(should (file-directory-p tmp-name2)))
;; Cleanup.
(ignore-errors (delete-directory tmp-name2 'recursive)))
(unwind-protect
;; Map `tramp-backup-directory-alist'.
(let ((tramp-backup-directory-alist `(("." . ,tmp-name2)))
backup-directory-alist)
(should
(equal
(find-backup-file-name tmp-name1)
(list
(funcall
(if quoted 'tramp-compat-file-name-quote 'identity)
(expand-file-name
(format
"%s~"
;; This is taken from `make-backup-file-name-1'.
(subst-char-in-string
?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1)))
tmp-name2)))))
;; The backup directory is created.
(should (file-directory-p tmp-name2)))
;; Cleanup.
(ignore-errors (delete-directory tmp-name2 'recursive)))
(unwind-protect
;; Map `tramp-backup-directory-alist' with local file name.
(let ((tramp-backup-directory-alist
`(("." . ,(file-remote-p tmp-name2 'localname))))
backup-directory-alist)
(should
(equal
(find-backup-file-name tmp-name1)
(list
(funcall
(if quoted 'tramp-compat-file-name-quote 'identity)
(expand-file-name
(format
"%s~"
;; This is taken from `make-backup-file-name-1'.
(subst-char-in-string
?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1)))
tmp-name2)))))
;; The backup directory is created.
(should (file-directory-p tmp-name2)))
;; Cleanup.
(ignore-errors (delete-directory tmp-name2 'recursive))))))
;; The functions were introduced in Emacs 26.1.
(ert-deftest tramp-test34-make-nearby-temp-file ()
(ert-deftest tramp-test35-make-nearby-temp-file ()
"Check `make-nearby-temp-file' and `temporary-file-directory'."
(skip-unless (tramp--test-enabled))
;; Since Emacs 26.1.
@ -3678,7 +3773,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(defun tramp--test-emacs26-p ()
"Check for Emacs version >= 26.1.
Some semantics has been changed for there, w/o new functions or
variables, so we check function Emacs version directly."
variables, so we check the Emacs version directly."
(>= emacs-major-version 26))
(defun tramp--test-adb-p ()
@ -3904,7 +3999,7 @@ This requires restrictions of file name syntax."
(ignore-errors (delete-directory tmp-name2 'recursive))))))
(defun tramp--test-special-characters ()
"Perform the test in `tramp-test35-special-characters*'."
"Perform the test in `tramp-test36-special-characters*'."
;; Newlines, slashes and backslashes in file names are not
;; supported. So we don't test. And we don't test the tab
;; character on Windows or Cygwin, because the backslash is
@ -3947,7 +4042,7 @@ This requires restrictions of file name syntax."
"{foo}bar{baz}"))
;; These tests are inspired by Bug#17238.
(ert-deftest tramp-test35-special-characters ()
(ert-deftest tramp-test36-special-characters ()
"Check special characters in file names."
(skip-unless (tramp--test-enabled))
(skip-unless (not (tramp--test-rsync-p)))
@ -3955,7 +4050,7 @@ This requires restrictions of file name syntax."
(tramp--test-special-characters))
(ert-deftest tramp-test35-special-characters-with-stat ()
(ert-deftest tramp-test36-special-characters-with-stat ()
"Check special characters in file names.
Use the `stat' command."
:tags '(:expensive-test)
@ -3973,7 +4068,7 @@ Use the `stat' command."
tramp-connection-properties)))
(tramp--test-special-characters)))
(ert-deftest tramp-test35-special-characters-with-perl ()
(ert-deftest tramp-test36-special-characters-with-perl ()
"Check special characters in file names.
Use the `perl' command."
:tags '(:expensive-test)
@ -3994,7 +4089,7 @@ Use the `perl' command."
tramp-connection-properties)))
(tramp--test-special-characters)))
(ert-deftest tramp-test35-special-characters-with-ls ()
(ert-deftest tramp-test36-special-characters-with-ls ()
"Check special characters in file names.
Use the `ls' command."
:tags '(:expensive-test)
@ -4017,7 +4112,7 @@ Use the `ls' command."
(tramp--test-special-characters)))
(defun tramp--test-utf8 ()
"Perform the test in `tramp-test36-utf8*'."
"Perform the test in `tramp-test37-utf8*'."
(let* ((utf8 (if (and (eq system-type 'darwin)
(memq 'utf-8-hfs (coding-system-list)))
'utf-8-hfs 'utf-8))
@ -4032,7 +4127,7 @@ Use the `ls' command."
"银河系漫游指南系列"
"Автостопом по гала́ктике")))
(ert-deftest tramp-test36-utf8 ()
(ert-deftest tramp-test37-utf8 ()
"Check UTF8 encoding in file names and file contents."
(skip-unless (tramp--test-enabled))
(skip-unless (not (tramp--test-docker-p)))
@ -4042,7 +4137,7 @@ Use the `ls' command."
(tramp--test-utf8))
(ert-deftest tramp-test36-utf8-with-stat ()
(ert-deftest tramp-test37-utf8-with-stat ()
"Check UTF8 encoding in file names and file contents.
Use the `stat' command."
:tags '(:expensive-test)
@ -4062,7 +4157,7 @@ Use the `stat' command."
tramp-connection-properties)))
(tramp--test-utf8)))
(ert-deftest tramp-test36-utf8-with-perl ()
(ert-deftest tramp-test37-utf8-with-perl ()
"Check UTF8 encoding in file names and file contents.
Use the `perl' command."
:tags '(:expensive-test)
@ -4085,7 +4180,7 @@ Use the `perl' command."
tramp-connection-properties)))
(tramp--test-utf8)))
(ert-deftest tramp-test36-utf8-with-ls ()
(ert-deftest tramp-test37-utf8-with-ls ()
"Check UTF8 encoding in file names and file contents.
Use the `ls' command."
:tags '(:expensive-test)
@ -4108,7 +4203,7 @@ Use the `ls' command."
tramp-connection-properties)))
(tramp--test-utf8)))
(ert-deftest tramp-test37-file-system-info ()
(ert-deftest tramp-test38-file-system-info ()
"Check that `file-system-info' returns proper values."
(skip-unless (tramp--test-enabled))
;; Since Emacs 27.1.
@ -4130,7 +4225,7 @@ Use the `ls' command."
(ert-fail (format "`%s' timed out" (ert-test-name (ert-running-test)))))
;; This test is inspired by Bug#16928.
(ert-deftest tramp-test38-asynchronous-requests ()
(ert-deftest tramp-test39-asynchronous-requests ()
"Check parallel asynchronous requests.
Such requests could arrive from timers, process filters and
process sentinels. They shall not disturb each other."
@ -4287,7 +4382,7 @@ process sentinels. They shall not disturb each other."
(ignore-errors (cancel-timer timer))
(ignore-errors (delete-directory tmp-name 'recursive)))))))
(ert-deftest tramp-test39-recursive-load ()
(ert-deftest tramp-test40-recursive-load ()
"Check that Tramp does not fail due to recursive load."
(skip-unless (tramp--test-enabled))
@ -4310,7 +4405,7 @@ process sentinels. They shall not disturb each other."
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument code))))))))
(ert-deftest tramp-test40-remote-load-path ()
(ert-deftest tramp-test41-remote-load-path ()
"Check that Tramp autoloads its packages with remote `load-path'."
;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el.
;; It shall still work, when a remote file name is in the
@ -4333,11 +4428,36 @@ process sentinels. They shall not disturb each other."
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument code)))))))
(ert-deftest tramp-test41-unload ()
(ert-deftest tramp-test42-delay-load ()
"Check that Tramp is loaded lazily, only when needed."
;; Tramp is neither loaded at Emacs startup, nor when completing a
;; non-Tramp file name like "/foo". Completing a Tramp-alike file
;; name like "/foo:" autoloads Tramp.
(let ((code
"(progn \
(message \"Tramp loaded: %s\" (featurep 'tramp)) \
(file-name-all-completions \"/foo\" \"/\") \
(message \"Tramp loaded: %s\" (featurep 'tramp)) \
(file-name-all-completions \"/foo:\" \"/\") \
(message \"Tramp loaded: %s\" (featurep 'tramp)))"))
(should
(string-match
"Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: t[\n\r]+"
(shell-command-to-string
(format
"%s -batch -Q -L %s --eval %s"
(expand-file-name invocation-name invocation-directory)
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument code)))))))
(ert-deftest tramp-test43-unload ()
"Check that Tramp and its subpackages unload completely.
Since it unloads Tramp, it shall be the last test to run."
:tags '(:expensive-test)
(skip-unless noninteractive)
;; The autoloaded Tramp objects are different since Emacs 26.1. We
;; cannot test older Emacsen, therefore.
(skip-unless (tramp--test-emacs26-p))
(when (featurep 'tramp)
(unload-feature 'tramp 'force)
@ -4383,7 +4503,6 @@ Since it unloads Tramp, it shall be the last test to run."
;; * file-acl
;; * file-name-case-insensitive-p
;; * file-selinux-context
;; * find-backup-file-name
;; * set-file-acl
;; * set-file-selinux-context
@ -4392,7 +4511,7 @@ Since it unloads Tramp, it shall be the last test to run."
;; * Fix `tramp-test06-directory-file-name' for `ftp'.
;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?).
;; * Fix `tramp-test28-interrupt-process', timeout doesn't work reliably.
;; * Fix Bug#16928 in `tramp-test38-asynchronous-requests'.
;; * Fix Bug#16928 in `tramp-test39-asynchronous-requests'.
(defun tramp-test-all (&optional interactive)
"Run all tests for \\[tramp]."

View File

@ -50,7 +50,7 @@
(lambda (_command) t))
((symbol-function 'process-lines)
(lambda (_program &rest _args)
(error))))
(error "some error"))))
(should-not (sql-postgres-list-databases))))
(provide 'sql-tests)

View File

@ -0,0 +1,83 @@
;;; url-tramp-tests.el --- Test suite for Tramp / URL conversion.
;; Copyright (C) 2017 Free Software Foundation, Inc.
;; Author: Michael Albinus <michael.albinus@gmx.de>
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Code:
(require 'url-tramp)
(require 'ert)
(ert-deftest url-tramp-test-convert-url-to-tramp ()
"Test that URLs are converted into proper Tramp file names."
(should
(string-equal
(url-tramp-convert-url-to-tramp "ftp://ftp.is.co.za/rfc/rfc1808.txt")
"/ftp:ftp.is.co.za:/rfc/rfc1808.txt"))
(should
(string-equal
(url-tramp-convert-url-to-tramp "ssh://user@localhost")
"/ssh:user@localhost:"))
(should
(string-equal
(url-tramp-convert-url-to-tramp "telnet://remotehost:42")
"/telnet:remotehost#42:"))
;; The password will be added to the cache. The password cache key
;; is the remote file name identification of the Tramp file.
(should
(string-equal
(url-tramp-convert-url-to-tramp "scp://user:geheim@somewhere/localfile")
"/scp:user@somewhere:/localfile"))
(let ((key
(file-remote-p
(url-tramp-convert-url-to-tramp "scp://user@somewhere/localfile"))))
(should (password-in-cache-p key))
(should (string-equal (password-read-from-cache key) "geheim"))
(password-cache-remove key)
(should-not (password-in-cache-p key)))
;; "http" does not belong to `url-tramp-protocols'.
(should-not (url-tramp-convert-url-to-tramp "http://www.gnu.org")))
(ert-deftest url-tramp-test-convert-tramp-to-url ()
"Test that Tramp file names are converted into proper URLs."
(should
(string-equal
(url-tramp-convert-tramp-to-url "/ftp:ftp.is.co.za:/rfc/rfc1808.txt")
"ftp://ftp.is.co.za/rfc/rfc1808.txt"))
(should
(string-equal
(url-tramp-convert-tramp-to-url "/ssh:user@localhost:")
"ssh://user@localhost"))
(should
(string-equal
(url-tramp-convert-tramp-to-url "/telnet:user@remotehost#42:")
"telnet://user@remotehost:42"))
;; "sftp" does not belong to `url-tramp-protocols'.
(should-not (url-tramp-convert-tramp-to-url "/sftp:user@localhost:")))
(provide 'url-tramp-tests)
;;; url-tramp-tests.el ends here

View File

@ -7,6 +7,9 @@ let c = 1,
var e = 100500,
+ 1;
// Don't misinterpret "const"
/const/
function test ()
{
return /[/]/.test ('/') // (bug#19397)
@ -135,6 +138,12 @@ if (1) {
: 4
}
// Regexp is not a continuation
bar(
"string arg1",
/abc/
)
// Local Variables:
// indent-tabs-mode: nil
// js-indent-level: 2