João Távora [Thu, 20 Jul 2023 10:02:12 +0000 (05:02 -0500)]
Eglot: fix textDocument/onTypeFormatting for 'newline' command
In the newline command, last-input-event is 13 (carriage return), but
most, if not all, language servers that support
documentOnTypeFormattingProvider expect 10 (linefeed) to be the
trigger, so convert 13 to 10 for the purposes of the
textDocument/onTypeFormatting request.
Also make this common edit silent in the mode-line/messages.
* lisp/progmodes/eglot.el (eglot--post-self-insert-hook): Convert
linefeed to carriage return.
(eglot-format): Pass SILENT to eglot--apply-text-edits.
(eglot--apply-text-edits): Take new optional SILENT arg.
Po Lu [Thu, 20 Jul 2023 03:21:25 +0000 (11:21 +0800)]
Use context menu header titles on Android
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu):
New field `title'.
(addSubmenu): New arg TITLE. Set that field.
(expandTo): Set MENU's header title if it's a context menu.
* src/androidmenu.c (android_init_emacs_context_menu): Adjust
signature of `createContextMenu'.
(android_menu_show): Use TITLE instead of pane titles if there's
only one pane.
F. Jason Park [Wed, 19 Jul 2023 05:18:00 +0000 (22:18 -0700)]
Warn when toggling erc-nicks-mode in target buffers
* lisp/erc/erc-nicks.el (erc-nicks-mode, erc-nicks-enable): This local
module isn't autoloaded like most global modules, in part to dissuade
users from attempting to enable it by running M-x erc-nicks-mode RET.
However, rather than signal an error upon detecting such an attempt,
ERC should explain that the only supported means of activation is via
`erc-modules'. This change does that and then enables it anyway,
despite the degraded experience.
F. Jason Park [Sun, 16 Jul 2023 02:11:37 +0000 (19:11 -0700)]
; Address some ambiguities in ERC's documentation
* doc/misc/erc.texi: Change name of example function from
`erc-my-enable-read-indicator-on-join' to
`erc-my-enable-keep-place-indicator-on-join'. Fix example functions
`erc-cmd-TRACK' and `erc-cmd-UNTRACK' to work with server buffers as
well as target buffers.
* etc/ERC-NEWS: Revise `keep-place' entry and make headlines less
redundant.
* lisp/erc/erc.el (erc-accidental-paste-threshold-seconds): Fix
portion of existing wording that was more likely interpreted as a
single multiline submission, whereas the intended meaning is three
separate submissions.
Po Lu [Wed, 19 Jul 2023 06:42:02 +0000 (14:42 +0800)]
Improve behavior of `restart-drag'
* lisp/touch-screen.el (touch-screen-handle-point-up): If what
is `restart-drag' (meaning that a drag has been restarted but
the touchpoint has not moved), translate the release into a
regular mouse click to deactivate the region.
Po Lu [Wed, 19 Jul 2023 04:46:02 +0000 (12:46 +0800)]
Update Android port
* build-aux/makecounter.sh (curcount): Rename `counter' to
`emacs_shortlisp_counter'.
* doc/emacs/input.texi (Touchscreens): Document
`touch-screen-extend-selection'.
* doc/lispref/commands.texi (Touchscreen Events): Document
`touchscreen-restart-drag'.
* lisp/touch-screen.el (touch-screen-extend-selection): New user
option.
(touch-screen-restart-drag): New function.
(touch-screen-handle-point-update): Handle `restart-drag'
gestures.
(touch-screen-handle-touch): Check if the prerequisites for
extending a previous drag gesture are met, and generate such
events if so.
(touch-screen-translate-touch): Update doc string.
* src/Makefile.in (otherobj): Remove BUILD_COUNTER_OBJ.
($(lispsource)/international/charprop.el):
(%.elc): Don't depend on bootstrap-emacs if cross configuring
for Android.
(libemacs.so): Directly depend on and link with
BUILD_COUNTER_OBJ.
Po Lu [Wed, 19 Jul 2023 01:53:58 +0000 (09:53 +0800)]
Make sure Android builds are redumped upon changes to shortlisp
* build-aux/makecounter.sh: New script.
* src/Makefile.in (abs_top_builddir): New variable.
(BUILD_COUNTER_OBJ): Define to build-counter.o
if compiling for Android.
(build-counter.c): New target. Generate this file using
makecounter.sh upon changes to lisp.mk or shortlisp.
(lisp.mk): Make and load relative to abs_top_builddir.
(emacs$(EXEEXT)): Adjust acordingly.
(mostlyclean): Remove build-counter.c.
Po Lu [Wed, 19 Jul 2023 00:21:43 +0000 (08:21 +0800)]
Improve reliability of minor mode menu dispatch
* lisp/mouse.el (minor-mode-menu-from-indicator): Instead of using the
word at point, search for a matching enabled minor mode from the
beginning of the string object when mode-line-compact is enabled.
Po Lu [Tue, 18 Jul 2023 08:15:05 +0000 (16:15 +0800)]
Fix display of minor mode menus when mode-line-compact is enabled
* lisp/mouse.el (minor-mode-menu-from-indicator): New arg
WINDOW. If INDICATOR is a string object and mode-line-compat is
enabled within WINDOW, use the symbol within the object at its
position instead.
(mouse-minor-mode-menu): Pass posn-object and posn-window to
minor-mode-menu-from-indicator.
Po Lu [Tue, 18 Jul 2023 05:24:36 +0000 (13:24 +0800)]
Update Android port
* lisp/touch-screen.el (touch-screen-hold)
(touch-screen-handle-point-up): Don't select inactive minibuffer
windows.
(touch-screen-handle-point-update): Improve detection of left
and right edges.
Po Lu [Tue, 18 Jul 2023 02:12:40 +0000 (10:12 +0800)]
Update Android port
* doc/lispref/commands.texi (Touchscreen Events): Describe
treatment of canceled touch sequences during touch event
translation.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Update JNI
prototypes.
* java/org/gnu/emacs/EmacsWindow.java (motionEvent): Set
cancelation flag in events sent where appropriate.
* lisp/touch-screen.el (touch-screen-handle-point-update):
Improve treatment of horizontal scrolling near window edges.
(touch-screen-handle-touch): Don't handle point up if the touch
sequence has been canceled.
* src/android.c (sendTouchDown, sendTouchUp, sendTouchMove): New
argument `flags'.
* src/androidgui.h (enum android_touch_event_flags): New enum.
(struct android_touch_event): New field `flags'.
* src/androidterm.c (handle_one_android_event): Report
cancelation in TOUCHSCREEN_END_EVENTs.
* src/keyboard.c (make_lispy_event): Fix botched merge.
Po Lu [Tue, 18 Jul 2023 01:27:27 +0000 (09:27 +0800)]
Expose the ``cancellation'' of touch events to Lisp
* doc/lispref/commands.texi (Touchscreen Events):
* etc/NEWS: Describe new event parameter `canceled'.
* src/keyboard.c (make_lispy_event) <TOUCHSCREEN_END_EVENT>:
If event->modifiers, set canceled to t.
* src/termhooks.h (enum event_kind): Describe meaning of
modifiers in TOUCHSCREEN_END_EVENTs.
* src/xfns.c (setup_xi_event_mask): Select for
XI_TouchOwnership.
* src/xterm.c (xi_link_touch_point): Round X and Y and clear
ownership.
(xi_unlink_touch_point): Return 1 if the touch point is not
owned by Emacs, 2 otherwise.
(handle_one_xevent): Handle XI_TouchOwnership events and report
ownership correctly.
* src/xterm.h (enum xi_touch_ownership): New enum. Write
commentary on XI touch sequence ownership.
(struct xi_touch_point_t): Use integer X and Y. New field
`ownership'. Adjust for alignment.
Delete vc-deduce-fileset-1, taking advantage of set-buffer
* lisp/vc/vc.el (vc-deduce-fileset): Set buffer to the base
buffer, if any (bug#63949). That's to replace the more complex
previous strategy. vc-deduce-fileset is allowed to change the
current buffer, so why not do it for that case.
(vc-deduce-fileset-1): Delete, moving the meat of the logic back
to vc-deduce-fileset.
Like in `tab-bar-format-align-right', use `add-face-text-property' to
add 'mode-line' face on the `rest-str' string for `string-pixel-width'
to calculate the correct pixel width (bug#62606).
The Emacs regexp engine interprets character ranges from ASCII to raw
bytes, such as [a-\xfe], as not including non-ASCII Unicode at all;
ranges from non-ACII Unicode to raw bytes, such as [ü-\x91], are
ignored entirely.
To make rx produce a translation that works as intended, split ranges
that that go from ordinary characters to raw bytes. Such ranges may
appear from set manipulation and regexp optimisation.
* lisp/emacs-lisp/rx.el (rx--generate-alt): Split intervals that
straddle the char-raw boundary when rendering a string regexp from an
interval set.
* test/lisp/emacs-lisp/rx-tests.el (rx-char-any-raw-byte):
Add test cases.
Po Lu [Mon, 17 Jul 2023 12:42:56 +0000 (20:42 +0800)]
Don't deliver touch or pinch events from master or slave devices
* src/xfns.c (setup_xi_event_mask): Select for gesture events on
only master devices if safe.
* src/xterm.c (handle_one_xevent): Deliver touchscreen events
only from direct slave devices, and gesture events only from
master pointers.
Po Lu [Mon, 17 Jul 2023 06:28:20 +0000 (14:28 +0800)]
Update Android port
* doc/lispref/commands.texi (Touchscreen Events): Document
meaning of `mouse-1-menu-command'.
* lisp/mouse.el (minor-mode-menu-from-indicator): New arg EVENT.
Give it to popup-menu.
(mouse-minor-mode-menu): Use posn specified within EVENT.
* lisp/touch-screen.el (touch-screen-handle-touch): Fix
interactive translation. Treat commands labeled
`mouse-1-menu-command' like ordinary keymaps.
Po Lu [Mon, 17 Jul 2023 05:58:32 +0000 (13:58 +0800)]
Update Android port
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to simple translation.
* lisp/touch-screen.el (touch-screen-handle-point-up): Generate
`down-mouse-1' if the current gesture is `mouse-1-menu'.
(touch-screen-handle-touch): If binding is a keymap, set state
to `mouse-1-menu' and wait for point to be released before
generating down-mouse-1.
Po Lu [Mon, 17 Jul 2023 04:58:29 +0000 (12:58 +0800)]
Improve word selection behavior
* lisp/tab-bar.el (tab-bar-map): Don't bind touch-screen-drag.
* lisp/touch-screen.el (touch-screen-drag): Extend the region
based on the position of the mark, not the position of point
relative to EVENT.
(touch-screen-translate-touch): Don't generate virtual function
keys for non-mouse events.
(function-key-map): Remove redundant definitions.
* src/keyboard.c (read_key_sequence): Don't generate *-bar
prefix keys for mock input (such as input from function key
translation.)
Po Lu [Mon, 17 Jul 2023 01:46:37 +0000 (09:46 +0800)]
Improve touch screen support
* doc/emacs/input.texi (Touchscreens): Document the new feature
for people who have trouble dragging to word boundaries.
* lisp/touch-screen.el (touch-screen-word-select): New
defcustom.
(touch-screen-word-select-bounds)
(touch-screen-word-select-initial-word): New variable
definitions.
(touch-screen-hold): If `touch-screen-word-select', select the
word around EVENT.
(touch-screen-drag): If `touch-screen-word-select', extend the
region to the next word boundary if the character under point
constitutes a word.
(touch-screen-handle-point-update, touch-screen-handle-touch)
(touch-screen-translate-touch): Fix doc strings and fill
comments.
Po Lu [Sun, 16 Jul 2023 07:30:01 +0000 (15:30 +0800)]
Improve touch-screen support
* doc/emacs/emacs.texi (Top):
* doc/emacs/input.texi (Other Input Devices): Correctly
capitalize subsection name.
(Touchscreens): Document additional translation.
* doc/lispref/commands.texi (Touchscreen Events): Document that
`touchscreen-end' events now have prefix keys. Also, describe
mouse emulation and `touchscreen-scroll' events.
* doc/lispref/keymaps.texi (Translation Keymaps): Document
`current-key-remap-sequence'.
* lisp/touch-screen.el (touch-screen-translate-prompt): New
function.
(touch-screen-scroll): New command. Bind to
`touchscreen-scroll'.
(touch-screen-handle-point-update, touch-screen-handle-point-up)
(touch-screen-handle-touch): Refactor to actually translate
touch screen event sequences, as opposed to looking up commands
and executing them.
(touch-screen-translate-touch): New function. Bind in
function-key-map to all touch screen events.
(touch-screen-drag-mode-line-1, touch-screen-drag-mode-line)
(touch-screen-tap-header-line): Remove special commands for
dragging the mode line and clicking on the header line.
* lisp/wid-edit.el (widget-button-click): Adjust accordingly.
* src/keyboard.c (access_keymap_keyremap): Bind
`current-key-remap-sequence' to the key sequence being remapped.
(keyremap_step): Give fkey->start and fkey->end to
access_keymap_keyremap.
(head_table): Add imaginary prefix to touchscreen-end events as
well.
(syms_of_keyboard): New variable Vcurrent_key_remap_sequence.
Stefan Monnier [Sat, 15 Jul 2023 15:41:32 +0000 (11:41 -0400)]
sgml-mode.el: Cosmetic fixes
* lisp/textmodes/sgml-mode.el: Prefer #' to quote function names.
(sgml-font-lock-keywords-1, sgml-font-lock-syntactic-face):
Refer to font-lock faces rather than their variables.
(sgml-mode-facemenu-add-face-function): Remove redundant arg to `mapconcat`.
(sgml-electric-tag-pair-before-change-function): Remove left-over
debugging messages (bug#64636).
Eli Zaretskii [Sat, 15 Jul 2023 09:30:14 +0000 (05:30 -0400)]
Merge from origin/emacs-29
7ac947f34c7 ; * src/lisp.h (struct Lisp_Overlay): Update commentary (... 9bc93c7996c Replace duplicate text from epa.texi by a reference 74cc1d27f1f Add basic usage information and fix references f24bdbfaf57 Add concept index, title-case structure titles 0165b50b0ff ; * lisp/emacs-lisp/lisp.el (raise-sexp): Fix typo in doc... 4cf33b6bd02 ; * doc/misc/modus-themes.org: Fix whitespace (bug#64548). 4821da1ad7f Fix show-paren-mode when the parentheses is partially vis... 419b4d44914 ; Improve documentation of with-restriction be34e8294af ; * admin/git-bisect-start: Update failing commits 8e06809fccd Merge branch 'scratch/bug64391' into emacs-29 dbac8076057 * lisp/net/tramp.el (tramp-get-buffer-string): Stabilize. 01fb898420f Simplify after adding internal function to enter a labele... b741dc7fcde Add internal function to enter a labeled restriction
Ignore quit while getting interprogram paste in kill-new
On X, if the current selection owner is not responding to selection
requests, the user may want to take ownership of the selection. The
obvious way to do this is to kill some text (which a user might also
be doing just as part of normal editing at the time the selection
owner becomes nonresponsive). However, if
save-interprogram-paste-before-kill is non-nil, then killing text will
hang until the user quits, and this quit will abort the entire
kill-new, preventing the user from taking ownership of the selection.
Now instead if the user quits while we are attempting to retrieve the
selection from hanging owner, we will proceed to take ownership of the
selection as normal, resolving the problem.
(One example of a selction owner that might not be responding to
selection requests is another instance of Emacs itself; while Emacs is
blocked in call-process or Lisp execution, it currently does not
respond to selection requests.)
* lisp/simple.el (kill-new): Ignore quit while getting interprogram
paste (bug#64423)
* lisp/progmodes/python.el (python--list-imports): Prefer to
use an exit status >1.
(python--list-imports-check-status): New function to check
status of Python script.
(python--do-isort): Fix wrong status check introduced with 6295d7abdd4. (Bug#64406)
* configure.ac (netbsd): Don't set TERMINFO=no unless the termcap
library is either -ltermcap or -lcurses. This prevents aborts
because on recent versions of NetBSD libtermcap is actually a
symlink to libterminfo. (Bug#64577)
Support displaying function name in the header line
In some languages, the function name as displayed in the mode-line by
which-func-mode can be quite long. It's useful to be able to display
it in the header-line instead. Let's support that.
* lisp/progmodes/which-func.el (which-func-display)
(which-func--use-header-line, which-func--use-mode-line):
Add. (Bug#64533)
(which-func-try-to-enable): Support 'which-func--use-header-line'.
(which-func--disable): Add, to support 'which-func--use-header-line'.
(which-func-ff-hook, which-func-update-1): Use 'which-func--disable'.
Łukasz Stelmach [Tue, 13 Jun 2023 11:26:39 +0000 (13:26 +0200)]
Show SHA-256 digest of a public key in 'nsm-format-certificate'
* lisp/net/nsm.el (nsm-format-certificate): Show public key
digest (SHA-256 if available). Displaying the digest enables
users to verify the certificate with other tools like 'gnutls-cli'
which present much more detailed information.
* src/gnutls (emacs_gnutls_certificate_details): Export SHA-256
public key digest if supported by GnuTLS. (Bug#64043)
Po Lu [Sat, 15 Jul 2023 01:53:22 +0000 (09:53 +0800)]
Update Android port
* doc/emacs/android.texi (Android): Add new node to menu.
(Android Environment): Add footnote pointing to new node.
(Android Software): New node.
* doc/emacs/emacs.texi (Top): Add new node to menu.
* java/AndroidManifest.xml.in (manifest): Fix location of
sharedUserId property.
* java/INSTALL: Improve documentation of shared user ID
support.
Po Lu [Fri, 14 Jul 2023 12:30:30 +0000 (20:30 +0800)]
Make --with-shared-user-id work
* configure.ac (ANDROID_SHARED_USER_NAME): New variable.
Substitute it.
* java/AndroidManifest.xml.in: Set `sharedUserLabel' if a shared
user ID is enabled.
* java/res/values/strings.xml (shared_user_name): New string
resource.