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.
Mark Oteiza [Wed, 13 Sep 2017 14:27:37 +0000 (10:27 -0400)]
Add lcms2 interface
configure.ac: Add boilerplate for configuring and detecting liblcms2.
etc/NEWS: Mention new configure option and color-distance change.
src/Makefile.in: Add references to lcms.c and liblcms.
src/emacs.c: Define lcms2 symbols.
src/lcms.c: New file.
src/lisp.h: Add declaration for lcms2.
src/xfaces.c: Add optional METRIC argument.
Mark Oteiza [Wed, 13 Sep 2017 14:19:59 +0000 (10:19 -0400)]
; Fix previous commit
Removing extraneous code, thanks to Michael Heerdegen.
* lisp/emacs-lisp/subr-x.el (internal--listify): Remove latter
condition which always evaluates to t.
(internal--build-binding-value-form): Remove dead code.
Eric Abrahamsen [Tue, 12 Sep 2017 23:06:12 +0000 (16:06 -0700)]
Allow write-contents-functions to short-circuit buffer save
Bug#28412
* lisp/files.el (basic-save-buffer): Re-arrange function so that
write-contents-functions are run earlier. If they return non-nil,
consider the buffer saved without requiring the buffer to be
visiting a file.
(save-some-buffers): This function should consider any buffer with a
buffer-local value for write-contents-functions eligible for
saving.
* test/lisp/files-tests.el (files-test-no-file-write-contents): New
test.
* doc/lispref/files.texi (Saving Buffers): Mention in docs.
* etc/NEWS: And in NEWS.
Paul Eggert [Tue, 12 Sep 2017 19:17:41 +0000 (12:17 -0700)]
Less chatter for ’make info/dir’
* Makefile.in (${srcdir}/info/dir): Tweak shell command so
that an ordinary make says just "GEN info/dir" rather than
also having a seemingly-unrelated mv line.
Paul Eggert [Tue, 12 Sep 2017 19:15:22 +0000 (12:15 -0700)]
Tweak Gnus doc re gnus-copy-file
* doc/misc/gnus.texi (Saving Articles):
Document behavior with directory name targets (Bug#27986).
Problem reported by Katsumi Yamaoka in:
http://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00216.html
Mark Oteiza [Tue, 12 Sep 2017 16:44:45 +0000 (12:44 -0400)]
Implement and-let*
This also includes changes to if-let and when-let. The single tuple
special case is ambiguous, and binding a symbol to nil is not as
useful as binding it to its value outside the lexical scope of the
binding. (Bug#28254)
* etc/NEWS: Mention.
* lisp/emacs-lisp/subr-x.el (internal--listify):
(internal--build-binding-value-form): Extend to account for
solitary symbols and (EXPR) items in binding varlist.
(if-let*, when-let*): Nix single tuple case and incumbent
bind-symbol-to-nil behavior.
(and-let*): New macro.
(if-let, when-let): Mark obsolete. Redefine in terms of if-let*, so
they implicitly gain the new features without breaking existing code.
* test/lisp/emacs-lisp/subr-x-tests.el: Adjust tests for: lack of
single-tuple special case, lack of binding solitary symbols to nil,
and the introduction of uninterned symbols for (EXPR) bindings. Add
SRFI-2 test suite adapted to Elisp.
Paul Eggert [Tue, 12 Sep 2017 16:24:43 +0000 (09:24 -0700)]
Merge Emacs 25.3 fixes
The security patches released for Emacs 25.3 were less drastic
than what we had immediately put into master. Adjust master to
match 25.3 (Bug#28350).
* lisp/textmodes/enriched.el (enriched-translations):
Re-enable FUNCTION and display translations that are safe.
(enriched-handle-display-prop): Bring back.
(enriched-decode-display-prop): Bring back, but disable
the unsafe part.
Alan Mackenzie [Tue, 12 Sep 2017 16:19:52 +0000 (16:19 +0000)]
Don't match C++ template delims starting within a token. FIxes bug #28418.
* lisp/progmodes/cc-engine.el (c-restore-<>-properties): After failing an
attempted match from the start of a token (in particular, "<<"), move to the
next token rather than the nex character before searching for the next "<".
Mark Oteiza [Mon, 11 Sep 2017 20:06:06 +0000 (16:06 -0400)]
Include sxhash of object with printed bytecode
This printing, while succint, is rather opaque. At least give an
immediate clue of whether different byte code printouts are for the
same or different byte code objects.
* lisp/emacs-lisp/cl-print.el (cl-print-object): Add object sxhash to
printed token "#<bytecode>".
Paul Eggert [Mon, 11 Sep 2017 05:28:08 +0000 (22:28 -0700)]
Adjust thumbs to new rename-file behavior
* etc/NEWS: Mention this.
* lisp/thumbs.el (thumbs-rename-images): Treat the destination
as special only if it is a directory name. When there is
a marked list, turn the destination into a directory name
if it is not already.
Paul Eggert [Mon, 11 Sep 2017 05:19:01 +0000 (22:19 -0700)]
Make write-file act like copy-file etc.
Change write-file to be consistent with the new behavior
of copy-file, etc.
* etc/NEWS: Mention this.
* lisp/files.el (write-file): Treat the destination as special
only if it is a directory name.
Paul Eggert [Mon, 11 Sep 2017 05:07:30 +0000 (22:07 -0700)]
Make copy-directory act like copy-file etc.
Do the special dance with the destination only if it is a
directory name, for consistency with copy-file etc. (Bug#27986).
* doc/emacs/files.texi (Copying and Naming):
* doc/lispref/files.texi (Create/Delete Dirs):
* etc/NEWS: Document this.
* lisp/files.el (copy-directory): Treat NEWNAME as special
only if it is a directory name.
Paul Eggert [Mon, 11 Sep 2017 03:37:17 +0000 (20:37 -0700)]
Fix some make-directory bugs
* lisp/files.el (files--ensure-directory): New function.
(make-directory): Use it to avoid bugs when (make-directory FOO t)
is invoked on a non-directory, or on a directory hierarchy that
is being built by some other process while Emacs is running.
* test/lisp/files-tests.el (files-tests--make-directory): New test.
Paul Eggert [Sun, 10 Sep 2017 22:39:24 +0000 (15:39 -0700)]
Fix race with rename-file etc. with dir NEWNAME
This changes the behavior of rename-file etc. slightly.
The old behavior mostly disagreed with the documentation, and had
a race condition bug that could allow attackers to modify victims'
write-protected directories (Bug#27986).
* doc/lispref/files.texi (Changing Files): Document that in
rename-file etc., NEWFILE is special if it is a directory name.
* etc/NEWS: Document the change in behavior.
* src/fileio.c (directory_like): Remove. All uses removed.
(expand_cp_target): Test only whether NEWNAME is a directory name,
not whether it is currently a directory. This avoids a race.
(Fcopy_file, Frename_file, Fadd_name_to_file, Fmake_symbolic_link):
Document behavior if NEWNAME is a directory name.
(Frename_file): Simplify now that the destdir behavior occurs
only when NEWNAME is a directory name.
* test/lisp/net/tramp-tests.el (tramp-test11-copy-file)
(tramp-test12-rename-file, tramp--test-check-files):
Adjust tests to match new behavior.
Eli Zaretskii [Sun, 10 Sep 2017 14:52:41 +0000 (17:52 +0300)]
Avoid warnings about file names in autoloads on MS-Windows
* configure.ac (srcdir) [mingw32]: Downcase the drive letter, to
avoid warnings from find-file-noselect when making autoloads. For
the details, see
http://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00049.html.
Mark Oteiza [Sun, 10 Sep 2017 03:12:47 +0000 (23:12 -0400)]
Avoid looking at localized strings
* lisp/xdg.el (xdg-desktop-read-group): Add condition to catch
localized strings.
* test/lisp/xdg-tests.el (xdg-desktop-parsing): Add test to ensure
parsing l10n strings doesn't error but is essentially a no-op.
* lisp/gnus/mm-view.el (mm-inline-text):
Do not worry about enriched or richtext type.
* lisp/textmodes/enriched.el (enriched-translations):
Remove translations for FUNCTION, display (Bug#28350).
(enriched-handle-display-prop, enriched-decode-display-prop): Remove.
Paul Eggert [Sat, 9 Sep 2017 18:10:35 +0000 (11:10 -0700)]
Improve --enable-gcc-warnings for MinGW64
This partially reverts my 2016-05-30 patch. Apparently MinGW64
still requires pacifications that GCC 7.1.1 x86-64 (Fedora 26)
does not. Also, pacify tparam.c, which isn’t used on Fedora.
* lib-src/etags.c (process_file_name, TeX_commands):
* src/buffer.c (fix_overlays_before):
* src/data.c (Fmake_variable_buffer_local, cons_to_unsigned)
(cons_to_signed):
* src/editfns.c (Ftranslate_region_internal):
Prefer UNINIT to some stray value, as this simplifies
code-reading later.
* src/eval.c (CACHEABLE): New macro.
(internal_lisp_condition_case): Use it.
* src/tparam.c (tparam1): Use FALLTHROUGH to pacify GCC.
Mark Oteiza [Sat, 9 Sep 2017 15:55:09 +0000 (11:55 -0400)]
Add function to read all entries in a group
Use that to extend xdg-desktop-read-file. Also fix a bug where all
entries in all groups were read and returned by xdg-desktop-read-file.
* lisp/xdg.el (xdg-desktop-read-group): New function.
(xdg-desktop-read-file): Use it.
* test/data/xdg/malformed.desktop: New file.
* test/data/xdg/test.desktop: Add another section.
* test/lisp/xdg-tests.el (xdg-desktop-parsing): Test presence of a key
in another group. Test reading a prescribed group. Test detecting a
malformed key=value.
Gemini Lasswell [Wed, 30 Aug 2017 14:11:41 +0000 (07:11 -0700)]
Reduce Tramp's memory usage
Construct Tramp syntax strings and regular expressions once instead
of every time they are used, and store them in alists keyed by Tramp
syntax.
* tramp.el (tramp-build-remote-file-name-spec-regexp)
(tramp-build-file-name-structure): New functions.
(tramp-prefix-format-alist, tramp-prefix-regexp-alist)
(tramp-method-regexp-alist)
(tramp-postfix-method-format-alist)
(tramp-postfix-method-regexp-alist)
(tramp-prefix-ipv6-format-alist, tramp-prefix-ipv6-regexp-alist)
(tramp-postfix-ipv6-format-alist)
(tramp-postfix-ipv6-regexp-alist)
(tramp-postfix-host-format-alist)
(tramp-postfix-host-regexp-alist)
(tramp-remote-file-name-spec-regexp-alist)
(tramp-file-name-structure-alist): New constants.
(tramp-lookup-syntax): New function.
(tramp-prefix-format, tramp-prefix-regexp, tramp-method-regexp)
(tramp-postfix-method-format, tramp-postfix-method-regexp)
(tramp-prefix-ipv6-format, tramp-prefix-ipv6-regexp)
(tramp-postfix-ipv6-format, tramp-postfix-ipv6-regexp)
(tramp-postfix-host-format, tramp-postfix-host-regexp)
(tramp-remote-file-name-spec-regexp, tramp-file-name-structure):
Use it.