OGAWA Hirofumi [Sat, 18 Nov 2017 10:29:41 +0000 (12:29 +0200)]
Fix quick-calc in C mode with hex values
* lisp/calc/calc-aent.el (math-read-token): Make sure the match
against "0[xX][0-9a-fA-F]+" is found at math-exp-pos. See
http://lists.gnu.org/archive/html/emacs-devel/2017-11/msg00174.html
for the details.
Eli Zaretskii [Fri, 17 Nov 2017 19:37:04 +0000 (21:37 +0200)]
Prevent aborts in line-move-visual
* src/indent.c (line_number_display_width): Avoid assertion
violations in init_iterator when the window's buffer was
temporarily switched without updating window-start. (Bug#29326)
Robert Pluim [Fri, 17 Nov 2017 13:39:02 +0000 (15:39 +0200)]
Document how to enter whitespace when using grep-read-files
* lisp/progmodes/grep.el (lgrep, rgrep, grep-read-files): Explain
how to enter whitespace when using grep-read-files. (Bug#29303)
* lisp/progmodes/project.el (project-find-regexp): Likewise.
* lisp/vc/vc-git.el (vc-git-grep): Likewise.
Martin Rudalics [Tue, 14 Nov 2017 17:36:12 +0000 (18:36 +0100)]
; Fix last fix of 'mouse-drag-and-drop-region'
* lisp/mouse.el (mouse-drag-and-drop-region): Use 'car-safe'
instead of 'car' to ignore 'select-window' events. Thanks to
Stefan Monnier for spotting this.
Daniel Pittman [Tue, 14 Nov 2017 10:38:30 +0000 (11:38 +0100)]
Fix Bug#28139
* tramp-sh.el: Set TERM and INSIDE_EMACS environment earlier.
(tramp-remote-process-environment): Remove TERM and INSIDE_EMACS.
(tramp-remote-process-environment): Document their special handling.
(tramp-open-shell): Set TERM and INSIDE_EMACS prior to starting the
initial remote shell, so that it is also aware of the environment
in which it is operating. (Bug#28139)
Katsumi Yamaoka [Mon, 13 Nov 2017 23:56:26 +0000 (23:56 +0000)]
Fix cookie handling (bug#29282)
* lisp/url/url-cookie.el (url-cookie-handle-set-cookie):
Regard a Set-Cookie header as it contains a single cookie;
prefer Max-Age to Expires and convert it to Expires;
remove support for old time string styles (bug#29282).
Gemini Lasswell [Mon, 13 Nov 2017 21:22:39 +0000 (13:22 -0800)]
Improve documentation of Edebug and macros
* doc/lispref/edebug.texi (Instrumenting Macro Calls): Improve
discussion of when it might be necessary to find and evaluate macro
specifications before instrumenting.
(Specification List): Clarify what "defining form" means to Edebug
and when 'def-form' or 'def-body' should be used instead of 'form'
or 'body'.
Paul Eggert [Mon, 13 Nov 2017 16:51:41 +0000 (08:51 -0800)]
Simplify by removing HAVE_STRUCT_ATTRIBUTE_ALIGNED
* configure.ac (HAVE_STRUCT_ATTRIBUTE_ALIGNED): Remove. No longer
needed, since we no longer rely on __attribute__ ((aligned (8))).
All uses removed.
* src/emacs-module.c (HAVE_STRUCT_ATTRIBUTE_ALIGNED): Remove.
(lisp_to_value): Simplify now that we no longer need to worry
whether HAVE_STRUCT_ATTRIBUTE_ALIGNED is false.
Paul Eggert [Mon, 13 Nov 2017 16:51:41 +0000 (08:51 -0800)]
Use alignas to fix GCALIGN-related bugs
Use alignas and unions to specify alignments of objects needing
addresses that are at least a multiple of GCALIGNMENT. Using
these standard C facilities should be safer than relying on ad hoc
and poorly-understood features like GCC’s __attribute__
((aligned (N))), the root cause for recent porting bugs like
Bug#29040. The alignas macro was standardized by C11 and Gnulib
supports alignas for pre-C11 platforms. I have tested this on Sun
Studio 12 sparc (2007) and GCC 4.4.7 x86-64 (2012) as well as on
more recent platforms like GCC 7.2.1 (2017) on Fedora 26 (both
x86-64 and x86).
* lib-src/make-docfile.c (close_emacs_globals): lispsym is now
just an array of struct Lisp_Symbol, since struct Lisp_Symbol is
now properly aligned. All uses changed.
* src/alloc.c (NEXT_FREE_LISP_STRING): Just use the new u.next
member; this is simpler and safer than casting a pointer that
might not be aligned properly.
(aligned_Lisp_Symbol): Remove. No longer needed, now that struct
Lisp_Symbol is aligned properly. All uses replaced with struct
Lisp_Symbol.
* src/lisp.h (GCALIGNED): Remove, as it does not work as expected:
it can cause the natural alignment to be ignored. All uses
replaced by unions with a ‘char alignas (GCALIGNMENT)’ member as
described below.
(struct Lisp_Symbol, struct Lisp_Cons, struct Lisp_String):
Change definition from ‘struct TAG { MEMBERS };’ to
‘struct TAG { union { struct { MEMBERS } s; char alignas
(GCALIGNMENT) gcaligned; } u; };’. This guarantees ‘struct TAG’
to have an alignment that at least max (GCALIGNMENT, N) where N is
its old alignment. All uses like ‘PTR->MEMBER’ changed to
‘PTR->u.s.MEMBER’; these uses were supposed to be mostly private
anyway. Verify that the resulting ‘struct TAG’ is properly
aligned for Emacs.
(union vectorlike_header): New member ‘gcaligned’ to guarantee
that this type, and its containing types like ‘struct Lisp_Subr’,
‘struct buffer’ and ‘struct thread_state’, are all properly
aligned for Emacs.
(struct Lisp_String): New union member ‘next’, for the benefit
of NEXT_FREE_LISP_STRING.
(union Aligned_Cons, union Aligned_String): Remove. All uses
replaced by struct Lisp_Cons and struct Lisp_String, since they
are now properly aligned.
(USE_STACK_CONS, USE_STACK_STRING): Simplify now that we can
assume struct Lisp_Cons and struct Lisp_String are properly
aligned.
Paul Eggert [Mon, 13 Nov 2017 16:51:41 +0000 (08:51 -0800)]
Change vectorlike from struct to union
* src/lisp.h (vectorlike_headed): Change from struct to union.
All uses changed. Since it has only one member, this does not
change semantics. This is designed to simplify future changes
needed to fix bugs like Bug#29040. All uses changed.
Paul Eggert [Sun, 12 Nov 2017 06:59:41 +0000 (22:59 -0800)]
Pacify GCC when configured --with-x-toolkit=no
Without these changes, Emacs does not build on Fedora 26 x86-64
when configured --with-x-toolkit=no --enable-gcc-warnings.
* oldXMenu/Activate.c (XMenuActivate): Add FALLTHROUGH.
* src/xterm.c (x_dispatch_event): Define only if
USE_X_TOOLKIT || USE_MOTIF || USE_GTK.
Eli Zaretskii [Sat, 11 Nov 2017 11:48:37 +0000 (13:48 +0200)]
Improve the documentation of M-n for entering file names
* lisp/files.el (find-file, find-file-other-window)
(find-file-other-frame): Mention file-name-at-point-functions in
the doc string. Reported by Florian Weimer <fw@deneb.enyo.de> in
http://lists.gnu.org/archive/html/emacs-devel/2017-11/msg00224.html.
* doc/emacs/mini.texi (Minibuffer History): Document
file-name-at-point-functions and its effect on M-n when typing
file names in the minibuffer.
* doc/emacs/files.texi (File Names):
* doc/emacs/mini.texi (Minibuffer File): Add a cross-reference to
"Minibuffer History", where special features of M-n regarding
files are described.
Eli Zaretskii [Sat, 11 Nov 2017 09:53:42 +0000 (11:53 +0200)]
Fix desktop auto-save timer when linum-mode is used
* lisp/desktop.el (desktop-read): Use toplevel value of
window-configuration-change-hook when deciding whether desktop
auto-saving is enabled. Suggested by Peter Neidhardt
<pe.neidhardt@googlemail.com>. (Bug#28945)
Paul Eggert [Fri, 10 Nov 2017 23:16:50 +0000 (15:16 -0800)]
Fix off-by-1 bug in --enable-checking=stringbytes
Evidently nobody builds Emacs with --enable-checking=all,
which is no surprise as it is so slow as to be unusable nowadays.
Perhaps we should remove the slowest checks, or move them into
another category, or speed them up, or something.
* src/alloc.c (SDATA_SIZE) [GC_CHECK_STRING_BYTES]: Fix off-by-one
error in size calculation, which caused a failure when
--enable-checking=stringbytes was used. I introduced this bug in
2016-09-08T01:08:45!eggert@cs.ucla.edu "Port flexible array
members to GCC + valgrind".
Alan Mackenzie [Fri, 10 Nov 2017 17:45:22 +0000 (17:45 +0000)]
Correct the indentation of C99's compound literals.
* lisp/progmodes/cc-engine.el (c-looking-at-statement-block): Amend so that
if there is only syntactic whitespace in a brace block, it is regarded as a
statement block. Also, if there is no semicolon or comma delimiter, treat as
a statement block when there is a keyword.
(c-guess-basic-syntax): CASE 9 test: Regard a brace as starting a brace block
when its contents indicate a brace block.
João Távora [Thu, 9 Nov 2017 21:16:40 +0000 (21:16 +0000)]
Flymake correctly highlights whole last line if eob (bug#29201)
If a line/column pair indicates an end-of-buffer position, flymake
should behave like the case where the last line of the buffer is
referenced without a column indication. This behavior is currently
to highlight the whole last line.
* lisp/progmodes/flymake.el (flymake-diag-region): Correct
conditions of fallback to the fallback-eol local function.
João Távora [Thu, 9 Nov 2017 20:44:11 +0000 (20:44 +0000)]
Protect Flymake checkdoc backend against checkdoc errors (bug#29176)
The function checkdoc-current-buffer may error if there are unbalanced
parens, for example, but this shouldn't disable the
elisp-flymake-checkdoc backend.
* lisp/progmodes/elisp-mode.el (elisp-flymake-checkdoc): Use
ignore-errors.
Alan Mackenzie [Thu, 9 Nov 2017 18:34:13 +0000 (18:34 +0000)]
Correctly indent C++14 brace lists which are a second argument to a function.
In particular, don't indent contained brace lists in "staircase" fashion.
This fixes bug #28623.
* lisp/progmodes/cc-engine.el (c-looking-at-or-maybe-in-bracelist): When
testing for being enclosed in parens, recognise also a brace directly
following a comma, as well as a brace being the first thing inside the paren.
Enhance the return value, by indicating when we're directly inside an open
paren.
(c-inside-bracelist-p): Add an extra argument ACCEPT-IN-PARAM which indicates
whether we will accept a bracelist directly inside an open parenthesis.
Simplify the manipulation of PAREN-STATE by dispensing with variable LIM and
using c-pull-open-brace. Enhance the return value, respecting the new argument.
(c-guess-basic-syntax): Save a copy of the initial parse-state in the new
variable STATE-CACHE. Use this variable in place of C-STATE-CACHE throughout
the function. At CASE 7B, call c-inside-bracelist-p with extra argument nil.
At CASE 9, call that function with extra argument t.
Eli Zaretskii [Thu, 9 Nov 2017 16:22:42 +0000 (18:22 +0200)]
Fix redisplay of overlay-arrows on GUI frames
* src/xdisp.c (try_window_reusing_current_matrix)
(try_cursor_movement): Disallow these optimizations if the buffer
has overlay arrow(s) shown on the fringe(s). (Bug#29198)
Paul Eggert [Thu, 9 Nov 2017 05:30:26 +0000 (21:30 -0800)]
Fix URL cookie expiration bug
Problem reported by Damien Cassou (Bug#29223).
* lisp/url/url-cookie.el (url-cookie-expired-p):
Fix typo in previous change, which caused unexpired cookies
to be treated as expired and vice versa.
Paul Eggert [Thu, 9 Nov 2017 03:11:18 +0000 (19:11 -0800)]
Use GCALIGNED properly for GCC
Apparently GCC requires that ‘__attribute__ ((aligned (8)))’ must
immediately follow the ‘struct’ keyword when aligning a structure.
The attribute silently does not work if it follows a tag after the
‘struct’ keyword. Who knew? Anyway, this patch is designed to
fix a SIGSEGV problem reported by John Mastro (Bug#29183).
* lib-src/make-docfile.c (close_emacs_globals):
* src/buffer.c (buffer_defaults, buffer_local_symbols):
* src/lisp.h (DEFUN):
* src/thread.c (main_thread):
Put 'GCALIGNED' immediately after 'struct'.
Further workaround for faulty localtime() under macOS 10.6
* lisp/org/org-clock.el (org-clock--oldest-date): Fix an issue
when compiling on macOS 10.6 with a western time zone (a
continuation of Bug#27736). In particular, see:
Eric Abrahamsen [Sun, 22 Oct 2017 14:59:29 +0000 (07:59 -0700)]
Handle object string name in eieio-persistent-convert-list-object
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-convert-list-to-object):
Starting to phase out the printing of object names in
`object-write', handle either case.
Ryan C. Thompson [Wed, 26 Jul 2017 18:09:42 +0000 (11:09 -0700)]
Fix handling of nil PRED2 arg for completion-table-with-predicate
* lisp/minibuffer.el (completion-table-with-predicate): Don't act as
if strict is non-nil when pred2 is nil (Bug#27841).
* test/lisp/minibuffer-tests.el
(completion-table-with-predicate-test): Add a test for Bug#27841.
Antonin Houska [Mon, 6 Nov 2017 08:59:07 +0000 (09:59 +0100)]
Handle single-line comments correctly (Bug#26049)
* lisp/newcomment.el (comment-region-internal): Previously, the
comment text had to contain at least one line break character for the
ending extra line to be added. Make the behavior more consistent by
looking for end of line instead.
(comment-region-internal): Remove trailing white space from the
comment's initial line.
Martin Rudalics [Mon, 6 Nov 2017 07:45:52 +0000 (08:45 +0100)]
Document new treatment of 'comment-auto-fill-only-comments'
* doc/lispref/text.texi (Auto Filling): Add reference to Emacs
manual. Add description of 'comment-auto-fill-only-comments'.
* etc/NEWS: Mention new treatment of
'comment-auto-fill-only-comments'.
Michael Albinus [Sun, 5 Nov 2017 19:08:05 +0000 (20:08 +0100)]
Do not load Tramp unless `tramp-mode' is non-nil
* lisp/net/tramp.el (tramp-autoload-file-name-handler): Load Tramp only if
`tramp-mode' is non-nil.
(tramp-unload-file-name-handlers): Unload also
`tramp-autoload-file-name-handler'.
Justin Timmons [Mon, 12 Dec 2016 00:39:56 +0000 (19:39 -0500)]
Support python virtualenv on w32 (Bug#24464)
According to the virtualenv docs only POSIX systems follow the
structure "/path/to/venv/bin/", while windows systems use
"/path/to/venv/Scripts" for the location of the binary files, most
importantly including the python interpreter (see:
https://virtualenv.pypa.io/en/stable/userguide/#windows-notes).
* lisp/progmodes/python.el (python-shell-calculate-exec-path): Use the
"/path/to/venv/Scripts" for `windows-nt' machines.
João Távora [Sun, 5 Nov 2017 14:58:07 +0000 (14:58 +0000)]
Fix Flymake help-echo functions across windows (bug#29142)
* lisp/progmodes/flymake.el (flymake--highlight-line): Use
with-selected-window.
(flymake-goto-next-error): Call help-echo with a window and an
overlay.
João Távora [Fri, 3 Nov 2017 16:05:39 +0000 (16:05 +0000)]
Add a Flymake backend for Perl
Define a simple backend in perl-mode.el, which cperl-mode.el also
uses.
* lisp/progmodes/cperl-mode.el (cperl-mode): Add to
flymake-diagnostic-functions.
* lisp/progmodes/flymake-proc.el
(flymake-proc-allowed-file-name-masks): Disable legacy backend
for perl files.
* lisp/progmodes/perl-mode.el (perl-flymake-command): New
defcustom.
(perl--flymake-proc): New buffer-local variable.
(perl-flymake): New function.
(perl-mode): Add to flymake-diagnostic-functions.
João Távora [Fri, 3 Nov 2017 12:43:11 +0000 (12:43 +0000)]
Add a Flymake backend for Ruby
* lisp/progmodes/ruby-mode.el (ruby-flymake-command): New
defcustom.
(ruby--flymake-proc): New buffer-local variable.
(ruby-flymake): New function.
(ruby-mode): Add flymake-diagnostic-functions.
Lele Gaifax [Fri, 3 Nov 2017 12:20:36 +0000 (12:20 +0000)]
Add a Flymake backend for Python (bug#28808)
Implement new Flymake backend with related customizable settings.
* lisp/progmodes/python.el (python-flymake-command)
(python-flymake-command-output-pattern)
(python-flymake-msg-alist): New defcustom.
(python--flymake-parse-output): New function, able to parse
python-flymake-command output accordingly to
python-flymake-command-output-pattern.
(python-flymake): New function implementing the backend
interface using python--flymake-parse-output for the real
work.
(python-mode): Add python-flymake to flymake-diagnostic-functions.
Noam Postavsky [Tue, 31 Oct 2017 17:31:46 +0000 (13:31 -0400)]
Use hybrid malloc for FreeBSD (Bug#28308)
FreeBSD aarch64 does not provide sbrk, so gmalloc cannot be used; when
using system malloc dumping does not work correctly (allocated data is
invalid after dumping).
* configure.ac: Set hybrid_malloc for freebsd.
* src/gmalloc.c (gdefault_morecore) [!HAVE_SBRK]: Don't call sbrk.
Add html-, mhtml- and python-mode support to semantic symref
* lisp/cedet/semantic/symref/grep.el
(semantic-symref-filepattern-alist): Fix the entry for
'html-mode', which used a regexp-like syntax where only glob
syntax is permitted. As a result, 'xref-find-references' (M-?)
can now find references in HTML files. Also duplicate the same
entry for the sake of 'mhtml-mode', and add a new one for
'python-mode'.
(semantic-symref-derive-find-filepatterns): In the documentation,
clarify that returned patterns must follow the glob syntax. Fix
an 'if' test that always evaluates to nil.
(semantic-symref-tool-grep):
(semantic-symref-perform-search): Fix typos.
Eli Zaretskii [Sat, 4 Nov 2017 14:28:25 +0000 (16:28 +0200)]
Fix subtle problems in tabulated-list-mode with line numbers
* lisp/emacs-lisp/tabulated-list.el
(tabulated-list-watch-line-number-width): Call
tabulated-list-init-header instead of tabulated-list-revert.
(tabulated-list-window-scroll-function): New function.
(tabulated-list-mode): Put 'tabulated-list-window-scroll-function'
on the buffer-local 'window-scroll-functions' list.
Eli Zaretskii [Sat, 4 Nov 2017 09:56:26 +0000 (11:56 +0200)]
Improve documentation of window hooks
* doc/lispref/windows.texi (Window Hooks): Fix the description of
window-configuration-change-hook. (Bug#29049)
<run-window-scroll-functions, run-window-configuration-change-hook>:
Document these functions.