Michael Albinus [Mon, 8 Apr 2019 11:34:54 +0000 (13:34 +0200)]
Fix file-readable-p and file-executable-p in some Tramp backends
* lisp/net/tramp-archive.el (tramp-archive-handle-file-readable-p):
Use tramp-gvfs.
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-executable-p):
Check that FILENAME exists.
(tramp-gvfs-handle-file-readable-p): Check that FILENAME exists.
Use heuristic in case it cannot be determined correctly.
Paul Eggert [Sun, 7 Apr 2019 18:43:17 +0000 (11:43 -0700)]
Simplify fill_gstring_header
* src/composite.c (fill_gstring_header): Omit first argument HEADER,
since in practice it is always nil. Change caller to match.
Help the compiler by telling it LEN is nonnegative.
Problem found with --enable-gcc-warnings and gcc -O2 -Og.
Paul Eggert [Sun, 7 Apr 2019 09:44:37 +0000 (02:44 -0700)]
Fix more regexp oddities
Problems reported by Mattias Engdegård in:
https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00178.html
* lisp/progmodes/sh-script.el (sh-get-indent-info):
Reorder skip-chars-forward arg so that it does not look like a regexp.
* lisp/progmodes/verilog-mode.el (verilog-sk-define-signal):
Fix typo: the string is not a regexp.
* lisp/vc/log-edit.el (log-edit-goto-eoh): Fix typo: stray ‘:’.
* lisp/xml.el (xml-parse-dtd): Avoid ‘-’ right after char class.
display-graphic-p is not used in this case because it may be possible
in the future for terminals to allow control over cursor blinking. For
details, see bug#35058.
* lisp/frame.el (blink-cursor-mode): Use display-blink-cursor-p.
* lisp/button.el (button-at):
* lisp/wid-edit.el (widget-at): Avoid returning a false positive
when looking for a button and finding a widget, or vice versa.
* test/lisp/button-tests.el:
* test/lisp/wid-edit-tests.el: New files.
Alex Branham [Tue, 26 Mar 2019 01:49:01 +0000 (20:49 -0500)]
Update documentation for indent-relative functions
* lisp/indent.el (indent-relative): Document what happens when there
is no previous nonblank line.
* doc/lispref/text.texi (Relative Indent): Document
indent-relative-first-indent-point instead of obsolete
indent-relative-maybe. Fix documentation of which argument from
'indent-relative' is used.
Troy Hinckley [Wed, 16 Jan 2019 22:47:07 +0000 (14:47 -0800)]
Don't check comp-buffer-name-function in derived mode (Bug#34956)
* lisp/progmodes/compile.el (define-compilation-mode): Remove
'compilation-buffer-name-function' from the list of overridden
variables to ensure that it is not mistaken for a variable that can be
major mode specific. 'compilation-buffer-name-function' is used
before the major mode is loaded, therefore overriding it here is
ineffectual. Also, the function 'compilation-start' takes an optional
argument name-function, so there is already a mechanism to override
it.
Mauro Aranda [Sat, 23 Mar 2019 14:38:14 +0000 (11:38 -0300)]
Avoid recursive load of eshell
* lisp/eshell/eshell.el: Provide eshell before requiring esh-mode to
avoid a recursive load when esh-mode requires esh-module (which in
turn requires eshell). (Bug #34954)
The double loading can be noticed by entries in 'eshell-load-hook' or
forms passed to (with-eval-after-load 'eshell ...).
Eli Zaretskii [Wed, 3 Apr 2019 17:41:47 +0000 (20:41 +0300)]
Improve commentary in 'field_relpos'
* src/pdumper.c (PDUMPER_MAX_OBJECT_SIZE): New macro.
(field_relpos): Use PDUMPER_MAX_OBJECT_SIZE, and comment on
why we require that relpos be not too large.
Eli Zaretskii [Wed, 3 Apr 2019 17:30:23 +0000 (20:30 +0300)]
Restore process-environment after portable dumping
* src/pdumper.c (struct dump_context): New member
old_process_environment.
(Fdump_emacs_portable): Record the original value of
process-environment.
(dump_unwind_cleanup): Restore the original values of
process-environment and post-gc-hook.
* lisp/electric.el (electric-indent-functions-without-reindent):
* lisp/indent.el (indent-according-to-mode): Check for
indent-relative-first-indent-point in addition to its obsolete alias
indent-relative-maybe.
* lisp/obsolete/vi.el (vi-com-map): Use
indent-relative-first-indent-point in place of its obsolete alias
indent-relative-maybe.
Stefan Monnier [Wed, 3 Apr 2019 15:24:12 +0000 (11:24 -0400)]
* lisp/progmodes/compile.el: Use non-nil values for *-function
(compilation-parse-errors-filename-function,compilation-exit-message-function)
(compilation-process-setup-function, compilation-buffer-name-function):
Give them non-nil default values.
(compilation-buffer-name): Restructure slightly.
(compilation--default-buffer-name): New function, extracted from it.
Use `name-of-mode` instead of `mode-command` to check if the current
buffer is already in the appropriate mode.
Stefan Monnier [Wed, 3 Apr 2019 14:58:36 +0000 (10:58 -0400)]
* lisp/progmodes/compile.el: Allow 'line' functions in error-regexp-alist
(compilation-error-properties): Allow 'line' and 'end-line' to be functions,
like 'col' and 'end-col'.
(compilation-error-regexp-alist): Document this.
(compilation-parse-errors): Drop support for old undocumented feature
where 'line' was a function of 2 arguments.
(compilation--compat-error-properties): Delete function.
(gnus-dup-list-dirty): Add docstring.
(gnus-dup-open): Allocate gnus-dup-hashtb more conservatively now
that it is no longer an obarray.
(gnus-dup-enter-articles): Fix off-by-one error.
(gnus-dup-suppress-articles): DRY.
For discussion, see thread starting at:
https://lists.gnu.org/archive/html/emacs-devel/2019-03/msg00974.html
Wilson Snyder [Wed, 3 Apr 2019 00:05:16 +0000 (20:05 -0400)]
Fix verilog-mode vmm statements and AUTOINPUTREG ignores.
* lisp/progmodes/verilog-mode.el (verilog-vmm-statement-re):
Fix vmm statement regexps. Reported by Mattias Engdegard.
(verilog-auto-reg-input)
(verilog-auto-reg-input-assigned-ignore-regexp): For AUTOINPUTREG,
allow ignoring assignments with new
`verilog-auto-reg-input-assigned-ignore-regexp' variable, bug1401.
Reported by David Rogoff.
Paul Eggert [Tue, 2 Apr 2019 22:00:59 +0000 (15:00 -0700)]
Improve regexp advice again, and unchain ranges
* doc/lispref/searching.texi (Regexp Special):
Mention char classes earlier, in a more-logical place.
Advise sticking to ASCII letters and digits in ranges.
Reword negative advice to make it clearer that it’s negative.
* lisp/files.el (make-auto-save-file-name):
* lisp/gnus/message.el (message-mailer-swallows-blank-line):
* lisp/gnus/nndoc.el (nndoc-lanl-gov-announce-type-p)
(nndoc-generate-lanl-gov-head):
* lisp/org/org-eshell.el (org-eshell-open):
* lisp/org/org.el (org-deadline-time-hour-regexp)
(org-scheduled-time-hour-regexp):
* lisp/progmodes/bat-mode.el (bat-font-lock-keywords):
* lisp/progmodes/bug-reference.el (bug-reference-bug-regexp):
* lisp/textmodes/less-css-mode.el (less-css-font-lock-keywords):
* lisp/vc/vc-cvs.el (vc-cvs-valid-symbolic-tag-name-p):
* lisp/vc/vc-svn.el (vc-svn-valid-symbolic-tag-name-p):
Avoid attempts to chain ranges, as this can be confusing.
For example, instead of [0-9-_.], use [0-9_.-].
Paul Eggert [Tue, 2 Apr 2019 07:17:37 +0000 (00:17 -0700)]
More regexp advice and clarifications
* doc/lispref/searching.texi (Regexp Special): Simplify style
advice for order of ], ^, and - in character alternatives.
Stick with saying that it’s not a good idea to put ‘-’ after a
range. Remove the special case about raw 8-bit bytes and
unibyte characters, as this documentation is confusing and
seems to be incorrect in some cases. Say that z-a is the
preferred style for reversed ranges, since it’s clearer and is
typically what’s used in practice. Mention some bad styles:
duplicates in character alternatives, ranges that denote <=3
characters, and ‘-’ as the first character.
Paul Eggert [Mon, 1 Apr 2019 18:54:23 +0000 (11:54 -0700)]
Make struct Lisp_Objfwd etc. objects read-only
Initialize these objects statically, and make them constants.
This is a bit safer and more efficient.
* src/data.c (XBOOLFWD, XKBOARD_OBJFWD, XFIXNUMFWD, XOBJFWD):
* src/lisp.h (XBUFFER_OBJFWD):
Return a pointer-to-const instead of an unrestricted pointer.
(lispfwd): fwdptr is now a pointer-to-const instead of an
unrestricted pointer. All uses changed.
(SET_SYMBOL_FWD): Accept pointer-to-const instead of an
unrestricted pointer.
(DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT)
(DEFVAR_KBOARD): Initialize static structures statically
instead of dynamically, and make them const.
* src/lread.c (defvar_int, defvar_bool, defvar_lisp_nopro)
(defvar_lisp, defvar_kboard): Accept pointer-to-const instead
of an unrestricted pointer; it’s now the caller’s
responsibility to initialize the pointed-to storage. No need
for a separate address argument any more. All callers
changed.
Paul Eggert [Mon, 1 Apr 2019 18:54:23 +0000 (11:54 -0700)]
Fix union Lisp_Fwd * alignment bug
It's not portable to cast (e.g.) struct Lisp_Objfwd * to union
Lisp_Fwd * and then back again, because the compiler can then assume
that the pointer is aligned for union Lisp_Fwd * when accessing
the struct Lisp_Objfwd * components, and this assumption might
be incorrect becase we don't force that alignment.
* src/lisp.h (lispfwd): New type, replacing ...
(union Lisp_Fwd): ... this type, which was removed.
All uses changed.
(SET_SYMBOL_FWD): 2nd arg is now void *, not lispfwd.
All uses changed (casts no longer needed; they were
not portable anyway).
Paul Eggert [Mon, 1 Apr 2019 03:00:30 +0000 (20:00 -0700)]
Use update-game-score more often with Tetris
* lisp/play/gamegrid.el (gamegrid-add-score-with-update-game-score):
Go back to previous way of deciding whether to invoke
update-game-score, except do not try to invoke it if file-modes
fails on it (Bug#35056).
* lisp/textmodes/text-mode.el (text-mode): Do not reset
indent-line-function to its global default value of indent-relative.
* doc/lispref/modes.texi (Example Major Modes):
* etc/NEWS: Document change accordingly.
For discussion, see thread starting at:
https://lists.gnu.org/archive/html/emacs-devel/2019-03/msg01012.html
* lisp/textmodes/text-mode.el (text-mode): Do not reset
indent-line-function to its global default value of indent-relative.
* doc/lispref/modes.texi (Example Major Modes):
* etc/NEWS: Document change accordingly.
* lisp/textmodes/text-mode.el: Use lexical-binding.
(text-mode, paragraph-indent-minor-mode, text-mode-hook-identify):
Use setq-local.
(toggle-text-mode-auto-fill): Quote function symbols as such.
(center-line): Minor simplification.
* doc/lispref/modes.texi (Example Major Modes): Update code example
for these changes to text-mode.
* doc/lispref/text.texi (User-Level Deletion): Document new optional
arguments of delete-indentation.
* lisp/simple.el (delete-indentation): Do not barf if called
interactively when region is inactive. (bug#35021)
Do not skip blank lines. (bug#35036)
Consistently deactivate mark even when no text was changed.
Handle active region spanning a single line.
* test/lisp/simple-tests.el (simple-test--buffer-substrings):
New convenience function.
(simple-test--dummy-buffer, simple-test--transpositions): Use it.
(simple-delete-indentation-no-region)
(simple-delete-indentation-inactive-region): Update commentary.
Call delete-indentation interactively when testing for behavior with
inactive region and region is not explicitly defined.
(simple-delete-indentation-blank-line)
(simple-delete-indentation-boundaries)
(simple-delete-indentation-region)
(simple-delete-indentation-prefix): New tests.
Alan Mackenzie [Sat, 30 Mar 2019 13:19:47 +0000 (13:19 +0000)]
Allow a CC Mode derived mode to have strings delimited by single quotes.
Also fix the bug where the delimiters of '\033', etc. got the error face.
* lisp/progmodes/cc-langs.el (c-single-quotes-quote-strings): Enhance the docr
string.
(c-string-delims): Change doc string to doc comment.
* listp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings): In
searches and comparisons, take account of the string delimiters possibly
being '. Fix argument in call of c-before-change-check-unbalanced-strings.
(c-parse-quotes-before-change, c-parse-quotes-after-change): Bind
case-fold-search to nil. Analyze escape constructs inside character constants
more accurately, in particular accepting as valid more than one character
after /[0-7], /x, /u, and /U. Amend calculations to account for this extra
length.
* src/search.c (looking_at_1, search_buffer_re): Unfreeze the regexp
buffer before signalling a matcher overflow, since the error
processing may require quite some regexp use as well (Bug#34910).
* src/search.c (compile_pattern): Don't give up if the last regexp
cache entry is busy. Instead, use the last (least recently used)
non-busy entry, and only signal a reentrancy error if there is no free
entry at all (Bug#34910).
Eli Zaretskii [Sat, 30 Mar 2019 09:01:58 +0000 (12:01 +0300)]
Don't run buffer-related hooks in " *code conversion work*" buffers
Note: portions of this change were mistakenly pushed as part
of an unrelated commit a35a1f6a9.
* src/buffer.c (Fget_buffer_create): Set inhibit_buffer_hooks
non-zero for temporary buffers created by coding.c. Don't run
buffer-list-update-hook for such buffers.
(Frename_buffer, Fkill_buffer, record_buffer)
(Fbury_buffer_internal): Don't run hooks for buffers whose
inhibit_buffer_hooks flag is set.
* src/buffer.h (struct buffer): New member
inhibit_buffer_hooks.
* src/pdumper.c (dump_buffer): Dump the new field. Update the
hash value in HASH_buffer_XXX.
* src/coding.c (make_conversion_work_buffer): Function deleted;
code moved to code_conversion_save.
(code_conversion_save): Insert code from
make_conversion_work_buffer, but arrange for unwind-protecting
the current buffer before switching to the work buffer. This
avoids leaving reused_workbuf_in_use set if user presses C-g
during encoding/decoding.
(Vcode_conversion_workbuf_name): Now external variable.
* src/coding.h (Vcode_conversion_reused_workbuf): Declare.
Stefan Monnier [Fri, 29 Mar 2019 12:46:29 +0000 (08:46 -0400)]
Gnus: Automatically render text/calendar in a human-friendly way
* lisp/gnus/mm-decode.el (mm-inline-media-tests): Add text/calendar entry.
Use (fboundp 'device-sound-enabled-p) rather than fishing for features.
(mm-automatic-display): Add text/calendar entry.
* lisp/emacs-lisp/pcase.el (pcase--u1):
Use memql instead of memq to work with bignums (Bug#34781).
* test/lisp/emacs-lisp/pcase-tests.el (pcase-tests-member): Test the above.
Eli Zaretskii [Thu, 28 Mar 2019 16:00:06 +0000 (18:00 +0200)]
Fix display of sliced images on MS-Windows
* src/w32term.c (x_draw_image_foreground): Fix detection of
scaled images for sliced images. Scale the original width of
a slice and its coordinates of origin as well.
Paul Eggert [Thu, 28 Mar 2019 04:51:39 +0000 (21:51 -0700)]
Simpler way to export HAVE_X_WINDOWS to GDB
* src/.gdbinit: Simplify by removing dependency on globals
implementation. This is useful for a future performance
improvement that I have in mind.
* src/alloc.c (enum defined_HAVE_X_WINDOWS, defined_HAVE_X_WINDOWS):
New enum and constant.
(gdb_make_enums_visible) [__GNUC__]: Use it, to make
defined_HAVE_X_WINDOWS visible to GDB.
Paul Eggert [Thu, 28 Mar 2019 04:03:10 +0000 (21:03 -0700)]
Tweak re_registers allocation
* src/regex-emacs.c (re_match_2_internal):
No need to allocate one extra trailing search register;
Emacs does not use it. Avoid quadratic behavior on
reallocation.
Eli Zaretskii [Wed, 27 Mar 2019 18:34:22 +0000 (20:34 +0200)]
Attempt to fix crashes under GDB on Windows 10
* src/pdumper.c (dump_discard_mem)
[VM_SUPPORTED == VM_MS_WINDOWS]: Don't pass NULL pointer as
last argument to VirtualProtect. Reported by Martin Rudalics
<rudalics@gmx.at>.
Paul Eggert [Wed, 27 Mar 2019 17:01:21 +0000 (10:01 -0700)]
Minor xml.el tweaks
* lisp/xml.el (xml-name-start-char-re, xml-name-char-re):
No need to call concat.
(xml-name-char-re): Use \u escapes rather than chars inline,
so that the code matches the comments better and is easier
to audit.