lisp/comint.el (comint-get-old-input-default): Modify behavior to follow
docstring: if `comint-use-prompt-regexp' is nil, then return the CURRENT LINE,
if point is on an output field.
Tom Tromey [Fri, 20 Jan 2017 04:40:38 +0000 (21:40 -0700)]
css-mode documentation lookup feature
* etc/NEWS: Mention new feature.
* lisp/textmodes/css-mode.el (css-mode-map): New defvar.
(css--mdn-lookup-history): New defvar.
(css-lookup-url-format): New defcustom.
(css--mdn-property-regexp, css--mdn-completion-list): New defconsts.
(css--mdn-after-render, css--mdn-find-symbol, css-lookup-symbol): New
defuns.
* test/lisp/textmodes/css-mode-tests.el (css-mdn-symbol-guessing): New
test.
Glenn Morris [Mon, 30 Jan 2017 22:22:32 +0000 (17:22 -0500)]
edt-mapper: just loading a library should not run code
* lisp/emulation/edt-mapper.el (edt-mapper): New function,
containing code previously at top-level.
* lisp/emulation/edt.el (edt-load-keys): After loading edt-mapper,
run edt-mapper function.
Vibhav Pant [Mon, 30 Jan 2017 06:33:23 +0000 (12:03 +0530)]
Fix hash tables not being purified correctly.
* src/alloc.c
(purecopy_hash_table) New function, makes a copy of the given hash
table in pure storage.
Add new struct `pinned_object' and `pinned_objects' linked list for
pinning objects.
(Fpurecopy) Allow purifying hash tables
(purecopy) Pin hash tables that are either weak or not declared with
`:purecopy t`, use purecopy_hash_table otherwise.
(marked_pinned_objects) New function, marks all objects in pinned_objects.
(garbage_collect_1) Use it. Mark all pinned objects before sweeping.
* src/lisp.h Add new field `pure' to struct `Lisp_Hash_Table'.
* src/fns.c: Add `purecopy' parameter to hash tables.
(Fmake_hash_table): Check for a `:purecopy PURECOPY' argument, pass it
to make_hash_table.
(make_hash_table): Add `pure' parameter, set h->pure to it.
(Fclrhash, Fremhash, Fputhash): Enforce that the table is impure with
CHECK_IMPURE.
* src/lread.c: (read1) Parse for `purecopy' parameter while reading
hash tables.
* src/print.c: (print_object) add the `purecopy' parameter while
printing hash tables.
* src/category.c, src/emacs-module.c, src/image.c, src/profiler.c,
src/xterm.c: Use new (make_hash_table).
Dmitry Gutov [Sun, 29 Jan 2017 08:39:55 +0000 (10:39 +0200)]
Say JavaScript, not Javascript
* lisp/progmodes/js.el (js-mode-map, js-syntax-propertize)
(js-js-error, js-eval, js-set-js-context)
(js--get-js-context):
Refer to the language consistently as JavaScript.
Mark Oteiza [Sat, 28 Jan 2017 17:06:41 +0000 (12:06 -0500)]
Use access-file in EWW to check before downloading a file
* lisp/net/eww.el (eww-download): Check accessibility of
eww-download-directory to prevent starting a download that will fail
to write.
* src/fileio.c (Faccess_file): Clarify the use of string argument in
the docstring.
Yuri D'Elia [Sat, 28 Jan 2017 14:20:54 +0000 (15:20 +0100)]
Subject: Check Bcc after the Messag hook has run
* lisp/gnus/message.el (message-send): If the hook modifies
the message (mml tags or headers), we should check bcc on the
final message, not on the original.
Philipp Stephani [Tue, 17 Jan 2017 17:24:29 +0000 (18:24 +0100)]
Don't require a shell when loading htmlfontify
* lisp/htmlfontify.el (hfy-which-etags): Don't call a shell for
detecting the etags version (Bug#25468).
* test/lisp/htmlfontify-tests.el (htmlfontify-bug25468): Add unit
test.
Arash Esbati [Thu, 26 Jan 2017 19:25:16 +0000 (20:25 +0100)]
Add \citetitle to biblatex cite format
* lisp/textmodes/reftex-vars.el (reftex-cite-format-builtin): Add
\citetitle[*] to `reftex-cite-format' and bind them to keys i/I
per user request
http://lists.gnu.org/archive/html/auctex/2017-01/msg00049.html.
Eli Zaretskii [Fri, 27 Jan 2017 09:39:31 +0000 (11:39 +0200)]
Ensure last line is at window bottom in shell buffers
* lisp/shell.el (shell-mode): Use setq-local. Set
scroll-conservatively to 101 locally. See the discussion at
http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00736.html
for the reasons.
* lisp/gnus/mml.el (mml-generate-mime-1): It seems nonsensical
to try to determine the charset of non-text message parts, so
skip that (bug#24190). This will also remove messages like
"bunzip2ing /tmp/acsb.cpio.bz2...done" while sending messages
if you include such files.
* lisp/gnus/gnus-sum.el (gnus-article-sort-by-marks): New
function (bug#23393).
(gnus-thread-sort-by-marks): Ditto.
(gnus-summary-sort-by-mark): New command suggested by Dan Jacobson.
(gnus-summary-mode-map): Add keystroke.
(gnus-summary-make-menu-bar): Add to menu.
* lisp/gnus/message.el
(message-cross-post-followup-to-header): Gnus server prefixes
shouldn't be included in the group names (bug#21661).
(message-cross-post-followup-to): Ditto.
* lisp/mail/rfc2047.el (rfc2047-fold-field): Remove dead code.
It's been disabled since 2005, when I made the change with the
following comment.
(rfc2047-encode-message-header): Disabled header folding -- not
all headers can be folded, and this should be done by the message
composition mode. Probably. I think.
* lisp/gnus/message.el (message--fold-long-headers): New
function to fold too-long headers (bug#21608).
(message-send-mail): Use it to fill headers longer than 998
characters (which is the protocol limit).
* lisp/gnus/nndoc.el (nndoc-possibly-change-buffer): Don't bug
out on invalid files, like invalid .gz files (bug#21538).
This may hinder Gnus from starting up.
* lisp/gnus/message.el (message-do-fcc): Copy the local
variables from the Message buffer so that local settings of
`message-fcc-handler-function' etc are respected (bug#21174).
Paul Eggert [Thu, 26 Jan 2017 05:13:19 +0000 (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.
Paul Eggert [Thu, 26 Jan 2017 04:27:45 +0000 (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.
* 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).
* 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.
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.
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.
* 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).
* 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.
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).
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.
David Engster [Tue, 24 Jan 2017 21:47:53 +0000 (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.
Noam Postavsky [Sun, 18 Dec 2016 05:00:30 +0000 (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.
Alan Mackenzie [Mon, 23 Jan 2017 19:00:49 +0000 (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
``'.
Paul Eggert [Sun, 22 Jan 2017 08:18:40 +0000 (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.
Alan Mackenzie [Sat, 21 Jan 2017 15:14:15 +0000 (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.
Noam Postavsky [Sat, 14 Jan 2017 00:47:22 +0000 (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).
Tino Calancha [Sat, 21 Jan 2017 02:54:55 +0000 (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.