Eli Zaretskii [Mon, 21 Dec 2020 17:27:02 +0000 (19:27 +0200)]
Fix frame creation on X when tool bar is disabled
* src/xterm.c (handle_one_xevent): Restrict the fix for bug#44002
to situations when we are asked by the WM to create a window with
bogus 1x1 dimensions. (Bug#44794)
Make python-mode fontify more assignment statements
* lisp/progmodes/python.el (python-font-lock-assignment-matcher): New
function to match assignment statements.
(python-rx): Add `assignment-target' and `grouped-assignment-target'.
(python-font-lock-keywords-maximum-decoration): Add new matchers
(bug#45341).
Dmitry Gutov [Mon, 21 Dec 2020 01:38:37 +0000 (03:38 +0200)]
Generic-ify xref-location-column
* lisp/progmodes/xref.el (xref-location-column):
Create a generic from xref-file-location-column, to use in the
common rendering code (bug#36967).
(xref--insert-xrefs): Update accordingly.
Juri Linkov [Mon, 21 Dec 2020 01:22:23 +0000 (03:22 +0200)]
De-duplicate lines in Xref buffers
* lisp/progmodes/xref.el (xref--insert-xrefs):
Render matches coming from the same line together (bug#36967).
(xref--item-at-point): Account for the above.
Give get-buffer-create an optional argument to inhibit buffer hooks
in internal or temporary buffers for efficiency (bug#34765).
* etc/NEWS: Announce new parameter of get-buffer-create and
generate-new-buffer, and that with-temp-buffer and with-temp-file
now inhibit buffer hooks.
* doc/lispref/buffers.texi (Buffer Names): Fix typo.
(Creating Buffers): Document new parameter of get-buffer-create and
generate-new-buffer.
(Buffer List, Killing Buffers): Document when buffer hooks are
inhibited.
(Current Buffer):
* doc/lispref/files.texi (Writing to Files): Document that
with-temp-buffer and with-temp-file inhibit buffer hooks.
* doc/lispref/internals.texi (Buffer Internals): Document
inhibit_buffer_hooks flag. Remove stale comment.
* doc/misc/gnus-faq.texi (FAQ 5-8):
* lisp/simple.el (shell-command-on-region): Fix indentation.
* lisp/subr.el (generate-new-buffer): Forward new optional argument
to inhibit buffer hooks to get-buffer-create.
(with-temp-file, with-temp-buffer, with-output-to-string):
* lisp/json.el (json-encode-string): Inhibit buffer hooks in buffer
used.
* src/buffer.c (run_buffer_list_update_hook): New helper function.
(Fget_buffer_create): Use it. Add optional argument to set
inhibit_buffer_hooks flag instead of comparing the buffer name to
Vcode_conversion_workbuf_name. All callers changed.
(Fmake_indirect_buffer, Frename_buffer, Fbury_buffer_internal)
(record_buffer): Use run_buffer_list_update_hook.
(Fkill_buffer): Document when buffer hooks are inhibited. Use
run_buffer_list_update_hook.
(init_buffer_once): Inhibit buffer hooks in Vprin1_to_string_buffer.
(Vkill_buffer_query_functions, Vbuffer_list_update_hook): Document
when hooks are inhibited.
* src/buffer.h (struct buffer): Update inhibit_buffer_hooks
commentary.
* src/coding.h (Vcode_conversion_workbuf_name):
* src/coding.c (Vcode_conversion_workbuf_name): Make static again
since it is no longer needed in src/buffer.c.
(code_conversion_restore, code_conversion_save, syms_of_coding):
Prefer boolean over integer constants.
* src/fileio.c (Finsert_file_contents): Inhibit buffer hooks in
" *code-converting-work*" buffer.
* src/window.c (Fselect_window): Fix grammar. Mention
window-selection-change-functions alongside buffer-list-update-hook.
* test/src/buffer-tests.el: Fix requires.
(buffer-tests-inhibit-buffer-hooks): New test.
Juri Linkov [Sat, 19 Dec 2020 20:19:18 +0000 (22:19 +0200)]
* lisp/image-mode.el: Use one timer and lock for slow remote calls (bug#45256)
* lisp/image-mode.el (image-auto-resize-timer): New variable.
(image--window-state-change): Cancel previous timer and
remember new timer in image-auto-resize-timer.
(image--window-state-change): New variable.
(image-fit-to-window): When image-fit-to-window-lock is nil,
call image-toggle-display-image ignoring 'remote-file-error'.
Stefan Kangas [Sat, 19 Dec 2020 18:54:46 +0000 (19:54 +0100)]
Convert apropos-internal from C to Lisp (Bug#44529)
This runs insignificantly faster in C, and is already fast enough on
reasonably modern hardware. We might as well lift it to Lisp.
This benchmark can be used to verify:
Roland Winkler [Sat, 19 Dec 2020 04:26:40 +0000 (22:26 -0600)]
bibtex-mode: Permit user-defined schemes for sorting entries.
* lisp/textmodes/bibtex.el (bibtex-maintain-sorted-entries):
New allowed value (INDEX-FUN PREDICATE).
(bibtex-entry-index, bibtex-lessp): Use it.
(bibtex-init-sort): Rename from bibtex-init-sort-entry-class-alist.
Glenn Morris [Fri, 18 Dec 2020 16:55:06 +0000 (08:55 -0800)]
Merge from origin/emacs-27
48b9c47805 Minor fixes in authors.el and in tarball-making instructions d7a4ceaa1e ; Add a new item to TODO 64fe805b19 Improve documentation of 'query-replace' 7cacf5da47 Update to Org 9.4.3
João Távora [Fri, 18 Dec 2020 15:38:27 +0000 (15:38 +0000)]
Document that flymake-diag-region saves match data
The typical use of this function (which is parsing compiler diagnostic
messages), lends itself too easily to one the problems in bug#29193.
Make it a friendlier API.
* doc/misc/flymake.texi (Flymake utility functions): Document that
flymake-diag-region saves match data.
* lisp/progmodes/flymake.el (flymake-diag-region): Document that
this saves match data.
Stefan Monnier [Fri, 18 Dec 2020 15:02:15 +0000 (10:02 -0500)]
* lisp/emacs-lisp/package.el: Byte compile the quickstart file
Earlier tests had found problems when byte-compiling the file,
but later investigations indicated the problem was not
directly related. The performance difference is appreciable.
(package-quickstart-refresh): Byte compile the file.
(package-activate-all): Load byte-compiled version if available.
(package--quickstart-maybe-refresh): Delete the byte-compiled file as well.
* lisp/help-fns.el (help-fns--first-release): Use string-end instead
of line-end when matching a file name.
* lisp/org/ob-core.el (org-babel--string-to-number): Put hyphen last
in alternative.
* lisp/org/org-agenda.el (org-agenda-filter): Escape '+' correctly.
Zajcev Evgeny [Thu, 17 Dec 2020 08:27:20 +0000 (11:27 +0300)]
Make "Invalid modifier in string" ordinary invalid-read-syntax error
* src/lread.ec (read1): Raise "Invalid modifier in string" error as
`invalid-read-syntax'. This fixes raise of unhandled error in
`elisp--local-variables'
Pankaj Jangid [Wed, 16 Dec 2020 22:34:20 +0000 (23:34 +0100)]
Fix resetting of gnus-pick-line-number
* lisp/gnus/gnus-sum.el (gnus-summary-read-group-1): Move setting
gnus-pick-line-number from here (bug#45269)...
(gnus-summary-prepare): To here. This ensures that the number is
reset when regenerating the buffer, for instance when limiting it.
Juri Linkov [Wed, 16 Dec 2020 21:27:11 +0000 (23:27 +0200)]
Don't show minibuffer keybindings for suggestions in read-extended-command
* lisp/simple.el (read-extended-command): Use 'affixation-function'
instead of 'annotation-function'. (Bug#45035)
(read-extended-command--affixation): New function created from
'read-extended-command--annotation'.
Juri Linkov [Wed, 16 Dec 2020 21:19:46 +0000 (23:19 +0200)]
Give affixation-function higher priority over annotation-function (bug#45234)
* doc/lispref/minibuf.texi (Completion Variables)
(Programmed Completion): Describe precedence rules
of affixation-function and annotation-function.
* lisp/minibuffer.el (completion-metadata)
(completion-extra-properties): Describe precedence rules
of affixation-function and annotation-function.
(minibuffer-completion-help): First try to apply
affixation-function, if there is no such function,
try annotation-function.
Eli Zaretskii [Tue, 15 Dec 2020 17:34:16 +0000 (19:34 +0200)]
Fix C-n/C-p when a line starts with an image
* src/xdisp.c (move_it_to): Handle the case where the second call
to move_it_in_display_line_to under MOVE_TO_Y takes us farther
from TO_CHARPOS than the first call. This fixes values returned
by pos-visible-in-window-p and posn-at-point when the screen line
starts with invisible text followed by an image. (Bug#9092)
Eli Zaretskii [Tue, 15 Dec 2020 17:19:43 +0000 (19:19 +0200)]
Fix setting breakpoints in "M-x gdb" when a source file is missing
* lisp/progmodes/gdb-mi.el (gdb-get-location): Fix control flow
logic when "fullname" is not found. Unquote and unescape the full
file name by calling gdb-mi--c-string-from-string. FLAG is a
string, not a character. (Bug#15051)
Alan Mackenzie [Tue, 15 Dec 2020 12:09:47 +0000 (12:09 +0000)]
CC Mode: Optimize for scrolling large buffers containing few braces
This fixes bug #25706. It particularly pertains to .h files which contain
only macro definitions. Many of these files are to be found, for example, in
the driver sections of the Linux kernel.
* lisp/progmodes/cc-engine.el (c-beginning-of-statement-1, c-on-identifier)
(c-syntactic-skip-backward, c-find-decl-prefix-search, c-find-decl-spots)
(c-forward-name, c-back-over-list-of-member-inits)
(c-back-over-member-initializers, c-looking-at-inexpr-block)
(c-guess-basic-syntax): Give search limits to, or amend existing ones to
c-backward-syntactic-ws, c-forward-syntactic-ws, c-backward-token-2,
c-beginning-of-statement-1.
(c-determine-limit-no-macro): New function.
(c-determine-limit-get-base): Remove unlimted invocation of
c-backward-syntactic-ws.
(c-determine-limit): Exclude movement between two different macros. Use new
function c-determine-limit-no-macro.
(c-back-over-list-of-member-inits): New parameter `limit'.
* lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare)
(c-font-lock-declarations, c-font-lock-c++-using): Give search limits to, or
amend existing ones to c-backward-syntactic-ws, c-beginning-of-decl-1.
* lisp/progmodes/cc-mode.el (c-unfind-coalesced-tokens, c-before-changer)
(c-fl-decl-end): Give search limits to, or amend existing ones to
c-backward-syntactic-ws, c-forward-syntactic-ws, skip-chars-backward,
skip-chars-forward.
Alan Mackenzie [Mon, 14 Dec 2020 20:44:33 +0000 (20:44 +0000)]
Optimise c-font-lock-<>-arglists, particularly for buffers with few <..> pairs
* lisp/progmodes/cc-fonts.el (c-font-lock-<>-arglists): In place of a regexp
search for a complicated and slow regexp, search simply for "<" ouside of
literals together with add hoc testing of other requirements for a <...>
match.
* lisp/progmodes/cc-langs.el (c-nonsymbol-key): New c-lang-defvar from the
c-lang-const.
Alan Mackenzie [Mon, 14 Dec 2020 19:38:52 +0000 (19:38 +0000)]
Optimise c-parse-state for large buffers with few (if any) braces.
* lisp/progmodes/cc-engine (c-get-fallback-scan-pos): Search a maximum of
50,000 characters back for the two BODs. Return nil if we dont' find them.
(c-parse-state-get-strategy): For strategy `forward', always use the position
`good-pos' for `start-point', even when there's a change of current macro.
Deal with a possible return value of nil from c-get-fallback-scan-pos (as
above).
(c-invalidate-state-cache-1): For `c-state-cache-good-pos', instead of
sometimes using the minimum scan pos (leading to extensive scanning of the
entire buffer) use a point close to `here'.
* lisp/net/tramp-cmds.el (tramp-cleanup-all-connections): Do not set
`tramp-locked'.
* lisp/net/tramp-compat.el (remote-file-error): Define if it
doesn't exist.
* lisp/net/tramp-sh.el (tramp-timeout-session): Check for "locked"
property.
(tramp-maybe-open-connection): Simplify.
* lisp/net/tramp.el (tramp-locked, tramp-locker): Remove them.
(tramp-file-name-handler): Do not set them.
(with-tramp-locked-connection): New defmacro.
(tramp-accept-process-output, tramp-send-string): Use it.
* src/fileio.c (Qremote_file_error): New error symbol.
Eli Zaretskii [Mon, 14 Dec 2020 18:23:24 +0000 (20:23 +0200)]
Improve accuracy of scrolling commands
* src/xdisp.c (move_it_vertically_backward): Don't rely on
line_bottom_y for accurate calculation of the next screen line's Y
coordinate: it doesn't work when the current screen line was not
yet traversed. Instead, record the previous Y coordinate and
reseat there if overshoot is detected.
* src/window.c (window_scroll_pixel_based): Calculate the new
window-start point more accurately when screen lines have uneven
height. (Bug#8355)
Stefan Kangas [Mon, 14 Dec 2020 18:21:28 +0000 (19:21 +0100)]
Make XEmacs entry in the FAQ more contemporary
* doc/misc/efaq.texi (Difference between Emacs and XEmacs): Make
XEmacs entry in the FAQ more contemporary. Remove part about re-using
XEmacs code; this is not likely to be relevant these days and in any
case is not a frequently asked question. (Bug#45235)
Eli Zaretskii [Mon, 14 Dec 2020 18:09:04 +0000 (20:09 +0200)]
Fix point location when completing in gdb-mi.el
* lisp/progmodes/gdb-mi.el (def-gdb-auto-update-handler): Don't
force window-start position, so that redisplay doesn't move point
when popping completion window below the GUD one. (Bug#45052)
Tim Ruffing [Mon, 14 Dec 2020 16:59:58 +0000 (17:59 +0100)]
* etc/emacs.service:
* etc/emacs.service (ExecStart): Make Emacs exit from systemd work
better (bug#45181).
The problem here is the exit code 15, which emacs will return *only* if
it has received SIGTERM. I believe what's happening here is that
emacsclient will call kill-emacs but not wait until the emacs server
has properly shut down. However, it's supposed to wait for the shutdown
as an "ExecStop" command according to "man systemd.service". So since
the process is still alive when emacsclient comes back, systemd will
still issue SIGTERM, making emacs return 15 (maybe after calling kill-
emacs again?!).
Daniel Martín [Mon, 14 Dec 2020 16:16:00 +0000 (17:16 +0100)]
Make goto-char offer the number at point as default
* lisp/subr.el (read-natnum-interactive): New function to read natural
numbers for interactive functions.
* src/editfns.c (Fgoto_char): Call read-natnum-interactive from the
interactive definition of goto-char to offer the number at point as
default. Also expand the docstring to document this new interactive
behavior.
* doc/emacs/basic.texi (Moving Point): Expand the Emacs manual to
document this new behavior.
* etc/NEWS: And announce it (bug#45199).