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).
Mark Oteiza [Tue, 25 Jul 2017 00:17:50 +0000 (20:17 -0400)]
; Fix previous commit
Functions prefixed with `turn-on-foo' are quite old, and in general
subsumed by the corresponding `foo-mode` command.
* lisp/display-line-numbers.el (turn-on-display-line-numbers-mode):
Rename with library prefix, mark as internal. Nix autoload.
Stefan Monnier [Mon, 24 Jul 2017 22:10:02 +0000 (18:10 -0400)]
* lisp/progmodes/perl-mode.el: Add support for indented here docs
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function):
Recognize the new <<~ syntax for indented here docs.
(perl-syntax-propertize-special-constructs): Adjust search of the
end of here docs accordingly.
* test/manual/indent/perl.perl: Add test for indented here docs.
Michael Albinus [Mon, 24 Jul 2017 17:38:17 +0000 (19:38 +0200)]
Fix Bug#27371
* lisp/loadhist.el (loadhist-unload-element): Declare for
different entry types of `load-history'.
(loadhist--restore-autoload): New variable.
(loadhist--unload-function): New defun.
(unload-feature): Use `loadhist-unload-element'. Recommended by
Stefan Monnier. (Bug#27371)
* test/lisp/net/tramp-tests.el (tramp-test39-unload):
Check, that the `tramp-file-name' structure has been unloaded.
Enable GUI Emacs without 'make install' on macOS (Bug #27645)
* nextstep/INSTALL: Correct it, and mention that Emacs can be run
from 'src/emacs'.
* src/nsterm.m (applicationDidFinishLaunching:): When Emacs is
launched outside of a macOS application bundle, change its
activation policy from the default 'prohibited' to 'regular'.
Alan Mackenzie [Sun, 23 Jul 2017 13:48:36 +0000 (13:48 +0000)]
Convert CC Mode's c-found-types from an obarray to a hash table.
* lisp/progmodes/cc-engine.el (c-clear-found-types): create a hash table
rather than an obarray.
(c-copy-found-types): Remove.
(c-add-type, c-unfind-type, c-check-type, c-list-found-types): Amend to use
the new hash table.
(c-forward-<>-arglist): Use copy-hash-table rather than c-copy-found-types.
* lisp/net/shr.el (shr-put-image): Display svg images as svg
(bug#27799). I suspect the previous change was checked in by
accident in conjuction with some other svg changes.
Don't automatically enable Gconf if Gsettings was found
* configure.ac (HAVE_GCONF) [HAVE_GSETTINGS]:
Don't test for Gconf unless specifically requested.
Gconf was deprecated in favor of Gsettings several years ago.
Michael Albinus [Sat, 22 Jul 2017 18:24:24 +0000 (20:24 +0200)]
Add line numbers display to the Options menu
* lisp/menu-bar.el (toggle-display-line-numbers): Remove.
(menu-bar-display-line-numbers-mode): New defun.
(menu-bar-showhide-line-numbers-menu): New defvar.
(menu-bar-showhide-menu): Use `menu-bar-showhide-line-numbers-menu'
Noam Postavsky [Wed, 7 Jun 2017 23:59:09 +0000 (19:59 -0400)]
Signal error for symbol names with strange quotes (Bug#2967)
* src/lread.c (read1): Signal an error when a symbol starts with a
non-escaped quote-like character.
* test/src/lread-tests.el (lread-tests--funny-quote-symbols): New
test.
* etc/NEWS: Announce change.
Add a minor mode interface for display-line-numbers
* lisp/cus-start.el: Use the new display-line-numbers group.
* lisp/display-line-numbers.el: New file.
* doc/emacs/custom.texi (Init Rebinding): Re-add entry that used to
belong to linum-mode.
* doc/emacs/modes.texi (Minor Modes): Summarize the mode.
* etc/NEWS: Document display-line-numbers-mode and its customization
variables, and mention that display-line-numbers-width is
buffer-local.
* src/xdisp.c (syms_of_xdisp) <display-line-numbers-width>: Fix a
typo.
* lisp/progmodes/ld-script.el: (ld-script-keywords): New commands
NOCROSSREFS_TO and HIDDEN added. Fix documentation sections
numbers for PROVIDE/PROVIDE_HIDDEN commands.
(ld-script-builtins): New builtin function LOG2CEIL added.
Eli Zaretskii [Sat, 22 Jul 2017 08:24:05 +0000 (11:24 +0300)]
Doc fixes for kmacro.el functions
* lisp/kmacro.el (kmacro-start-macro, kmacro-call-macro)
(kmacro-end-and-call-macro): Don't use "permanent name", as that
could be misinterpreted. (Bug#27492)
Andrew L. Moore [Sat, 22 Jul 2017 07:34:18 +0000 (10:34 +0300)]
Introduce defcustom 'executable-prefix-env'
* lisp/progmodes/executable.el (executable-prefix): Update the doc
string.
(executable-prefix-env): New defcustom.
(executable-set-magic): Use executable-prefix-env.
Stefan Monnier [Fri, 21 Jul 2017 16:54:07 +0000 (18:54 +0200)]
Use lexical-binding in todo-mode.el
Adjust code accordingly and make various minor improvements.
* lisp/calendar/todo-mode.el: Enable lexical-binding.
(dayname, monthname, day, month, year): Make forward defvars
of these keywords from macros defined in calendar.el; wrap
them in with-no-warnings.
(todo-files, todo-files-function, todo-date-pattern)
(todo-mode-line-function, todo-show, todo-forward-category)
(todo-edit-item--header, todo-set-category-number)
(todo-adjusted-category-label-length)
(todo-total-item-counts, todo-filter-items)
(todo-print-buffer-function, todo-convert-legacy-date-time)
(todo-category-number, todo-category-completions)
(todo-read-file-name, todo-read-category)
(todo-validate-name, todo-read-date)
(todo-set-show-current-file, todo-modes-set-1)
(todo-modes-set-2, todo-modes-set-3, todo-mode):
Use #' instead of ' to quote functions.
(todo-files): Use \' instead of $ in regexp.
(todo--files-type-list): New function.
(todo-default-todo-file, todo-category-completions-files)
(todo-filter-files, todo-multiple-filter-files)
(todo-reevaluate-default-file-defcustom)
(todo-reevaluate-category-completions-files-defcustom)
(todo-reevaluate-filter-files-defcustom): Use it.
(todo-show, todo-rename-file, todo-move-category)
(todo-edit-item--text, todo-edit-quit, todo-edit-item--header)
(todo-item-undone, todo-unarchive-items, todo-search)
(todo-filter-items, todo-filter-items-1, todo-find-item)
(todo-category-select, todo-read-date)
(todo-nondiary-marker-matcher, todo-date-string-matcher)
(todo-diary-expired-matcher, todo-convert-legacy-files)
(todo-read-category): Reformat to avoid code hiding behind a
more deeply embedded element.
(todo-forward-category, todo-set-category-number):
Use 'funcall' instead of 'apply'.
(todo-toggle-mark-item, todo-edit-item--diary-inclusion)
(todo-edit-category-diary-inclusion)
(todo-insert-sort-button, todo-insert-category-line)
(todo-multiple-filter-files): Mark unused local variables.
(todo-edit-item--header, todo-move-item, todo-print-buffer)
(todo-edit-item--header, todo-move-item, todo-check-file)
(todo-edit-item--next-key): Remove unused local variables.
(todo-insert-sort-button, todo-insert-category-line):
Use a closure instead of a backquoted lambda.
(todo-update-categories-display, todo-print-buffer): Simplify code.
(todo-print-buffer-function): Document calling convention.
(todo-category-completions): Use cl-pushnew instead of add-to-list.
(todo-mode-map, todo-archive-mode-map)
(todo-categories-mode-map, todo-filtered-items-mode-map):
Remove superfluous call of suppress-keymap, since it's already
in the parent special-mode-map.
* lisp/dired.el (dired-internal-noselect): Revert buffer if DIR-OR-LIST
is a cons, or dired-directory is a cons and DIR-OR-LIST a string (Bug#7131).
Update the comments.
* test/lisp/dired-tests.el (dired-test-bug7131): Test should pass.
* lisp/eshell/em-prompt.el (eshell-next-prompt): Search for
`eshell-prompt-regexp' (and `read-only' text-property if
`eshell-highlight-prompt' is set) rather than trying to use
`forward-paragraph'.
(eshell-previous-prompt): Don't count prompt on current line.