Michael Albinus [Mon, 28 Aug 2017 16:08:16 +0000 (18:08 +0200)]
Further fixes in tramp-smb.el
* lisp/net/tramp-smb.el (tramp-smb-handle-file-truename): New defun.
(tramp-smb-file-name-handler-alist): Use it.
(tramp-smb-handle-make-symbolic-link): Unquote target.
* test/lisp/net/tramp-tests.el
(tramp--test-ignore-make-symbolic-link-error): New defmacro.
(tramp-test18-file-attributes, tramp-test21-file-links)
(tramp--test-check-files): Use it.
Robert Pluim [Mon, 28 Aug 2017 07:49:56 +0000 (09:49 +0200)]
Use string-match to check for dotfiles in ido
* lisp/ido.el (ido-make-file-list): Use string-match to check
for dotfiles instead of substring, as when using tramp
simplified syntax ido-temp-list may contain empty strings.
Mark Oteiza [Mon, 28 Aug 2017 02:22:29 +0000 (22:22 -0400)]
Font-lock FDO desktop files correctly
Single and double quotes do not have a special meaning in
desktop files.
https://standards.freedesktop.org/desktop-entry-spec/latest/
* etc/NEWS: Mention new mode.
* lisp/files.el (auto-mode-alist): Split out an entry for handling
the .desktop extension with conf-desktop-mode.
* lisp/textmodes/conf-mode.el (conf-desktop-font-lock-keywords): New
variable with rules for booleans and format specifiers.
(conf-unix-mode): Remove desktop file entry example from docstring.
(conf-desktop-mode): New derived major mode.
Tom Tromey [Sun, 27 Aug 2017 18:54:01 +0000 (12:54 -0600)]
Fix auto-fill bug in js-mode
* lisp/progmodes/js.el (js-do-auto-fill): New function.
(js-mode): Set normal-auto-fill-function.
* test/lisp/progmodes/js-tests.el (js-mode-fill-comment-bug): New
test.
Noam Postavsky [Sat, 19 Aug 2017 15:45:07 +0000 (11:45 -0400)]
Disable completion while entering python multiline statements
The "legacy" completion mechanism sends newlines to the running python
process to get the list of completions, which confuses things if the
user is in the middle of entering a multiline statement (Bug#28051).
It's better to disable completion in this case.
* lisp/progmodes/python.el (python-shell--block-prompt): New variable.
(python-shell-prompt-set-calculated-regexps): Set it.
(python-shell-completion-at-point): Return 'ignore' as the completion
function when the current prompt is a block prompt.
Michael Albinus [Sun, 27 Aug 2017 17:16:58 +0000 (19:16 +0200)]
Tramp cleanup
* lisp/net/tramp-sh.el (tramp-sh-extra-args): Remove compat code.
(tramp-sh-handle-make-symbolic-link): More robust check for
TARGET remoteness.
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory):
Disable copying by tar temporarily, it doesn't work reliably.
(tramp-smb-do-file-attributes-with-stat): Resolve symlink.
(tramp-smb-handle-make-symbolic-link): Fix implementation.
Philipp Stephani [Sun, 27 Aug 2017 11:13:16 +0000 (13:13 +0200)]
Fix GdkSettings-related deprecation warnings
* src/gtkutil.c (xg_initialize): Don’t set deprecated and ignored
gtk-menu-bar-accel setting in new versions of GTK+. Use g_object_set
instead of deprecated gtk_settngs_set_string_property otherwise.
Fix 'diff-goto-source' when buffer is narrowed (Bug#21262)
* lisp/vc/diff-mode.el (diff-find-file-name): Save the current
narrowing, and widen the buffer before searching for the name of the
file corresponding to the diff.
Paul Eggert [Sun, 27 Aug 2017 06:07:01 +0000 (23:07 -0700)]
Fix over-protection of byte-compiled files
Problem reported by Sven Joachim (Bug#28244).
Also, fix similar problem for autoload files.
* lisp/emacs-lisp/autoload.el (autoload--save-buffer):
Set temp file modes to the buffer-file-name file modes (or 666
if not available) as adjusted by umask.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file):
Set temp file modes to 666 as adjusted by umask.
Tom Tromey [Sat, 26 Aug 2017 22:23:34 +0000 (16:23 -0600)]
Refine conf-toml-mode font-lock
Bug#28218
* lisp/textmodes/conf-mode.el (conf-toml-font-lock-keywords): Use
conf-toml-recognize-section. Use \s- in variable regexp.
(conf-toml-recognize-section): New function.
Paul Eggert [Sun, 27 Aug 2017 01:36:38 +0000 (18:36 -0700)]
Do not munge contents of local symbolic links
This lets Emacs deal with arbitrary local symlinks without
mishandling their contents (Bug#28156). For example,
(progn (shell-command "ln -fs '~' 'x'") (rename-file "x" "/tmp/x"))
now consistently creates a symbolic link from '/tmp/x' to '~'.
Formerly, it did that only if the working directory was on the
same filesystem as /tmp; otherwise, it expanded the '~' to
the user's home directory.
* lisp/dired.el (dired-get-filename): Use files--name-absolute-system-p
instead of rolling our own code.
* lisp/files.el (files--name-absolute-system-p): New function.
(file-truename, file-chase-links): Use it to avoid mishandling
symlink contents that begin with ~.
(copy-directory, move-file-to-trash):
Use concat rather than expand-file-name, to avoid mishandling
symlink contents that begin with ~.
* src/fileio.c (Fmake_symbolic_link): Do not expand leading "~" in the
target unless interactive. Strip leading "/:" if interactive.
(emacs_readlinkat): Do not prepend "/:" to the link target if
it starts with "/" and contains ":" before NUL.
* test/src/fileio-tests.el (try-link): Rename from try-char,
and accept a string instead of a char. All uses changed.
(fileio-tests--symlink-failure): Also test leading ~, and "/:",
to test the new behavior.
Reuben Thomas [Sat, 26 Aug 2017 23:26:28 +0000 (00:26 +0100)]
Remove invalid regexp for shell builtins for wksh
* lisp/progmodes/sh-script.el (sh-builtins): Shell built-ins have to
be literal strings, so remove a regexp for wksh. In any case, it’s a
defunct proprietary shell.
Grégory Mounié [Sat, 26 Aug 2017 08:36:58 +0000 (11:36 +0300)]
Support multi-lingual detection of SEE ALSO man sections
* lisp/man.el (Man-see-also-regexp): Add support for SEE ALSO
section detection in several langages: French, German, Spanish,
Portugese, Italian, Polish, Turkish, Japanese, Chinese. (Bug#28142)
Paul Eggert [Sat, 26 Aug 2017 04:12:37 +0000 (21:12 -0700)]
Improve expand-file-name doc
* doc/lispref/files.texi (Relative File Names, Directory Names)
(File Name Expansion):
* doc/lispref/minibuf.texi (Reading File Names):
Document expand-file-name behavior with ~ more clearly
and accurately.
* doc/misc/org.texi (Batch execution): Simplify example
script so that it does not need expand-file-name and thus
will not mishandle file names with leading ~.
Paul Eggert [Fri, 25 Aug 2017 19:44:52 +0000 (12:44 -0700)]
Fix file-attributes race on GNU hosts
* doc/lispref/files.texi (File Attributes):
Document file-attributes atomicity.
* etc/NEWS: Document the fix.
* src/dired.c (file_attributes): New args DIRNAME and FILENAME,
for diagnostics. All callers changed. On platforms like
GNU/Linux that support O_PATH, fix a race condition in
file-attributes and similar functions, so that these functions do
not return nonsense if a directory entry is replaced while getting
its attributes. On non-GNU platforms, do a better (though not
perfect) job of detecting the race, and return nil if detected.
Paul Eggert [Fri, 25 Aug 2017 16:20:52 +0000 (09:20 -0700)]
Simplify expand_and_dir_to_file
* src/fileio.c (expand_and_dir_to_file): Simplify by omitting 2nd
argument, since in practice it always has the default value. All
callers changed. Prefer C99 style decls in nearby code.
Stefan Monnier [Fri, 25 Aug 2017 06:10:53 +0000 (02:10 -0400)]
* lisp/emacs-lisp/package.el: Don't let failure stop us
(package-activate-1): Don't throw an error for missing deps.
(package-unpack): Don't bother compiling if activation failed.
(package-initialize): Report failures but keep activating other packages.
Paul Eggert [Thu, 24 Aug 2017 23:15:59 +0000 (16:15 -0700)]
Prefer ‘double’ for FP temps in xterm.c
* src/xterm.c (xm_scroll_callback, xaw_jump_callback)
(x_set_toolkit_scroll_bar_thumb)
(x_set_toolkit_horizontal_scroll_bar_thumb): Prefer ‘double’ to
‘float’ for individual local floating-point temporaries.
Reuben Thomas [Tue, 22 Aug 2017 00:46:27 +0000 (01:46 +0100)]
Avoid using string-to-multibyte in ispell.el
* lisp/textmodes/ispell.el (ispell-get-decoded-string): Use
decode-coding-string instead. Note that decode-coding-string returns a
string that satisfies multibyte-string-p even if its input is pure
ASCII and the third argument is t, so the result of
ispell-get-decoded-string is always a multibyte string.
Tino Calancha [Thu, 24 Aug 2017 15:00:20 +0000 (00:00 +0900)]
Keep face available if there are no matches
If font-lock-mode is disabled in the current buffer, and
there are no matches for REGEXP, then keep FACE available
for a next search.
* lisp/hi-lock.el (hi-lock-set-pattern): Add FACE into
hi-lock--unused-faces if font-lock-mode is disabled and
there are no matches.
* test/lisp/hi-lock-tests.el (hi-lock-test-set-pattern): Add test.
Reuben Thomas [Wed, 23 Aug 2017 10:54:34 +0000 (11:54 +0100)]
Remove old commented code and obsolete comments
* lisp/files.el (locate-dominating-files): Remove old commented
implementation from 9 years ago. Since the current version
appears (at least to me) not just more efficient but clearer than the
version removed, also delete a comment in the new version referring to
the old version. Remove old commented heuristic code,
and explanatory comments.
Alan Third [Wed, 23 Aug 2017 18:53:23 +0000 (19:53 +0100)]
Fix PNGs on macOS (bug#28176)
* src/nsimage.m (ns_load_image): Remove index check.
(EmacsImage::getAnimatedBitmapImageRep): New function.
(EmacsImage::getMetadata): Use getAnimatedBitmapImageRep.
(EmacsImage::setFrame): Use getAnimatedBitmapImageRep and check index
is valid.
The primary speedup comes from the optimizing lookup-nested-alist and
set-nested-alist for the case where the key is a string. This brings
the time down to less than half the original.
* lisp/international/mule-util.el (lookup-nested-alist)
(set-nested-alist): Use `assq' instead of `assoc' when KEYSEQ is a
string.
* lisp/international/ja-dic-cnv.el (skkdic-collect-okuri-nasi)
(skkdic-convert-okuri-nasi): Use progress-reporter functions instead
of calculating ratio of work done inline.
(skkdic-reduced-candidates): Call `char-category-set' on the first
character of the string directly, instead of using a regexp for the
character category.
(skkdic--japanese-category-set): New constant.
(skkdic-collect-okuri-nasi): Just set
`skkdic-okuri-nasi-entries-count' at once at the end rather than
updating it throughout the loop.
(skkdic-convert-postfix skkdic-convert-prefix)
skkdic-get-candidate-list, skkdic-collect-okuri-nasi)
(skkdic-extract-conversion-data): Use `match-string-no-properties'
instead of `match-string'.
Reuben Thomas [Tue, 22 Aug 2017 00:39:10 +0000 (01:39 +0100)]
Treat tests in lib-src like tests in src
* test/Makefile.in (test_template): Depend on a .c source file for a
test under lib-src, as for src. (Thanks, Glenn Morris for pointing me
in the right direction.)
Paul Eggert [Mon, 21 Aug 2017 22:34:07 +0000 (15:34 -0700)]
Port /bin/sh scripts to Solaris 10
Its /bin/sh builtin ‘test’ command does not support -e.
* autogen.sh, build-aux/git-hooks/pre-commit:
* build-aux/gitlog-to-emacslog, make-dist:
Use test -r, not test -e.
Eli Zaretskii [Mon, 21 Aug 2017 17:21:28 +0000 (20:21 +0300)]
Avoid losing the buffer restriction in flyspell-mode
* src/intervals.c (get_local_map): Don't allow C-g to quit as long
as we have the buffer widened, to make sure the restriction is
preserved. (Bug#28161)
Michael Albinus [Mon, 21 Aug 2017 15:30:33 +0000 (17:30 +0200)]
Implement `interrupt-process-functions'
* lisp/net/tramp.el (tramp-interrupt-process): Rename from
`tramp-advice-interrupt-process'. Adapt according to changed API.
(top): Add it to `interrupt-process-functions'.
* src/process.c (Finternal_default_interrupt_process): New defun.
(Finterrupt_process): Change implementation, based on
Vinterrupt_process_functions.
(Vinterrupt_process_functions): New defvar.
* test/lisp/net/tramp-tests.el (tramp-test40-unload): Do not
test removal of advice.
Eli Zaretskii [Mon, 21 Aug 2017 14:46:42 +0000 (17:46 +0300)]
Avoid floating-point exceptions while drawing underwave
* src/w32term.c (x_get_scale_factor):
* src/xterm.c (x_get_scale_factor): Don't let the scale factors
become less than 1. Reported by Yuri D'Elia <wavexx@thregr.org> in
http://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00459.html.
Dmitry Gutov [Sun, 20 Aug 2017 21:39:22 +0000 (00:39 +0300)]
Fix byte-compilation warnings in semantic/symref/grep
* lisp/cedet/semantic/symref/grep.el (greppattern): Remove.
(grepflags): Rename to semantic-symref-grep-flags.
(semantic-symref-grep-expand-keywords): Update accordingly.
(semantic-symref-grep-use-template): Remove the last two
arguments to make sure they don't shadow the (not renamed)
global variables.
(semantic-symref-perform-search)
(semantic-symref-parse-tool-output-one-line): Use slot names
instead of keywords, like the byte-compiler wants us to.
Noam Postavsky [Tue, 15 Aug 2017 21:49:10 +0000 (17:49 -0400)]
Work around w32-python-2.x bug to fix prompt detection (Bug#21376)
* lisp/progmodes/python.el (python-shell-prompt-detect): Don't put
carriage returns into the temporary file when running in unbuffered
mode, the w32 build of python 2.7 chokes on them.
Noam Postavsky [Wed, 16 Aug 2017 11:06:38 +0000 (07:06 -0400)]
; Remove python-shell-calculate-command-1 test
* test/lisp/progmodes/python-tests.el
(python-shell-calculate-pythonpath-1): Remove, it merely reprises the
body of `python-shell-calculate-command' and it has been broken on w32
since the fix for Bug#25025 was applied.
Reuben Thomas [Sun, 4 Dec 2016 22:39:27 +0000 (22:39 +0000)]
Add Enchant support to ispell.el (Bug#17742)
* lisp/textmodes/ispell.el (ispell-program-name): Add “enchant”.
(ispell-really-enchant): Add variable.
(ispell-check-version): If using Enchant, check it’s new enough (at
least 1.6.1). (Like the ispell check, this is absolute: cannot work
without.)
(ispell-enchant-dictionary-alist): Add variable.
(ispell-find-enchant-dictionaries): Add function, based on
ispell-find-aspell-dictionaries.
(ispell-set-spellchecker-params): Allow dictionary auto-detection for
Enchant, and call ispell-find-enchant-dictionaries to find them. Use
old ispell name to locale mapping code for Enchant too.
(ispell-send-replacement): Make it work with Enchant.
Noam Postavsky [Sat, 19 Aug 2017 11:36:05 +0000 (07:36 -0400)]
Stop printing '4' in .elc files after 'define-symbol-prop' calls
* lisp/emacs-lisp/bytecomp.el (byte-compile-define-symbol-prop):
Return nil in case we have compiled the form, to prevent a redundant
constant from getting added to the compiled output.
Paul Eggert [Sun, 20 Aug 2017 00:57:00 +0000 (17:57 -0700)]
Change recent symlink tests to just test ASCII
* test/src/fileio-tests.el (fileio-tests--symlink-failure):
Be less ambitious about testing non-ASCII chars and encoding
errors, as there are too many portability issues.
Paul Eggert [Sun, 20 Aug 2017 00:15:52 +0000 (17:15 -0700)]
Don’t adjust CRLF in file names
* doc/misc/gnus.texi (Non-ASCII Group Names):
* etc/NEWS:
* test/lisp/net/tramp-tests.el (tramp--test-utf8):
Use utf-8-unix, not utf-8, for default-file-name-coding-system, so
that CRLF in file names is left alone.
* lisp/international/mule-cmds.el (set-default-coding-systems):
Do not alter CRLF in file name coding systems.
(prefer-coding-system): Ignore differences in CRLF processing when
checking whether we used the user-specified file name coding system.
* test/src/fileio-tests.el: New file.
Eli Zaretskii [Sat, 19 Aug 2017 11:05:51 +0000 (14:05 +0300)]
Improve support of display-line-numbers in package.el
* lisp/emacs-lisp/package.el (package-menu--refresh): Redisplay
the header. (Bug#27895)
* lisp/emacs-lisp/tabulated-list.el
(tabulated-list-line-number-width): Fix the case when
display-line-numbers is nil.
Eli Zaretskii [Sat, 19 Aug 2017 10:37:31 +0000 (13:37 +0300)]
Improve support of display-line-numbers in tabulated-list-mode
* lisp/emacs-lisp/tabulated-list.el
(tabulated-list-line-number-width): New function.
(tabulated-list-init-header, tabulated-list-print-entry): Use it.
(Bug#27895)
Martin Rudalics [Sat, 19 Aug 2017 09:23:10 +0000 (11:23 +0200)]
Fix one more issue reported by Alex (Bug#27999)
* doc/lispref/windows.texi (Preserving Window Sizes)
(Window Parameters): Use the term `window-preserved-size'
instead of `preserved-size' (Bug#27999).
Martin Rudalics [Sat, 19 Aug 2017 08:55:04 +0000 (10:55 +0200)]
Fix two side window problems noted by Alex (Bug#27999)
* lisp/window.el (display-buffer-in-side-window): Fix doc-string
typo.
(delete-other-windows): Rename the `no-delete-other-window'
parameter to `no-delete-other-windows' (see the discussion in
Bug#27999 for the rationale of this change).
* doc/lispref/windows.texi (Deleting Windows)
(Frame Layouts with Side Windows, Window Parameters): Rename
`no-delete-other-window' to `no-delete-other-windows'.
Paul Eggert [Sat, 19 Aug 2017 07:48:28 +0000 (00:48 -0700)]
Clarify behavior of symlinks and directories
* doc/lispref/files.texi (Saving Buffers): Document how functions
like rename-file work with symlinks and directories. This patch
attempts to document the current behavior better, in preparation
for possibly changing it. See Bug#27986.
Paul Eggert [Sat, 19 Aug 2017 03:36:10 +0000 (20:36 -0700)]
Improve make-temp-file performance on local files
* lisp/files.el (make-temp-file): Let make-temp-file-internal do
the work of inserting the text.
* src/fileio.c (Fmake_temp_file_internal): New arg TEXT.
All callers changed.
Ted Zlatanov [Sat, 19 Aug 2017 01:55:11 +0000 (21:55 -0400)]
Fix and document make-temp-file optional text parameter
* lisp/files.el (make-temp-file): Fix initial TEXT parameter.
(files--make-magic-temp-file): Support optional TEXT parameter.
* etc/NEWS: Document it.
* doc/lispref/files.texi: Document it.
* test/lisp/auth-source-tests.el: Minor reformat.