* lisp/textmodes/css-mode.el (css-smie-grammar): Give colons belonging
to properties higher precedence.
(css--colon-inside-selector-p, css--colon-inside-funcall): New
functions for helping SMIE during tokenization.
(css-smie--forward-token, css-smie--backward-token): Distinguish
colons belonging to properties from other colons.
* test/manual/indent/css-mode.css: Add tests for the changes above.
* doc/lispref/edebug.texi (Checking Whether to Stop): Mention
edebug-max-depth and index it. Add cross-references for
max-lisp-eval-depth and max-specpdl-size.
Eli Zaretskii [Sat, 4 Feb 2017 10:02:55 +0000 (12:02 +0200)]
Support options with embedded whitespace in 'dired-listing-switches'
* lisp/dired.el (dired-listing-switches): Document how to quote
options with embedded whitespace.
* lisp/files.el (insert-directory): Use split-string-and-unquote
to support dired-listing-switches that specify command-line
options with embedded spaces. (Bug#25485)
Mark Oteiza [Sat, 4 Feb 2017 02:42:42 +0000 (21:42 -0500)]
Rename to if-let* and when-let*
Make the existing if-let and when-let aliases.
* lisp/emacs-lisp/subr-x.el (if-let*, when-let*): New macros. Rewrite
docstrings, incorporating that from let* and the existing if-let.
(if-let, when-let, and-let*): Alias them.
Paul Eggert [Fri, 3 Feb 2017 05:28:45 +0000 (21:28 -0800)]
Re-port alloc.c to Solaris sparc and simplify
alloc.c had bitrotted a bit, and used an undefined symbol
stack_base when Emacs was built on Solaris sparc, leading to
compilation failures. Also, code related to __builtin_unwind_init
was unnecessarily duplicated. Fix the bitrot and remove some
duplication.
* src/alloc.c: Remove uses of GC_SAVE_REGISTERS_ON_STACK, since it
is never defined.
(test_setjmp) [!HAVE___BUILTIN_UNWIND_INIT && GC_SETJMP_WORKS]:
Define a no-op dummy, to simplify use.
(test_setjmp) [!GC_SETJMP_WORKS]: Test setjmp_tested_p here rather
than in the caller, to simplify use.
(stacktop_sentry): New type.
(__builtin_unwind_init) [!HAVE___BUILTIN_UNWIND_INIT]: New macro.
(SET_STACK_TOP_ADDRESS): New macro, containing code that was duplicated.
(flush_stack_call_func, Fgarbage_collect): Use it.
(init_alloc): Omit unnecessary initialization.
After dumping, Emacs need not re-test setjmp.
Noam Postavsky [Sat, 21 Jan 2017 18:24:47 +0000 (13:24 -0500)]
Fix scrolling with partial lines
* src/xdisp.c (partial_line_height): New function.
(try_scrolling):
* src/window.c (window_scroll_pixel_based): Use it for calculating the
pixel scroll margin correctly in a window with partial lines.
* src/xdisp.c (maximum-scroll-margin): New variable.
* lisp/cus-start.el: Make it customizable.
* etc/NEWS: Mention it.
* doc/emacs/display.texi (Auto Scrolling):
* doc/lispref/windows.texi (Textual Scrolling): Document it.
* src/window.c (window_scroll_pixel_based): Use it instead of hardcoding
division by 4 (Bug #5718).
Dmitry Gutov [Fri, 3 Feb 2017 01:10:30 +0000 (03:10 +0200)]
(xref-collect-matches): Use '-E' together with '-e'
* lisp/progmodes/xref.el (xref-collect-matches): Use '-E'
together with '-e', as suggested by Noam Postavsky
(http://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00780.html).
Paul Eggert [Thu, 2 Feb 2017 17:52:20 +0000 (09:52 -0800)]
Fix lisp.h underparenthesization
* src/lisp.h (STACK_CONS, AUTO_STRING_WITH_LEN):
Parenthesize compound literals that are function call args.
Although this does not fix any bugs, it is the proper style for
macro parenthesization as it means this code will continue to
work even if make_lisp_ptr is changed to a macro.
Paul Eggert [Thu, 2 Feb 2017 15:49:55 +0000 (07:49 -0800)]
Merge from gnulib
2017-01-30 Port to PGI 16.10 x86-64
2017-01-20 time_rz: fix comment typo
2017-01-14 strftime: %z is -00 if unknown
This incorporates:
* doc/misc/texinfo.tex, lib/c-ctype.h, lib/strftime.c:
* lib/time-internal.h, lib/verify.h:
Copy from gnulib.
Tino Calancha [Thu, 2 Feb 2017 10:13:27 +0000 (19:13 +0900)]
Show current line highlighted in *Occur* buffer
* lisp/replace.el (list-matching-lines-current-line-face)
(list-matching-lines-jump-to-current-line): New user options.
(occur--orig-line, occur--orig-line-str): New variables.
(occur, occur-engine): Use them.
(occur--final-pos): New variable.
(occur-1): Use it.
(occur-engine): Idem.
Show the current line with 'list-matching-lines-current-line-face'.
Set point on the first matching line after the current one.
* etc/NEWS: Add entry for the new option.
Mark Oteiza [Thu, 2 Feb 2017 03:07:03 +0000 (22:07 -0500)]
Treat list-buffers-directory as a string
Another step in the long history of list-buffers-directory. A thread
branch discussing the meaning/use of the variable starts here
https://lists.gnu.org/archive/html/emacs-devel/2009-09/msg00684.html
Also see (info "(elisp) Buffer File Name").
* lisp/buff-menu.el: Relocate special case code into info.el. Nix
Info-* defvars.
(Buffer-menu--pretty-file-name): Remove special case. Use
bound-and-true-p.
(Buffer-menu-info-node-description): Remove.
* lisp/ibuffer.el (ibuffer-buffer-file-name): Treat
list-buffers-directory as a string.
* lisp/info.el (Info-node-description): New function.
(Info-select-node): Use it.
Mark Oteiza [Thu, 2 Feb 2017 01:51:00 +0000 (20:51 -0500)]
Prevent creating thumbnails of all gif frames
With the previous defaults, doing image-dired on a directory with an
animated foo.gif would cause creation of foo.thumb-N.gif for each of
N frames in foo.gif. By default image-dired looks for foo.thumb.gif, so
there additionally is no usable thumbnail after all the needless effort.
image-dired never handled animation, regardless.
* lisp/image-dired.el: Mention limitation.
(image-dired-cmd-create-thumbnail-options):
(image-dired-cmd-create-temp-image-options):
(image-dired-cmd-create-standard-thumbnail-options): Append [0] to
filename to indicate only converting the 0th frame.
(image-dired-display-image-mode): Don't show a cursor.
Paul Eggert [Wed, 1 Feb 2017 23:18:44 +0000 (15:18 -0800)]
Fix quitting bug when buffers are frozen
Problem noted by Eli Zaretskii in:
http://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00721.html
This patch also fixes some other issues in that report.
* src/lisp.h (incr_rarely_quit): Remove.
All callers changed to use rarely_quit directly.
* src/search.c (freeze_buffer_relocation)
(thaw_buffer_relocation): New functions.
(looking_at_1, fast_looking_at, search_buffer):
Use them to fix bug when quitting when buffers are frozen.
* src/sysdep.c (emacs_intr_read): Rename from emacs_nointr_read.
All uses changed.
Paul Eggert [Wed, 1 Feb 2017 23:18:44 +0000 (15:18 -0800)]
Revamp quitting and fix infloops
This fixes some infinite loops that cannot be quitted out of,
e.g., (defun foo () (nth most-positive-fixnum '#1=(1 . #1#)))
when byte-compiled and when run under X. See:
http://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00577.html
This also attempts to keep the performance improvements I recently
added, as much as possible under the constraint that the infloops
must be caught. In some cases this fixes infloop bugs recently
introduced when I removed immediate_quit.
* src/alloc.c (Fmake_list):
Use rarely_quit, not maybe_quit, for speed in the usual case.
* src/bytecode.c (exec_byte_code):
* src/editfns.c (Fcompare_buffer_substrings):
* src/fns.c (Fnthcdr):
* src/syntax.c (scan_words, skip_chars, skip_syntaxes)
(Fbackward_prefix_chars):
Use rarely_quit so that users can C-g out of long loops.
* src/callproc.c (call_process_cleanup, call_process):
* src/fileio.c (read_non_regular, Finsert_file_contents):
* src/indent.c (compute_motion):
* src/syntax.c (scan_words, Fforward_comment):
Remove now-unnecessary maybe_quit calls.
* src/callproc.c (call_process):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/fileio.c (Fcopy_file, read_non_regular, Finsert_file_contents):
* src/lread.c (safe_to_load_version):
* src/sysdep.c (system_process_attributes) [GNU_LINUX]:
Use emacs_read_quit instead of emacs_read in places where
C-g handling is safe.
* src/eval.c (maybe_quit): Move comment here from lisp.h.
* src/fileio.c (Fcopy_file, e_write):
Use emacs_write_quit instead of emacs_write_sig in places where
C-g handling is safe.
* src/filelock.c (create_lock_file): Use emacs_write, not
plain write, as emacs_write no longer has a problem.
(read_lock_data): Use emacs_read, not read, as emacs_read
no longer has a problem.
* src/fns.c (rarely_quit): Move to lisp.h and rename to
incr_rarely_quit. All uses changed..
* src/fns.c (Fmemq, Fmemql, Fassq, Frassq, Fplist_put, Fplist_member):
* src/indent.c (compute_motion):
* src/syntax.c (find_defun_start, back_comment, forw_comment)
(Fforward_comment, scan_lists, scan_sexps_forward):
Use incr_rarely_quit so that users can C-g out of long loops.
* src/fns.c (Fnconc): Move incr_rarely_quit call to within
inner loop, so that it catches C-g there too.
* src/keyboard.c (tty_read_avail_input): Remove commented-out
and now-obsolete code dealing with interrupts.
* src/lisp.h (rarely_quit, incr_rarely_quit): New functions,
the latter moved here from fns.c and renamed from rarely_quit.
(emacs_read_quit, emacs_write_quit): New decls.
* src/search.c (find_newline, search_buffer, find_newline1):
Add maybe_quit to catch C-g.
* src/sysdep.c (get_child_status): Always invoke maybe_quit
if interruptible, so that the caller need not bother.
(emacs_nointr_read, emacs_read_quit, emacs_write_quit):
New functions.
(emacs_read): Rewrite in terms of emacs_nointr_read.
Do not handle C-g or signals; that is now for emacs_read_quit.
(emacs_full_write): Replace PROCESS_SIGNALS two-way arg
with INTERRUPTIBLE three-way arg. All uses changed.
Paul Eggert [Wed, 1 Feb 2017 23:18:43 +0000 (15:18 -0800)]
Remove immediate_quit.
The old code that sets and clears immediate_quit was
ineffective except when Emacs is running in terminal mode, and
has problematic race conditions anyway, so remove it. This
will introduce some hangs when Emacs runs in terminal mode,
and these hangs should be fixed in followup patches.
* src/keyboard.c (immediate_quit): Remove. All uses removed.
Alan Mackenzie [Wed, 1 Feb 2017 20:20:09 +0000 (20:20 +0000)]
Allow C++ nested brace-list-entries to be better indented.
This fixes bug #24431. The key change of this bug fix is correctly analyzing
nested brace lists when the opening element stands on the same line as both
its introductory brace and an enclosing parameter list parenthesis.
* list/progmodes/cc-align.el (c-lineup-under-anchor): New line-up function.
* list/progmodes/cc-engine.el (c-looking-at-or-maybe-in-bracelist): Accept the
presence of exactly an identifier between an open parenthesis and an open
brace as evidence of the brace starting a brace list.
(c-looking-at-statement-block): New function, extracted from
c-looking-at-inexpr-block. Enhance it to analyze inner blocks recursively
when needed.
(c-looking-at-inexpr-block): Extract new function (see above) and call it.
(c-add-stmt-syntax): Enhance, with new &optional parameter, to supply the
prime syntactic symbol with a fixed anchor point. When this is used, restrict
all added syntactic symbols to those having an anchor point on the same line.
Add, in addition to the current additional symbols, c-brace-list-entry when
needed; use c-looking-at-statement-block to determine the latter.
(c-guess-basic-syntax, CASE 9D): Use c-add-stmt-syntax rather than just
c-add-syntax, to assemble the syntactic context of a 'brace-list-entry, thus
getting, possibly, several accompanying syntactic entries.
* lisp/progmodes/cc-styles.el (c-style-alist, "gnu" style): New entry for
'brace-list-intro, namely c-lineup-arglist-intro-after-paren.
* lisp/progmodes/cc-vars.el (c-offsets-alist): Change the factory default
offset for 'brace-list-entry from 0 to c-lineup-under-anchor.
* doc/misc/cc-mode.texi (Syntactic Symbols): Amend the definition of
brace-list-intro.
(Brace List Symbols): Amend the example to show the new analysis of brace
lists when the first element comes on the same line as the opening brace.
(Misc Line-Up): Document the new line-up function c-lineup-under-anchor.
Michael Albinus [Wed, 1 Feb 2017 09:06:37 +0000 (10:06 +0100)]
Fix a subtle problem in Tramp with timers
* lisp/net/tramp.el (tramp-accept-process-output): Change argument
list. Make it work when called inside a timer. See
<http://lists.gnu.org/archive/html/tramp-devel/2017-01/msg00010.html>.
Juri Linkov [Tue, 31 Jan 2017 16:36:06 +0000 (17:36 +0100)]
Allow C-s C-w to yank ' to the search ring in the Gnus article buffer
* lisp/gnus/gnus-art.el (gnus-article-mode-syntax-table): Make
M-. in article buffers work for `foo' strings, and still allow
C-s C-w to yank ' to the search ring (bug#22248).
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).