Enable GUI Emacs without 'make install' on macOS (Bug #27645)
* nextstep/INSTALL: Correct it, and mention that Emacs can be run
from 'src/emacs'.
* src/nsterm.m (applicationDidFinishLaunching:): When Emacs is
launched outside of a macOS application bundle, change its
activation policy from the default 'prohibited' to 'regular'.
Alan Mackenzie [Sun, 23 Jul 2017 13:48:36 +0000 (13:48 +0000)]
Convert CC Mode's c-found-types from an obarray to a hash table.
* lisp/progmodes/cc-engine.el (c-clear-found-types): create a hash table
rather than an obarray.
(c-copy-found-types): Remove.
(c-add-type, c-unfind-type, c-check-type, c-list-found-types): Amend to use
the new hash table.
(c-forward-<>-arglist): Use copy-hash-table rather than c-copy-found-types.
* lisp/net/shr.el (shr-put-image): Display svg images as svg
(bug#27799). I suspect the previous change was checked in by
accident in conjuction with some other svg changes.
Don't automatically enable Gconf if Gsettings was found
* configure.ac (HAVE_GCONF) [HAVE_GSETTINGS]:
Don't test for Gconf unless specifically requested.
Gconf was deprecated in favor of Gsettings several years ago.
Michael Albinus [Sat, 22 Jul 2017 18:24:24 +0000 (20:24 +0200)]
Add line numbers display to the Options menu
* lisp/menu-bar.el (toggle-display-line-numbers): Remove.
(menu-bar-display-line-numbers-mode): New defun.
(menu-bar-showhide-line-numbers-menu): New defvar.
(menu-bar-showhide-menu): Use `menu-bar-showhide-line-numbers-menu'
Noam Postavsky [Wed, 7 Jun 2017 23:59:09 +0000 (19:59 -0400)]
Signal error for symbol names with strange quotes (Bug#2967)
* src/lread.c (read1): Signal an error when a symbol starts with a
non-escaped quote-like character.
* test/src/lread-tests.el (lread-tests--funny-quote-symbols): New
test.
* etc/NEWS: Announce change.
Add a minor mode interface for display-line-numbers
* lisp/cus-start.el: Use the new display-line-numbers group.
* lisp/display-line-numbers.el: New file.
* doc/emacs/custom.texi (Init Rebinding): Re-add entry that used to
belong to linum-mode.
* doc/emacs/modes.texi (Minor Modes): Summarize the mode.
* etc/NEWS: Document display-line-numbers-mode and its customization
variables, and mention that display-line-numbers-width is
buffer-local.
* src/xdisp.c (syms_of_xdisp) <display-line-numbers-width>: Fix a
typo.
* lisp/progmodes/ld-script.el: (ld-script-keywords): New commands
NOCROSSREFS_TO and HIDDEN added. Fix documentation sections
numbers for PROVIDE/PROVIDE_HIDDEN commands.
(ld-script-builtins): New builtin function LOG2CEIL added.
Eli Zaretskii [Sat, 22 Jul 2017 08:24:05 +0000 (11:24 +0300)]
Doc fixes for kmacro.el functions
* lisp/kmacro.el (kmacro-start-macro, kmacro-call-macro)
(kmacro-end-and-call-macro): Don't use "permanent name", as that
could be misinterpreted. (Bug#27492)
Andrew L. Moore [Sat, 22 Jul 2017 07:34:18 +0000 (10:34 +0300)]
Introduce defcustom 'executable-prefix-env'
* lisp/progmodes/executable.el (executable-prefix): Update the doc
string.
(executable-prefix-env): New defcustom.
(executable-set-magic): Use executable-prefix-env.
Stefan Monnier [Fri, 21 Jul 2017 16:54:07 +0000 (18:54 +0200)]
Use lexical-binding in todo-mode.el
Adjust code accordingly and make various minor improvements.
* lisp/calendar/todo-mode.el: Enable lexical-binding.
(dayname, monthname, day, month, year): Make forward defvars
of these keywords from macros defined in calendar.el; wrap
them in with-no-warnings.
(todo-files, todo-files-function, todo-date-pattern)
(todo-mode-line-function, todo-show, todo-forward-category)
(todo-edit-item--header, todo-set-category-number)
(todo-adjusted-category-label-length)
(todo-total-item-counts, todo-filter-items)
(todo-print-buffer-function, todo-convert-legacy-date-time)
(todo-category-number, todo-category-completions)
(todo-read-file-name, todo-read-category)
(todo-validate-name, todo-read-date)
(todo-set-show-current-file, todo-modes-set-1)
(todo-modes-set-2, todo-modes-set-3, todo-mode):
Use #' instead of ' to quote functions.
(todo-files): Use \' instead of $ in regexp.
(todo--files-type-list): New function.
(todo-default-todo-file, todo-category-completions-files)
(todo-filter-files, todo-multiple-filter-files)
(todo-reevaluate-default-file-defcustom)
(todo-reevaluate-category-completions-files-defcustom)
(todo-reevaluate-filter-files-defcustom): Use it.
(todo-show, todo-rename-file, todo-move-category)
(todo-edit-item--text, todo-edit-quit, todo-edit-item--header)
(todo-item-undone, todo-unarchive-items, todo-search)
(todo-filter-items, todo-filter-items-1, todo-find-item)
(todo-category-select, todo-read-date)
(todo-nondiary-marker-matcher, todo-date-string-matcher)
(todo-diary-expired-matcher, todo-convert-legacy-files)
(todo-read-category): Reformat to avoid code hiding behind a
more deeply embedded element.
(todo-forward-category, todo-set-category-number):
Use 'funcall' instead of 'apply'.
(todo-toggle-mark-item, todo-edit-item--diary-inclusion)
(todo-edit-category-diary-inclusion)
(todo-insert-sort-button, todo-insert-category-line)
(todo-multiple-filter-files): Mark unused local variables.
(todo-edit-item--header, todo-move-item, todo-print-buffer)
(todo-edit-item--header, todo-move-item, todo-check-file)
(todo-edit-item--next-key): Remove unused local variables.
(todo-insert-sort-button, todo-insert-category-line):
Use a closure instead of a backquoted lambda.
(todo-update-categories-display, todo-print-buffer): Simplify code.
(todo-print-buffer-function): Document calling convention.
(todo-category-completions): Use cl-pushnew instead of add-to-list.
(todo-mode-map, todo-archive-mode-map)
(todo-categories-mode-map, todo-filtered-items-mode-map):
Remove superfluous call of suppress-keymap, since it's already
in the parent special-mode-map.
* lisp/dired.el (dired-internal-noselect): Revert buffer if DIR-OR-LIST
is a cons, or dired-directory is a cons and DIR-OR-LIST a string (Bug#7131).
Update the comments.
* test/lisp/dired-tests.el (dired-test-bug7131): Test should pass.
* lisp/eshell/em-prompt.el (eshell-next-prompt): Search for
`eshell-prompt-regexp' (and `read-only' text-property if
`eshell-highlight-prompt' is set) rather than trying to use
`forward-paragraph'.
(eshell-previous-prompt): Don't count prompt on current line.
Paul Eggert [Thu, 20 Jul 2017 23:21:57 +0000 (16:21 -0700)]
Simplify recent gnutls.c changes
* src/gnutls.c (clear_storage) [HAVE_GNUTLS3_AEAD]: Remove.
All uses replaced by calls to explicit_bzero; that’s clear enough.
(gnutls_symmetric_aead) [HAVE_GNUTLS3_AEAD]: Simplify by
coalescing duplicate actions. There is no need to invoke
SAFE_FREE before calling ‘error’.
* lisp/progmodes/grep.el (grep-use-null-filename-separator): New option.
(grep--regexp-alist-column, grep--regexp-alist-bin-matcher)
(grep-with-null-regexp-alist, grep-fallback-regexp-alist): New
constants, replacing `grep-regexp-alist'.
(grep-regex-alist): Mark the variable obsolete, add a new function of
the same name to replace it.
(grep-compute-defaults): Compute default for
`grep-use-null-filename-separator'.
(grep-mode): Set compilation-error-regexp-alist (buffer locally) to the
value of `grep-with-null-regexp-alist' or `grep-fallback-regexp-alist'
according to `grep-use-null-filename-separator'.
* lisp/progmodes/xref.el (xref-collect-matches): Call
`grep-regex-alist' instead of the obsolete variable. Don't hardcode
grep-regexp-alist match groups.
* etc/NEWS: Announce new use of --null. Move 'grep-save-buffers'
item under "Grep" heading as well.
Stephen Berman [Wed, 19 Jul 2017 13:41:59 +0000 (15:41 +0200)]
Adjust todo-quit to recent change in dired
* lisp/calendar/todo-mode.el (todo-quit): Use quit-window instead of
bury-buffer to exit todo-mode. This restores the desired behavior
of not immediately returning to the exited todo-mode buffer on
quitting another buffer, which a dired bug fix had changed (see
http://lists.gnu.org/archive/html/emacs-devel/2017-07/msg00739.html).
Require 'ls-lisp' at top of the file.
* test/lisp/dired-tests.el (dired-test-bug7131, dired-test-bug27762):
New tests.
(dired-test-bug27693): Delete Dired buffer at the end.
Paul Eggert [Tue, 18 Jul 2017 07:37:03 +0000 (00:37 -0700)]
Port gnutls.c to older (buggier?) GnuTLS
Problem reported for GnuTLS 3.2.1 by Glenn Morris in:
http://lists.gnu.org/archive/html/emacs-devel/2017-07/msg00716.html
http://lists.gnu.org/archive/html/emacs-devel/2017-07/msg00742.html
Although I don't see how this bug can occur with vanilla GnuTLS 3.2.1,
perhaps hydra was using a modified GnuTLS.
* src/gnutls.c (Fgnutls_ciphers): Don't assume GNUTLS_CIPHER_NULL
is at the end of the list returned by gnutls_cipher_list,
or that the earlier ciphers all have non-null names.
Vincent Belaïche [Mon, 17 Jul 2017 17:58:12 +0000 (19:58 +0200)]
Fix symbol completion and document it.
* doc/misc/ses.texi (Configuring what printer function
applies): Add description of keys for completing local printer
symbols and listing local printers in a help buffer.
(Formulas): Add decription for key to list the named cell
symbols in a help buffer.
* lisp/ses.el (ses-completion-keys): New constant.
(ses--completion-table): New defvar.
(ses--list-orig-buffer): New defvar.
(ses-mode-edit-map): Fixed for symbol completion, plus add
help functions to list named cells or local printers.
(ses-edit-cell-complete-symbol)
(ses--edit-cell-completion-at-point-function): New defuns for
completion during formula edition.
(ses-edit-cell): Redefine dynamically edit keymap for
completion keys to point at the right function.
(ses-read-printer-complete-symbol)
(ses--read-printer-completion-at-point-function): New defuns
for completion during printer edition.
(ses-read-printer): Redefine dynamically edit keymap for
completion keys to point at the right function.
(ses-list-local-printers): New defun.
(ses-list-named-cells): New defun.
* src/gtkutil.c (xg_get_gdk_scale): Remove.
(xg_get_default_scrollbar_height)
(xg_get_default_scrollbar_width): Pass in a frame to check for
scaling.
(xg_frame_set_char_size): Use the API for querying scale
instead of looking at the GDK_SCALE variable.
(xg_get_default_scrollbar_width): Ditto.
(xg_get_default_scrollbar_height): Ditto.
(xg_update_scrollbar_pos): Ditto.
* src/xfns.c (x_set_scroll_bar_default_height): Pass in the
frame to get the width.
Eli Zaretskii [Mon, 17 Jul 2017 14:50:37 +0000 (17:50 +0300)]
Allow user control on what starts and ends a paragraph for bidi
* src/buffer.h (struct buffer): New members
bidi_paragraph_separate_re_ and bidi_paragraph_start_re_.
* src/buffer.c (bset_bidi_paragraph_start_re)
(bset_bidi_paragraph_separate_re): New setters/
(Fbuffer_swap_text): Swap the values of bidi-paragraph-start-re and
bidi-paragraph-separate-re.
(init_buffer_once): Init the values of bidi-paragraph-start-re and
bidi-paragraph-separate-re.
(syms_of_buffer) <bidi-paragraph-start-re, bidi-paragraph-separate-re>:
New per-buffer variables.
* src/bidi.c (bidi_at_paragraph_end, bidi_find_paragraph_start):
Support bidi-paragraph-start-re and bidi-paragraph-separate-re.
(bidi_move_to_visually_next): Handle correctly the case when the
separator matches an empty string. (Bug#27526)
If TESTFN is non-nil, then it is the predicate to lookup
the alist. Otherwise, use 'eq' (Bug#27584).
* lisp/subr.el (alist-get): Add optional arg FULL.
* lisp/emacs-lisp/map.el (map-elt, map-put): Add optional arg TESTFN.
* lisp/emacs-lisp/gv.el (alist-get): Update expander.
* doc/lispref/lists.texi (Association Lists): Update manual.
* etc/NEWS: Announce the changes.
* test/lisp/emacs-lisp/map-tests.el (test-map-put-testfn-alist)
(test-map-elt-testfn): New tests.
Michael Albinus [Mon, 17 Jul 2017 12:12:20 +0000 (14:12 +0200)]
Fix `tramp-test39-unload'
* test/lisp/net/tramp-tests.el (tramp--test-instrument-test-case-p)
(tramp--test-instrument-test-case): Rename. Adapt all callees.
(tramp-test36-asynchronous-requests): Bind `timer-max-repeats'.
(tramp-test39-unload): Expect it to pass. Ignore buffer-local
variables and autoload functions; they are not removed. Check
also for `-function(s)'.
Stephen Berman [Mon, 17 Jul 2017 09:09:07 +0000 (11:09 +0200)]
Preserve point under 'dired-auto-revert-buffer' (second case)
* lisp/dired.el (dired): Use pop-to-buffer-same-window instead
of switch-to-buffer. This preserves Dired window point when
dired-auto-revert-buffer is non-nil. (Bug#27243)
* test/lisp/dired-tests.el (dired-test-bug27243): New test.
Paul Eggert [Sun, 16 Jul 2017 23:22:33 +0000 (16:22 -0700)]
Use explicit_bzero to clear GnuTLS keys
* admin/merge-gnulib (GNULIB_MODULES): Add explicit_bzero.
* lib/explicit_bzero.c, m4/explicit_bzero.m4: New files.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* src/gnutls.c (clear_storage): New function.
(gnutls_symmetric_aead): Use it instead of memset.
Paul Eggert [Sun, 16 Jul 2017 23:22:33 +0000 (16:22 -0700)]
Merge from gnulib
This incorporates:
2017-07-16 explicit_bzero: new module
2017-07-15 getdtablesize: Add minimal support for OpenVMS.
* lib/getdtablesize.c, lib/string.in.h, m4/getdtablesize.m4:
* m4/string_h.m4:
Copy from Gnulib.
* lib/gnulib.mk.in: Regenerate.
Fix test when running from test/lisp/subr-tests.elc
* test/lisp/subr-tests.el (subr-test-backtrace-simple-tests): Don't
assume a lambda expression will be `equal' to its quoted form. That's
not true if the lambda expression has been compiled.
* lisp/ls-lisp.el (ls-lisp-filesize-d-fmt, ls-lisp-filesize-f-fmt)
(ls-lisp-filesize-b-fmt): Add space in front (Bug#27693).
* test/lisp/dired-tests.el (dired-test-bug27693): Add test.
Eli Zaretskii [Sat, 15 Jul 2017 13:54:12 +0000 (16:54 +0300)]
Avoid link errors with older versions of GnuTLS
* src/gnutls.c (Fgnutls_ciphers, gnutls_symmetric_aead)
(Fgnutls_macs, Fgnutls_digests): Conditionally compile code that
calls GnuTLS functions which might be unavailable in older
versions of GnuTLS.
Eli Zaretskii [Sat, 15 Jul 2017 11:03:44 +0000 (14:03 +0300)]
Fix compilation of gnutls.c with older GnuTLS
* src/gnutrls.c (syms_of_gnutls): Condition some defsubr's
on HAVE_GNUTLS3, to avoid compilation errors when GnuTLS
v3.X is not available. Reported by Colin Baxter <m43cap@yandex.com>.
Paul Eggert [Fri, 14 Jul 2017 23:18:37 +0000 (16:18 -0700)]
GnuTLS integer-overflow and style fixes
This tweaks the recently-added GnuTLS improvements so that
they avoid some integer-overflow problems and follow typical
Emacs style a bit better.
* configure.ac (HAVE_GNUTLS3_HMAC, HAVE_GNUTLS3_AEAD)
(HAVE_GNUTLS3_CIPHER): Use AC_CACHE_CHECK so that the
configure-time results are displayed.
* src/fns.c (extract_data_from_object): Return char *, not char
const *, since one gnutls caller wants a non-const pointer. Use
CONSP rather than !NILP when testing for conses. Use CAR_SAFE
instead of rolling our own code. Prefer signed types to unsigned
when either will do. Report problems for lengths out of range,
instead of silently mishandling them.
* src/gnutls.c (emacs_gnutls_strerror): New function, to simplify
callers. All callers of gnutls_sterror changed.
(Fgnutls_boot): Check for integers out of range rather than
silently truncating them.
(gnutls_symmetric_aead): Check for integer overflow in size
calculations.
(gnutls_symmetric_aead, Fgnutls_macs, Fgnutls_digests):
Prefer signed to unsigned integers where either will do.
(gnutls_symmetric_aead, gnutls_symmetric):
Work even if ptrdiff_t is wider than ‘long’.
(gnutls_symmetric, Fgnutls_hash_mac, Fgnutls_hash_digest):
Check for integer overflow in algorithm selection.
Eli Zaretskii [Fri, 14 Jul 2017 19:00:55 +0000 (22:00 +0300)]
Fix the MS-Windows build due to added GnuTLS functions
* src/gnutls.c [WINDOWSNT]: Add DEF_DLL_FN for new functions.
(init_gnutls_functions) [WINDOWSNT]: Add LOAD_DLL_FN for new
functions. Add #define redirections for new functions.
(gnutls_symmetric_aead): Fix format specs to be more portable when
printing ptrdiff_t arguments.
* src/fns.c (gnutls_rnd) [WINDOWSNT]: Redirect to w32_gnutls_rnd
wrapper.
* src/gnutls.h [WINDOWSNT]: Add prototype for w32_gnutls_rnd.
* test/lisp/net/gnutls-tests.el (gnutls-tests-tested-macs)
(gnutls-tests-tested-digests, gnutls-tests-tested-ciphers): Call
gnutls-available-p, otherwise GnuTLS functions might not be loaded
from the DLL on MS-Windows.