emacs.git
7 years agoAvoid a regexp overflow in message-goto-body
Lars Ingebrigtsen [Thu, 26 Jan 2017 20:12:05 +0000 (26 21:12 +0100)]
Avoid a regexp overflow in message-goto-body

* lisp/gnus/message.el (message-goto-body-1): Avoid using a
complicated backtracking regexp, because they may overflow on
large headers (bug#21160).

7 years agoRefactor message-goto-body
Lars Ingebrigtsen [Thu, 26 Jan 2017 20:04:00 +0000 (26 21:04 +0100)]
Refactor message-goto-body

* lisp/gnus/message.el (message-goto-body-1): Refactor out for reuse.

7 years agoFix typo in last checkin
Lars Ingebrigtsen [Thu, 26 Jan 2017 18:45:39 +0000 (26 19:45 +0100)]
Fix typo in last checkin

* lisp/gnus/nnimap.el (nnimap-shell-program): Document
nnimap-shell-program (bug#20651).

7 years agoDocument nnimap-shell-program
Lars Ingebrigtsen [Thu, 26 Jan 2017 18:44:01 +0000 (26 19:44 +0100)]
Document nnimap-shell-program

* lisp/gnus/nnimap.el (nnimap-shell-program): Document
nnimap-shell-program (bug#20651).

7 years agoDocument :shell-command in `make-network-process'
Lars Ingebrigtsen [Thu, 26 Jan 2017 18:41:56 +0000 (26 19:41 +0100)]
Document :shell-command in `make-network-process'

* doc/lispref/processes.texi (Network): Document :shell-command.

* lisp/net/network-stream.el (open-network-stream): Document
the :shell-command parameter (bug#20651).

7 years agoGnus doc clarification
Lars Ingebrigtsen [Thu, 26 Jan 2017 18:21:59 +0000 (26 19:21 +0100)]
Gnus doc clarification

* lisp/gnus/gnus-sum.el (gnus-summary-save-article): Mention
the gnus-prompt-before-saving variable (bug#20500).

7 years agoFix the previous mml patch better
Lars Ingebrigtsen [Thu, 26 Jan 2017 18:09:58 +0000 (26 19:09 +0100)]
Fix the previous mml patch better

* lisp/gnus/mml.el (mml-minibuffer-read-file): Fix the
previous patch in a better way (bug#20480).

7 years agoGive a slight better error message in mml-minibuffer-read-file
Lars Ingebrigtsen [Thu, 26 Jan 2017 18:07:00 +0000 (26 19:07 +0100)]
Give a slight better error message in mml-minibuffer-read-file

* lisp/gnus/mml.el (mml-minibuffer-read-file): Give a slightly
better error message when the user enters nothing (bug#20480).

7 years ago; Just use octal
Mark Oteiza [Thu, 26 Jan 2017 18:12:54 +0000 (26 13:12 -0500)]
; Just use octal

* lisp/recentf.el (recentf-save-file-modes): Write file mode in octal.

7 years agoMake eww buffers prettier in the buffer listing
Lars Ingebrigtsen [Thu, 26 Jan 2017 17:32:48 +0000 (26 18:32 +0100)]
Make eww buffers prettier in the buffer listing

* lisp/net/eww.el (eww-render): Put the currently visited URL
into the buffer listing (bug#23738).
(eww-render): Ditto.

7 years agoAllow mml-attach-file to prompt less
Lars Ingebrigtsen [Thu, 26 Jan 2017 17:19:46 +0000 (26 18:19 +0100)]
Allow mml-attach-file to prompt less

* lisp/gnus/mml.el (mml-attach-file): If given a prefix, don't
prompt for type/description/disposition, but use defaults
(bug#19202).

7 years agoDon't allow message-newline-and-reformat to be run outside the body
Lars Ingebrigtsen [Thu, 26 Jan 2017 14:07:38 +0000 (26 15:07 +0100)]
Don't allow message-newline-and-reformat to be run outside the body

* lisp/gnus/message.el (message-newline-and-reformat): Error
out if run outside the body of a message (bug#18820).

7 years agoReplace QUIT with maybe_quit
Paul Eggert [Thu, 26 Jan 2017 05:13:19 +0000 (25 21:13 -0800)]
Replace QUIT with maybe_quit

There’s no longer need to have QUIT stand for a slug of C statements.
Use the more-obvious function-call syntax instead.
Also, use true and false when setting immediate_quit.
These changes should not affect the generated machine code.
* src/lisp.h (QUIT): Remove.  All uses replaced by maybe_quit.

7 years agoA quicker check for quit
Paul Eggert [Thu, 26 Jan 2017 04:27:45 +0000 (25 20:27 -0800)]
A quicker check for quit

On some microbenchmarks this lets Emacs run 60% faster on my
platform (AMD Phenom II X4 910e, Fedora 25 x86-64).
* src/atimer.c: Include keyboard.h, for pending_signals.
* src/editfns.c (Fcompare_buffer_substrings):
* src/fns.c (Fnthcdr, Fmemq, Fmemql, Fassq, Frassq, Fplist_put)
(Fnconc, Fplist_member):
Set and clear immediate_quit before and after loop instead of
executing QUIT each time through the loop.  This is OK for loops
that affect only locals.
* src/eval.c (process_quit_flag): Now static.
(maybe_quit): New function, containing QUIT’s old body.
* src/fns.c (rarely_quit): New function.
(Fmember, Fassoc, Frassoc, Fdelete, Fnreverse, Freverse)
(Flax_plist_get, Flax_plist_put, internal_equal, Fnconc):
Use it instead of QUIT, for
speed in tight loops that might modify non-locals.
* src/keyboard.h (pending_signals, process_pending_signals):
These belong to keyboard.c, so move them here ...
* src/lisp.h: ... from here.
(QUIT): Redefine in terms of the new maybe_quit function, which
contains this macro’s old definiens.  This works well with branch
prediction on processors with return stack buffers, e.g., x86
other than the original Pentium.

7 years agoSimplify make-list implementation
Paul Eggert [Thu, 26 Jan 2017 03:07:57 +0000 (25 19:07 -0800)]
Simplify make-list implementation

* src/alloc.c (Fmake_list): Don’t unroll loop, as the complexity
is not worth it these days.

7 years agoMake use of cl-loop destructuring
Mark Oteiza [Thu, 26 Jan 2017 02:34:46 +0000 (25 21:34 -0500)]
Make use of cl-loop destructuring

* lisp/progmodes/js.el (js--get-tabs): Replace extraneous bits with
destructuring.
(with-js): Add declare forms.

7 years agoRevert "Bind C-c keys in the article buffer"
Lars Ingebrigtsen [Wed, 25 Jan 2017 21:53:07 +0000 (25 22:53 +0100)]
Revert "Bind C-c keys in the article buffer"

This reverts commit 6b4195f2ace1f6328c5a833fde40f39babef4fa6.

The commit somehow lead to problems in other parts of Emacs.

7 years ago; * doc/lispref/lists.texi (List Elements): Fix last change.
Eli Zaretskii [Wed, 25 Jan 2017 20:49:35 +0000 (25 22:49 +0200)]
; * doc/lispref/lists.texi (List Elements): Fix last change.

7 years agoDocument how to quote MML tags
Lars Ingebrigtsen [Wed, 25 Jan 2017 20:47:28 +0000 (25 21:47 +0100)]
Document how to quote MML tags

* doc/misc/emacs-mime.texi (MML Definition): Mention how to
quote MML tags (bug#18881).

7 years agoMake address parsing more robust
Lars Ingebrigtsen [Wed, 25 Jan 2017 20:21:40 +0000 (25 21:21 +0100)]
Make address parsing more robust

* lisp/mail/ietf-drums.el (ietf-drums-parse-address): Don't
bug out on addresses like
(ietf-drums-parse-address "\"Foo \"bar\" <larsi@gnus.org>")
(bug#18572).

7 years agoFix the %P (line number) thing in Gnus summary buffers
Lars Ingebrigtsen [Wed, 25 Jan 2017 19:57:52 +0000 (25 20:57 +0100)]
Fix the %P (line number) thing in Gnus summary buffers

* lisp/gnus/gnus-salt.el (gnus-pick-line-number): Remove hack.

* lisp/gnus/gnus-sum.el (gnus-summary-read-group-1): Reset the
"pick" mode line number on entry instead of relying in a hack (bug#18311).

7 years agoFix wrong documentation on nnmairix keystrokes
Lars Ingebrigtsen [Wed, 25 Jan 2017 19:43:27 +0000 (25 20:43 +0100)]
Fix wrong documentation on nnmairix keystrokes

* doc/misc/gnus.texi (nnmairix keyboard shortcuts): The
nnmairix commands are on G G, not $ (bug#18260).

7 years agoBind C-c keys in the article buffer
Lars Ingebrigtsen [Wed, 25 Jan 2017 19:40:27 +0000 (25 20:40 +0100)]
Bind C-c keys in the article buffer

* lisp/gnus/gnus-art.el (gnus-article-mode-map): Also bind the
C-c keys so that they execute in the summary buffer
(bug#18257).  This makes commands like `C-c C-f' work from the
article buffer.

7 years agoDon't mark articles in Gnus as displayed when they aren't
Lars Ingebrigtsen [Wed, 25 Jan 2017 19:30:44 +0000 (25 20:30 +0100)]
Don't mark articles in Gnus as displayed when they aren't

* lisp/gnus/gnus-sum.el (gnus-summary-read-group-1): Don't
mark any articles as selected if we're not selecting any
articles (bug#18255).

7 years agoMove cXXXr and cXXXXr to subr.el
Mark Oteiza [Wed, 25 Jan 2017 19:21:10 +0000 (25 14:21 -0500)]
Move cXXXr and cXXXXr to subr.el

* etc/NEWS: Mention new core Elisp.
* doc/lispref/lists.texi (List Elements): Document and index the new
functions.
* doc/misc/cl.texi (List Functions): Change "defines" to "aliases".
* lisp/subr.el (caaar, caadr, cadar, caddr, cdaar, cdadr, cddar)
(cdddr, caaaar caaadr, caadar, caaddr, cadaar, cadadr, caddar):
(cadddr, cdaaar, cdaadr, cdadar, cdaddr, cddaar, cddadr, cdddar):
(cddddr): New functions.
* lisp/emacs-lisp/cl-lib.el (cl-caaar, cl-caadr, cl-cadar, cl-caddr):
(cl-cdaar, cl-cdadr, cl-cddar cl-cdddr, cl-caaaar cl-caaadr):
(cl-caadar, cl-caaddr, cl-cadaar, cl-cadadr, cl-caddar, cl-cadddr):
(cl-cdaaar, cl-cdaadr, cl-cdadar, cl-cdaddr, cl-cddaar, cl-cddadr):
(cl-cdddar, cl-cddddr): Alias to new subr functions.
* lisp/emacs-lisp/cl.el (cl-unload-function): Remove cXXXr and cXXXXr
elements.

7 years agoOnly save .newsrc file if the native method is NNTP
Lars Ingebrigtsen [Wed, 25 Jan 2017 18:30:33 +0000 (25 19:30 +0100)]
Only save .newsrc file if the native method is NNTP

* lisp/gnus/gnus-start.el (gnus-save-newsrc-file): Only save
the .newsrc file if the native select method is NNTP
(bug#18198).  This avoids problems with invalid IMAP group
names and the like in the .newsrc file.

7 years agoOnly save .newsrc file if the native method is NNTP
Lars Ingebrigtsen [Wed, 25 Jan 2017 18:30:22 +0000 (25 19:30 +0100)]
Only save .newsrc file if the native method is NNTP

* lisp/gnus/gnus-start.el (gnus-save-newsrc-file): Only save
the .newsrc file if the native select method is NNTP
(bug#18198).  This avoids problems with invalid IMAP group
names and the like in the .newsrc file.

7 years agoGnus custom spec fix
Lars Ingebrigtsen [Wed, 25 Jan 2017 17:31:42 +0000 (25 18:31 +0100)]
Gnus custom spec fix

* lisp/gnus/gnus-art.el (gnus-signature-limit): Fix customize
spec to match the doc string (bug#17679).

7 years agoClarify confusing Gnus error message
Lars Ingebrigtsen [Wed, 25 Jan 2017 17:27:33 +0000 (25 18:27 +0100)]
Clarify confusing Gnus error message

* lisp/gnus/gnus-topic.el (gnus-topic-unindent): Clarify
confusing error message (bug#17677).

7 years agoMake C-u C-x m work with Message as documented
Lars Ingebrigtsen [Wed, 25 Jan 2017 17:14:00 +0000 (25 18:14 +0100)]
Make C-u C-x m work with Message as documented

* lisp/gnus/message.el (message-mail): Respect the CONTINUE
parameter (bug#17175).

7 years agoFix problem with auto-mode and dir-locals-collect-variables
Lars Ingebrigtsen [Wed, 25 Jan 2017 16:43:44 +0000 (25 17:43 +0100)]
Fix problem with auto-mode and dir-locals-collect-variables

* lisp/files.el (dir-locals-collect-variables): When run from
auto-mode, the file in question may not be an absolute path
name (bug#24016).

Example backtrace:

Debugger entered--Lisp error: (args-out-of-range "compile-1st-in-loa
  dir-locals-collect-variables(((emacs-lisp-mode (indent-tabs-mode))
  hack-dir-local-variables()
  hack-local-variables(no-mode)
  run-mode-hooks(diff-mode-hook)
  diff-mode()
  mm-display-inline-fontify((#<buffer  *mm*-923037> ("text/x-diff" (

7 years agoAttach text files correctly in Message
Lars Ingebrigtsen [Wed, 25 Jan 2017 16:28:17 +0000 (25 17:28 +0100)]
Attach text files correctly in Message

* lisp/gnus/mml.el (mml-generate-mime-1): Detect which coding
system has been used in attached text files, and don't try to
do any encoding of these files (bug#13808).

7 years agoBuild fix for older gnutls versions
Lars Ingebrigtsen [Wed, 25 Jan 2017 13:21:13 +0000 (25 14:21 +0100)]
Build fix for older gnutls versions

* src/gnutls.c (emacs_gnutls_handle_error):
GNUTLS_E_PREMATURE_TERMINATION is apparently only present in
gnutls-3.

7 years agoediff-difference-vector-alist: Drop duplicated definition
Tino Calancha [Wed, 25 Jan 2017 06:15:16 +0000 (25 15:15 +0900)]
ediff-difference-vector-alist: Drop duplicated definition

* lisp/vc/ediff-init.el (ediff-difference-vector-alist):
Drop duplicated definition.
(ediff-difference-vector-A, ediff-difference-vector-B)
(ediff-difference-vector-C, ediff-difference-vector-Ancestor):
Move definition before 'ediff-difference-vector-alist'.

7 years agoRevert "nnimap.el: support additional expunge options"
Lars Ingebrigtsen [Wed, 25 Jan 2017 00:18:43 +0000 (25 01:18 +0100)]
Revert "nnimap.el: support additional expunge options"

This reverts commit 4e9baea6aba1633074889339dcc7cdc9d73880d3.

The patch broke fetching new mail:

Debugger entered--Lisp error: (error "Format specifier doesn’t match argument type")
  format("%d .*\n" (t ("OK" ("HIGHESTMODSEQ" "914696") "Expunge" "completed.") ("VANISHED" "1825937") ("0" "RECENT")))
  (looking-at (format "%d .*\n" sequence))
  (not (looking-at (format "%d .*\n" sequence)))
  (progn (while (and (not (bobp)) (progn (forward-line -1) (looking-at "\\*\\|[0-9]+ OK NOOP")))) (not (looking-at (format "%d .*\n" sequence))))

7 years agonnimap.el: support additional expunge options
Nikolaus Rath [Tue, 24 Jan 2017 23:46:13 +0000 (25 00:46 +0100)]
nnimap.el: support additional expunge options

* lisp/gnus/nnimap.el (nnimap-close-group)
(nnimap-request-expire-articles, nnimap-delete-article)
(nnimap-request-scan): add new 'never, 'immediate, and 'on-exit
settings for nnimap-expunge (bug#20670).

7 years agoDon't tag Gnus bugs with "gnus"
Lars Ingebrigtsen [Tue, 24 Jan 2017 23:29:24 +0000 (25 00:29 +0100)]
Don't tag Gnus bugs with "gnus"

* lisp/gnus/gnus-msg.el (gnus-bug): Remove the bug package tags.

* lisp/gnus/gnus.el (gnus-bug-package): Removed; Gnus doesn't
have its own package any more in the bug tracker.

7 years agoTweak TLS error messaging on closed connections
Lars Ingebrigtsen [Tue, 24 Jan 2017 23:23:28 +0000 (25 00:23 +0100)]
Tweak TLS error messaging on closed connections

* src/gnutls.c (emacs_gnutls_handle_error): Demote the normal
peer-closed-connection "The TLS connection was non-properly
terminated" message to a lower level so that it isn't shown to
the user by default.

7 years agoAvoid having eww unexpectedly open external browsers
Lars Ingebrigtsen [Tue, 24 Jan 2017 22:39:05 +0000 (24 23:39 +0100)]
Avoid having eww unexpectedly open external browsers

* lisp/net/eww.el (eww-render): Instead of opening unsupported
content types like audio/mpeg directly in an external browser
(which can be very confusing especially when something
redirects to a file like that), just display a simple
interstitial that people can choose to click on or not
(bug#22671).

7 years agoWhen opening new eww buffers, use buffer names based on the host name
Lars Ingebrigtsen [Tue, 24 Jan 2017 21:40:57 +0000 (24 22:40 +0100)]
When opening new eww buffers, use buffer names based on the host name

* lisp/net/eww.el (eww-browse-url): When opening in a new
window, use a buffer name based on the host name (bug#23738).
(eww--dwim-expand-url): Refactored out into its own function
for easier reuse.

7 years agoxml: Fix parsing of default namespace with quoted names
David Engster [Tue, 24 Jan 2017 21:47:53 +0000 (24 22:47 +0100)]
xml: Fix parsing of default namespace with quoted names

* lisp/xml.el (xml-parse-attlist): Properly extract namespace when
  parsing is done with quoted symbol names (bug#23440).
* test/lisp/xml-tests.el (xml-parse-test--default-namespace-qnames)
  (xml-parse-test-default-namespace-qnames): Test for the above.

7 years agoFix rendering of some complex SVG images
Lars Ingebrigtsen [Tue, 24 Jan 2017 21:21:45 +0000 (24 22:21 +0100)]
Fix rendering of some complex SVG images

* lisp/net/shr.el (shr-parse-image-data): Don't transform
SVG->DOM->XML unless we're blocking images, as this is apt to
destroy the SVG (bug#24111).

7 years agoClarify the last clarification
Lars Ingebrigtsen [Tue, 24 Jan 2017 20:33:51 +0000 (24 21:33 +0100)]
Clarify the last clarification

* lisp/net/shr.el (shr-width): Clarify the interaction with
`shr-use-fonts' (bug#24928).

7 years agoshr-width doc clarification
Lars Ingebrigtsen [Tue, 24 Jan 2017 20:31:17 +0000 (24 21:31 +0100)]
shr-width doc clarification

* lisp/net/shr.el (shr-width): Clarify the interaction with
`shr-use-fonts' (bug#24928).

7 years agoAllow passing in max-width/height
Lars Ingebrigtsen [Tue, 24 Jan 2017 20:17:09 +0000 (24 21:17 +0100)]
Allow passing in max-width/height

* lisp/net/shr.el (shr-rescale-image): Allow passing in
max-width/height (bug#25287).

7 years ago* lisp/progmodes/vhdl-mode.el: Avoid add-to-list on local vars
Stefan Monnier [Tue, 24 Jan 2017 16:31:11 +0000 (24 11:31 -0500)]
* lisp/progmodes/vhdl-mode.el: Avoid add-to-list on local vars

Require `cl' for `pushnew'.
(vhdl-scan-project-contents, vhdl-compose-wire-components)
(vhdl-uniquify): Use `pushnew' instead of `add-to-list'.

7 years agoFix comment detection on open parens
Noam Postavsky [Sun, 18 Dec 2016 05:00:30 +0000 (18 00:00 -0500)]
Fix comment detection on open parens

Characters having both open paren syntax and comment start syntax were
being detected as open parens even when they should have been part a
comment starter (Bug#24870).

* src/syntax.c (in_2char_comment_start): New function, extracted from
`scan_sexps_forward'.
(scan_sexps_forward): Add check for a 2-char comment starter before the
loop.  Inside the loop, do that check after incrementing the 'from'
character index.  Move the single char comment syntax cases into the
switch instead of special casing them before.
* test/src/syntax-tests.el (parse-partial-sexp-paren-comments):
(parse-partial-sexp-continue-over-comment-marker): New tests.

7 years agoGive , and .@ doc strings. Fixes bug #24561.
Alan Mackenzie [Mon, 23 Jan 2017 19:00:49 +0000 (23 19:00 +0000)]
Give , and .@ doc strings.  Fixes bug #24561.

Also make *Help* links to ``' possible.  Also make usable as such doc strings
on the function-documentation property of a symbol.

* lisp/emacs-lisp/backquote.el (top-level): Give , and '@ doc strings on the
function-documentation property.  Also give these symbols a reader-construct
property.

* lisp/help-fns.el (describe-function): Allow the function-documentation
property to work.  Use princ rather than prin1 to print the function's name
when it has a reader-construct property.
(help-fns-signature): Don't insert `high-usage' for a reader-construct.
(describe-function-1): Adapt to process documentation on the
function-documentation property.  Print "a reader construct" when appropriate.

* lisp/help-mode.el (help-xref-symbol-regexp): Amend this regexp also to match
``'.

7 years ago; Fix previous commit
Mark Oteiza [Sun, 22 Jan 2017 15:18:42 +0000 (22 10:18 -0500)]
; Fix previous commit

* lisp/play/dunnet.el (dun-drop): Nix assignment of nonexistent binding.

7 years agoImprove uses of CHECK_LIST etc.
Paul Eggert [Sun, 22 Jan 2017 08:18:40 +0000 (22 00:18 -0800)]
Improve uses of CHECK_LIST etc.

* src/eval.c (FletX): Report an error for invalid constructs like
‘(let* (a . 0))’, so that ‘let*’ is more consistent with ‘let’.
(lambda_arity): Use plain CHECK_CONS.
* src/fns.c (CHECK_LIST_END): Move from here to lisp.h.
(Fcopy_alist): Remove unnecessary CHECK_LIST call, since
concat does that for us.
(Fnthcdr, Fmember, Fmemql, Fdelete, Fnreverse):
Use CHECK_LIST_END, not CHECK_LIST_CONS.  This hoists a
runtime check out of the loop.
(Fmemq): Simplify and use CHECK_LIST_END instead of CHECK_LIST.
(Fassq, Fassoc, Frassq, Frassoc):
Simplify and use CHECK_LIST_END instead of CAR.
(assq_no_quit, assoc_no_quit): Simplify and assume proper list.
(Fnconc): Use plain CHECK_CONS, and do-while instead of while loop.
* src/fontset.c (Fnew_fontset):
* src/frame.c (Fmodify_frame_parameters):
Use CHECK_LIST_END at end, rather than CHECK_LIST at start, for a
more-complete check.
* src/gfilenotify.c (Fgfile_add_watch):
Omit unnecessary CHECK_LIST, since Fmember does that for us.
* src/lisp.h (lisp_h_CHECK_LIST_CONS, CHECK_LIST_CONS):
Remove; no longer used.
(CHECK_LIST_END): New inline function.

7 years agoPrevent to use tabulated-list--near-rows unbound
Tino Calancha [Sun, 22 Jan 2017 05:23:45 +0000 (22 14:23 +0900)]
Prevent to use tabulated-list--near-rows unbound

* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print-entry):
Make sure 'tabulated-list--near-rows' is bound before use it (Bug#25506).

7 years ago* lisp/simple.el (region-bounds): New function.
Juri Linkov [Sat, 21 Jan 2017 23:18:53 +0000 (22 01:18 +0200)]
* lisp/simple.el (region-bounds): New function.

(region-noncontiguous-p): Use it.
http://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00044.html

7 years ago; * etc/NEWS: Describe how to disable double-buffering. (Bug#25474)
Eli Zaretskii [Sat, 21 Jan 2017 18:31:33 +0000 (21 20:31 +0200)]
; * etc/NEWS: Describe how to disable double-buffering.  (Bug#25474)

7 years agoFix low-level handling of (big) C macros.
Alan Mackenzie [Sat, 21 Jan 2017 15:14:15 +0000 (21 15:14 +0000)]
Fix low-level handling of (big) C macros.

In particular, ensure that a comment detected by its syntax is not a CPP
construct marked with generic comment delimiter syntax-table text
properties.

* lisp/progmodes/cc-engine.el (c-beginning-of-macro, c-end-of-macro): Set
c-macro-cache-syntactic to nil when the cached macro changes.
(c-syntactic-end-of-macro, c-no-comment-end-of-macro)
(c-state-semi-pp-to-literal, c-state-full-pp-to-literal)
(c-state-pp-to-literal, c-parse-ps-state-to-cache)
(c-state-cache-non-literal-place, c-literal-limits, c-literal-start)
(c-determine-limit): When checking a parse syntax for a comment, check that
we're not in a CPP construct marked by syntax-table generic comment delimiter
text property.
(c-state-pp-to-literal): Change from a defsubst to a defun.

* lisp/progmodes/cc-mode.el (c-neutralize-syntax-in-and-mark-CPP): Check a
parse syntax as described above under cc-engine.el.

7 years agoDon't wait for frame to become visible
Noam Postavsky [Sat, 14 Jan 2017 00:47:22 +0000 (13 19:47 -0500)]
Don't wait for frame to become visible

* src/xterm.c (x_make_frame_visible): Remove code that waits for the
frame to become visible.  We have to deal with invisible frames anyway,
the loop could sometimes before the frame turned visible, and for some
window managers (e.g., XMonad, i3wm) it caused Emacs to get stuck in a
busy loop (Bug#24091).

7 years agodiff-hunk-kill independent of point inside headers
Tino Calancha [Sat, 21 Jan 2017 02:54:55 +0000 (21 11:54 +0900)]
diff-hunk-kill independent of point inside headers

Make diff-apply-hunk and diff-hunk-kill independent of the point
position in a diff header (Bug#17544).
This change allows to apply hunks in order.  It also makes possible to
press M-k repeatedly to kill hunks in the order they appear in the buffer.
See discussion on #Bug25105.
* lisp/vc/diff-mode.el (diff-file-junk-re):
Move definition before it's used.
(diff--at-diff-header-p): New predicate; return non-nil when point
is inside a hunk header, a file header, or within a line
matching diff-file-junk-re.
(diff-beginning-of-hunk): Use it.
Check if the point is inside a diff header, in the middle of a hunk,
or before the first hunk.
(diff-apply-hunk): Call diff-beginning-of-hunk with non-nil arg
before apply the hunk.
(diff-hunk-kill, diff-file-kill):
Call diff-beginning-of-hunk with non-nil arg after kill the hunks.
(diff-post-command-hook): Call diff-beginning-of-hunk with non-nil argument.

7 years ago; Revert "Improve diff-mode navigation/manipulation"
Tino Calancha [Sat, 21 Jan 2017 02:54:38 +0000 (21 11:54 +0900)]
; Revert "Improve diff-mode navigation/manipulation"

This reverts commit 2c8a7e50d24daf19ea7d86f1cfeaa98a41c56085.
This change causes regressions:
https://lists.gnu.org/archive/html/emacs-devel/2016-11/msg00738.html
The following related commits are reverted as well:
61c6a10e3110490dadac4577cc540053341ff25c
a283d655db88cdcc8cb53d8e2578e1cdf751c84b
6b6abe0dba6a9a2e5f78aac3814421886e7a184f
e5ef59b87da5c2ddfa22f7342efe29b3eea6ed97
73349822cbd6e50526eda9c75453584d73dfca83

Fixes: debbugs:25105, 25400.

7 years agoFix free var FOO-mode-{syntax,abbrev}-table warnings
Noam Postavsky [Sat, 14 Jan 2017 06:47:52 +0000 (14 01:47 -0500)]
Fix free var FOO-mode-{syntax,abbrev}-table warnings

* lisp/emacs-lisp/derived.el (define-derived-mode): Unconditionally
defvar the syntax and abbrev tables so that the compiler will know that
they are dynamically bound variables (Bug#25446).

7 years agoCheck that variable lists are actually lists
Philipp Stephani [Wed, 18 Jan 2017 18:49:58 +0000 (18 19:49 +0100)]
Check that variable lists are actually lists

'let' and 'let*' document that their first argument has to be a list,
but don't check for that; instead, they allow (and silently ignore)
other types.  Introduce an explicit type check.

* src/eval.c (Flet, FletX): Check that the variable list is indeed a
list.
* test/src/eval-tests.el: Add unit tests.

7 years agoAvoid inefficient regex in diff-refine-hunk (Bug#25410)
Noam Postavsky [Fri, 13 Jan 2017 04:32:44 +0000 (12 23:32 -0500)]
Avoid inefficient regex in diff-refine-hunk (Bug#25410)

* lisp/vc/diff-mode.el (diff--forward-while-leading-char): New function.
(diff-refine-hunk): Use it instead of trying to match multiple lines
with a single lines.

7 years agoRemove lock file when auto-saving into the visited file
Eli Zaretskii [Wed, 18 Jan 2017 18:36:14 +0000 (18 20:36 +0200)]
Remove lock file when auto-saving into the visited file

* src/fileio.c (write_region): When auto-saving into the visited
file, unlock the file whenever we mark the buffer unmodified.
(Bug#25470)

7 years agoFix a bug with signaling a thread that waits for condvar
Eli Zaretskii [Wed, 18 Jan 2017 16:06:42 +0000 (18 18:06 +0200)]
Fix a bug with signaling a thread that waits for condvar

* src/thread.c (lisp_mutex_lock_for_thread): New function,
with all the guts of lisp_mutex_lock.
(lisp_mutex_lock): Call lisp_mutex_lock_for_thread.
(condition_wait_callback): Don't call post_acquire_global_lock
before locking the mutex, as that could cause a signaled thread to
exit prematurely, because the condvar's mutex is recorded to be
not owned by any thread, and with-mutex wants to unlock it as part
of unwinding the stack in response to the signal.

7 years agoRudimentary error handling for non-main threads
Eli Zaretskii [Wed, 18 Jan 2017 16:00:16 +0000 (18 18:00 +0200)]
Rudimentary error handling for non-main threads

* src/thread.c (last_thread_error): New static variable.
(syms_of_threads): Staticpro it.
(record_thread_error, Fthread_last_error): New functions.
(syms_of_threads): Defsubr Fthread_last_error.

* doc/lispref/threads.texi (Basic Thread Functions): Document
thread-last-error.

* test/src/thread-tests.el (thread-errors, thread-signal-early)
(threads-condvar-wait): Test the values returned by
thread-last-error.

7 years agoAdd info-lookup help for gdb-script-mode
Tom Tromey [Mon, 16 Jan 2017 22:59:06 +0000 (16 15:59 -0700)]
Add info-lookup help for gdb-script-mode

Bug#25464:
* lisp/info-look.el (info-lookup-guess-gdb-script-symbol): New
function.
Add help for gdb-script-mode.

7 years agoTreat ":root" as a css-selector
Tom Tromey [Tue, 17 Jan 2017 00:17:38 +0000 (16 17:17 -0700)]
Treat ":root" as a css-selector

* lisp/textmodes/css-mode.el (css--font-lock-keywords): Recognize bare
":root" as selector.

7 years agoFix JS regexp literal syntax propertization in expressions
Tom Tromey [Mon, 16 Jan 2017 21:02:45 +0000 (16 14:02 -0700)]
Fix JS regexp literal syntax propertization in expressions

Bug#25465:
* lisp/progmodes/js.el (js-syntax-propertize): Recognize a regexp
literal after "!", "&", and "|".
test/lisp/progmodes/js-tests.el (js-mode-regexp-syntax): New test.

7 years agoMark unused arguments and remove unused variables
Mark Oteiza [Tue, 17 Jan 2017 20:19:30 +0000 (17 15:19 -0500)]
Mark unused arguments and remove unused variables

* lisp/play/dunnet.el (dun-mode, dun-die, dun-inven, dun-try-take):
(dun-dig, dun-type, dun-n, dun-s, dun-e, dun-w, dun-ne, dun-se):
(dun-nw, dun-sw, dun-up, dun-down, dun-in, dun-out, dun-long):
(dun-swim, dun-score, dun-flush, dun-piss, dun-sleep, dun-drive):
(dun-superb, dun-power, dun-unix-parse, dun-bin, dun-fascii):
(dun-ftpquit, dun-ftphelp, dun-uexit, dun-pwd, dun-dos-parse):
(dun-dos-invd, dun-dos-spawn, dun-dos-exit, dun-dos-nil):
(dungeon-nil): Mark arguments as unused.
(dun-drop, dun-objnum-from-args, dun-get-path, dun-ftp):
(dun-restore): Remove unused variable.

7 years agoFix auto-save-file-name problem in Tramp on MS Windows
Michael Albinus [Tue, 17 Jan 2017 16:35:23 +0000 (17 17:35 +0100)]
Fix auto-save-file-name problem in Tramp on MS Windows

* lisp/files.el (make-auto-save-file-name): Use `file-remote-p'
rather than an ange-ftp regexp.

* lisp/net/tramp.el (tramp-handle-make-auto-save-file-name):
Fix a problem when running on MS Windows.

* test/lisp/net/tramp-tests.el (tramp-test31-make-auto-save-file-name):
Adapt test.

7 years ago; Spelling fixes
Paul Eggert [Tue, 17 Jan 2017 15:45:39 +0000 (17 07:45 -0800)]
; Spelling fixes

7 years agoMerge from origin/emacs-25
Paul Eggert [Tue, 17 Jan 2017 15:34:25 +0000 (17 07:34 -0800)]
Merge from origin/emacs-25

42614fa Update remaining copyright years with admin.el M-x set-copyright
f17a006 * lisp/ffap.el (ffap-lax-url): Bump :version after recent cha...

7 years ago; Merge from origin/emacs-25
Paul Eggert [Tue, 17 Jan 2017 15:32:13 +0000 (17 07:32 -0800)]
; Merge from origin/emacs-25

The following commit was skipped:

8dd624c Document that functions in 'ffap-alist' can use the match data

7 years agoNix some uses of eval
Mark Oteiza [Tue, 17 Jan 2017 05:48:00 +0000 (17 00:48 -0500)]
Nix some uses of eval

* lisp/play/dunnet.el: Fix triple negative.
(dun-doverb): Use funcall instead of eval.
(dun-echo): Just call dun-mprinc.
(dun-save-val): Just bind value without eval.

7 years ago; * lisp/play/dunnet.el: Fix file footer.
Mark Oteiza [Tue, 17 Jan 2017 04:35:05 +0000 (16 23:35 -0500)]
; * lisp/play/dunnet.el: Fix file footer.

7 years agoFix comment in css-mode.el
Tom Tromey [Tue, 17 Jan 2017 00:21:55 +0000 (16 17:21 -0700)]
Fix comment in css-mode.el

* lisp/textmodes/css-mode.el: Remove obsolete comment.

7 years agoImprove ffap-gopher-at-point handling of long lines
Noam Postavsky [Sun, 8 Jan 2017 23:19:32 +0000 (8 18:19 -0500)]
Improve ffap-gopher-at-point handling of long lines

* lisp/ffap.el (ffap-gopher-regexp): Only match the KEY part.  Note
setting to nil is now supported.
(ffap--gopher-var-on-line): New function.
(ffap-gopher-at-point): Use it instead of the old ffap-gopher-regexp
which could overflow the regexp stack on long lines (Bug#25391).  Use
`let-alist' instead of calling `set' on local variables.
* test/lisp/ffap-tests.el (ffap-gopher-at-point): New test.

7 years agoFix NS main thread check (bug#25265)
Alan Third [Sat, 14 Jan 2017 16:57:46 +0000 (14 16:57 +0000)]
Fix NS main thread check (bug#25265)

* src/nsterm.m (ns_read_socket, ns_select): Replace mainThread with
isMainThread.

7 years agoCorrect c-parse-state-get-strategy for moving HERE backward into a macro.
Alan Mackenzie [Sat, 14 Jan 2017 12:38:43 +0000 (14 12:38 +0000)]
Correct c-parse-state-get-strategy for moving HERE backward into a macro.

* list/progmodes/c-engine.el (c-parse-state-get-strategy): When HERE is below
its previous value, we chose strategy 'forward, and the new HERE is in a
(different) macro, ensure the returned START-POINT is not above the start of
the macro.

7 years agoInclude "Date:" in mail messages filed by 'sendmail-send-it'
Eli Zaretskii [Sat, 14 Jan 2017 08:55:16 +0000 (14 10:55 +0200)]
Include "Date:" in mail messages filed by 'sendmail-send-it'

* lisp/mail/sendmail.el (mail-do-fcc): Insert a 'Date:' header
into the filed message.  In the outgoing message, sendmail will
add the date, but the composed message body doesn't have it.
(Bug#25436)

7 years agoRemove leftover references to log-view-message-face
Dmitry Gutov [Sat, 14 Jan 2017 03:56:37 +0000 (14 06:56 +0300)]
Remove leftover references to log-view-message-face

* lisp/vc/vc-bzr.el (vc-bzr-log-view-mode): Use log-view-message.

* lisp/vc/vc-git.el (vc-git-root-log-format): Same.

* lisp/vc/vc-hg.el (vc-hg-root-log-format): Same.

7 years agoRecord autoloads till emacs dump
Phillip Lord [Fri, 13 Jan 2017 13:57:51 +0000 (13 13:57 +0000)]
Record autoloads till emacs dump

* admin/ldefs-clean.el (ldefs-clean-up): Record autoloads till emacs dump
* lisp/ldefs-boot-auto.el (batch-byte-compile): Update

Previously, autoloads were collected till loaddefs.el was generated as
part of the build. However, bootstrap-emacs does not load
loaddefs (rather it is dumped), hence we must record autoloads until the
full emacs binary is dumped.

7 years agoAdd chained indentation to js-mode
Tom Tromey [Fri, 13 Jan 2017 06:15:00 +0000 (12 23:15 -0700)]
Add chained indentation to js-mode

Bug#20896
* lisp/progmodes/js.el (js-chain-indent): New variable.
(js--skip-term-backward, js--skip-terms-backward)
(js--chained-expression-p): New functions.
(js--proper-indentation): Call js--chained-expression-p.
* test/manual/indent/js-chain.js: New file.
* test/manual/indent/js.js: Add (non-)chained indentation test.

7 years agoFix js-mode indentation bug
Tom Tromey [Tue, 10 Jan 2017 05:15:57 +0000 (9 22:15 -0700)]
Fix js-mode indentation bug

Bug#15582:
* lisp/progmodes/js.el (js--find-newline-backward): New function.
(js--continued-expression-p): Use it.
* test/manual/indent/js.js: Add new test.

7 years agoFix definition of EMACS in test/manual/indent/Makefile
Tom Tromey [Fri, 13 Jan 2017 06:20:02 +0000 (12 23:20 -0700)]
Fix definition of EMACS in test/manual/indent/Makefile

* test/manual/indent/Makefile (EMACS): Add one more "..".

7 years agoAdd .jsx to auto-mode-alist
Tom Tromey [Tue, 10 Jan 2017 03:44:19 +0000 (9 20:44 -0700)]
Add .jsx to auto-mode-alist

Bug#25389:
* lisp/files.el (auto-mode-alist): Add entry for .jsx.

7 years agoFix two js-mode filling bugs
Tom Tromey [Tue, 10 Jan 2017 03:42:43 +0000 (9 20:42 -0700)]
Fix two js-mode filling bugs

Bug#19399 and Bug#22431:
* lisp/progmodes/js.el (js-mode): Set comment-line-break-function and
c-block-comment-start-regexp.
* test/lisp/progmodes/js-tests.el: New file.

7 years agoFix last change
Eli Zaretskii [Fri, 13 Jan 2017 16:17:12 +0000 (13 18:17 +0200)]
Fix last change

* test/src/thread-tests.el (threads-condvar-wait): Revert
previous change.  Make sure no other threads from previous
tests are running, to avoid interfering with our thread counts.

7 years agoFix the new condvar test
Eli Zaretskii [Fri, 13 Jan 2017 16:05:38 +0000 (13 18:05 +0200)]
Fix the new condvar test

* test/src/thread-tests.el (threads-condvar-wait): Enlarge the
time we sleep in the main thread to let the other thread
process notifications.

7 years agoMinor improvements in the new condvar test
Eli Zaretskii [Fri, 13 Jan 2017 14:13:30 +0000 (13 16:13 +0200)]
Minor improvements in the new condvar test

* test/src/thread-tests.el (threads-test-condvar-wait): Use
with-mutex instead of emulating it inline.
(threads-condvar-wait): Improve comments.  Check that the new
thread is alive before waiting for it to become blocked on the
conditional variable.

7 years agoFix a bug in waiting for condition variable
Eli Zaretskii [Fri, 13 Jan 2017 09:48:51 +0000 (13 11:48 +0200)]
Fix a bug in waiting for condition variable

* src/thread.c (lisp_mutex_lock, lisp_mutex_unlock)
(lisp_mutex_unlock_for_wait, condition_wait_callback)
(condition_notify_callback): Improve commentary.
(condition_wait_callback): Call post_acquire_global_lock before
attempting to lock the mutex, to make sure the lock's owner is
recorded correctly.

* test/src/thread-tests.el (threads-condvar-wait): New test.

7 years agoFix last change of dd80ee6 (was: mm-uu.el: Don't dissect patch part)
Katsumi Yamaoka [Fri, 13 Jan 2017 07:42:35 +0000 (13 07:42 +0000)]
Fix last change of dd80ee6 (was: mm-uu.el: Don't dissect patch part)

7 years agomm-uu.el: Don't dissect patch part
Katsumi Yamaoka [Fri, 13 Jan 2017 07:22:30 +0000 (13 07:22 +0000)]
mm-uu.el: Don't dissect patch part

This fixes a bug that the patch part is broken in the article
<87inpjzhpb.fsf@users.sourceforge.net> in the bug-gnu-emacs list.

* lisp/gnus/mm-uu.el (mm-uu-dissect-text-parts):
Don't dissect patch part.

7 years agoFix extracting async def type and name in python mode imenu
Dmitry Lazurkin [Wed, 4 Jan 2017 18:46:21 +0000 (4 21:46 +0300)]
Fix extracting async def type and name in python mode imenu

* lisp/progmodes/python.el (python-imenu--get-defun-type-name):
New function.
(python-imenu--build-tree): Use python-imenu--get-defun-type-name for
extract async or simple def type and name at current
position (Bug#24820).
* test/lisp/progmodes/python-tests.el (python-imenu-create-index-1):
(python-imenu-create-flat-index-1): Add async def's.

7 years agoRemove garbage from Content-Transfer-Encoding value (bug#25420)
Katsumi Yamaoka [Thu, 12 Jan 2017 23:32:41 +0000 (12 23:32 +0000)]
Remove garbage from Content-Transfer-Encoding value (bug#25420)

* lisp/mail/ietf-drums.el (ietf-drums-strip-cte): New function.
(ietf-drums-remove-garbage): New function.
(ietf-drums-remove-whitespace): Remove CR as well.

* lisp/mail/mail-parse.el (mail-header-strip-cte):
Alias to ietf-drums-strip-cte.

* lisp/gnus/gnus-art.el (article-decode-charset):
* lisp/gnus/gnus-sum.el (gnus-summary-enter-digest-group):
* lisp/gnus/mm-decode.el (mm-dissect-buffer):
* lisp/gnus/nndoc.el (nndoc-decode-content-transfer-encoding)
(nndoc-rfc822-forward-generate-article):
* lisp/mh-e/mh-mime.el (mh-decode-message-body):
Replace mail-header-strip with mail-header-strip-cte.

7 years agoRestore behavior of ‘./autogen.sh autoconf git’
Paul Eggert [Thu, 12 Jan 2017 23:04:38 +0000 (12 15:04 -0800)]
Restore behavior of ‘./autogen.sh autoconf git’

* autogen.sh: Do both autoconf and git setup when invoked
as ‘./autogen.sh autoconf git’.  Avoid unnecessary newline in chatter.
Mention new --no-check option in usage message.  (Bug#25359)

7 years ago* autogen.sh: Simplify argument parsing.
Glenn Morris [Thu, 12 Jan 2017 19:06:03 +0000 (12 14:06 -0500)]
* autogen.sh: Simplify argument parsing.

7 years ago* autogen.sh: Add --no-check option. (Bug#25359)
Glenn Morris [Wed, 11 Jan 2017 20:01:28 +0000 (11 15:01 -0500)]
* autogen.sh: Add --no-check option.  (Bug#25359)

7 years agoConvert some network test failures to skipping
Glenn Morris [Wed, 11 Jan 2017 19:35:51 +0000 (11 14:35 -0500)]
Convert some network test failures to skipping

These tests intermittently fail on hydra.nixos.org for unclear
reasons related to starting the external process.
This isn't an Emacs issue, and the failures cause noise on
the emacs-buildstatus list.  (Bug#24503)
* test/lisp/net/network-stream-tests.el (echo-server-nowait)
(connect-to-tls-ipv4-nowait): Skip rather than fail if the
external process fails to start properly.

7 years agoAdd DNS keywords and remove duplications
Alexander Kuleshov [Fri, 23 Dec 2016 10:53:41 +0000 (23 16:53 +0600)]
Add DNS keywords and remove duplications

* lisp/textmodes/dns-mode.el (dns-mode-types): Add two TLSA and
NSEC" DNS related keywords and remove duplication of "NSAP".

7 years agoHandle syntactic WS cache properties more accurately at buffer changes.
Alan Mackenzie [Wed, 11 Jan 2017 18:25:39 +0000 (11 18:25 +0000)]
Handle syntactic WS cache properties more accurately at buffer changes.

This fixes bug #25362.

* lisp/progmodes/cc-engine.el (c-sws-lit-type, c-sws-lit-limits)
(c-invalidate-sws-region-before, c-invalidate-sws-region-after-del)
(c-invalidate-sws-region-after-ins): New variables and functions.
(c-invalidate-sws-region-after): Change from a defsubst to a defun.
Also pass
it the standard OLD-LEN argument.  Call both
c-invalidate-sws-region-after-{ins,del} to check for "dangerous" WS
cache
properties.

* lisp/progmodes/cc-langs.el (c-block-comment-ender-regexp): New language
variable.

* lisp/progmodes/cc-mode.el (c-before-change): Call
c-invalidate-sws-region-before.
(c-after-change): Pass old-len to c-invalidate-sws-region-after.

7 years agoSupport stat 8.26 in Tramp
Michael Albinus [Wed, 11 Jan 2017 16:13:41 +0000 (11 17:13 +0100)]
Support stat 8.26 in Tramp

* lisp/net/tramp-sh.el (tramp-get-remote-stat): Use QUOTING_STYLE
environment variable of newer coreutils.  (Bug#23422)