F. Jason Park [Fri, 14 Jul 2023 13:12:30 +0000 (06:12 -0700)]
Make erc-fill-wrap work with left-sided stamps
* etc/ERC-NEWS: Remove all mention of option `erc-timestamp-align-to'
supporting a value of `margin', which has been abandoned. Do mention
leading white space before stamps now having stamp-related properties.
* lisp/erc/erc-backend.el (erc--reveal-prompt, erc--conceal-prompt):
New generic functions with default implementations factored out from
`erc--unhide-prompt' and `erc--hide-prompt'.
(erc--prompt-hidden-p): New internal predicate function.
(erc--unhide-prompt): Defer to `erc--reveal-prompt', and set
`erc-prompt' text property to t.
(erc--hide-prompt): Defer to `erc--conceal-prompt', and set
`erc-prompt' text property to `hidden'.
* lisp/erc/erc-compat.el (erc-compat--29-browse-url-irc): Don't
use `function-equal'.
* lisp/erc/erc-fill.el (erc-fill-wrap-margin-width,
erc-fill-wrap-margin-side): New options to control side and initial
width of `fill-wrap' margin.
(erc-fill--wrap-beginning-of-line): Fix bug involving non-string
valued `display' props.
(erc-fill-wrap-toggle-truncate-lines): New command to re-enable
`visual-line-mode' when toggling off `truncate-lines'.
(erc-fill-wrap-mode-map): Remap `toggle-truncate-lines' to
`erc-fill-wrap-toggle-truncate-lines'.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Update doc string, persist a few local vars, and conditionally set
`erc-stamp--margin-left-p'. When deactivating, disable
`visual-line-mode' first.
(erc-fill--wrap-continued-message-p): Use `erc-speaker' instead of
heuristics when comparing nicks between consecutive messages.
(erc-fill-wrap-nudge): Update doc string and account for left-sided
stamps.
(erc-timestamp-offset): Add comment regarding conditional guard based
on function-valued option.
* lisp/erc/erc-stamp.el (erc-timestamp-use-align-to): Remove value
variant `margin', which was originally intended to be new in ERC 5.6.
This functionality was all but useless without the internal minor mode
`erc-stamp--display-margin-mode' active.
(erc-stamp-right-margin-width): Remove unused option new in 5.6.
(erc-stamp--display-margin-force): Remove unused function.
(erc-stamp--margin-width, erc-stamp--margin-left-p): New internal
variables.
(erc-stamp--init-margins-on-connect): New function for initializing
mode-managed margin after connecting.
(erc-stamp--adjust-right-margin, erc-stamp--adjust-margin): Rename
function to latter and accommodate left-hand stamps.
(erc-stamp--inherited-props): Move definition higher up in same file.
(erc-stamp--display-margin-mode): Update function name, and adjust
setup and teardown to accommodate left-handed stamps. Don't add
advice around `erc-insert-timestamp-function'.
(erc-stamp--last-prompt, erc-stamp--display-prompt-in-left-margin):
New function and helper var to convert a normal inserted prompt so
that it appears in the left margin.
(erc-stamp--refresh-left-margin-prompt): Helper for other modules to
quickly refresh prompt outside of insert hooks.
(erc--reveal-prompt, erc--conceal-prompt): New implementations for
when `erc-stamp--display-margin-mode' is active.
(erc-insert-timestamp-left): Convert to generic function and provide
implementation for `erc-stamp--display-margin-mode'.
(erc-stamp--omit-properties-on-folded-lines): New variable, an escape
hatch for propertizing white space before right-side stamps folded
over onto another line.
(erc-insert-timestamp-right): Don't expect `erc-timestamp-align-to' to
ever be the symbol `margin'. Move handling for that case to one
contingent on the internal minor mode `erc-stamp--display-margin-mode'
being active. Add text properties preceding stamps that occupy a line
by their lonesome. See related news entry for rationale. This is
arguably a breaking change.
* lisp/erc/erc.el (erc--refresh-prompt-hook): New hook variable for
modules to adjust prompt properties whenever it's refreshed.
(erc--refresh-prompt): Fix bug in which user-defined prompt functions
failed to hide when quitting in server buffers. Run new hook
`erc--refresh-prompt-hook'.
(erc-display-prompt): Add comment noting that the text property
`erc-prompt' now actually matters: it's t while a session is running
and `hidden' when disconnected.
* test/lisp/erc/erc-fill-tests.el (erc-fill--left-hand-stamps): New
test.
* test/lisp/erc/erc-stamp-tests.el
(erc-stamp-tests--use-align-to--nil,
erc-stamp-tests--use-align-to--t): New functions forged from old test
bodies to allow optionally asserting pre-5.6 behavior regarding
leading white space on right-hand stamps that exist on their own line.
(erc-timestamp-use-align-to--nil, erc-timestamp-use-align-to--t):
Parameterize with compatibility flag.
(erc-timestamp-use-align-to--margin,
erc-stamp--display-margin-mode--right): Rename test to latter.
* test/lisp/erc/erc-tests.el (erc-hide-prompt): Add some assertions
for new possible value of `erc-prompt' text property.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: New test
data file. (Bug#60936)
Avoid prompting when creating a restricted-sexp widget
* lisp/wid-edit.el (restricted-sexp): Turn value into a
string before reading.
(widget-field-value-create): Guard against value being nil,
so the field can be created even if the widget has a bad
default value. (Bug#59937)
* doc/misc/tramp.texi (Frequently Asked Questions): Do not
document tramp-mode any longer. Describe inhibit-remote-files and
without-remote-files instead.
* etc/NEWS: Add inhibit-remote-files and without-remote-files.
Fix typos.
* lisp/net/tramp.el (inhibit-remote-files): New defun.
(without-remote-files): New defmacro.
* test/lisp/net/tramp-archive-tests.el
(tramp-archive-test49-without-remote-files):
* test/lisp/net/tramp-tests.el (tramp-test49-without-remote-files):
New tests.
(tramp-test50-unload): Rename.
Eli Zaretskii [Fri, 21 Jul 2023 12:19:02 +0000 (15:19 +0300)]
Fix Proced display header alignment under 'text-scale-adjust'
* lisp/proced.el (proced-mode): Force the header-line to scale
according to 'text-scale-adjust'.
(proced-header-line): Use width of the header-line's face's
characters as align-to units, not the width of the frame's
default face's font. (Bug#64752)
* src/xdisp.c (calc_pixel_width_or_height): Use font's
average_width or space_width, not max_width, as the correct
measure of the font's width. This is consistent with the rest of
the display engine.
Stephen Berman [Thu, 20 Jul 2023 19:51:24 +0000 (21:51 +0200)]
Fix last change to wid-edit.el
* lisp/wid-edit.el (widget-choose): Test for stringp instead of
char-or-string-p, since substitute-command-keys should only apply
to choice values that are strings. (Bug#64046, Message #37)
Alan Mackenzie [Thu, 20 Jul 2023 19:33:42 +0000 (19:33 +0000)]
CC Mode (some languages): handle string lines ending in \\
In C, C++, Objective C, and Pike modes, regard \\ in a string
at EOL as a backslash followed by an escaped newline. In the
other languages, this remains regarded as an escaped backslash
followed by an invalid string terminator.
* lisp/progmodes/cc-defs.el (c-is-escaped, c-will-be-escaped):
Amend to observe the changed notion of escaped newlines.
* lisp/progmodes/cc-langs.el (c-string-escaped-newlines):
Unused, removed.
(c-escaped-newline-takes-precedence): New lang const and var.
(c-string-innards-re-alist): Amend, using the above new lang
var.
Morgan Smith [Tue, 11 Jul 2023 18:08:24 +0000 (14:08 -0400)]
docview: imenu: check return value of 'mutool'
While 'mutool' supports many filetypes, 'mutool show' only
supports PDF files. This would lead to cryptic imenu errors
when opening other
file types (like EPUB) since we would parse the error output.
During my testing this caused 'imenu--index-alist' to have a
value of '(nil).
* lisp/doc-view.el (doc-view--pdf-outline): Error when 'mutool'
returns an error. Use 'call-process' to get the return value and
remove the call to 'shell-quote-argument' as 'call-process'
doesn't want any escapes.
(doc-view-mode): Handle possible error from 'doc-view-imenu-setup'.
(doc-view-imenu-enabled): Remove superfluous (and ... t).
(doc-view-imenu-setup): Remove check for mutool already ensured by
'doc-view-imenu-enabled' being non-nil.
(Bug#64516)
* lisp/progmodes/python.el (python-interpreter): Mention
new variable in documentation.
(python-interpreter-args): New custom variable.
(python-shell-interpreter, python-shell-interpreter-args)
(python-shell-interpreter-interactive-arg): Improve
documentation.
(python--list-imports, python--do-isort)
(python-fix-imports): Make process use customisable
arguments.
Preserve comments when redrawing a widget (Bug#64649)
* lisp/cus-edit.el (custom-comment-preserve): New function.
(custom-redraw): Use it.
(custom-comment-create): Make sure :comment-shown is set to
t if the comment widget gets created.
(custom-face-value-create, custom-variable-value-create):
Recreate the custom-comment widget with the preserved value,
if any.
Pass original spec just after creating the face-widget
* lisp/cus-edit.el (custom-face-get-current-spec-unfiltered):
New function, extracted from custom-face-get-current-spec.
(custom-face-get-current-spec): Use it.
(custom-face-state-set): Take an optional argument, to decide
if we should check against a filtered or unfiltered spec.
(custom-face-value-create): Use the new optional argument.
(Bug#64347)
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.
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 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 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.
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)
This adds a section for documenting all the optional modules.
Do not merge to master. This is a backport of f2981a1681d.
* doc/misc/eshell.texi (Extension modules): Move explanation about
writing modules to...
(Writing a module): ... here.
(Module testing): Remove. Testing an Eshell module doesn't require
any special documentation.
(Key binding, Smart scrolling, Electric forward slash): Move under...
(Optional modules): ... here.
(Directory handling, Terminal emulation): Remove. These modules are
enabled by default, and so are documented above.
(Tramp extensions, Extra built-in commands): New sections.