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.
Eli Zaretskii [Sat, 9 Sep 2017 14:20:47 +0000 (17:20 +0300)]
Avoid infloop when scrolling under scroll-preserve-screen-position
* src/window.c (window_scroll_pixel_based): If screen position is
to be preserved, make sure its recorded Y coordinate is outside
the scroll margin. (Bug#28342)
Miles Bader [Tue, 30 Jul 2013 10:21:31 +0000 (19:21 +0900)]
Use text-property buttons in rcirc-markup-urls
* lisp/net/rcirc.el (rcirc-markup-urls): Use `make-text-button'
instead of `make-button'; the former is much more efficient in large
buffers, and for the purposes of rcirc, changes no functionality.
Alex Branham [Fri, 8 Sep 2017 09:36:59 +0000 (12:36 +0300)]
New variable 'dired-confirm-killing-deleted-buffers'
* lisp/dired-x.el (dired-clean-confirm-killing-deleted-buffers):
New variable.
* lisp/dired.el (dired-clean-up-after-deletion): Kill buffers
visiting deleted files without confirming if
dired-clean-confirm-killing-deleted-buffers is nil. (Bug#28373)
* etc/NEWS: Document the change.
Ken Olum [Fri, 8 Sep 2017 09:08:49 +0000 (12:08 +0300)]
Fix Rmail editing with reapplying encoding to message body
* lisp/mail/rmailedit.el (rmail-cease-edit): If no
content-type in edited headers, look for one in original
headers and add it to edited headers. (Bug #26918)
Use a marker to track start of new body, so that
content-transfer-encoding gets applied only to body. (Bug #27353).
Ensure blank line at end of message after encoding, not
before.
Tak Kunihiro [Fri, 8 Sep 2017 08:52:47 +0000 (11:52 +0300)]
Make mouse clicks in Dired more customizable
* lisp/dired.el (dired-mouse-find-file): Allow callers to
specify functions to visit file/directory.
(dired-mouse-find-file-other-window)
(dired-mouse-find-file-other-frame): New functions to visit
files in another window/frame. (Bug#27435)
Eli Zaretskii [Fri, 8 Sep 2017 08:00:34 +0000 (11:00 +0300)]
Avoid compiler warnings on MS-Windows with GCC 6 and 7
* src/w32font.c (SUBRANGE): Use unsigned arithmetic for
bit-shifting, to avoid compiler warnings.
(w32font_text_extents): Tell GCC NGLYPHS is non-negative, to avoid
a warning. For details of the warning, see
http://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00093.html.
* src/term.c (keys) [WINDOWSNT]: Don't define, as it is not used
in that build.
* src/sound.c (sound_perror): Ifdef away on WINDOWSNT, as this
function is not used in that build.
* configure.ac: Disable -Wsuggest-attribute=format on MS-Windows.
Eli Zaretskii [Fri, 8 Sep 2017 07:51:14 +0000 (10:51 +0300)]
Fix 'directory-file-name' on DOS_NT systems as well
* src/fileio.c (directory_file_name) [DOS_NT]: Fix the DOS_NT case
to be consistent with last change.
* test/src/fileio-tests.el (fileio-tests--odd-symlink-chars):
Disable on MS-Windows.
(fileio-tests--directory-file-name-dos-nt)
(fileio-tests--file-name-as-directory-dos-nt): New tests.
Wilson Snyder [Fri, 8 Sep 2017 03:24:28 +0000 (23:24 -0400)]
Fix various verilog-mode.el issues.
* lisp/progmodes/verilog-mode.el (verilog-expand-dirnames): Fix expanding
"*/*", msg2284. Reported by Jonathan Ferguson.
(ignore-errors): Fix ignore-errors error on Emacs 22.3, bug1177. Reported
by Victor Lau.
(verilog-getopt, verilog-getopt-file) (verilog-library-flags,
verilog-substitute-file-name-path): Support -F in verilog getopt files,
bug1171. Reported by George Cuan.
(verilog-do-indent): Fix misindenting symbols starting with t,
bug1169. Reported by Hoai Tran.
(verilog-read-auto-template-middle): Fix slow template matching on
AUTOINST. Reported by Jeffrey Huynh.
(verilog-pretty-expr): The extra whitespace addition before "=" operators
is now done only if the whole assignment block contains the 2-character
"<=" operator. Remove the unused argument _myre. Use `unless',
`save-excursion' and `when' functions where possible. Internal variables
refactored for clarity. Follow elisp convention for closing parentheses.
By Kaushal Modi.
(verilog-get-lineup-indent-2): Update docstring. Internal variables
refactored for clarity. Earlier EDPOS argument was expected to be a
marker; it is now renamed to END and is now expected to be a position.
Use `when' instead of `if'. By Kaushal Modi.
(electric-verilog-terminate-line): Remove the unused second argument from
`verilog-pretty-expr' call. By Kaushal Modi.
(verilog-calc-1): Fix indentation of a virtual class definition after a
typedef class, bug1080. By Kaushal Modi.
Don't use summary window to visit group buffer (bugfix)
* lisp/gnus/gnus-sum.el (gnus-summary-jump-to-group): Make sure that
the window to open the group buffer doesn't visit the summary buffer.
This fixes a bug: `gnus-summary-next-article' sometimes causes an error
by trying to select nonexistent summary window.
Paul Eggert [Fri, 8 Sep 2017 00:46:12 +0000 (17:46 -0700)]
Fix bug: (directory-file-name "///") returned "//"
* src/fileio.c (directory_file_name): For "///" and longer,
return "/", not "//", as per POSIX.
* test/src/fileio-tests.el (fileio-tests--directory-file-name)
(fileio-tests--file-name-as-directory): New tests.
Paul Eggert [Thu, 7 Sep 2017 07:10:05 +0000 (00:10 -0700)]
autogen.sh: omit bogus chatter if no .git
Problem reported by Angelo Graziosi in:
http://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00045.html
* autogen.sh (git_config): Do not execut 'git' if $do_git fails.
Skip emacsclient tests if --enable-profiling was used
* test/lib-src/emacsclient-tests.el
(emacsclient-test-call-emacsclient): Make it a macro.
Handle "Profiling timer expired" return from emacsclient. (Bug#28319)
(emacsclient-test-alternate-editor-allows-arguments)
(emacsclient-test-alternate-editor-allows-quotes): Update for above.
Eli Zaretskii [Wed, 6 Sep 2017 18:00:29 +0000 (21:00 +0300)]
Fix a minor markup problem in ELisp manual
* doc/lispref/functions.texi (Mapping Functions): Fix the order of
@example and @group. For the details, see
http://lists.gnu.org/archive/html/bug-texinfo/2017-09/msg00007.html.
Mark Oteiza [Wed, 6 Sep 2017 17:17:05 +0000 (13:17 -0400)]
Add XDG desktop file parsing and tests
* lisp/xdg.el: Add support for Desktop Entry Specification.
(xdg--user-dirs-parse-line): Check if file is readable.
(xdg-desktop-group-regexp, xdg-desktop-entry-regexp): New variables.
(xdg--desktop-parse-line, xdg-desktop-read-file, xdg-desktop-strings):
New functions.
* test/lisp/xdg-tests.el:
* test/data/xdg/test.desktop:
* test/data/xdg/wrong.desktop: New files.
Allow customizing line length of ert backtraces in batch mode
* lisp/emacs-lisp/ert.el (ert-batch-backtrace-right-margin):
Make it a user option.
(ert-run-tests-batch): Handle ert-batch-backtrace-right-margin nil.