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)
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).
Ulrich Ölmann [Mon, 14 Dec 2020 15:02:54 +0000 (16:02 +0100)]
Add a DirectoryMode to the Emacs Server example
* doc/emacs/misc.texi (Emacs Server): Update example
* doc/emacs/misc.texi (Emacs Server): The socket containing directory
is per default created with permissions 0755 by the socket-unit.
However this is considered unsafe since commit [1], so enhance unit
example with systemd configuration directive `DirectoryMode=' to
create it with safe permissions, see
https://www.freedesktop.org/software/systemd/man/systemd.socket.html#DirectoryMode=
[1] 2003-04-12 "(server-socket-name): Use new safe location for socket."
Stefan Kangas [Mon, 14 Dec 2020 14:48:38 +0000 (15:48 +0100)]
Remove more references to old versions from FAQ
* doc/misc/efaq.texi (Learning how to do something)
(Installing Emacs, Emacs for GNUstep, Emacs for macOS): Remove more
references to Emacs 22 and older from FAQ.
Stefan Kangas [Mon, 14 Dec 2020 14:16:13 +0000 (15:16 +0100)]
Make XEmacs compat variable warning-level-aliases obsolete
* lisp/emacs-lisp/warnings.el (warning-level-aliases): Make obsolete.
(display-warning): Warn when using one of the warning levels defined
in above obsolete variable. (Bug#44849)
* lisp/url/url-proxy.el (url-find-proxy-for-url): Replace obsolete
warning type 'critical with :error.
b6227446d9 Importing dictionary module 658ec3ccee Renamed connection.el e2ebffdd62 Renamed link.el 723906c444 Removed some compability parts in dictionary 5dc17d73b0 Add :version tag to defcustom statement 49c250b388 Dont't check coding-system-list for existence 99a7e918c8 Don't check for existence of defface 1773b9b687 Dictionary now uses button 329b6a0210 Adding details page for dictionary 837505075c Fix dictionary tooltip mode 2f1e4fbc42 Support nil value for dictionary-server 91ff1c8f7c Move placement of dictionary-tooltip-mouse-event 28fe134971 Remove text property from empty line 7ca331a4f9 Add history of search words to read-string d5a4da25b0 * lisp/net/dictionary.el: Remove remnants of package cc5f280378 * lisp/net/dictionary.el: Add lexical-binding:t 09952ce434 Removed useless check for popup-menu 81ebe86d8d Show error message when asking to match for nothing 0044a2e888 * lisp/net/dictionary-connection.el: Add lexical-binding:t f58443780c * lisp/net/dictionary-connection.el: Remove obsolete Version 54a3964e29 Update GPL version a557a103cc * lisp/net/dictionary-connection.el: Prefer defsubst ffa7d6671d * lisp/net/dictionary.el: Prefer defsubst over defmacro 4deb8618e4 * lisp/net/dictionary.el (dictionary-mode): Use setq-local d30618cbc1 * lisp/net/dictionary.el (dictionary-tooltip-mode): Use ... a25a12ddaf Use when where else case returns nil 89e9c1686e * lisp/net/dictionary.el (dictionary-display-more-info): ... d466231c3e A number of docstring fixes b18217eb87 A number of docstring fixes ca0de4d1e0 * etc/NEWS: Add entry for dictionary.el 62d14e10f9 * lisp/net/dictionary.el (dictionary-pre-buffer): Unify casing
Torsten Hilbrich [Mon, 14 Dec 2020 08:48:26 +0000 (09:48 +0100)]
Use when where else case returns nil
* lisp/net/dictionary-connection.el (dictionary-connection-status,
dictionary-connection-close): Instead of returning nil in the else case
of the if just use when.
Use defsubst instead of defmacro here. It was suggested by Stefan
Kangas to replace the defmacro here and, looking at the lispref,
defsubst seems to be a suitable replacement providing the same
benefit of inlining functionality as the defmacro.
Torsten Hilbrich [Thu, 19 Nov 2020 20:40:45 +0000 (21:40 +0100)]
Removed useless check for popup-menu
* lisp/net/dictionary.el (dictionary-popup-matching-words): No need to
check for popup-menu, the code is part of Emacs now and the function
should always be there
Juri Linkov [Mon, 14 Dec 2020 08:52:05 +0000 (10:52 +0200)]
Allow creating a new tab for tab-switcher from the minibuffer (bug#45072)
* lisp/tab-bar.el (tab-switcher): Simplify by let-binding
tab-bar-new-tab-choice to t before calling tab-bar-new-tab
that handles the case when it's called in the active minibuffer.
Juri Linkov [Mon, 14 Dec 2020 08:44:04 +0000 (10:44 +0200)]
Don't show matches with no input for nil icomplete-show-matches-on-no-input
* lisp/icomplete.el (icomplete-show-matches-on-no-input): Fix docstring.
(icomplete--initial-input): New internal variable.
(icomplete-minibuffer-setup): Set buffer-local
icomplete--initial-input to icomplete--field-string.
(icomplete-ret, icomplete-force-complete-and-exit)
(icomplete--sorted-completions, icomplete-exhibit):
Compare icomplete--initial-input with icomplete--field-string
to detect no input. (Bug#19031)
João Távora [Sun, 13 Dec 2020 23:08:42 +0000 (23:08 +0000)]
Inhibit quit in ElDoc timer functions (bug#45117)
The point of un-inhibiting it was to make ElDoc backends interruptible
with any input (as in while-no-input), since that should in principle
invalidate the need of the current ElDoc processing. But that
strategy is dangerous for backends that perform complex
synchronization with external processes. Better let each backend
decide for itself it needs this eager interruptive behavior, like is
presumably the case with the Octave backend.
Dmitry Gutov [Sun, 13 Dec 2020 20:50:46 +0000 (22:50 +0200)]
Remove the duplication from project-switch-commands's config
Based on an older patch by Philip K (https://debbugs.gnu.org/41890#127).
* lisp/progmodes/project.el: (project-switch-commands): Change to
'defcustom', alter the value format, add :type.
(project-switch-use-entire-map): New option.
(project--keymap-prompt, project-switch-project):
Update accordingly, while keeping compatibility with user-defined
values in the previous format (for some transition period).
Philipp Stephani [Sun, 13 Dec 2020 16:13:50 +0000 (17:13 +0100)]
Byte compilation: handle case where the output file is a mountpoint.
See Bug#44631. While testing for a readonly output directory has
slightly different semantics, in practice they should cover cases
where Emacs is sandboxed and can only write to the destination file,
not its directory.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Handle the case
where the output directory is not writable.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--not-writable-directory)
(bytecomp-tests--dest-mountpoint): New unit tests.
Mauro Aranda [Sun, 13 Dec 2020 13:44:30 +0000 (10:44 -0300)]
Stop dropping the tag when creating the custom-variable widget
* lisp/cus-edit.el (custom-variable-value-create): Obey the specified
tag format when creating the variable tag, but stop dropping the tag
format for the variable's type widget, since the tag can be used to
give useful information to the user about the variable. (Bug#35133)
Stefan Monnier [Sun, 13 Dec 2020 00:19:03 +0000 (19:19 -0500)]
* lisp/emacs-lisp/bytecomp.el: Allow a nil destination file
(byte-compile--default-dest-file): New function, extracted from
byte-compile-dest-file.
(byte-compile-dest-file): Use it.
(byte-compile-dest-file-function): Give it a non-nil default value.
(byte-recompile-file, byte-compile-file): Handle a nil return value
from `byte-compile-dest-file`.
* lisp/progmodes/elisp-mode.el (elisp-flymake--batch-compile-for-flymake):
Tell the compiler not to write the result, instead of writing it to
a dummy temp file.
Stefan Kangas [Sat, 12 Dec 2020 22:51:30 +0000 (23:51 +0100)]
Remove references to Emacs before version 22 from FAQ
* doc/misc/efaq.texi (Escape sequences in shell output): Remove
reference to versions before Emacs 21.
(Basic editing, Latest version of Emacs)
(Turning on abbrevs by default, Going to a line by number)
(Security risks with Emacs): Remove references to versions before
Emacs 22.
Philipp Stephani [Sat, 12 Dec 2020 22:21:18 +0000 (23:21 +0100)]
Document and enforce some properties for strings created by modules.
When creating multibyte or unibyte strings, we should guarantee the
following invariants:
- When creating empty strings, a NULL data pointer should be allowed.
This often arises in practice if the string length isn't known in
advance, and we don't want to unnecessarily trigger undefined
behavior. Since functions like memcpy might not accept NULL
pointers, use the canonical empty string objects in this case.
- Nonzero strings should be guaranteed to be unique and mutable.
These are the same guarantees expected from Lisp functions such as
'make-string' or 'unibyte-string'. On the other hand, empty strings
might not be unique.
* lisp/progmodes/make-mode.el (makefile-bsdmake-statements): Fix
the BSD conditional syntax (bug#24000).
(makefile-make-font-lock-keywords): Allow calling without keywords.
(makefile-bsdmake-font-lock-keywords): Add the conditional syntax.
Makefile inclusion, conditional structures and for loops reminiscent of
the C programming language are provided in make. All such structures are
identified by a line beginning with a single dot (`.') character.
Whitespace characters may follow this dot, e.g.,
* doc/emacs/rmail.texi (Rmail Display): Mention the key
binding (bug#25411).
* lisp/mail/rmail.el (rmail-mode-map): Bind C-c C-d to
rmail-epa-decrypt.
(rmail-mode): Mention it.
(rmail-epa-decrypt): Don't mark a mail as decrypted unless we're
replacing it.
* lisp/mail/rmailsum.el (rmail-summary-mode-map): Bind C-c C-d.
(rmail-summary-epa-decrypt): New command.
Eric Abrahamsen [Thu, 3 Dec 2020 23:58:57 +0000 (15:58 -0800)]
New option gnus-registry-register-all
* lisp/gnus/gnus-registry.el (gnus-registry-register-all): If nil,
the registry won't automatically create new entries for all seen
messages. Defaults to t to preserve previous behavior.
(gnus-registry-handle-action): Don't automatically create entries; if
one doesn't exist, don't handle anything.
(gnus-registry-register-message-ids): Only register if this option is
t.
(gnus-registry-get-or-make-entry): Add optional no-create argument.
(gnus-registry-get-id-key): This "get" operation should only create an
entry if this option is t.
* doc/misc/gnus.texi: Documentation and news.
Stefan Monnier [Sat, 12 Dec 2020 15:37:42 +0000 (10:37 -0500)]
* lisp/vc/log-edit.el: Keep separator line thin even with line-numbers
(log-edit-font-lock-keywords): Disable line-number display on
the thin separator line.
(log-edit-mode): Adjust `font-lock-extra-managed-props` accordingly.
(log-edit-changelog-entries): Don't use a nil buffer-local
`change-log-default-name`.
Stefan Monnier [Sat, 12 Dec 2020 14:56:04 +0000 (09:56 -0500)]
* src/keyboard.c: Fix bug#5803.
A long time ago, `read_key_sequence` used to read the keymaps at the
start, so if something happened between this start and the moment
the user actually hits a key, `read_key_sequence` could end up using
the wrong keymaps. To work around this problem, the code used
`record_asynch_buffer_change` to try and trigger `read_key_sequence`
to re-read the keymaps in some known cases.
Several years ago, `read_key_sequence` was changed so as to read the keymaps
only once the user hits a key, making this machinery now redundant
(and also harmful apparently in bug#5803 because it introduces
"spurious" events).
So we here remove `record_asynch_buffer_change` and the
`BUFFER_SWITCH_EVENT` and `Qbuffer_switch` pseudo-events it generated.
Zajcev Evgeny [Thu, 3 Dec 2020 15:37:18 +0000 (18:37 +0300)]
Explicitly specify svg base_uri using `:base-uri' image property
* src/image.c (svg_load): Check `:base-uri' image property to
explicitly set base_uri for images embedded into SVG
(enum svg_keyword_index):
(svg_format): Add :base-uri.
* lisp/svg.el (svg-embed-base-uri-image): New function to embed images
located relative to images `:base-uri'
* lisp/tutorial.el (tutorial--buffer): New variable (bug#27998).
(tutorial--save-on-kill): Use it.
(help-with-tutorial): Set it and add new function to
kill-emacs-query-functions.
Preserve point in dired buffers in dired-*-find-file* commands
* lisp/dired.el (dired--find-file): New function (bug#28949).
(dired-find-file): Use it.
(dired-mouse-find-file): Ditto.
(dired-find-file-other-window): Ditto.
Eli Zaretskii [Sat, 12 Dec 2020 11:25:35 +0000 (13:25 +0200)]
Unbreak the MS-Windows build broken by recent changes
* src/image.c (rsvg_handle_set_dpi_x_y) [WINDOWSNT]: DEF_DLL_FN it.
(init_svg_functions): LOAD_DLL_FN rsvg_handle_set_dpi_x_y.
<rsvg_handle_set_dpi_x_y>: Define as a macro
Eli Zaretskii [Sat, 12 Dec 2020 11:12:57 +0000 (13:12 +0200)]
Improve support for 'memory-report' on MS-Windows
* src/w32term.c (w32_image_size): New function.
* src/image.c (image_frame_cache_size) [HAVE_NTGUI]: Support
reporting the size of frame image cache.
(image_frame_cache_size, Fimage_cache_size): The total size is
now of the type 'size_t', not 'int'.
Alan Third [Fri, 11 Dec 2020 19:52:20 +0000 (19:52 +0000)]
Improve some NS drawing code
* src/nsterm.m (ns_update_end): There's no need to schedule a redraw
if nothing has been changed.
(ns_set_vertical_scroll_bar):
(ns_set_horizontal_scroll_bar): Fix the logic for clearing under the
scrollbars.
(ns_clear_under_internal_border): No need to clip, the default
clipping rectangle will be fine.
Alan Third [Wed, 9 Dec 2020 00:02:44 +0000 (00:02 +0000)]
Use real DPI when rendering SVGs (bug#45124)
* src/image.c (svg_css_length_to_pixels): Pass in a DPI value instead
of using a hard coded value.
(svg_load_image): Set the DPI on the rsvg_handle, and pass it to
svg_css_length_to_pixels.
Harald Jörg [Fri, 11 Dec 2020 16:48:30 +0000 (17:48 +0100)]
; cperl-mode: Eliminate fallbacks if font-lock isn't loaded
* lisp/progmodes/cperl-mode.el (cperl-find-pods-heres):
Eliminate conditionals which always evaluate to true if
font-lock is preloaded (since Emacs 22.1). (Bug#45183)