Andrea Corallo [Sun, 19 Jul 2020 08:46:24 +0000 (10:46 +0200)]
Move eln files into dedicated cache directories
When loading a elc file search for a corresponding eln one into
`comp-eln-load-path' directories and load it if available.
`comp-eln-load-path' contains by default two directory (user and
system one).
* src/pdumper.c (dump_do_dump_relocation): While resurrecting from
load set eln cache sys dir in `Vcomp_eln_load_path'.
* src/lread.c (maybe_swap_for_eln): New function.
(Fload): Clean-up some now unnecessary code going
back to the master one.
(Fload): Make use of Vcomp_eln_to_el_h for the reverse file
look-up.
(openp_add_middle_dir_to_suffixes)
(openp_max_middledir_and_suffix_len, openp_fill_filename_buffer):
Remove functions.
(openp): As for Fload revert code modifications.
(openp): When a .elc file is being loaded check if a corresponding
eln can be loaded in place.
* src/comp.c (ELN_FILENAME_HASH_LEN): New macro.
(comp_hash_string): New function.
(hash_native_abi): Make use of 'comp_hash_string'.
(hash_native_abi): Change `comp-native-path-postfix' format.
(Fcomp_el_to_eln_filename): New function.
(Fcomp__compile_ctxt_to_file): Have file_name as a input.
(Vcomp_eln_to_el_h, Vcomp_eln_load_path): New global varaibles.
* lisp/startup.el (normal-top-level): Add user eln cache directory
in `comp-eln-load-path'.
* lisp/help-fns.el (find-lisp-object-file-name): Reverse look-up
files using `comp-eln-to-el-h'.
Ensure that server-socket-dir doesn't have "//" in the path
* lisp/server.el (server-socket-dir): Use expand-file-name to
avoid "//" in the path name (if either XDG_RUNTIME_DIR or TMPDIR
ends in a slash) (bug#18658).
Handle negative prefix arguments to mark-paragraph correctly
* textmodes/paragraph.el (mark-paragraph): Handle negative
arguments correctly (bug#18847). This makes `M- M-h M-h' do the
correct thing with expanding the region (like other marking
commands) backwards. Also fix problem at the end of the buffer,
where the numbers of paragraphs left in the buffer is less than
ARG, then paragraphs would also be marked *before* the current
paragraph. Also clarify the doc string.
Jonas Bernoulli [Sun, 9 Aug 2020 21:02:34 +0000 (23:02 +0200)]
Update section heading conventions for libraries
* doc/lispref/tips.texi (Comment Tips): Update information on section
headings to reflect common usage.
Previously the tips stated that if the code is split up into multiple
sections, then that should be done by splitting up the ";;; Code:"
section into multiple sub-sections.
However about half the libraries in Emacs instead use multiple
top-level sections. We update the tips (aka conventions) to allow
this common usage, but because it is awkward if there is a section
named "Code", which contains only some of the code instead of all of
it, we now recommend that that section should be empty in this case.
We cannot just give up on the "Code:" section/heading because that is
an old convention that is followed be nearly every library and because
it is likely that there are some utilities out there that depend on
its presence.
This was discussed in
https://lists.gnu.org/archive/html/emacs-devel/2020-07/msg00444.html
https://lists.gnu.org/archive/html/emacs-devel/2020-08/msg00001.html
Jonas Bernoulli [Wed, 15 Jul 2020 16:40:36 +0000 (18:40 +0200)]
* lisp/font-lock.el: No longer use headings as end of section markers.
Each section ends right before the following section begins and IMO
that means that it is unnecessary to mark the end of sections.
For users of `outline-minor-mode' the old end-of-section markers were
a distraction. They made it much harder to parse the overview outline
state because each section heading was followed by a end-of-section
marker that was formatted as a section heading. Because of this I
wanted to remove the end-of-section markers.
But as Eli pointed out these sections are long and not everyone uses
`outline-minor-mode'.
So instead of removing them, I am turning the end-of-section markers
into regular comments (beginning with just two semicolons) instead of
section headings (beginning with tree semicolons). That way users of
`outline-minor-mode' won't be distracted by them and others can still
benefit from the markers as before.
Jonas Bernoulli [Wed, 17 Jun 2020 00:59:41 +0000 (02:59 +0200)]
* lisp/font-lock.el: Split the Commentary into subsections.
The "Commentary" was already split into multiple sections, but
these sections where on the same level as "Commentary" itself,
which is less convenient for users of `outline-minor-mode'.
Jonas Bernoulli [Wed, 17 Jun 2020 01:00:12 +0000 (03:00 +0200)]
* lisp/net/imap.el: Use proper outline headings
This library already used section headings but it used just two
instead of three semicolons, making them indistinguishable from
plain comments. One heading is new.
Jonas Bernoulli [Fri, 8 May 2020 19:24:20 +0000 (21:24 +0200)]
* lisp/obsolete/longlines.el: Use proper outline headings.
This library already used section headings but it used just two
instead of three semicolons, making them indistinguishable from
plain comments. One heading is new.
These comments are unnecessary because the doc-strings that follow
already cover the same ground, while being more concise. These
comments were also prefixed with too many semicolons, causing them
to be treated as outline headings.
Jonas Bernoulli [Mon, 20 Apr 2020 21:30:41 +0000 (23:30 +0200)]
Merge two conditions and fix indentation
The motivation behind this change is that the indentation of some
lines was outright wrong. If we address that issue, then we might
as well also address the issue that some code is needlessly nested
an additional level. That we can fix by merging the conditions.
By doing these two changes in on commit we have to change the fewest
lines. Even though we are moving to using just spaces for indentation
of the modified lines, other lines in the same function are left alone
and continue to us tabs+spaces for indentation. That is not "wrong",
but just the style we are slowly migrating away from when touching
lines for other reasons.
Discussed in bug#42397.
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message): Merge two
conditions and fix indentation.
`concat' treats arguments that are nil as if they were empty strings.
We therefore do not have to write (if TEST THEN "") and can just use
(and TEST THEN).
Don't output emacsclient warning if both -a and --quiet
* lib-src/emacsclient.c (set_local_socket): Don't output the
warning if both -a and --quiet are specified (bug#16117).
Inspired by a patch from Scott Turner <srt19170@gmail.com>.
Paul Eggert [Wed, 12 Aug 2020 18:40:12 +0000 (11:40 -0700)]
Stop using Gnulib inttypes module
It wasn’t needed for MinGW after all, no other platform
seems to need it, and it slows down ‘configure’.
* admin/merge-gnulib (GNULIB_MODULES): Remove inttypes.
* m4/gnulib-comp.m4: Regenerate.
Paul Eggert [Wed, 12 Aug 2020 18:37:52 +0000 (11:37 -0700)]
Update from Gnulib
This incorporates:
2020-08-12 stdint: port intptr_t to more-recent MinGW
2020-08-11 Use __restrict also on clang
2020-08-11 Use flexible array syntax also on clang
2020-08-11 fcntl: On native Windows, use _setmode, not setmode
* lib/binary-io.h, lib/cdefs.h, lib/fcntl.c, lib/regex.h:
* lib/stdint.in.h: Copy from Gnulib.
Simplify the computation of mm-mime-mule-charset-alist
* lisp/gnus/mm-util.el (mm-mime-mule-charset-alist): For
compatibility with XEmacs, mm-mime-mule-charset-alist was first
set to a list of hard-coded entries, and then overwritten on Emacs
from `coding-system-list'. Remove the hard-coded values and
simplify the code.
* lisp/net/eudc-bob.el (eudc-bob-save-object)
(eudc-bob-pipe-object-to-external-program): Remove checks for
functions that are always defined in Emacs.
Amin Bandali [Wed, 12 Aug 2020 17:33:36 +0000 (13:33 -0400)]
Add support for italic text in ERC
* lisp/erc/erc-goodies.el (erc-italic-face): New face for italic text.
(erc-controls-interpret), (erc-controls-highlight): Add `italicp'.
(erc-controls-remove-regexp),
(erc-controls-highlight-regexp): Handle C-] for italic.
(erc-controls-propertize): Add `italicp' argument and use it to
conditionally propertize text with the new `erc-italic-face'.
* etc/NEWS: Announce italic text support.
* lisp/emulation/viper.el (viper-go-away, viper-set-hooks)
(viper-non-hook-settings, viper-mode):
* lisp/emulation/viper-cmd.el (viper-normalize-minor-mode-map-alist)
(viper-harness-minor-mode): Remove a bunch of checks to do (or
not do) things based on whether add-to-ordered-list is fbound and
emulation-mode-map-alists is bound, because in Emacs now, these
are always true.
Fix a check for whether Emacs can play sounds in eudc-bob
* lisp/net/eudc-bob.el (eudc-bob-sound-menu)
(eudc-bob-play-sound-at-point): Check for play-sound-internal
instead of play-sound, because the latter is always defined.
Stefan Kangas [Wed, 12 Aug 2020 13:43:23 +0000 (15:43 +0200)]
Remove Emacs 23 compat code from checkdoc.el
* lisp/emacs-lisp/checkdoc.el (checkdoc-run-hooks): Redefine as
obsolete function alias for 'run-hook-with-args-until-success'.
(checkdoc-this-string-valid-engine)
(checkdoc-file-comments-engine): Adjust callers.
* src/macfont.m (macfont_monospace_width_multiplier): New function
to compute the width for monospace fonts (bug#24582).
(macfont_glyph_extents): Fix monospace glyph computation.
(macfont_shape): Ditto.
* lisp/erc/erc.el (erc-generate-new-buffer-name): Fixes behavior 1,
also determines if the '#channel/server' buffer already exists
and will reuse that buffer when joining on the same
server. Additionally when creating a new buffer with
'#channel/serverB', the existing buffer '#channel' on 'severA' will be
renamed to '#channel/serverA' for the sake of consistency (bug#40121).
* lisp/erc/erc-join.el (erc-autojoin-channels): The logic is
simplified ensuring that when autojoining channels specified in
erc-autojoin-channels-alist, if there exists an erc buffer with the
same channel name but a different server, it will create a new buffer
to join the channel. The current logic is very weak that will skip
joining same channel on different servers altogether.
By the definition of erc-reuse-buffers, if non-nil it should create a
new buffer when joining channels with same names on different
servers. The current behavior of erc-reuse-buffers is:
1. when non-nil, it will always reuse the same channel buffer,
resulting in server A's channel gets reconnected to the channel with
the same name of server B.
2. when nil, the buffer-name of the joined channel is
'#channel/server'. However if one tries to '/join #channel' from the
server buffer, it creates a new empty buffer with buffer-name
'#channel', instead of opening the already-joined channel buffer.
Sungbin Jo [Wed, 12 Aug 2020 10:39:50 +0000 (12:39 +0200)]
Add utility functions and new xwidget commands
Co-authored-by: Jaesup Kwak <veshboo@gmail.com>
* lisp/xwidget.el (xwidget-webkit-callback): Add case for
'response-callback' event.
(xwidget-webkit-download-dir): New variable.
(xwidget-webkit-save-as-file): New function.
* src/nsxwidget.m (XwWebView::decidePolicyForNavigationResponse):
Store download event.
* src/xwidget.c src/xwidget.h (store_xwidget_download_callback_event):
New function.
Sungbin Jo [Wed, 12 Aug 2020 10:34:29 +0000 (12:34 +0200)]
Add utility functions and new xwidget commands
Co-authored-by: Jaesup Kwak <veshboo@gmail.com>
* etc/NEWS: Announce new functions and options.
* lisp/xwidget.el (xwidget): New defgroup.
(xwidget-webkit-mode-map): Add new keybindings.
(xwidget-webkit-scroll-up, xwidget-webkit-scroll-down)
(xwidget-webkit-scroll-forward, xwidget-webkit-scroll-backward):
Add optional argument to specify specific amounts to scroll down.
(xwidget-webkit-scroll-up-line, xwidget-webkit-scroll-down-line): New
functions.
(xwidget-webkit-scroll-bottom): Fix function to scroll to the bottom
of the document.
(xwidget-webkit-callback): Use new function to update buffer title
even when Javascript is disabled.
(xwidget-webkit-bookmark-jump-new-session): New variable.
(xwidget-webkit-bookmark-make-record): Modify to use xwidget-webkit to
open bookmark that is created in xwidget-webkit.
(xwidget-webkit-insert-string): Fix Javascript snippet to not throw
Javsscript exceptions.
(xwidget-webkit-inside-pixel-width)
(xwidget-window-inside-pixel-height): New functions.
(xwidget-webkit-adjust-size-to-window): Use new functions.
(xwidget-webkit-new-session): Insert invisible URL instead of an empty
string to achieve better default behavior.
(xwidget-webkit-back, xwidget-webkit-forward, xwidget-webkit-reload)
(xwidget-webkit-current-url): Use new functions to enable scrolling
even when Javascript is disabled.
(xwidget-webkit-copy-selection-as-kill): Remove unnecessary lambda.
* src/nsxwidget.h src/nsxwidget.m (nsxwidget_webkit_uri)
(nsxwidget_webkit_title, nsxwidget_webkit_goto_history): Add new
functions.
* src/xwidget.c (Fxwidget_webkit_uri, Fxwidget_webkit_title)
(Fxwidget_webkit_goto_history): Add new functions.
(syms_of_xwidget): Define new functions.
Sungbin Jo [Wed, 12 Aug 2020 10:12:34 +0000 (12:12 +0200)]
Add xwidget support for macOS
Co-authored-by: Jaesup Kwak <veshboo@gmail.com>
* configure.ac: Allow '--with-xwidgets' for "${NS_IMPL_COCOA}".
* etc/NEWS: Mention new feature.
* etc/TODO: Remove done TODO to implement xwidget in NeXTstep port.
* lisp/xwidget.el (xwidget-webkit-clone-and-split-below)
(xwidget-webkit-clone-and-split-right): New procedures.
(xwidget-webkit-callback): Remove call to
'xwidget-webkit-adjust-size-to-window' as adjusting xwidget size is
handled in 'x_draw_xwidget_glyph_string'.
(xwidget-webkit-enable-plugins): New variable.
* nextstep/templates/Info.plist.in: Add 'NSAppTransportSecurity'.
* src/Makefile.in: Add nsxwidget.o for compilation.
* src/emacs.c (main): Move conditional call to 'syms_of_xwidget'.
* src/nsterm.m (ns_draw_glyph_string): Add case for 'XWIDGET_GLYPH'.
(note_mouse_movement mouseMoved): Make it easy to resize window by
dragging mode-line or vertical separator adjacent to large glyph.
* src/nsxwidget.h src/nsxwidget.m: Newly added files, xwidget webkit
backend for macOS Cocoa.
* src/xwidget.c (Fmake_xwidget, xwidget_init_view)
(x_draw_xwidget_glyph_string, xwidget_is_web_view)
(Fxwidget_webkit_goto_uri, Fxwidget_webkit_zoom, Fxwidget_resize)
(Fxwidget_size_request, Fdelete_xwidget_view, xwidget_end_redisplay)
(kill_buffer_xwidgets): Add macOS Cocoa specific functions and code
with 'NS_IMPL_COCOA' and guard GTK specific functions and code with
'USE_GTK'.
(x_draw_xwidget_glyph_string): Handle adjusting xwidget size.
* src/xwidget.h (xwidget, xwidget_view): Add macOS Cocoa specific
fields with 'NS_IMPL_COCOA' and guard GTK specific fields with
USE_GTK.
Paul Eggert [Wed, 12 Aug 2020 01:35:44 +0000 (18:35 -0700)]
Don’t warn about integer conversion in pdumper.c
Problem reported by Juanma Barranquero in:
https://lists.gnu.org/r/emacs-devel/2020-08/msg00279.html
and a similar glitch was reported by Eli Zaretskii (Bug#36597#67).
* src/pdumper.c: Remove -Wconversion pragma.
(ALLOW_IMPLICIT_CONVERSION, DISALLOW_IMPLICIT_CONVERSION):
Remove. All uses removed. Although -Wconversion may have
been helpful when writing pdumper.c it is now causing more
trouble than it’s worth here (just as in the rest of Emacs).
(dump_read_all): Avoid no-longer-necessary use of ‘size_t’
rather than ‘int’.
* lisp/emacs-lisp/autoload.el (autoload--make-defs-autoload):
register-definition-prefixes is in subr.el, so it shouldn't be
necessary to check whether it's defined.
* lisp/eshell/esh-proc.el (eshell-gather-process-output):
`start-file-process' is always defined, so remove the code that
deals with Emacs versions that doesn't have it.
Paul Eggert [Tue, 11 Aug 2020 17:58:35 +0000 (10:58 -0700)]
Update from Gnulib
This incorporates:
2020-08-11 Use expression statements also on clang
2020-08-10 Use many __attribute__s with clang
2020-08-09 Use attribute __aligned__ with clang
2020-08-09 Use __alignof__ with clang
2020-08-09 ignore-value: Simplify on clang
2020-08-09 Use __typeof__ with clang
2020-08-09 intprops: Fix typo in comment
2020-08-09 Silence warnings from clang 10 with -Wimplicit-fallthrough
2020-08-09 count-one-bits: Use __builtin_popcount{,l,ll} on clang
2020-08-09 string: Fix build error in C++ mode with clang
2020-08-09 Add ability to emit user-defined diagnostics with clang
2020-08-07 alloca: No need to compile alloca.c with clang
2020-08-06 Use __builtin_assume with clang
* lib/alloca.in.h, lib/arg-nonnull.h, lib/c++defs.h, lib/cdefs.h:
* lib/count-one-bits.h, lib/dirent.in.h, lib/ignore-value.h:
* lib/intprops.h, lib/malloca.h, lib/regex_internal.h:
* lib/stdalign.in.h, lib/stddef.in.h, lib/stdio.in.h:
* lib/stdlib.in.h, lib/string.in.h, lib/verify.h, lib/warn-on-use.h:
* m4/gnulib-common.m4, m4/stddef_h.m4, m4/stdint.m4:
Copy from Gnulib.
Paul Eggert [Tue, 11 Aug 2020 17:29:02 +0000 (10:29 -0700)]
Prefer make_nil_vector to make-vector with nil
* src/pdumper.c (hash_table_thaw): Pacify -Wconversion so
we can use make_nil_vector again.
* src/timefns.c (syms_of_timefns): Prefer make_nil_vector
to make_vector with Qnil.
Eli Zaretskii [Tue, 11 Aug 2020 16:59:17 +0000 (19:59 +0300)]
Fix MinGW build broken by recent pdumper changes.
* src/pdumper.c (hash_table_thaw): Use Fmake_vector. Suggested by
Pip Cet <pipcet@gmail.com>.
(dump_trace): Declare ATTRIBUTE_FORMAT_PRINTF, not
ATTRIBUTE_FORMAT((__printf__), so that we pick the right attribute
for MinGW.
Bastian Beischer [Tue, 11 Aug 2020 16:45:01 +0000 (18:45 +0200)]
Make mouse-2 respect select-enable-primary etc
* lisp/calc/calc-yank.el (calc-yank-internal): Factor out into its
own function (bug#23629).
(calc-yank): Factored out from here.
(calc-yank-mouse-primary): New command to
Noam Postavsky [Tue, 11 Aug 2020 14:02:11 +0000 (16:02 +0200)]
Fix (end-of-defun N) for N >= 2
* lisp/emacs-lisp/lisp.el (end-of-defun): Only skip to next line when
after end of defun when ARG is 1 or less.
* test/lisp/emacs-lisp/lisp-tests.el (end-of-defun-twice): New
test (bug#24427).
Tino Calancha [Tue, 11 Aug 2020 13:40:48 +0000 (15:40 +0200)]
Change the Calc text input method to insert at point
* lisp/calc/calc.el (calcDigit-delchar): New command to delete chars
forward in the calc minibuffer.
(calc-digit-map): Bind calcDigit-delchar to '\C-d'.
(calcDigit-key): Do not go to (point-max) in calc minibuffer
before insert a digit (Bug#24612).
* lisp/help-fns.el (find-lisp-object-file-name): Check for 'defvar
argument before searching for an internal variable (Bug#24697).
* test/lisp/help-fns-tests.el: New tests.
Kaushal Modi [Tue, 11 Aug 2020 13:16:11 +0000 (15:16 +0200)]
Allow Dired to dereference symbolic links when copying
* doc/emacs/dired.texi (Operating on Files): Mention the new
defcustom (bug#25075).
* lisp/dired-aux.el (dired-do-copy): Invert the value of
`dired-copy-dereference' in lexical scope when prefix argument is
'(4). Update function documentation for the new defcustom.
* lisp/dired-aux.el (dired-copy-file): Use `dired-copy-dereference' as
the `dereference' argument to `dired-copy-file-recursive'.
* lisp/dired-aux.el (dired-copy-file-recursive): Add new optional
argument `dereference'.
* lisp/dired.el (dired-copy-dereference): New defcustom, defaults to
nil.
* test/lisp/gnus/mml-sec-tests.el (mml-secure-en-decrypt-sign-3):
(mml-secure-en-decrypt-sign-1-3-double): These tests are unstable
on Ubuntu (bug#42803).
Further tweaks to the user manual about shell-command-buffer-name
* doc/emacs/misc.texi (Single Shell): Reintroduce the actual
buffer names in the user manual (bug#39138), but keep the
references to the variables. It's easier for people reading the
user manual to deal with actual names.
Paul Eggert [Tue, 11 Aug 2020 09:16:54 +0000 (02:16 -0700)]
pdumper speed tweeks for hash tables
* src/pdumper.c (dump_queue_empty_p): Avoid unnecessary call
to Fhash_table_count on a known hash table.
(dump_hash_table_list): !NILP, not CONSP.
(hash_table_freeze, hash_table_thaw): ASIZE, not Flength, on vectors.
Initialize in same order as struct.
(hash_table_thaw): make_nil_vector, not Fmake_vector with nil.
Paul Eggert [Tue, 11 Aug 2020 09:16:54 +0000 (02:16 -0700)]
Don’t needlessly convert to ‘unsigned’ in pdumper
* src/pdumper.c (PRIdDUMP_OFF): New macro.
(EMACS_INT_XDIGITS): New constant.
(struct dump_context): Use dump_off for relocation counts.
All uses changed.
(dump_queue_enqueue, dump_queue_dequeue, Fdump_emacs_portable):
Don’t assume counts fit in ‘unsigned’ or ‘unsigned long’.
Use EMACS_INT_XDIGITS instead of assuming it’s 16.