Alan Third [Sat, 23 Sep 2017 18:43:58 +0000 (19:43 +0100)]
Fix undecorated frame resizing issues on NS (bug#28512)
* src/nsterm.m (EmacsView::updateFrameSize): Don't wait for the
toolbar on undecorated frames.
(EmacsView::initFrameFromEmacs): Group window flags correctly.
Eli Zaretskii [Fri, 22 Sep 2017 14:52:47 +0000 (17:52 +0300)]
Fix restoring in GUI sessions desktop saved in TTY sessions
* lisp/frameset.el (frameset-filter-font-param): New function.
(frameset-persistent-filter-alist): Use it for processing the
'font' frame parameter. (Bug#17352)
Mark Oteiza [Fri, 22 Sep 2017 02:47:24 +0000 (22:47 -0400)]
Expose viewing conditions in CAM02-UCS metric
Also add tests from the colorspacious library. Finally, catch an
errant calculation, where degrees were not being converted to radians.
* src/lcms.c (deg2rad, default_viewing_conditions):
(parse_viewing_conditions): New functions.
(lcms-cam02-ucs): Add comments pointing to references used. Expand
the docstring and explain viewing conditions. JCh hue is given in
degrees and needs to be converted to radians.
(lcms-d65-xyz): Remove. No need to duplicate this in Lisp or make the
API needlessly impure.
* test/src/lcms-tests.el: Reword commentary.
(lcms-rgb255->xyz): New function.
(lcms-cri-cam02-ucs): Fix let-binding.
(lcms-dE-cam02-ucs-silver): New test, assimilated from colorspacious.
* lisp/emacs-lisp/ert-x.el (ert-with-message-capture): Capture
messages from prin1, princ and print.
(ert--make-message-advice): New function.
(ert--make-print-advice): New function.
Tak Kunihiro [Thu, 21 Sep 2017 08:26:00 +0000 (11:26 +0300)]
Support setting region from secondary selection and vice versa
* lisp/mouse.el (secondary-selection-exist-p): New function to
allow callers to tell existence of the secondary selection
in current buffer.
(secondary-selection-to-region): New function to set
beginning and end of the region from those of the secondary
selection.
(secondary-selection-from-region): New function to set
beginning and end of the secondary selection from those of
the region. (Bug#27530)
Paul Eggert [Wed, 20 Sep 2017 18:49:12 +0000 (11:49 -0700)]
Fix new copy-directory bug with empty dirs
Problem reported by Afdam Plaice (Bug#28520) and by Eli Zaretskii
(Bug#28483#34). This is another bug that I introduced in my
recent copy-directory changes.
* lisp/files.el (copy-directory): Work with empty subdirectories, too.
* test/lisp/files-tests.el (files-tests--copy-directory):
Test for this bug.
Eli Zaretskii [Wed, 20 Sep 2017 07:16:11 +0000 (10:16 +0300)]
Fix 2 testsuite tests for MS-Windows
* test/lisp/ibuffer-tests.el (test-buffer-list): Don't try to
create files with "*" in their names.
* test/src/editfns-tests.el (format-time-string-with-zone): Adapt
results to MS-Windows build. Reported by Fabrice Popineau
<fabrice.popineau@gmail.com>.
Alan Third [Fri, 8 Sep 2017 18:26:47 +0000 (19:26 +0100)]
Provide native touchpad scrolling on macOS
* etc/NEWS: Describe changes.
* lisp/term/ns-win.el (mouse-wheel-scroll-amount,
mouse-wheel-progressive-speed): Set to smarter values for macOS
touchpads.
* src/nsterm.m (emacsView::mouseDown): Use precise scrolling deltas to
calculate scrolling for touchpads and mouse wheels.
(syms_of_nsterm): Add variables 'ns-use-system-mwheel-acceleration',
'ns-touchpad-scroll-line-height' and 'ns-touchpad-use-momentum'.
* src/keyboard.c (make_lispy_event): Pass on .arg when relevant.
* src/termhooks.h (event_kind): Update comments re. WHEEL_EVENT.
* lisp/mwheel.el (mwheel-scroll): Use line count.
* lisp/subr.el (event-line-count): New function.
Eli Zaretskii [Tue, 19 Sep 2017 16:48:27 +0000 (19:48 +0300)]
Fix a minor inaccuracy in the Emacs manual
* doc/emacs/cmdargs.texi (Action Arguments): Don't mention
'find-file', as the implementation has changed. Reported by
Everton J. Carpes <everton.carpes@gmail.com> in
http://lists.gnu.org/archive/html/help-gnu-emacs/2017-09/msg00146.html.
Eli Zaretskii [Tue, 19 Sep 2017 16:32:09 +0000 (19:32 +0300)]
Fix errors in flyspell-post-command-hook
* lisp/textmodes/ispell.el (ispell-get-decoded-string): Handle the
case of a nil Nth element of the language dictionary slot. This
avoids errors in 'flyspell-post-command-hook' when switching
dictionaries with some spell-checkers. (Bug#28501)
Michael Albinus [Tue, 19 Sep 2017 16:12:35 +0000 (18:12 +0200)]
Work on Tramp's file-truename
* lisp/net/tramp-sh.el (tramp-perl-file-truename):
Check also for symlinks.
(tramp-sh-handle-file-truename): Move check for a symlink
cycle to the end. Do not blame symlinks which look like a
remote file name.
Paul Eggert [Tue, 19 Sep 2017 08:47:39 +0000 (01:47 -0700)]
Fix bug with make-directory on MS-Windows root
* lisp/files.el (files--ensure-directory): Treat any error, not
just file-already-exists, as an opportunity to check whether DIR
is already a directory (Bug#28508).
Ken Brown [Mon, 18 Sep 2017 21:22:52 +0000 (17:22 -0400)]
Adapt fileio-tests--symlink-failure to Cygwin
* test/src/fileio-tests.el (fileio-tests--symlink-failure)
[CYGWIN]: Skip the case of a symlink target starting with '\';
this is treated specially on Cygwin.
Paul Eggert [Mon, 18 Sep 2017 05:32:31 +0000 (22:32 -0700)]
Remove old cl-assert calls in 'newline'
* lisp/simple.el (newline): Remove cl-assert calls
that didn't seem to be helping us debug Bug#18913,
and that caused problems as reported in Bug#28280.
Suggested by Glenn Morris (Bug#28280#8).
Paul Eggert [Mon, 18 Sep 2017 05:01:56 +0000 (22:01 -0700)]
Avoid crash with C-g C-g in GC
Problem reported by Richard Stallman (Bug#17406).
Based on fix suggested by Eli Zaretskii (Bug#28279#16).
* src/term.c (tty_send_additional_strings):
Use only safe accessors, to avoid crash when C-g C-g in GC.
Paul Eggert [Mon, 18 Sep 2017 03:38:12 +0000 (20:38 -0700)]
Fix format-time-string %Z bug with negative tz
* src/editfns.c (tzlookup): Fix sign error in %Z when a purely
numeric zone is negative (Bug#28746).
* test/src/editfns-tests.el (format-time-string-with-zone):
Add test for this bug.
Paul Eggert [Sun, 17 Sep 2017 22:25:44 +0000 (15:25 -0700)]
Fix bug with min and max and NaNs
* src/data.c (minmax_driver): Fix bug with (min 0 NaN), which
mistakenly yielded 0. Also, pacify GCC in a better way.
* test/src/data-tests.el (data-tests-min): Test for the bug.
Paul Eggert [Sun, 17 Sep 2017 19:56:00 +0000 (12:56 -0700)]
Fix recently-introduced copy-directory bug
Problem reported by Andrew Christianson (Bug#28451):
* lisp/files.el (copy-directory): If COPY-CONTENTS, make the
destination directory if it does not exist, even if it is a
directory name. Simplify, and omit unnecessary test for an
already-existing non-directory target, since make-directory
diagnoses that for us now.
* test/lisp/files-tests.el (files-tests--copy-directory):
Test for this bug.
Michael Albinus [Sun, 17 Sep 2017 17:16:59 +0000 (19:16 +0200)]
Fix compatibility problem in Tramp
* lisp/net/tramp.el (tramp-interrupt-process): Better error handling.
* lisp/net/tramp-compat.el (default-toplevel-value): Move up.
(top): Do not call `tramp-change-syntax' anymore.
(tramp-compat-directory-name-p): New defalias.
* lisp/net/tramp-adb.el (tramp-adb-handle-copy-file):
* lisp/net/tramp-sh.el (tramp-sh-handle-copy-directory):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-copy-file): Use it.
Eli Zaretskii [Sun, 17 Sep 2017 16:50:43 +0000 (19:50 +0300)]
Avoid GCC 7 compilation warning in eval.c
* src/eval.c (push_handler_nosignal): Use CACHEABLE to work around
GCC compilation warning. Suggested by Paul Eggert <eggert@cs.ucla.edu>
in http://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00492.html.
The pdf-view-mode entry had been added recently and should not have been
removed.
* lisp/net/mailcap.el: Restore pdf-view-mode entry from the pdf-tools
package.
Michael Albinus [Sun, 17 Sep 2017 08:03:18 +0000 (10:03 +0200)]
Adapt Tramp version. Do not merge
* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.3.3.26.1".
(customize-package-emacs-version-alist): Add Tramp version
integrated in Emacs 26.1.
Mark Oteiza [Sat, 16 Sep 2017 16:49:28 +0000 (12:49 -0400)]
Add lisp variable lcms-d65-xyz
This serves as the default optional argument for functions in this
library.
* src/lcms.c (lcms-d65-xyz): New variable.
(lcms-cam02-ucs): Use it. Use better word in docstring. Fix bug
color1 -> color2.
* test/src/lcms-tests.el: Add some tests for lcms-cri-cam02-ucs.
(lcms-colorspacious-d65): New variable.
Alan Mackenzie [Sat, 16 Sep 2017 11:31:38 +0000 (11:31 +0000)]
Cope better with C++ and Objective-C protection keywords in class declarations
This fix fixes the fontification of a method inside a class at the time it is
typed, when there is a protection keyword clause preceding it.
* lisp/progmodes/cc-engine.el (c-forward-keyword-clause): Handle protection
keywords.
(c-looking-at-decl-block): Avoid scanning forward over protection keyword
clauses too eagerly.
* lisp/progmodes/cc-langs.el (c-protection-key c-post-protection-token): New
lang defconsts and defvars.
* lisp/progmodes/cc-mode.el (c-fl-decl-start): When we encounter a protection
keyword following a semicolon or brace, move forward over it before attempting
to parse a type.
Eli Zaretskii [Sat, 16 Sep 2017 09:45:24 +0000 (12:45 +0300)]
Disable execution of unsafe Lisp by Enriched Text mode
* src/xdisp.c (handle_display_spec): If the display property is
wrapped in 'disable-eval' form, disable Lisp evaluation while
processing this property.
(handle_single_display_spec): Accept new argument ENABLE_EVAL_P.
If that argument is false, don't evaluate Lisp while processing
display properties.
* lisp/textmodes/enriched.el
(enriched-allow-eval-in-display-props): New defcustom.
(enriched-decode-display-prop): If
enriched-allow-eval-in-display-props is nil, wrap the display
property with 'disable-eval' to disable Lisp evaluation when the
display property is processed for display. (Bug#28350)
* lisp/gnus/mm-view.el (mm-inline-text): Re-enable processing of
enriched text.
* doc/lispref/display.texi (Display Property): Document the
'disable-eval' wrapping of 'display' properties.
* doc/emacs/text.texi (Enriched Properties): Document
'enriched-allow-eval-in-display-props'.
* etc/NEWS: Describe the security issues with Enriched Text mode
and their solution.
Eli Zaretskii [Sat, 16 Sep 2017 07:41:52 +0000 (10:41 +0300)]
Fix MS-Windows build broken by recent changes in lcms.c
* src/lcms.c [WINDOWSNT]: Define types for cmsWhitePointFromTemp
and cmsxyY2XYZ function pointers.
(init_lcms_functions) [WINDOWSNT]: Load cmsWhitePointFromTemp and
cmsxyY2XYZ from liblcms2.
(cmsWhitePointFromTemp, cmsxyY2XYZ) [WINDOWSNT]: Redirect to the
corresponding function pointers.
(Flcms_temp_to_white_point): Minor stylistic changes. Doc fix.
(syms_of_lcms2): Defsubr Slcms_temp_to_white_point.
Mark Oteiza [Sat, 16 Sep 2017 02:59:57 +0000 (22:59 -0400)]
Use cl-print in timer list
* lisp/emacs-lisp/timer-list.el (timer-list): Use cl-print
for handling functions.
(timer-list-mode): Capitalize major mode name. Set bidi direction
as in tabulated-list-mode.
Vincent Belaïche [Fri, 15 Sep 2017 21:51:05 +0000 (23:51 +0200)]
Make landscape layout with geometry package rather than a PostScript special.
* lisp/calendar/cal-tex.el (cal-tex-preamble): Make 12pt the
default class option.
(cal-tex-year, cal-tex-cursor-month-landscape): Pass landscape
request to `cal-tex-insert-preamble' function call within the
class option string.
(cal-tex-cursor-month): Don't pass any longer "12pt" argument
to `cal-tex-insert-preamble' function, as it is default.
(cal-tex-insert-preamble): Suppress landscape and size
argument, and replace them by a class-options string
argument. Do not insert any longer "\special{landscape}" in
case of landscape layout, as the job is made by the geometry
package.
Mark Oteiza [Fri, 15 Sep 2017 17:27:39 +0000 (13:27 -0400)]
Fix color-distance docstring
Also feed the translated color to the metric argument.
* src/xfaces.c (color-distance): Reword docstring to be more helpful.
Avoid duplicating effort in lcms2 by passing the translated 16 bit RGB
instead of the function's color arguments.
Michael Albinus [Fri, 15 Sep 2017 16:29:00 +0000 (18:29 +0200)]
Improve Tramp behaviour according to bug#27986
* lisp/net/tramp-adb.el (tramp-adb-handle-copy-file):
* lisp/net/tramp-sh.el (tramp-sh-handle-copy-directory):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-copy-file): Check, that NEWNAME is a
directory name when existing. Use `file-name-as-directory'
where appropriate.
Mark Oteiza [Fri, 15 Sep 2017 13:49:27 +0000 (09:49 -0400)]
More JSON optimization
Last I checked, inlining json-skip-whitespace didn't make much
difference. However, changing defsubsts to define-inline results
in roughly 15% reduction in read time on a 200K file.
* lisp/json.el (json-advance, json-peek, json-pop):
(json-skip-whitespace): Inline with define-inline.
(json-read-keyword): Don't use whitespace syntax.
(json-add-to-object): Simpler condition.
Eli Zaretskii [Fri, 15 Sep 2017 08:46:37 +0000 (11:46 +0300)]
Avoid compilation warnings with GCC 7 on MS-Windows
* src/w32term.c (w32_setup_relief_color, construct_mouse_click)
(w32_read_socket): Initialize variables to shut up bogus
compilation warnings from GCC 7.
* src/unexw32.c (COPY_CHUNK, COPY_PROC_CHUNK): Cast to DWORD_PTR
to avoid compiler warnings about printing signed values using %x
format spec.
* src/dispnew.c (adjust_glyph_matrix): Add eassert to avoid
compiler warning about possible NULL pointer dereference.
* src/lisp.h (pI): Tweak the definition some more for MinGW64.
Eli Zaretskii [Thu, 14 Sep 2017 17:46:59 +0000 (20:46 +0300)]
Avoid 64-bit compilation warnings in unexw32.c
* src/unexw32.c (pDWP): New macro.
(COPY_CHUNK, COPY_PROC_CHUNK): Declare 'count' as DWORD_PTR. Use
pDWP for printing values that can be either 32-bit or 64-bit wide.
Eli Zaretskii [Thu, 14 Sep 2017 17:38:42 +0000 (20:38 +0300)]
Fix warnings about formats in printf-like functions on MS-Windows
* src/lisp.h (pI) [__MINGW32__]: Provide definition that will
hopefully DTRT with both MinGW64 and mingw.org's MinGW. See
http://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00171.html
for the details.
* src/conf_post.h (PRINTF_ARCHETYPE) [MINGW_W64]: Separate
definition specific to MinGW64.
(PRINTF_ARCHETYPE) [__MINGW32__]: For mingw.org's MinGW, use
__mingw_printf__ in ANSI-compatible mode.
Paul Eggert [Thu, 14 Sep 2017 14:23:13 +0000 (07:23 -0700)]
Port renameat_noreplace to openSUSE 12.3
Problem reported by M. Nomiya in:
http://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00363.html
* src/sysdep.c (renameat_noreplace):
Call renameat2 only if CYGWIN.
Paul Eggert [Wed, 13 Sep 2017 22:52:52 +0000 (15:52 -0700)]
Prefer HTTPS to FTP and HTTP in documentation
Most of this change is to boilerplate commentary such as license URLs.
This change was prompted by ftp://ftp.gnu.org's going-away party,
planned for November. Change these FTP URLs to https://ftp.gnu.org
instead. Make similar changes for URLs to other organizations moving
away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and
fsf.org when this works, as this will further help defend against
man-in-the-middle attacks (for this part I omitted the MS-DOS and
MS-Windows sources and the test tarballs to keep the workload down).
HTTPS is not fully working to lists.gnu.org so I left those URLs alone
for now.
Paul Eggert [Wed, 13 Sep 2017 22:46:16 +0000 (15:46 -0700)]
Prefer HTTPS to HTTP for gnu.org
This patch just changes code files; a followup companion patch
(much larger) will affect the commentary. This part is
separated out to make it easier to review.
* .dir-locals.el (change-log-mode):
* lisp/org/org-info.el (org-info-other-documents)
(org-info-map-html-url):
* lisp/org/ox-html.el (org-html-creator-string):
* lisp/startup.el (fancy-startup-text, fancy-about-text)
(fancy-splash-head):
* test/lisp/ffap-tests.el (ffap-other-window--bug-25352):
* test/lisp/thingatpt-tests.el (thing-at-point-test-data):
Use HTTPS instead of HTTP.
* lisp/color.el (color-name-to-rgb, color-complement): Clarify in
docstrings that RGB triplets should use four digits per component.
(color-rgb-to-hsl): Break line to avoid "Hidden behind deeper element"
warning.
Michael Albinus [Wed, 13 Sep 2017 18:10:40 +0000 (20:10 +0200)]
Improve backward compatibility of tramp-tests
* test/lisp/net/tramp-tests.el (seq): Don't require.
(tramp--test-emacs26-p): New defun.
(tramp-test10-write-region, tramp-test11-copy-file)
(tramp-test12-rename-file, tramp-test15-copy-directory)
(tramp-test21-file-links): Use it.
(tramp-test16-file-expand-wildcards): Use `copy-sequence'.
Mark Oteiza [Wed, 13 Sep 2017 17:25:41 +0000 (13:25 -0400)]
Add clarification to if-let* docstring
Also make its behaviour consistent with and-let* in that empty bindings
results in success, not failure.
* lisp/emacs-lisp/subr-x.el: Edit docstring, change else to then.
Mark Oteiza [Wed, 13 Sep 2017 14:38:05 +0000 (10:38 -0400)]
Remove "baroque" use of prefix argument from gensym
'cl-gensym' was simply moved here, but let us take an opportunity to
shed some historical baggage.
* lisp/subr.el (gensym): Remove special treatment of PREFIX as a
number. Use "g" as prefix to differentiate from cl-gensym defaults.
* doc/lispref/symbols.texi (Creating Symbols): Update accordingly.
* lisp/emacs-lisp/cl-macs.el (cl--gensym-counter, cl-gensym): Restore.