Stefan Monnier [Wed, 27 Apr 2022 22:14:56 +0000 (18:14 -0400)]
src/xdisp.c: Use same test in `redisplay_window` and `prepare_menu_bars`
This consolidates the test made in those two functions so as to make
sure they agree whether a window needs to be redisplayed.
At the same time, change this test so it uses the window's point
rather than the buffer's point when comparing to `w->last_point`.
* src/xdisp.c (needs_no_redisplay): New function, extracted from
`redisplay_window`.
(redisplay_window, prepare_menu_bars): Use it.
* src/window.c (window_point): New function, extracted from `Fwindow_point`.
(Fwindow_point): Use it.
* src/window.h (window_point): Declare it.
Sean Whitton [Tue, 26 Apr 2022 18:39:38 +0000 (11:39 -0700)]
New user option 'calc-kill-line-numbering'
* lisp/calc/calc.el (calc-kill-line-numbering): New defcustom.
* lisp/calc/calc-yank.el (calc-kill): Unless calc-kill-line-numbering
is non-nil, do not include line numbering in copied text (bug#55133).
* etc/NEWS:
* doc/misc/calc.texi (Killing from the Stack): Document the change.
Ken Brown [Wed, 27 Apr 2022 14:46:57 +0000 (10:46 -0400)]
Implement system_process_attributes on Cygwin
* src/sysdep.c (system_process_attributes) [CYGWIN]: Implement,
using the /proc filesystem. The code is identical to the
GNU/Linux code except for the 'ttname' attribute. (Bug#55153)
* lisp/textmodes/string-edit.el (string-edit)
(read-string-from-buffer): Rework the function arguments so that
they're more similar to `read-string'. Rename symbols throughout
the file from help-text to prompt.
* doc/emacs/killing.texi (Secondary Selection): Document it.
* lisp/isearch.el (isearch-mouse-2): Make isearch respond to
mouse-yank-at-point (bug#7787).
* lisp/mouse.el (mouse-yank-at-point): Mention it.
Po Lu [Wed, 27 Apr 2022 11:19:01 +0000 (19:19 +0800)]
Cleanups to PGTK code
* src/pgtkfns.c (pgtk_explicitly_set_name, pgtk_set_tab_bar_lines)
(pgtk_change_tab_bar_height, pgtk_set_child_frame_border_width)
(pgtk_set_internal_border_width, pgtk_set_cursor_type)
(pgtk_set_mouse_color, pgtk_set_override_redirect, xg_set_icon)
(pgtk_frame_parm_handlers, Fpgtk_set_monitor_scale_factor)
(pgtk_set_scroll_bar_default_width, pgtk_get_focus_frame)
(pgtk_hide_tip, Fx_show_tip, Fx_hide_tip, frame_geometry)
(syms_of_pgtkfns): Clean up coding style and delete incorrect
comments that mostly duplicate what is in xfns.c, and fix
comment coding style. Also rename functions from `x_' to
`pgtk_'.
Po Lu [Wed, 27 Apr 2022 01:10:18 +0000 (09:10 +0800)]
Clean up pointer blanking code
* src/xterm.c (XTtoggle_invisible_pointer): Dispatch to correct
function directly.
(x_probe_xfixes_extension): Return directly based on dpyinfo.
(xfixes_toggle_visible_pointer): Make conditional on
`HAVE_XFIXES'.
(make_invisible_cursor): Initialize `c' correctly.
(x_toggle_visible_pointer): Handle cursor allocation failures.
(x_free_frame_resources): Dispatch with
XTtoggle_visible_pointer.
(x_setup_pointer_blanking): Delete function.
(x_term_init): Initialize blank cursor here instead.
* src/xterm.h (struct x_display_info): New field
`fixes_pointer_blanking'.
Stefan Monnier [Tue, 26 Apr 2022 21:09:03 +0000 (17:09 -0400)]
nadvice.el: Auto-generate the doc describing the "how" arg
* lisp/emacs-lisp/nadvice.el (advice--make-how-alist): New macro.
(advice--how-alist): Use it.
(nadvice--make-docstring): New function.
(add-function, advice-add): Use it to auto-generate the table
describing the accepted values for `how`.
Stefan Monnier [Tue, 26 Apr 2022 20:39:41 +0000 (16:39 -0400)]
nadvice.el: Use OClosures
* lisp/emacs-lisp/nadvice.el (advice): New OClosure type.
(advice--how-alist): Make it hold prototype OClosures rather
than bytecode strings.
(advice--bytecodes): Delete var.
(advice--where): Make it an obsolete alias of new `advice--how`.
(oclosure-interactive-form, cl-print-object) <advice>: New methods.
(advice--make-1): Delete function.
(advice--make): Use `advice-copy` and `advice-cons`.
(advice--tweak): Use `advice-cons`.
(add-function, advice-add): Rename `where` arg to `how`.
Stefan Monnier [Tue, 26 Apr 2022 21:30:29 +0000 (17:30 -0400)]
Pretty print OClosure slot accessors
* lisp/emacs-lisp/oclosure.el (oclosure--accessor-cl-print): New function.
* lisp/emacs-lisp/cl-print.el (cl-print-object) <accessor>: New method.
* test/lisp/emacs-lisp/nadvice-tests.el (advice-test-call-interactively):
Avoid `defun` within a function.
Alex Schroeder [Sun, 24 Apr 2022 11:33:09 +0000 (13:33 +0200)]
Fix error in rcirc for IRC tags without values
* src/lisp/net/rcirc.el (rcirc-process-server-response-1): If the
optional value for a tag is not present, do not call
replace-regexp-in-string on it. If (match-string 2 tag) is
nil, the STRING argument for the replace-regexp-in-string is nil,
which results in an error.
Stefan Monnier [Tue, 26 Apr 2022 14:36:52 +0000 (10:36 -0400)]
New generic function `oclosure-interactive-form`
It's used by `interactive-form` when it encounters an OClosure.
This lets one compute the `interactive-form` of OClosures
dynamically by adding appropriate methods.
This does not include support for `command-modes` for Oclosures.
* lisp/simple.el (oclosure-interactive-form): New generic function.
* src/data.c (Finteractive_form): Delegate to
`oclosure-interactive-form` if the arg is an OClosure.
(syms_of_data): New symbol `Qoclosure_interactive_form`.
* src/eval.c (Fcommandp): Delegate to `interactive-form` if the arg is
an OClosure.
* src/lisp.h (VALID_DOCSTRING_P): New function, extracted from
`store_function_docstring`.
* src/doc.c (store_function_docstring): Use it.
* lisp/kmacro.el (kmacro): Don't carry any interactive form.
(oclosure-interactive-form) <kmacro>: New method, instead.
* test/lisp/emacs-lisp/oclosure-tests.el (oclosure-interactive-form)
<oclosure-test>: New method.
(oclosure-test-interactive-form): New test.
* lisp/help-fns.el (help-fns--insert-menu-bindings): Only insert
the heading if it turns out that we actually find the menu.
(help-fns--insert-bindings): Tweak calling convention.
Po Lu [Tue, 26 Apr 2022 04:38:52 +0000 (12:38 +0800)]
Fix event mask of activation client message
* src/xterm.c (x_alloc_lighter_color):
(x_get_scale_factor): Minor formatting fixes.
(x_ewmh_activate_frame): Fix event mask used to send message to
the root window.
Fix Ruby indentation with double splat as first block param
* lisp/progmodes/ruby-mode.el (ruby-smie--forward-token)
(ruby-smie--backward-token): Tokenize "**" separately from "|".
Problem reported at https://github.com/dgutov/robe/issues/136.
Po Lu [Tue, 26 Apr 2022 01:19:56 +0000 (01:19 +0000)]
Cache relief colors on Haiku since their computation is expensive
* src/haikufns.c (haiku_create_frame, haiku_create_tip_frame):
Clear `relief_background'.
* src/haikuterm.c (haiku_calculate_relief_colors): Cache relief
colors for each frame.
* src/haikuterm.h (struct haiku_output): New fields for caching
the last relief color.
Paul Eggert [Mon, 25 Apr 2022 18:56:48 +0000 (11:56 -0700)]
Support (encode-time (list s m h D M Y))
* src/timefns.c (Fencode_time): Add support for a 6-elt list arg.
Requested by Max Nikulin for Org (bug#54764).
* test/src/timefns-tests.el (encode-time-alternate-apis): New test.
Alan Third [Tue, 19 Apr 2022 04:05:17 +0000 (05:05 +0100)]
Fix nsmenu compilation under macOS 10.6
* src/nsmenu.m ([EmacsMenu fillWithWidgetValue:]): Replace modern
shorthand dictionary and array definitions.
* src/nsterm.h (NSTextAlignmentRight): Redefine if necessary.
* src/macfont.m (mac_font_create_preferred_family_for_attributes):
isOperatingSystemAtLeastVersion is new in macOS 10.10, so it's
probably wrong to use it to check whether we're below 10.9.
(mac_font_copy_default_descriptors_for_language):
(mac_font_copy_default_name_for_charset_and_languages): It seems these
functions are only used on macOS 10.8 and below.
* src/nsterm.m ([NSColor colorUsingDefaultColorSpace]): Use the
generic colorspace.
(ns_parent_window_rect):
(ns_frame_scale_factor):
([EmacsWindow setParentChildRelationships]): Fix macOS version stuff.
Michael Albinus [Mon, 25 Apr 2022 10:57:01 +0000 (12:57 +0200)]
Add test for Tramp password handling
* lisp/net/tramp.el (tramp-error-show-message-timeout): New defvar.
(tramp-error-with-buffer, tramp-user-error): Use it.
* test/lisp/net/tramp-tests.el (tramp-error-show-message-timeout):
Set it to nil.
(tramp-test46-read-password): New test.
(tramp-test47-auto-load, tramp-test47-delay-load)
(tramp-test47-recursive-load, tramp-test47-remote-load-path)
(tramp-test48-unload):
* test/lisp/net/tramp-archive-tests.el (tramp-archive-test47-auto-load)
(tramp-archive-test47-delay-load): Rename.
* lisp/textmodes/string-edit.el (string-edit)
(read-string-from-buffer): Make doc strings use dynamic key
bindings.
(string-edit): Fix message at the end.
Karl Fogel [Sun, 24 Apr 2022 19:07:21 +0000 (14:07 -0500)]
Improve sorting in the bookmark list buffer
- Ensure that the bookmark bmenu buffer sorts when it should.
- Sort case-insensitively and by locale-dependent collation order.
- Rename "Bookmark" column to "Bookmark Name".
- Coordinate that column's sort toggle and `bookmark-sort-flag'.
- Document the new behavior.
* lisp/bookmark.el (bookmark-bmenu--name-predicate,
bookmark-bmenu--type-predicate, bookmark-bmenu--file-predicate): Use
`string-collate-lessp' with IGNORE-CASE argument, instead of plain
`string<'.
(bookmark-bmenu--revert): Sort based on `bookmark-sort-flag'.
(bookmark-bmenu-mode): Document the new behavior. Rename the
"Bookmark" column to "Bookmark Name" for clarity & documentabilty.
Po Lu [Sun, 24 Apr 2022 05:37:22 +0000 (05:37 +0000)]
Allow looking up window system colors on Haiku
* lisp/help-fns.el (help-fns--editable-variable): Fix describing
variables which don't have symbol values.
* lisp/term/haiku-win.el (haiku-allowed-ui-colors): Set list of
allowed UI colors.
* src/haiku_support.cc (be_get_ui_color): New function.
* src/haiku_support.h: Update prototypes.
* src/haikufns.c (haiku_get_color): Look for defined UI color.
(syms_of_haikufns): New defvar `haiku-allowed-ui-colors'.
* src/haikuterm.c (haiku_term_init): Fix coding style.
Po Lu [Sun, 24 Apr 2022 00:44:18 +0000 (08:44 +0800)]
Speed up color cache lookup on X
* src/xterm.c (x_hash_string_ignore_case): New function.
(x_parse_color): Turn color cache into a hash table.
(x_term_init): Allocate color cache.
(x_delete_display): Free color cache correctly.
* src/xterm.h (struct x_display_info): Turn color cache into a
hash table and add appropriate fields.
Alan Mackenzie [Sat, 23 Apr 2022 20:02:49 +0000 (20:02 +0000)]
CC Mode: New alignment function c-lineup-argcont-+
This fixes bug #21409.
* lisp/progmodes/cc-align.el (c-lineup-argcont-1): New function, mainly
extracted from c-lineup-argcont.
(c-lineup-argcont): Refactored to use the new function above.
(c-lineup-argcont-+): New function.
* doc/misc/cc-mode.texi (Operator Line-Up): Add a new piece for
c-lineup-argcont-+.
Don't make a header if the user hasn't specified columns in vtable
* lisp/emacs-lisp/vtable.el (vtable):
(make-vtable): Store whether the user has specified the columns.
(vtable-insert): Don't insert a header line or a header if the
user hasn't specified the columns (bug#55075).
Po Lu [Sat, 23 Apr 2022 11:34:46 +0000 (19:34 +0800)]
Fix key navigation of Lucid menus on XI2
* src/xmenu.c (popup_get_selection): Fix cookie claiming of
input extension events.
(Fx_menu_bar_open_internal): Use right timestamps on XI2.
* src/xterm.c (handle_one_xevent): Dispatch XI2 key events via
Xt when popup is active.
Alan Mackenzie [Fri, 22 Apr 2022 19:11:31 +0000 (19:11 +0000)]
Byte compiler: Prevent special forms' symbols being replaced by bare symbols
These are symbols with position from source code, which should not be replaced
by bare symbols in, e.g., optimization functions.
* lisp/Makefile.in: (BYTE_COMPILE_FLAGS, compile-first case): Set
max-specpdl-size to 5000 for the benefit of lisp/emacs-lisp/comp.el.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker)
(byte-optimize--rename-var, byte-optimize-if, byte-optimize-letX)
* lisp/emacs-lisp/bytecomp.el (byte-compile-recurse-toplevel)
(byte-compile-lambda)
* lisp/emacs-lisp/cconv.el (cconv-convert)
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Preserve, e.g., (car
form) in the byte compiler, when this form's car is a symbol with position of
a special form, rather than replacing the symbol with a bare symbol, e.g.
'cond.