Paul Eggert [Sun, 6 Aug 2017 04:27:45 +0000 (21:27 -0700)]
Fix a couple of make-temp-file races
* lisp/emacs-lisp/autoload.el (autoload--save-buffer):
* lisp/emacs-lisp/bytecomp.el (byte-compile-file):
Use make-temp-file, not make-temp-name, to avoid an unlikely race
that could lose data. Remove the deletion hook as quickly as
possible after the file is renamed; though a race still remains
here, it is smaller than before.
Tino Calancha [Sun, 6 Aug 2017 04:05:16 +0000 (13:05 +0900)]
dired-revert: save line numbers instead of positions
Positions might change if the length of one dired header line
changes; this happen, for instance, if we add new files.
Instead, line numbers are invariant under shrinks/enlargements
of the file header.
https://lists.gnu.org/archive/html/emacs-devel/2017-07/msg01092.html
* lisp/dired.el (dired-save-positions): Save the line numbers at point.
(dired-restore-positions): Use forward-line to restore the original
position (Bug#27968).
* test/lisp/dired-tests.el (dired-test-bug27968): Add test.
Eli Zaretskii [Sat, 5 Aug 2017 11:22:04 +0000 (14:22 +0300)]
Make header line in some modes be sensitive to display-line-numbers
* lisp/ruler-mode.el (ruler-mode-ruler, ruler-mode-window-col):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-init-header)
(tabulated-list-print-entry): Account for the width taken by
line-number display. (Bug#27895)
Eli Zaretskii [Sat, 5 Aug 2017 09:52:55 +0000 (12:52 +0300)]
Fix a bug in 'generate-new-buffer-name'
* src/buffer.c (Fgenerate_new_buffer_name): Test IGNORE for being
nil before calling string-equal, since the latter will compare
"nil and 'nil' as equal. (Bug#27966)
* test/src/buffer-tests.el
(test-generate-new-buffer-name-bug27966): New test.
* lisp/faces.el (describe-face): Return (buffer-string). Reorder
the placement of variables/faces in describe-symbol, to put more
emphasis on the variable entry rather than the face. (Bug#24543)
Paul Eggert [Sat, 5 Aug 2017 05:46:31 +0000 (22:46 -0700)]
Merge from gnulib
This incorporates:
2017-08-04 manywarnings: port to 64-bit GCC builds of Emacs
2017-08-01 manywarnings: port to 32-bit GCC bug
* lib/gnulib.mk.in: Regenerate.
* m4/manywarnings.m4: Copy from gnulib.
Tino Calancha [Sat, 5 Aug 2017 05:04:56 +0000 (14:04 +0900)]
insert-directory-wildcard-in-dir-p: Tweak regexp
This function must return non-nil for a wildcard like '/*/*.txt'.
* lisp/files.el (insert-directory-wildcard-in-dir-p): Adjust regexp.
* test/lisp/files-tests.el (files-tests--insert-directory-wildcard-in-dir-p):
Add test.
Noam Postavsky [Fri, 4 Aug 2017 21:55:50 +0000 (17:55 -0400)]
; Fix map-tests when compiled
* test/lisp/emacs-lisp/map-tests.el (test-map-elt-testfn)
(test-map-put-testfn-alist): Make sure the lookup key is really non-eq
to the map's key, even if the code is compiled.
Tino Calancha [Fri, 4 Aug 2017 15:53:48 +0000 (00:53 +0900)]
ls-lisp: Drop eshell dependencies
Use 'file-expand-wildcards' instead of 'eshell-extended-glob' to
expand the wildcards.
Suggested by Fabrice Popineau in:
https://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00108.html
* lisp/ls-lisp.el (ls-lisp--dired): Use file-expand-wildcards.
Tino Calancha [Fri, 4 Aug 2017 13:35:29 +0000 (22:35 +0900)]
Fix dired-test-bug27631 on MS-Windows
Skip the test if Dired use 'ls' emulation with lisp. The same
bug is tested in their respective test suites: ls-lisp-tests.el
and em-ls-tests.el.
* test/lisp/dired-tests.el (dired-test-bug27631): Skip test if 'ls-lisp'
or 'eshell' features are enabled.
Eli Zaretskii [Fri, 4 Aug 2017 13:10:06 +0000 (16:10 +0300)]
Fix dired-test-bug25609 on MS-Windows
* test/lisp/dired-tests.el (dired-test-bug25609): On MS-Windows,
pass temporary files through file-truename, to avoid bogus
failures due to file-name comparison as strings.
Tino Calancha [Fri, 4 Aug 2017 05:15:51 +0000 (14:15 +0900)]
Fix 2 tests that fail in MS-Windows
https://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00018.html
* test/lisp/vc/ediff-ptch-tests.el (ediff-ptch-test-bug26084):
Add comments to explain the test logic.
Pass '--binary' option to 'patch' program in windows environments.
Check explicitely that a backup is created before compare file contents.
* test/lisp/dired-tests.el (dired-test-bug25609):
Declare variable 'dired-dwim-target' right before the test.
Add comments to explain the test logic.
Ensure, before test the bug condition, that we are displaying the
2 dired buffers created in this test, and no other dired buffer
is shown.
Paul Eggert [Fri, 4 Aug 2017 00:57:24 +0000 (17:57 -0700)]
Fix version numbers for some GnuTLS features
Problem reported by Glenn Morris (Bug#27708#58).
* src/gnutls.c (HAVE_GNUTLS_X509_SYSTEM_TRUST):
New macro. Use it instead of low-level version number checks.
(HAVE_GNUTLS_AEAD): Move here from gnutls.h, and rename from
HAVE_GNUTLS3_AEAD. All uses changed. Indent preprocessor lines.
* src/gnutls.h (HAVE_GNUTLS3_CIPHER, HAVE_GNUTLS3_DIGEST)
(HAVE_GNUTLS3_HMAC): Remove, since these were available
before GnuTLS 3.0.0 and the code checks them only if HAVE_GNUTLS3
is defined. Remove all uses; this simplifies the code a bit.
Paul Eggert [Thu, 3 Aug 2017 23:18:45 +0000 (16:18 -0700)]
Port recent rename changes to RHEL 7 + NFS
Problem reported by Ted Zlatanov in:
http://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00082.html
* src/fileio.c (Frename_file): On RHEL 7 + NFS, renameat2 can fail
with errno == EINVAL when it is not supported. So treat that case
like errno == ENOSYS. Also, when ok_if_already_exists is neither
nil nor an integer, just call plain rename; this avoids an extra
syscall to renameat2 when the latter fails with errno == EINVAL or
ENOSYS or ENOENT.
Paul Eggert [Thu, 3 Aug 2017 02:46:41 +0000 (19:46 -0700)]
Simplify configuration of HAVE_GNUTLS3 etc.
There's only one GnuTLS, so configuring these symbols at
'configure' time is overkill. Simplify things by moving their
configuration to src/gnutls.h (Bug#27708).
* configure.ac (HAVE_GNUTLS3, HAVE_GNUTLS3_HMAC, HAVE_GNUTLS3_AEAD)
(HAVE_GNUTLS3_CIPHER, HAVE_GNUTLS3_DIGEST): Move these definitions
from here ...
* src/gnutls.h: ... to here, and simplify.
Paul Eggert [Thu, 3 Aug 2017 02:13:26 +0000 (19:13 -0700)]
Default to --with-mailutils if it is installed
* configure.ac (with_mailutils): Default to 'yes' if GNU Mailutils
is installed. See:
http://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00054.html
Paul Eggert [Wed, 2 Aug 2017 20:01:58 +0000 (13:01 -0700)]
Clarify when autogen.sh should run only autoconf
* Makefile.in (configure, bootstrap): Run ‘./autogen.sh autoconf’,
not plain ‘./autogen.sh’, to make it clear that only
autoconf-related tools should be run here.
Paul Eggert [Wed, 2 Aug 2017 08:53:46 +0000 (01:53 -0700)]
When renaming a file, ask only if EEXIST or ENOSYS
* src/fileio.c (Frename_file): Avoid calling Ffile_directory_p
more than once on FILE. Use renameat_noreplace, so that we can
ask the user (and unlink and retry) only if this fails with errno
== EEXIST or ENOSYS. This avoids the need to ask the user for
permission to do an operation that will fail anyway. Simplify
computation of ok_if_already_exists for subsidiary functions.
* src/filelock.c (rename_lock_file): Prefer renameat_noreplace
if it works, as this avoids the need to link and unlink.
* src/lisp.h (renameat_noreplace): New decl.
* src/sysdep.c [HAVE_LINUX_FS_H]: Include linux/fs.h and sys/syscall.h.
(renameat_noreplace): New function.
Paul Eggert [Wed, 2 Aug 2017 08:53:46 +0000 (01:53 -0700)]
When creating a link, ask only if EEXIST
* src/fileio.c (Fadd_name_to_file, Fmake_symbolic_link):
Ask the user (and unlink and retry) only if link creation fails
with errno == EEXIST. This avoids the need to ask the user for
permission to do an operation that will fail anyway.
Tino Calancha [Wed, 2 Aug 2017 07:39:11 +0000 (16:39 +0900)]
Move dired tests using ls emulation to different files
Suggested in:
https://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00018.html
* test/lisp/dired-tests.el (dired-test-bug27693)
(dired-test-bug27762, dired-test-bug27817)
(dired-test-bug27631, dired-test-bug27843): Delete those
parts requiring either ls-lisp or eshell-ls.
* test/lisp/ls-lisp-tests.el (ls-lisp-test-bug27762)
(ls-lisp-test-bug27631, ls-lisp-test-bug27693):
Add all dired tests using ls-lisp here.
* test/lisp/eshell/em-ls-tests.el (em-ls-test-bug27631)
(em-ls-test-bug27817, em-ls-test-bug27843): New test file. Add
all dired tests using eshell-ls here.
Katsumi Yamaoka [Wed, 2 Aug 2017 03:23:49 +0000 (03:23 +0000)]
* lisp/gnus/mm-uu.el (mm-uu-org-src-code-block-extract):
Say the handle is already decoded.
cf. <yw.87lgnh5cfv.fsf@alex.chromebook> in the info-gnus-english list.
Paul Eggert [Wed, 2 Aug 2017 00:24:28 +0000 (17:24 -0700)]
Don’t worry about unlink if errno == ENOENT
* src/fileio.c (Fdelete_file):
* src/keyboard.c (Fopen_dribble_file): Do not report failure to
remove a file if unlink fails with errno == ENOENT. This can
happen even if Emacs is the only program removing the file, in
case an NFS cache overflows. The file does not exist if errno ==
ENOENT, so it is OK to proceed.
Tino Calancha [Tue, 1 Aug 2017 15:01:45 +0000 (00:01 +0900)]
Fix misalignment in Dired when dired-directory is a cons
* lisp/dired.el (dired--need-align-p, dired--align-all-files):
New defuns.
(dired-internal-noselect): Call dired--align-all-files when
dired-directory is a cons (Bug#27762).
* test/lisp/dired-tests.el (dired-test-bug27762): Test should pass.
Eli Zaretskii [Tue, 1 Aug 2017 14:45:25 +0000 (17:45 +0300)]
Fix some dired-tests.el on MS-Windows
* test/lisp/dired-tests.el (dired-test-bug27243-01)
(dired-test-bug27243-02): On MS-Windows, pass test-dir through
file-truename, to avoid bogus failures due to file-name comparison
as strings.
Tino Calancha [Tue, 1 Aug 2017 14:31:35 +0000 (23:31 +0900)]
Insert subdir content if dir-or-list is a string w/o wildcards
* lisp/eshell/em-ls.el (eshell-ls--insert-directory):
Append '("-d") into 'eshell-ls-dired-initial-args'
if 'dired-directory' is a cons or there are wildcars (Bug#27843).
* test/lisp/dired-tests.el (dired-test-bug27843): Add test.
Stephen Berman [Tue, 1 Aug 2017 12:17:44 +0000 (14:17 +0200)]
Update todo-mode defcustoms in a less hideous way
* lisp/calendar/todo-mode.el (todo-reevaluate-filelist-defcustoms)
(todo-reevaluate-default-file-defcustom)
(todo-reevaluate-category-completions-files-defcustom)
(todo-reevaluate-filter-files-defcustom): Delete these functions.
(todo-update-filelist-defcustoms): New function. This replaces
todo-reevaluate-filelist-defcustoms, using the 'custom-type'
property instead of re-evaluating the defcustoms.
(todo-add-file, todo-rename-file, todo-delete-file)
(todo-delete-category, todo-move-category)
(todo-convert-legacy-files, todo-check-file): Replace call of
todo-reevaluate-filelist-defcustoms by
todo-update-filelist-defcustoms.
(todo-show, todo-category-completions): Replace call of
todo-reevaluate-* function by use of 'custom-type' property.
Tino Calancha [Tue, 1 Aug 2017 10:00:59 +0000 (19:00 +0900)]
Add more should form calls in a failing dired test
Some dired tests fail intermittently in hydra. Add few
more should form calls for debugging.
See:
https://lists.gnu.org/archive/html/emacs-devel/2017-07/msg01092.html
* test/lisp/dired-tests.el (dired-test-bug27243-01): Add few more should
forms for debugging.
Paul Eggert [Mon, 31 Jul 2017 19:31:02 +0000 (12:31 -0700)]
Avoid most stat calls when completing file names
* admin/merge-gnulib (GNULIB_MODULES): Add d-type.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* m4/d-type.m4: New file, copied from gnulib.
* src/dired.c (DT_UNKNOWN, DT_DIR, DT_LINK)
[!HAVE_STRUCT_DIRENT_D_TYPE]: New constants.
(dirent_type): New function.
(file_name_completion): Use it, to avoid unnecessary calls to
stat-like functions on GNU/Linux and other platforms with d_type.
(file_name_completion_stat): Just follow the link; there is no
need to try first with AT_SYMLINK_NOFOLLOW since the directory
entry was already checked to exist.
dired-tests: Unload tested features after test them
Some tests are for Dired with ls-lisp or eshell-ls.
Requiring these features add an advice on `dired' and
might affect other tests.
Do not require these features at the top of the file; require
then inside the tests and unload then at the end.
* test/lisp/dired-tests.el (dired-test-bug27693)
(dired-test-bug7131, dired-test-bug27817, dired-test-bug27631):
require ls-lisp and/or eshell-ls inside the test; unload the
features at the end.
Michael Albinus [Mon, 31 Jul 2017 12:32:24 +0000 (14:32 +0200)]
Small adaptions for directory wildcards
* lisp/dired.el (dired-insert-directory): Remove "--dired"
when there are wildcards, and the directory is remote.
* test/lisp/net/tramp-tests.el (tramp--test-make-temp-name):
Adapt docstring.
(tramp-test17-dired-with-wildcards): Skip for all methods but
those from tamp-sh.p.
ls-lisp: Do not require em-glob at top of the file
Require em-glob inside 'ls-lisp--dired'. This is necessary to
not break the Emacs build.
See following thread for details:
https://lists.gnu.org/archive/html/emacs-devel/2017-07/msg01083.html
* lisp/ls-lisp.el (dired-goto-next-file)
(dired-read-dir-and-switches, eshell-extended-glob):
Add function declarations.
* lisp/eshell/em-ls.el (dired-goto-next-file): Fix function declaration.
* lisp/textmodes/css-mode.el (css-property): Inherit from
`font-lock-keyword-face' instead of `font-lock-variable-name-face' to
distinguish CSS properties from variables.
Allow Dired to handle calls like
\(dired \"~/foo/*/*.el\"), that is, with wildcards within
the directory part of the file argument (Bug#27631).
* lisp/files.el (insert-directory-wildcard-in-dir-p): New predicate.
(insert-directory-clean): New defun extracted from insert-directory.
(insert-directory)
* lisp/dired.el (dired-internal-noselect)
(dired-insert-directory): Use the new predicate; when it's true,
handle the directory wildcards with a shell call.
* lisp/eshell/em-ls.el (eshell-ls-use-in-dired): Add/remove both advices.
(eshell-ls-unload-hook): New defun. Use it in
eshell-ls-unload-hook instead of an anonymous function.
(eshell-ls--dired)
* lisp/ls-lisp.el (ls-lisp--dired):
Advice dired to handle wildcards in the directory part with both
eshell-ls and ls-lisp.
* etc/NEWS: Announce it.
* doc/emacs/dired.texi (Dired Enter): Update manual.
* test/lisp/dired-tests.el (dired-test-bug27631): Add test.
Stephen Berman [Sat, 29 Jul 2017 11:59:18 +0000 (13:59 +0200)]
artist.el: Avoid error with keyboard command invocation
* lisp/textmodes/artist.el (artist-mouse-choose-operation):
Call x-popup-menu with t instead of last-nonmenu-event as the
value of the position argument; this allows invoking the
command from the keyboard without raising an error (bug#27819).
Stephen Berman [Sat, 29 Jul 2017 11:34:47 +0000 (13:34 +0200)]
Preserve point under 'dired-auto-revert-buffer' (third case)
* lisp/files.el (find-file): Use pop-to-buffer-same-window
instead of switch-to-buffer. This preserves Dired window
point when dired-auto-revert-buffer is non-nil. (Bug#27243)
* test/lisp/dired-tests.el (dired-test-bug27243-01)
(dired-test-bug27243-02, dired-test-bug27243-03): New tests.
The first two replace a previous test that combined them; that
test intermittently fails in the Hydra build system, so maybe
separating the two cases will help locate the point of
failure. The third test involves find-file but is here
because it, like the others, is testing the effect of
dired-auto-revert-buffer.
Eli Zaretskii [Sat, 29 Jul 2017 08:25:29 +0000 (11:25 +0300)]
Improve documentation of 'occur'
* doc/emacs/search.texi (Other Repeating Search):
* lisp/replace.el (occur): Make the documentation of 'occur' be
more accurate when matches overlap. (Bug#27818)
Paul Eggert [Sat, 29 Jul 2017 07:01:02 +0000 (00:01 -0700)]
Do not worry about paxctl on newer NetBSD
Problem reported privately by Thomas Klausner.
* configure.ac (emacs_uname_r): New var. Use it to avoid paxctl
on newer NetBSD platforms, where it is not needed. Also use it to
simplify Cygwin diagnostic.
Stefan Monnier [Fri, 28 Jul 2017 16:27:00 +0000 (12:27 -0400)]
* lisp/password-cache.el (password-data): Use a hash-table
* lisp/auth-source.el (auth-source-magic): Remove.
(auth-source-forget+, auth-source-forget-all-cached): Adjust to new
format of password-data.
(auth-source-format-cache-entry): Just use a cons.
Stefan Monnier [Fri, 28 Jul 2017 16:02:01 +0000 (12:02 -0400)]
* lisp/subr.el (define-symbol-prop): New function
(symbol-file): Make it find symbol property definitions.
* lisp/emacs-lisp/pcase.el (pcase-defmacro):
* lisp/emacs-lisp/ert.el (ert-set-test): Use it instead of `put'.
(ert-describe-test): Adjust call to symbol-file accordingly.
Stefan Monnier [Fri, 28 Jul 2017 15:28:48 +0000 (11:28 -0400)]
* lisp/subr.el (method-files): Move function to cl-generic.el
* lisp/emacs-lisp/cl-generic.el (cl-generic-p): New function.
(cl--generic-method-files): New function, moved from subr.el.
* lisp/emacs-lisp/edebug.el (edebug-instrument-function): Use them.
* test/lisp/emacs-lisp/cl-generic-tests.el:
* test/lisp/subr-tests.el: Move and adjust method-files tests accordingly.
Alan Mackenzie [Thu, 27 Jul 2017 17:56:23 +0000 (17:56 +0000)]
Fix C++ class initializers not always being fontified at mode start.
The problem here happened when an "outer list" of declarations moved beyond an
"inner list" containing class initializers. These weren't being checked for
by the code.
Also, fix places in c-get-fontification-context where point is undefined.
* lisp/progmodes/cc-fonts.el (c-get-fontification-context): when argument
not-front-decl is set, test for class initializers. Also, anchor point in
places where it is moved and is otherwise undefined.
Michael Albinus [Thu, 27 Jul 2017 10:51:45 +0000 (12:51 +0200)]
Add watchdog process to tramp-test36-asynchronous-requests
* test/lisp/net/tramp-tests.el (tramp--test-timeout-handler):
New defun.
(tramp-test36-asynchronous-requests): Use a watchdog process,
listening for SIGUSR1.
Stefan Monnier [Thu, 27 Jul 2017 04:13:27 +0000 (00:13 -0400)]
* lisp/url/url-cookie.el: Use lexical-binding
(url-cookie-host-can-set-p): Remove unused var `last'.
Use string-suffix-p.
(url-cookie-list): De morgan.
(url-cookie-quit): Remove.
(url-cookie-mode): Inherit from special-mode.
(url-cookie-mode-map): Simplify accordingly.
* lisp/emacs-lisp/ert.el
(ert-results-pop-to-backtrace-for-test-at-point):
Set multibyte true, not false. This copies a
debugger-setup-buffer change from 2009-08-30, and stops the
"Backtrace for" header line containing ^X and ^Y.
Fix semantic-symref-parse-tool-output-one-line after 644cdd1aa0
* lisp/cedet/semantic/symref/grep.el
(semantic-symref-grep--line-re): Delete.
(semantic-symref-parse-tool-output-one-line):
Use regexp and group numbers from (grep-regexp-alist).