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.
João Távora [Thu, 17 Aug 2017 09:44:38 +0000 (10:44 +0100)]
Fix default value of electric-pair-pairs and electric-pair-text-pairs
Fixes: debbugs:24901
A previous change, titled "Add support for curly quotation marks to
electric-pair-mode", attempted to add these characters to the default
value of these variables. But it did so in a quoted list, preventing
evaluation of the relevant expressions and resulting in an invalid
format.
* lisp/elec-pair.el (electric-pair-pairs, electric-pair-text-pairs):
Use backquote and comma.
Ted Zlatanov [Fri, 18 Aug 2017 22:30:37 +0000 (18:30 -0400)]
Add auth-source tests and codify its API better
The auth-source behavior was unclear in some API use cases, so these
extra tests codify and test it. For details see
https://github.com/DamienCassou/auth-password-store/issues/29
* lisp/files.el (make-temp-file): Add new initial TEXT parameter.
* test/lisp/auth-source-tests.el (auth-source-test-searches): Add
auth-source tests and simplify them with the new `make-temp-file'.
Eli Zaretskii [Fri, 18 Aug 2017 09:33:08 +0000 (12:33 +0300)]
Don't call the same hook twice due to obsolete aliases
* lisp/international/robin.el (robin-activate):
* lisp/international/quail.el (quail-activate):
* lisp/international/mule-cmds.el (deactivate-input-method):
* lisp/emulation/viper-init.el (viper-deactivate-input-method):
Don't call the same hook twice, when the obsolete and the
advertised symbols are aliased. (Bug#28118)
Felipe Ochoa [Fri, 18 Aug 2017 09:05:12 +0000 (12:05 +0300)]
A new face for show-paren in expression mode
* lisp/faces.el (show-paren-match-expression): Define the new face.
* lisp/paren.el (show-paren-function): Apply the different face
when in expression mode. (Bug#28047)
Eli Zaretskii [Fri, 18 Aug 2017 08:32:10 +0000 (11:32 +0300)]
Implement HiDPI support for underwave on MS-Windows
* src/w32term.c (x_get_scale_factor): New function.
(w32_draw_underwave): Use it.
* src/xterm.c (x_draw_underwave): Offset the wave starting point
to make it identical with original code.
Mark Oteiza [Fri, 18 Aug 2017 00:00:52 +0000 (20:00 -0400)]
Treat control characters in JSON strings as invalid
* lisp/json.el (json-peek): Reduce to following-char.
(json-pop, json-read): Zero (null char) means end of file.
(json-read-escaped-char): Delimit URL properly.
(json-read-string): Signal error for ASCII control characters.
* test/lisp/json-tests.el (test-json-peek): Check for zero instead of
:json-eof symbol.
(test-json-read-string): New test for control characters in JSON
strings.
João Távora [Thu, 17 Aug 2017 13:18:00 +0000 (14:18 +0100)]
Add flymake-backends defcustom
* lisp/progmodes/flymake-proc.el (flymake-proc-can-syntax-check-buffer):
Rename from flymake-can-syntax-check-file. Suitable for adding to
flymake-backends.
(flymake-proc-start-syntax-check): Rename from
flymake-start-syntax-check. Don't check again if buffer can be
checked.
(add-to-list flymake-backends): Hook only flymake-ui.el
* lisp/progmodes/flymake-ui.el (flymake-backends): New
defcustom.
(flymake-on-timer-event, flymake-after-change-function)
(flymake-after-save-hook, flymake-find-file-hook): Call new
flymake--start-syntax-check-buffer and
flymake--can-syntax-check-buffer.
(flymake-mode): Call flymake--can-syntax-check-buffer and set
flymake-backend.
(flymake--backend): New buffer-local variable.
Paul Eggert [Wed, 16 Aug 2017 20:55:46 +0000 (13:55 -0700)]
Merge from Gnulib; use ‘open’ for O_CLOEXEC
This incorporates:
2017-08-15 renameat: ensure declaration in <stdio.h> on NetBSD
2017-08-15 extensions: enable NetBSD specific extensions
2017-08-14 open: support O_CLOEXEC
2017-08-13 reallocarray: new module
* admin/merge-gnulib (AVOIDED_MODULES): Remove ‘open’, since
it now supports O_CLOEXEC and this simplifies Emacs.
* build-aux/config.guess, lib/fcntl.in.h, lib/stdio.in.h:
* lib/stdlib.in.h, m4/extensions.m4, m4/stdlib_h.m4:
Copy from Gnulib.
* lib/cloexec.c, lib/cloexec.h, lib/open.c:
* m4/mode_t.m4, m4/open-cloexec.m4, m4/open.m4:
New files, copied from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib-src/etags.c (O_CLOEXEC) [WINDOWSNT]:
Remove, as Gnulib does this for us.
* src/filelock.c (create_lock_file):
* src/sysdep.c (emacs_open, emacs_pipe):
Don’t worry about O_CLOEXEC == 0, as Gnulib no longer sets it to 0.
Alan Third [Thu, 6 Jul 2017 22:10:49 +0000 (23:10 +0100)]
Allow use of run-time OS version checks on macOS (bug#27810)
* src/nsterm.h (NSWindowTabbingMode): Define in pre-Sierra macOS.
(MAC_OS_X_VERSION_10_6, MAC_OS_X_VERSION_10_7, MAC_OS_X_VERSION_10_8,
MAC_OS_X_VERSION_10_9, MAC_OS_X_VERSION_10_12, HAVE_NATIVE_FS): Remove
defines.
(NSWindowStyleMaskFullScreen,
NSWindowCollectionBehaviorFullScreenPrimary,
NSApplicationPresentationFullScreen,
NSApplicationPresentationAutoHideToolbar): Define in macOS 10.6.
* src/nsterm.m (colorForEmacsRed, colorUsingDefaultColorSpace,
check_native_fs, ns_read_socket, ns_select, runAlertPanel,
initFrameFromEmacs, windowDidMiniaturize, windowDidEnterFullScreen,
windowDidExitFullScreen, isFullscreen, updateCollectionBehavior,
toggleFullScreen, constrainFrameRect, scrollerWidth, syms_of_nsterm):
Allow use of run-time checks and replace version check macros.
* src/nsfns.m (ns_screen_name): Use run-time OS version checks.
* src/macfont.m (macfont_draw): Use run-time OS version checks.
* src/nsmenu.m (menuWillOpen): Use run-time OS version checks.
Co-authored-by: Charles A. Roelli <charles@aurox.ch>
* test/lisp/progmodes/elisp-mode-tests.el
(elisp-mode-tests--face-propertized-string): New function.
(elisp--highlight-function-argument-indexed)
(elisp--highlight-function-argument-keyed-1)
(elisp--highlight-function-argument-keyed-2): New tests.
* lisp/progmodes/elisp-mode.el (elisp--highlight-function-argument):
Only switch to keyword-based searching if INDEX point beyond `&key' in
the argument list. All arguments prior to the `&key' are position
based. Additionally, be more strict about what is a keyword when
searching for the current keyword.
Paul Eggert [Tue, 15 Aug 2017 20:31:03 +0000 (13:31 -0700)]
Do not assume regular Git .git/hooks dir
Apparently Gitlab doesn’t create .git/hooks, like regular Git does.
Problem reported by Ted Zlatanov in:
http://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00380.html
* autogen.sh (git_sample_hook_src): New function. Use it to work
even if .git/hooks or its samples do not exist.
Paul Eggert [Tue, 15 Aug 2017 17:06:44 +0000 (10:06 -0700)]
New manual section "Copying and Naming"
* doc/emacs/files.texi (Copying and Naming):
New section, split off from Misc File Ops and containing the
operations that copy, name or rename files. This fixes some
confusion caused by the incorrect phrase "The same rule applies
to all the remaining commands in this section" in the old manual.
This change does not affect the confusion about directories (see
Bug#27986 for ongoing discussion).
* lisp/textmodes/less-css-mode.el (less-css): Tweak docstring.
(less-css-lessc-command): Tweak docstring. Don't mark it as
safe. Don't autoload.
(less-css-compile-at-save, less-css-lessc-options)
(less-css-output-directory): Tweak docstrings. Don't autoload.
(less-css-output-file-name): Tweak docstring. Don't mark it as safe.
(less-css-input-file-name): Tweak docstring. Don't autoload.
(less-css-compile-maybe): Use `when' for one-armed `if'.
(less-css--output-path): Tweak docstring.
(less-css--maybe-shell-quote-command): Remove function.
(less-css-compile): Don't autoload. Tweak docstring and message. Fix
compiler warning. Use `string-join' instead of `mapconcat'.
(less-css-font-lock-keywords): Use `font-lock-variable-name-face' for
variables.
(less-css-mode-syntax-table, less-css-mode-map): New variables.
(less-css-mode): Change status line mode name from "LESS" to
"Less". Tweak docstring. Move syntax table definitions to
`less-css-mode-syntax-table'.
(less-css-indent-line): Remove function.
Paul Eggert [Tue, 15 Aug 2017 01:16:04 +0000 (18:16 -0700)]
Improve rename-file port to macOS
* src/fileio.c (Frename_file): On macOS, renameat_noreplace can
fail with errno == ENOTSUP on file systems where it is not
supported, according to the Apple documentation.
Speed up ./configure with more caching (Bug#27960)
* configure.ac: Cache the 'GTK compiles', 'GSettings is in gio',
'LN_S', '-znocombreloc', 'sysinfo', 'gcc autodepends', '-b link',
'Xkb', 'Xpm preprocessor', 'tputs library' 'GLib', 'signals via
characters', and 'Windows API header' checks. Remove pause after
warning about GTK bug.
Paul Eggert [Mon, 14 Aug 2017 22:25:13 +0000 (15:25 -0700)]
Improve rename-file behavior on macOS
Problem reported by Philipp Stephani (Bug#27986).
* src/fileio.c (Frename_file):
Worry about file name case sensitivity only if CYGWIN or DOS_NT.
* src/sysdep.c (renameat_noreplace): Use renameatx_np on macOS,
since this provides the necessary atomicity guarantees.