commit 99df11a393e5ba39cb2dc93e5a01de69ae18e91a (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Sun May 15 06:23:25 2022 +0000 Simplify Haiku cursor management code * src/haiku_support.cc (BCursor_create_default) (BCursor_create_modeline, BCursor_from_id, BCursor_create_i_beam) (BCursor_create_progress_cursor, BCursor_create_grab) (BCursor_delete): Delete specialized cursor creation functions. (be_delete_cursor, be_create_cursor_from_id): New functions. (BView_set_view_cursor): Fix coding style. * src/haiku_support.h (enum haiku_cursor): Add all cursor IDs. * src/haikufns.c (haiku_free_custom_cursors): (haiku_set_mouse_color): * src/haikuterm.c (haiku_term_init): Adjust accordingly. diff --git a/src/haiku_support.cc b/src/haiku_support.cc index c0bd3c1b0e..ac2f4f39ea 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc @@ -3379,56 +3379,28 @@ BView_resize_to (void *view, int width, int height) vw->UnlockLooper (); } -void * -BCursor_create_default (void) -{ - return new BCursor (B_CURSOR_ID_SYSTEM_DEFAULT); -} - -void * -BCursor_create_modeline (void) -{ - return new BCursor (B_CURSOR_ID_CONTEXT_MENU); -} - -void * -BCursor_from_id (int cursor) -{ - return new BCursor ((enum BCursorID) cursor); -} - -void * -BCursor_create_i_beam (void) -{ - return new BCursor (B_CURSOR_ID_I_BEAM); -} - -void * -BCursor_create_progress_cursor (void) +void +be_delete_cursor (void *cursor) { - return new BCursor (B_CURSOR_ID_PROGRESS); + if (cursor) + delete (BCursor *) cursor; } void * -BCursor_create_grab (void) +be_create_cursor_from_id (int id) { - return new BCursor (B_CURSOR_ID_GRAB); -} - -void -BCursor_delete (void *cursor) -{ - if (cursor) - delete (BCursor *) cursor; + return new BCursor ((enum BCursorID) id); } void BView_set_view_cursor (void *view, void *cursor) { - if (!((BView *) view)->LockLooper ()) + BView *v = (BView *) view; + + if (!v->LockLooper ()) gui_abort ("Failed to lock view setting cursor"); - ((BView *) view)->SetViewCursor ((BCursor *) cursor); - ((BView *) view)->UnlockLooper (); + v->SetViewCursor ((BCursor *) cursor); + v->UnlockLooper (); } void diff --git a/src/haiku_support.h b/src/haiku_support.h index b9cbd6ca4c..8aeaf48787 100644 --- a/src/haiku_support.h +++ b/src/haiku_support.h @@ -38,7 +38,21 @@ along with GNU Emacs. If not, see . */ enum haiku_cursor { + CURSOR_ID_SYSTEM_DEFAULT = 1, + CURSOR_ID_CONTEXT_MENU = 3, + CURSOR_ID_COPY = 4, + CURSOR_ID_CREATE_LINK = 29, + CURSOR_ID_CROSS_HAIR = 5, + CURSOR_ID_FOLLOW_LINK = 6, + CURSOR_ID_GRAB = 7, + CURSOR_ID_GRABBING = 8, + CURSOR_ID_HELP = 9, + CURSOR_ID_I_BEAM = 2, + CURSOR_ID_I_BEAM_HORIZONTAL = 10, + CURSOR_ID_MOVE = 11, CURSOR_ID_NO_CURSOR = 12, + CURSOR_ID_NOT_ALLOWED = 13, + CURSOR_ID_PROGRESS = 14, CURSOR_ID_RESIZE_NORTH = 15, CURSOR_ID_RESIZE_EAST = 16, CURSOR_ID_RESIZE_SOUTH = 17, @@ -50,7 +64,9 @@ enum haiku_cursor CURSOR_ID_RESIZE_NORTH_SOUTH = 23, CURSOR_ID_RESIZE_EAST_WEST = 24, CURSOR_ID_RESIZE_NORTH_EAST_SOUTH_WEST = 25, - CURSOR_ID_RESIZE_NORTH_WEST_SOUTH_EAST = 26 + CURSOR_ID_RESIZE_NORTH_WEST_SOUTH_EAST = 26, + CURSOR_ID_ZOOM_IN = 27, + CURSOR_ID_ZOOM_OUT = 28 }; enum haiku_z_group @@ -556,14 +572,9 @@ extern void be_get_display_resolution (double *, double *); extern void be_get_screen_dimensions (int *, int *); /* Functions for creating and freeing cursors. */ -extern void *BCursor_create_default (void); -extern void *BCursor_from_id (int); -extern void *BCursor_create_modeline (void); -extern void *BCursor_create_i_beam (void); -extern void *BCursor_create_progress_cursor (void); -extern void *BCursor_create_grab (void); -extern void BCursor_delete (void *); +extern void *be_create_cursor_from_id (int); extern void *be_create_pixmap_cursor (void *, int, int); +extern void be_delete_cursor (void *); extern void *BScrollBar_make_for_view (void *, int, int, int, int, int, void *); extern void BScrollBar_delete (void *); diff --git a/src/haikufns.c b/src/haikufns.c index e15a3dc09b..e783ceec0f 100644 --- a/src/haikufns.c +++ b/src/haikufns.c @@ -1975,7 +1975,7 @@ haiku_free_custom_cursors (struct frame *f) if (output->current_cursor == *frame_cursor) output->current_cursor = *display_cursor; - BCursor_delete (*frame_cursor); + be_delete_cursor (*frame_cursor); } *frame_cursor = *display_cursor; @@ -2039,7 +2039,7 @@ haiku_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } /* Create and set the custom cursor. */ - *frame_cursor = BCursor_from_id (n); + *frame_cursor = be_create_cursor_from_id (n); } else if (color_specified_p && cursor_bitmaps[i].bits) { diff --git a/src/haikuterm.c b/src/haikuterm.c index 3ef3f58495..57f5b052f6 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c @@ -4216,34 +4216,24 @@ haiku_term_init (void) gui_init_fringe (terminal->rif); -#define ASSIGN_CURSOR(cursor, be_cursor) (dpyinfo->cursor = be_cursor) - ASSIGN_CURSOR (text_cursor, BCursor_create_i_beam ()); - ASSIGN_CURSOR (nontext_cursor, BCursor_create_default ()); - ASSIGN_CURSOR (modeline_cursor, BCursor_create_modeline ()); - ASSIGN_CURSOR (hand_cursor, BCursor_create_grab ()); - ASSIGN_CURSOR (hourglass_cursor, BCursor_create_progress_cursor ()); - ASSIGN_CURSOR (horizontal_drag_cursor, - BCursor_from_id (CURSOR_ID_RESIZE_EAST_WEST)); - ASSIGN_CURSOR (vertical_drag_cursor, - BCursor_from_id (CURSOR_ID_RESIZE_NORTH_SOUTH)); - ASSIGN_CURSOR (left_edge_cursor, - BCursor_from_id (CURSOR_ID_RESIZE_WEST)); - ASSIGN_CURSOR (top_left_corner_cursor, - BCursor_from_id (CURSOR_ID_RESIZE_NORTH_WEST)); - ASSIGN_CURSOR (top_edge_cursor, - BCursor_from_id (CURSOR_ID_RESIZE_NORTH)); - ASSIGN_CURSOR (top_right_corner_cursor, - BCursor_from_id (CURSOR_ID_RESIZE_NORTH_EAST)); - ASSIGN_CURSOR (right_edge_cursor, - BCursor_from_id (CURSOR_ID_RESIZE_EAST)); - ASSIGN_CURSOR (bottom_right_corner_cursor, - BCursor_from_id (CURSOR_ID_RESIZE_SOUTH_EAST)); - ASSIGN_CURSOR (bottom_edge_cursor, - BCursor_from_id (CURSOR_ID_RESIZE_SOUTH)); - ASSIGN_CURSOR (bottom_left_corner_cursor, - BCursor_from_id (CURSOR_ID_RESIZE_SOUTH_WEST)); - ASSIGN_CURSOR (no_cursor, - BCursor_from_id (CURSOR_ID_NO_CURSOR)); +#define ASSIGN_CURSOR(cursor, cursor_id) \ + (dpyinfo->cursor = be_create_cursor_from_id (cursor_id)) + ASSIGN_CURSOR (text_cursor, CURSOR_ID_I_BEAM); + ASSIGN_CURSOR (nontext_cursor, CURSOR_ID_SYSTEM_DEFAULT); + ASSIGN_CURSOR (modeline_cursor, CURSOR_ID_CONTEXT_MENU); + ASSIGN_CURSOR (hand_cursor, CURSOR_ID_GRAB); + ASSIGN_CURSOR (hourglass_cursor, CURSOR_ID_PROGRESS); + ASSIGN_CURSOR (horizontal_drag_cursor, CURSOR_ID_RESIZE_EAST_WEST); + ASSIGN_CURSOR (vertical_drag_cursor, CURSOR_ID_RESIZE_NORTH_SOUTH); + ASSIGN_CURSOR (left_edge_cursor, CURSOR_ID_RESIZE_WEST); + ASSIGN_CURSOR (top_left_corner_cursor, CURSOR_ID_RESIZE_NORTH_WEST); + ASSIGN_CURSOR (top_edge_cursor, CURSOR_ID_RESIZE_NORTH); + ASSIGN_CURSOR (top_right_corner_cursor, CURSOR_ID_RESIZE_NORTH_EAST); + ASSIGN_CURSOR (right_edge_cursor, CURSOR_ID_RESIZE_EAST); + ASSIGN_CURSOR (bottom_right_corner_cursor, CURSOR_ID_RESIZE_SOUTH_EAST); + ASSIGN_CURSOR (bottom_edge_cursor, CURSOR_ID_RESIZE_SOUTH); + ASSIGN_CURSOR (bottom_left_corner_cursor, CURSOR_ID_RESIZE_SOUTH_WEST); + ASSIGN_CURSOR (no_cursor, CURSOR_ID_NO_CURSOR); #undef ASSIGN_CURSOR system_name = Fsystem_name (); commit fef8a3a3cdbfc2aaf1b23a54b8b693178a2485fc Author: Eli Zaretskii Date: Sun May 15 09:08:50 2022 +0300 Fix database related to some scripts * lisp/international/fontset.el (script-representative-chars): Add tai-le and tai-lue scripts. (otf-script-alist): Fix the name of tai-le. * src/w32font.c (syms_of_w32font): Fix typos in some script symbol names. diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index 2579b839dd..288eb86e5c 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -184,6 +184,8 @@ (runic #x16A0) (khmer #x1780) (mongolian #x1826) + (tai-le #x1950) + (tai-lue #x1980) (tai-tham #x1A20 #x1A55 #x1A61 #x1A80) (symbol . [#x201C #x2200 #x2500]) (braille #x2800) @@ -439,7 +441,7 @@ (syrc . syriac) (tglg . tagalog) (tagb . tagbanwa) - (tale . tai_le) + (tale . tai-le) (talu . tai-lue) (lana . tai-tham) (tavt . tai-viet) diff --git a/src/w32font.c b/src/w32font.c index 1f93f6d5e0..4e60b818ce 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -2834,18 +2834,18 @@ syms_of_w32font (void) DEFSYM (Qhanunoo, "hanunoo"); DEFSYM (Qkharoshthi, "kharoshthi"); DEFSYM (Qlimbu, "limbu"); - DEFSYM (Qlinear_b, "linear_b"); + DEFSYM (Qlinear_b, "linear-b"); DEFSYM (Qaegean_number, "aegean-number"); - DEFSYM (Qold_italic, "old_italic"); - DEFSYM (Qold_persian, "old_persian"); + DEFSYM (Qold_italic, "old-italic"); + DEFSYM (Qold_persian, "old-persian"); DEFSYM (Qosmanya, "osmanya"); DEFSYM (Qphags_pa, "phags-pa"); DEFSYM (Qphoenician, "phoenician"); DEFSYM (Qshavian, "shavian"); - DEFSYM (Qsyloti_nagri, "syloti_nagri"); + DEFSYM (Qsyloti_nagri, "syloti-nagri"); DEFSYM (Qtagalog, "tagalog"); DEFSYM (Qtagbanwa, "tagbanwa"); - DEFSYM (Qtai_le, "tai_le"); + DEFSYM (Qtai_le, "tai-le"); DEFSYM (Qtifinagh, "tifinagh"); DEFSYM (Qugaritic, "ugaritic"); DEFSYM (Qlycian, "lycian"); commit f8b2aa5e0f531b629d199aa4ca18d211eea666a5 Author: समीर सिंह Sameer Singh Date: Sun May 15 05:09:15 2022 +0530 Add support for the Syloti Nagri script * lisp/language/indian.el ("Syloti Nagri"): New language environment. Add composition rules for Syloti Nagri. Add sample text and input method. Improve composition rules for Kaithi, Tirhuta, Sharada and Siddham. * lisp/international/fontset.el (script-representative-chars) (setup-default-fontset): Support Syloti Nagri. * lisp/leim/quail/indian.el ("syloti-nagri"): New input method. * etc/HELLO: Add two Syloti Nagri greetings. * etc/NEWS: Announce the new language environment and its input method. diff --git a/etc/HELLO b/etc/HELLO index b14fa0e861..16a38b59d3 100644 --- a/etc/HELLO +++ b/etc/HELLO @@ -82,6 +82,7 @@ Slovak (slovenčina) Dobrý deň Slovenian (slovenščina) Pozdravljeni! Spanish (español) ¡Hola! Swedish (svenska) Hej / Goddag / Hallå +Syloti Nagri (ꠍꠤꠟꠐꠤ ꠘꠣꠉꠞꠤ) ꠀꠌ꠆ꠍꠣꠟꠣꠝꠥ ꠀꠟꠣꠁꠇꠥꠝ / ꠘꠝꠡ꠆ꠇꠣꠞ Tamil (தமிழ்) வணக்கம் Telugu (తెలుగు) నమస్కారం TaiViet (ꪁꪫꪱꪣ ꪼꪕ) ꪅꪰꪙꫂ ꪨꪮꫂ ꪁꪫꪱ / ꪅꪽ ꪨꪷ ꪁꪫꪱ diff --git a/etc/NEWS b/etc/NEWS index 4651977e61..b89771cdbd 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -796,6 +796,11 @@ language. Nowadays it is mostly used by the Buddhist monks in Japan for religious writings. A new input method, 'siddham', is provided to type text in this script. +*** New language environment "Syloti Nagri" +This language environment supports the Syloti Nagri script for the Sylheti +language, which is spoke in parts of Bangladesh, Assam and Tripura. A new +input method, 'syloti-nagri', is provided to type text in this script. + --- *** New Greek translation of the Emacs tutorial. Type 'C-u C-h t' to select it in case your language setup does not do diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index 144c3761a0..2579b839dd 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -194,6 +194,7 @@ (kanbun #x319D) (han #x5B57) (yi #xA288) + (syloti-nagri #xA807 #xA823 #xA82C) (javanese #xA980) (cham #xAA00) (tai-viet #xAA80) @@ -748,6 +749,7 @@ symbol braille yi + syloti-nagri javanese tai-viet aegean-number diff --git a/lisp/language/indian.el b/lisp/language/indian.el index b399756bbe..559239b491 100644 --- a/lisp/language/indian.el +++ b/lisp/language/indian.el @@ -180,6 +180,17 @@ Sanskrit language and one of its script Siddham is supported in this language environment.")) '("Indian")) +(set-language-info-alist + "Syloti Nagri" '((charset unicode) + (coding-system utf-8) + (coding-priority utf-8) + (input-method . "syloti-nagri") + (sample-text . "Syloti Nagri (ꠍꠤꠟꠐꠤ ꠘꠣꠉꠞꠤ) ꠀꠌ꠆ꠍꠣꠟꠣꠝꠥ ꠀꠟꠣꠁꠇꠥꠝ") + (documentation . "\ +Sylheti language and its script Syloti Nagri is supported +in this language environment.")) + '("Indian")) + ;; Replace mnemonic characters in REGEXP according to TABLE. TABLE is ;; an alist of (MNEMONIC-STRING . REPLACEMENT-STRING). @@ -485,12 +496,13 @@ in this language environment.")) '(#x110B0 . #x110BA) (list (vector ;; Consonant based syllables - (concat consonant nukta "?\\(?:" virama zwj "?" consonant nukta "?\\)*\\(?:" - virama zwj "?\\|" vowel "*" nukta "?" nasal "?\\)") + (concat consonant nukta "?\\(?:" virama zwj "?" consonant + nukta "?\\)*\\(?:" virama zwj "?\\|" vowel "*" nukta + "?" nasal "?\\)") 1 'font-shape-gstring) (vector - ;; Nasal vowels - (concat independent-vowel nasal "?") + ;; Vowel based syllables + (concat independent-vowel nukta "?" virama "?" vowel "?") 1 'font-shape-gstring))) (set-char-table-range composition-function-table '(#x110BD . #x110BD) @@ -516,12 +528,13 @@ in this language environment.")) '(#x114B0 . #x114C3) (list (vector ;; Consonant based syllables - (concat consonant nukta "?\\(?:" virama consonant nukta "?\\)*\\(?:" - virama "\\|" vowel "*" nukta "?" nasal "?\\)") + (concat consonant nukta "?\\(?:" virama consonant nukta + "?\\)*\\(?:" virama "\\|" vowel "*" nukta "?" + nasal "?\\)") 1 'font-shape-gstring) (vector - ;; Nasal vowels - (concat independent-vowel nasal "?") + ;; Vowel based syllables + (concat independent-vowel nukta "?" virama "?" vowel "?" nasal "?") 1 'font-shape-gstring)))) ;; Sharada composition rules @@ -535,19 +548,21 @@ in this language environment.")) (virama "\x111C0") (fricatives "[\x111C2\x111C3]") (sandhi-mark "\x111C9") - (misc "[^\x11180-\x111C0\x111C2\x111C3\x111C9-\x111CC\x111CE-\x111CF]")) + (misc "[\x111C4-\x111C8\x111CD]")) (set-char-table-range composition-function-table - '(#x111B3 . #x111CF) + '(#x111B3 . #x111CE) (list (vector ;; Consonant based syllables (concat consonant nukta "?" vowel-modifier "?\\(?:" virama consonant nukta "?" vowel-modifier "?\\)*\\(?:" virama "\\|" vowel "*" nukta "?" nasal "?" extra-short-vowel-mark - "?" vowel-modifier "?" sandhi-mark "?+" misc "?\\)") + "?" vowel-modifier "?" sandhi-mark "?+" misc "?\\)") 1 'font-shape-gstring) (vector - ;; Nasal vowels - (concat independent-vowel nasal "?") + ;; Vowel based syllables + (concat independent-vowel nukta "?" vowel-modifier "?" virama "?" + vowel "?" extra-short-vowel-mark "?" sandhi-mark "?" + fricatives "?" misc "?") 1 'font-shape-gstring) (vector ;; Fricatives with Consonants @@ -560,17 +575,47 @@ in this language environment.")) (independent-vowel "[\x11580-\x1158D\x115D8-\x115DB]") (vowel "[\x115AF-\x115BB\x115DC\x115DD]") (nasal "[\x115BC\x115BD]") + (visarga "\x115BE") (virama "\x115BF")) (set-char-table-range composition-function-table '(#x115AF . #x115C0) (list (vector ;; Consonant based syllables - (concat consonant nukta "?\\(?:" virama consonant nukta "?\\)*\\(?:" - virama "\\|" vowel "*" nukta "?" nasal "?\\)") + (concat consonant nukta "?" "\\(?:" virama consonant nukta + "?\\)*\\(?:" virama "\\|" vowel "*" nukta "?" nasal + "?" visarga "?\\)") 1 'font-shape-gstring) (vector - ;; Nasal vowels - (concat independent-vowel nasal "?") + ;; Vowels based syllables + (concat independent-vowel nukta "?" virama "?" vowel "?" + nasal "?" visarga "?") + 1 'font-shape-gstring)))) + +;; Syloti Nagri composition rules +(let ((consonant "[\xA807-\xA80A\xA80C-\xA822]") + (vowel "[\xA802\xA823-\xA827]") + (nasal "[\xA80B]") + (virama "\xA806") + (alternate-virama "\xA82C")) + (set-char-table-range composition-function-table + '(#xA806 . #xA806) + (list (vector + ;; Consonant conjunct based syllables + (concat consonant "\\(?:" virama consonant "\\)+" + vowel "?" nasal "?") + 1 'font-shape-gstring))) + (set-char-table-range composition-function-table + '(#xA823 . #xA827) + (list (vector + ;; Non Consonant conjunct based syllables + (concat consonant vowel nasal "?") + 1 'font-shape-gstring))) + (set-char-table-range composition-function-table + '(#xA82C . #xA82C) + (list (vector + ;; Consonant with the alternate virama + (concat consonant "\\(?:" alternate-virama consonant "\\)+" + vowel "?" nasal "?") 1 'font-shape-gstring)))) (provide 'indian) diff --git a/lisp/leim/quail/indian.el b/lisp/leim/quail/indian.el index 6c58fdd40b..eb9d1183e5 100644 --- a/lisp/leim/quail/indian.el +++ b/lisp/leim/quail/indian.el @@ -1267,4 +1267,85 @@ Full key sequences are listed below:") ("`m" ?𑖼) ) + +(quail-define-package + "syloti-nagri" "Syloti Nagri" "ꠍꠤ" t "Syloti Nagri phonetic input method. + + `\\=`' is used to switch levels instead of Alt-Gr. +" nil t t t t nil nil nil nil nil t) + +(quail-define-rules +("``" ?₹) +("`~" ?৳) +("1" ?১) +("`1" ?1) +("2" ?২) +("`2" ?2) +("3" ?৩) +("`3" ?3) +("4" ?৪) +("`4" ?4) +("5" ?৫) +("`5" ?5) +("6" ?৬) +("`6" ?6) +("7" ?৭) +("`7" ?7) +("8" ?৮) +("`8" ?8) +("9" ?৯) +("`9" ?9) +("0" ?০) +("`0" ?0) +("`\\" ?𑇅) +("`|" ?𑇆) +("`" ?ꠐ) +("q" ?ꠐ) +("Q" ?ꠑ) +("`q" ?꠨) +("`Q" ?꠩) +("w" ?ꠒ) +("W" ?ꠓ) +("`w" ?꠪) +("`W" ?꠫) +("e" ?ꠦ) +("E" ?ꠄ) +("r" ?ꠞ) +("R" ?ꠠ) +("t" ?ꠔ) +("T" ?ꠕ) +("y" ?ꠂ) +("u" ?ꠥ) +("U" ?ꠃ) +("i" ?ꠤ) +("I" ?ꠁ) +("o" ?ꠧ) +("O" ?ꠅ) +("p" ?ꠙ) +("P" ?ꠚ) +("a" ?ꠣ) +("A" ?ꠀ) +("s" ?ꠡ) +("d" ?ꠖ) +("D" ?ꠗ) +("f" ?꠆) +("F" ?꠬) +("g" ?ꠉ) +("G" ?ꠊ) +("h" ?ꠢ) +("j" ?ꠎ) +("J" ?ꠏ) +("k" ?ꠇ) +("K" ?ꠈ) +("l" ?ꠟ) +("c" ?ꠌ) +("C" ?ꠍ) +("`c" #x200C) ; ZWNJ +("b" ?ꠛ) +("B" ?ꠜ) +("n" ?ꠘ) +("m" ?ꠝ) +("M" ?ꠋ) +) + ;;; indian.el ends here commit 9ac40fb9803acd57b15ef4b93ea9c8c72199ea23 Author: Visuwesh Date: Fri May 13 13:09:55 2022 +0530 describe-keymap: Suggest symbol at point * lisp/help-fns.el (describe-keymap): Suggest symbol at point if it is a keymap. (Bug#55393) * etc/NEWS: Announce change in behavior of 'describe-keymap'. diff --git a/etc/NEWS b/etc/NEWS index f8f6d93cc2..4651977e61 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -562,6 +562,11 @@ minor modes are listed after the major mode. The apropos commands will now select the apropos window if 'help-window-select' is non-nil. +--- +*** 'describe-keymap' now considers the symbol at point. +If the symbol at point is a keymap, 'describe-keymap' suggests it as +the default candidate. + ** Outline Mode +++ diff --git a/lisp/help-fns.el b/lisp/help-fns.el index f2b469c149..1ff47bcb49 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -1922,7 +1922,10 @@ in `describe-keymap'. See also `Searching the Active Keymaps'." When called interactively, prompt for a variable that has a keymap value." (interactive - (let* ((km (help-fns--most-relevant-active-keymap)) + (let* ((sym (symbol-at-point)) + (km (or (and (keymapp (ignore-errors (symbol-value sym))) + sym) + (help-fns--most-relevant-active-keymap))) (val (completing-read (format-prompt "Keymap" km) obarray commit b90909050d4d7b1f1a8d291c0da874748e79ef06 Merge: 2a5e1d8c44 8370caa835 Author: Stefan Kangas Date: Sun May 15 06:30:34 2022 +0200 Merge from origin/emacs-28 8370caa835 ; * lisp/electric.el (electric-indent-mode): Clarify doc (... commit 2a5e1d8c44e2a8b49135f5ed51f55cfe610ff5ce Author: Po Lu Date: Sun May 15 09:38:56 2022 +0800 Allocate some buffers used during event handling safely * src/xterm.c (handle_one_xevent): Allocate string lookup and device disable data safely since they can potentially become very large. diff --git a/src/xterm.c b/src/xterm.c index dbe07a8551..bb92e1bbe6 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -14536,6 +14536,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, GdkEvent *copy = NULL; GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (dpyinfo->display); #endif + USE_SAFE_ALLOCA; *finish = X_EVENT_NORMAL; @@ -15753,7 +15754,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (status_return == XBufferOverflow) { copy_bufsiz = nbytes + 1; - copy_bufptr = alloca (copy_bufsiz); + copy_bufptr = SAFE_ALLOCA (copy_bufsiz); nbytes = XmbLookupString (FRAME_XIC (f), &xkey, (char *) copy_bufptr, copy_bufsiz, &keysym, @@ -18858,7 +18859,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (status_return == XBufferOverflow) { copy_bufsiz = nbytes + 1; - copy_bufptr = alloca (copy_bufsiz); + copy_bufptr = SAFE_ALLOCA (copy_bufsiz); nbytes = XmbLookupString (FRAME_XIC (f), &xkey, (char *) copy_bufptr, copy_bufsiz, &keysym, @@ -18890,8 +18891,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, copy_bufsiz, &overflow); if (overflow) { - copy_bufptr = alloca ((copy_bufsiz += overflow) - * sizeof *copy_bufptr); + copy_bufptr = SAFE_ALLOCA ((copy_bufsiz += overflow) + * sizeof *copy_bufptr); overflow = 0; nbytes = XkbTranslateKeySym (dpyinfo->display, &sym, state & ~mods_rtrn, copy_bufptr, @@ -19202,7 +19203,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, struct xi_touch_point_t *tem, *last; #endif - disabled = alloca (sizeof *disabled * hev->num_info); + disabled = SAFE_ALLOCA (sizeof *disabled * hev->num_info); n_disabled = 0; for (i = 0; i < hev->num_info; ++i) @@ -20072,6 +20073,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (any && any != f) flush_dirty_back_buffer_on (any); #endif + + SAFE_FREE (); return count; } commit 8e592973782e38be75faed39f557642bbae6aec5 Author: Po Lu Date: Sun May 15 09:30:07 2022 +0800 Prevent crashes trying to access nonexistent key * src/xsettings.c (xg_settings_key_valid_p): New function. (apply_gsettings_font_antialias): Test that `font-aliasing' is actually available. (bug#55416) diff --git a/src/xsettings.c b/src/xsettings.c index e71887e03d..16625bd229 100644 --- a/src/xsettings.c +++ b/src/xsettings.c @@ -268,17 +268,47 @@ apply_gsettings_font_hinting (GSettings *settings) } } +static bool +xg_settings_key_valid_p (GSettings *settings, const char *key) +{ +#ifdef GLIB_VERSION_2_32 + GSettingsSchema *schema; + bool rc; + + g_object_get (G_OBJECT (settings), + "settings-schema", &schema, + NULL); + + if (!schema) + return false; + + rc = g_settings_schema_has_key (schema, key); + g_settings_schema_unref (schema); + + return rc; +#else + return false; +#endif +} + /* Apply changes in the antialiasing system setting. */ static void apply_gsettings_font_antialias (GSettings *settings) { - GVariant *val = g_settings_get_value (settings, GSETTINGS_FONT_ANTIALIASING); + GVariant *val; + const char *antialias; + + if (!xg_settings_key_valid_p (settings, GSETTINGS_FONT_ANTIALIASING)) + return; + + val = g_settings_get_value (settings, GSETTINGS_FONT_ANTIALIASING); + if (val) { g_variant_ref_sink (val); if (g_variant_is_of_type (val, G_VARIANT_TYPE_STRING)) { - const char *antialias = g_variant_get_string (val, NULL); + antialias = g_variant_get_string (val, NULL); if (!strcmp (antialias, "none")) cairo_font_options_set_antialias (font_options, commit 003dc93f93994c1fc568a7844623fa65f9d33448 Author: Po Lu Date: Sun May 15 09:05:41 2022 +0800 Fix scroll event translation for legacy button events * src/xterm.c (handle_one_xevent): Don't treat emulated Button8 as a wheel event. diff --git a/src/xterm.c b/src/xterm.c index c0d2ee40b0..dbe07a8551 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -16981,7 +16981,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, f = x_any_window_to_frame (dpyinfo, event->xbutton.window); if (event->xbutton.button > 3 - && event->xbutton.button < 9 + && event->xbutton.button < 8 && f) { if (ignore_next_mouse_click_timeout @@ -18402,7 +18402,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, f = x_any_window_to_frame (dpyinfo, xev->event); - if (xev->detail > 3 && xev->detail < 9 && f) + if (xev->detail > 3 && xev->detail < 8 && f) { if (xev->evtype == XI_ButtonRelease) { @@ -18445,7 +18445,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (f) { - if (xev->detail >= 4 && xev->detail <= 8) + if (xev->detail >= 4 && xev->detail < 8) { if (xev->evtype == XI_ButtonRelease) { commit a0af789d06077f3188635cf37b741edcebee56ec Author: Stefan Kangas Date: Sat May 14 22:36:36 2022 +0200 Remove some XEmacs compat code for display-graphic-p * lisp/dframe.el (dframe-have-timer-flag): * lisp/emacs-lisp/chart.el (chart-face-pixmap-list): * lisp/speedbar.el (speedbar-easymenu-definition-base): Remove XEmacs compat code; assume display-graphic-p is fboundp. * lisp/progmodes/cperl-mode.el (cperl-tags-hier-init): Remove XEmacs compat code. diff --git a/lisp/dframe.el b/lisp/dframe.el index 6593708a13..9580a3187f 100644 --- a/lisp/dframe.el +++ b/lisp/dframe.el @@ -120,9 +120,7 @@ :prefix "dframe-" :group 'dframe) -(defvar dframe-have-timer-flag (if (fboundp 'display-graphic-p) - (display-graphic-p) - window-system) +(defvar dframe-have-timer-flag (display-graphic-p) "Non-nil means that timers are available for this Emacs. This is nil for terminals, since updating a frame in a terminal is not useful to the user.") diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el index 4186a541f8..29fbcce773 100644 --- a/lisp/emacs-lisp/chart.el +++ b/lisp/emacs-lisp/chart.el @@ -1,7 +1,6 @@ ;;; chart.el --- Draw charts (bar charts, etc) -*- lexical-binding: t -*- -;; Copyright (C) 1996, 1998-1999, 2001, 2004-2005, 2007-2022 Free -;; Software Foundation, Inc. +;; Copyright (C) 1996-2022 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Old-Version: 0.2 @@ -76,8 +75,7 @@ Colors will be the background color.") (defvar chart-face-pixmap-list - (if (and (fboundp 'display-graphic-p) - (display-graphic-p)) + (if (display-graphic-p) '("dimple1" "scales" "dot" "cross_weave" "boxes" "dimple3")) "If pixmaps are allowed, display these background pixmaps. Useful if new Emacs is used on B&W display.") diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 1bf77381e8..b79dc65693 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -7080,9 +7080,7 @@ One may build such TAGS files from CPerl mode menu." (error "No items found")) (setq update ;; (imenu-choose-buffer-index "Packages: " (nth 2 cperl-hierarchy)) - (if (if (fboundp 'display-popup-menus-p) - (display-popup-menus-p) - window-system) + (if (display-popup-menus-p) (x-popup-menu t (nth 2 cperl-hierarchy)) (require 'tmm) (tmm-prompt (nth 2 cperl-hierarchy)))) diff --git a/lisp/speedbar.el b/lisp/speedbar.el index 5fe7e7ea34..3ceccfb20c 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -800,15 +800,10 @@ This basically creates a sparse keymap, and makes its parent be ["Auto Update" speedbar-toggle-updates :active (not speedbar-update-flag-disable) :style toggle :selected speedbar-update-flag]) - (if (and (or (fboundp 'defimage) - (fboundp 'make-image-specifier)) - (if (fboundp 'display-graphic-p) - (display-graphic-p) - window-system)) - (list - ["Use Images" speedbar-toggle-images - :style toggle :selected speedbar-use-images])) - ) + (when (and (fboundp 'defimage) (display-graphic-p)) + (list + ["Use Images" speedbar-toggle-images + :style toggle :selected speedbar-use-images]))) "Base part of the speedbar menu.") (defvar speedbar-easymenu-definition-special commit b5621dbe2f4289d69c5fae57d9870de9fc413e87 Author: Stefan Kangas Date: Sat May 14 22:33:07 2022 +0200 Delete some compat code for very old Emacs versions * lisp/apropos.el (apropos-local-value): * lisp/ido.el (ido-buffer-internal): * lisp/leim/quail/ipa.el (ipa-x-sampa-prepend-to-keymap-entry): * lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer): * lisp/speedbar.el (speedbar-create-tag-hierarchy): Delete compat code for very old versions of Emacs. * lisp/gnus/nnmail.el (nnmail-fancy-expiry-target): Avoid using obsolete name. diff --git a/lisp/apropos.el b/lisp/apropos.el index c57ca37e68..9970667179 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -874,7 +874,7 @@ Optional arg BUFFER (default: current buffer) is the buffer to check." apropos-all-words apropos-accumulator)) (setq var (apropos-value-internal #'local-variable-if-set-p symb #'symbol-value))) - (when (and (fboundp 'apropos-false-hit-str) (apropos-false-hit-str var)) + (when (apropos-false-hit-str var) (setq var nil)) (when var (setq apropos-accumulator (cons (list symb (apropos-score-str var) nil var) diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el index c71627f83a..bde0de9892 100644 --- a/lisp/gnus/nnmail.el +++ b/lisp/gnus/nnmail.el @@ -1937,9 +1937,7 @@ If TIME is nil, then return the cutoff time for oldness instead." (and (string-match (cadr regexp-target-pair) to) (let ((mail-dont-reply-to-names (message-dont-reply-to-names))) - (equal (if (fboundp 'rmail-dont-reply-to) - (rmail-dont-reply-to from) - (mail-dont-reply-to from)) ""))))) + (equal (mail-dont-reply-to from) ""))))) (setq target (format-time-string (caddr regexp-target-pair) date))) ((and (not (equal header 'to-from)) (string-match (cadr regexp-target-pair) diff --git a/lisp/ido.el b/lisp/ido.el index e068028d91..e5717d6e53 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -2238,8 +2238,7 @@ If cursor is not at the end of the user input, move to end of input." (t (add-to-history 'buffer-name-history buf) (setq buf (get-buffer-create buf)) - (if (fboundp 'set-buffer-major-mode) - (set-buffer-major-mode buf)) + (set-buffer-major-mode buf) (ido-visit-buffer buf method t)))))) (defun ido-record-work-directory (&optional dir) diff --git a/lisp/leim/quail/ipa.el b/lisp/leim/quail/ipa.el index 1eb2255f6c..773dc31f9b 100644 --- a/lisp/leim/quail/ipa.el +++ b/lisp/leim/quail/ipa.el @@ -269,7 +269,7 @@ QUAIL-KEYMAP is a cons that satisfies `quail-map-p'; TO-PREPEND is a string." (when (consp quail-keymap) (setq quail-keymap (cdr quail-keymap))) (if (or (integerp quail-keymap) - (and (fboundp 'characterp) (characterp quail-keymap))) + (characterp quail-keymap)) (setq quail-keymap (list (string quail-keymap))) (if (stringp quail-keymap) (setq quail-keymap (list quail-keymap)) diff --git a/lisp/obsolete/iswitchb.el b/lisp/obsolete/iswitchb.el index 2825ea1136..1929d1994e 100644 --- a/lisp/obsolete/iswitchb.el +++ b/lisp/obsolete/iswitchb.el @@ -1064,8 +1064,7 @@ Return the modified list with the last element prepended to it." ;; then create a new buffer (progn (setq newbufcreated (get-buffer-create buf)) - (if (fboundp 'set-buffer-major-mode) - (set-buffer-major-mode newbufcreated)) + (set-buffer-major-mode newbufcreated) (iswitchb-visit-buffer newbufcreated)) ;; else won't create new buffer (message "no buffer matching `%s'" buf)))) diff --git a/lisp/speedbar.el b/lisp/speedbar.el index b2e7be1505..5fe7e7ea34 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -2276,9 +2276,7 @@ the list." (with-current-buffer (get-file-buffer f) speedbar-tag-hierarchy-method) speedbar-tag-hierarchy-method)) - (lst (if (fboundp 'copy-tree) - (copy-tree lst) - lst))) + (lst (copy-tree lst))) (while methods (setq lst (funcall (car methods) lst) methods (cdr methods))) commit b65a905edf57b9d6d24713c18ce26c6475b87c3e Author: Stefan Monnier Date: Sat May 14 12:46:21 2022 -0400 src/lisp.h (FOR_EACH_TAIL_SAFE): Typo diff --git a/src/lisp.h b/src/lisp.h index e76a36d269..9ee63428d4 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -5496,7 +5496,7 @@ struct for_each_tail_internal intended for use only by the above macros. Use Brent’s teleporting tortoise-hare algorithm. See: - Brent RP. BIT. 1980;20(2):176-84. doi:10.1007/BF01933190 + Brent RP. BIT. 1980;20(2):176-184. doi:10.1007/BF01933190 https://maths-people.anu.edu.au/~brent/pd/rpb051i.pdf This macro uses maybe_quit because of an excess of caution. The commit 3d2cd8b779383e173560a298dd22517aa6d4541b Author: Eli Zaretskii Date: Sat May 14 19:08:55 2022 +0300 Make 'check-declare-directory' more portable * lisp/emacs-lisp/check-declare.el (check-declare-directory): Use 'directory-files-recursively' instead of running Find and Grep in a subprocess. (Bug#55386) diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index b3c965166b..83187acf71 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -319,11 +319,7 @@ Returns non-nil if any false statements are found." (setq root (directory-file-name (file-relative-name root))) (or (file-directory-p root) (error "Directory `%s' not found" root)) - (let ((files (process-lines-ignore-status - find-program root - "-name" "*.el" - "-exec" grep-program - "-l" "^[ \t]*(declare-function" "{}" "+"))) + (let ((files (directory-files-recursively root "\\.el\\'"))) (when files (apply #'check-declare-files files)))) commit 8370caa835372ba7841e3822b0f929398c074e1a Author: Eli Zaretskii Date: Sat May 14 17:48:22 2022 +0300 ; * lisp/electric.el (electric-indent-mode): Clarify doc (bug#22564). diff --git a/lisp/electric.el b/lisp/electric.el index 042fc90ccb..4a35c1a2a1 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -310,10 +310,16 @@ column specified by the function `current-left-margin'." ;;;###autoload (define-minor-mode electric-indent-mode - "Toggle on-the-fly reindentation (Electric Indent mode). + "Toggle on-the-fly reindentation of text lines (Electric Indent mode). When enabled, this reindents whenever the hook `electric-indent-functions' -returns non-nil, or if you insert a character from `electric-indent-chars'. +returns non-nil, or if you insert one of the \"electric characters\". +The electric characters normally include the newline, but can +also include other characters as needed by the major mode; see +`electric-indent-chars' for the actual list. + +By \"reindent\" we mean remove any existing indentation, and then +indent the line accordiung to context and rules of the major mode. This is a global minor mode. To toggle the mode in a single buffer, use `electric-indent-local-mode'." commit aa98a7823835366a0f06a2103ac183d5f7e59054 Author: Stefan Kangas Date: Sat May 14 15:47:35 2022 +0200 Drop ancient OEmacs support from vcursor.el * lisp/vcursor.el (vcursor-bind-keys, vcursor-key-bindings) (vcursor-other-window): Drop OEmacs support. OEmacs was "a version of GNU Emacs V19.19" that worked "under plain MSDOS, Windows, or DESQview/X". diff --git a/lisp/vcursor.el b/lisp/vcursor.el index 8b7105df51..a54227c1bc 100644 --- a/lisp/vcursor.el +++ b/lisp/vcursor.el @@ -216,23 +216,17 @@ ;; Key bindings ;; ============ ;; -;; There is an alternative set of key bindings which will be used -;; automatically for a PC if Oemacs is detected. This set uses separate -;; control, shift and meta keys with function keys 1 to 10. In -;; particular, movement keys are concentrated on f5 to f8 with (in -;; increasing order of distance traveled) C-, M- and S- as prefixes. -;; See the actual bindings below (search for C-f1). This is because the -;; C-S- prefix is represented by weird key sequences and the set is -;; incomplete; if you don't mind that, some hints are given in comments -;; below. +;; There is an alternative set of key bindings named "Oemacs" (for +;; historical reasons). This set uses separate control, shift and +;; meta keys with function keys 1 to 10. In particular, movement keys +;; are concentrated on f5 to f8 with (in increasing order of distance +;; traveled) C-, M- and S- as prefixes. See the actual bindings below +;; (search for C-f1). This is because the C-S- prefix is represented +;; by weird key sequences and the set is incomplete; if you don't mind +;; that, some hints are given in comments below. ;; -;; You can specify the usual or the Oemacs bindings by setting the -;; variable vcursor-key-bindings to `xterm' or `oemacs'. You can also set -;; it to nil, in which case vcursor will not make any key bindings -;; and you can define your own. The default is t, which makes vcursor -;; guess (it will use xterm unless it thinks Oemacs is running). The -;; oemacs set will work on an X terminal with function keys, but the -;; xterm set will not work under Oemacs. +;; You can specify which set of key bindings to use by customizing the +;; user option `vcursor-key-bindings'. ;; ;; Usage on dumb terminals ;; ======================= @@ -355,8 +349,7 @@ on loading vcursor and from the customize package." (set var value) (cond ((not value)) ;; Don't set any key bindings. - ((or (eq value 'oemacs) - (and (eq value t) (fboundp 'oemacs-version))) + ((eq value 'oemacs) (global-set-key [C-f1] #'vcursor-toggle-copy) (global-set-key [C-f2] #'vcursor-copy) (global-set-key [C-f3] #'vcursor-copy-word) @@ -386,33 +379,6 @@ on loading vcursor and from the customize package." (global-set-key [S-f9] #'vcursor-execute-key) (global-set-key [S-f10] #'vcursor-execute-command) - - ;; Partial dictionary of Oemacs key sequences for you to roll your own, - ;; e.g C-S-up: (global-set-key "\M-[\C-f\M-\C-m" 'vcursor-previous-line) - ;; Sequence: Sends: - ;; "\M-[\C-f\M-\C-m" C-S-up - ;; "\M-[\C-f\M-\C-q" C-S-down - ;; "\M-[\C-fs" C-S-left - ;; "\M-[\C-ft" C-S-right - ;; - ;; "\M-[\C-fw" C-S-home - ;; "\M-[\C-b\C-o" S-tab - ;; "\M-[\C-f\M-\C-r" C-S-insert - ;; "\M-[\C-fu" C-S-end - ;; "\M-[\C-f\M-\C-s" C-S-delete - ;; "\M-[\C-f\M-\C-d" C-S-prior - ;; "\M-[\C-fv" C-S-next - ;; - ;; "\M-[\C-f^" C-S-f1 - ;; "\M-[\C-f_" C-S-f2 - ;; "\M-[\C-f`" C-S-f3 - ;; "\M-[\C-fa" C-S-f4 - ;; "\M-[\C-fb" C-S-f5 - ;; "\M-[\C-fc" C-S-f6 - ;; "\M-[\C-fd" C-S-f7 - ;; "\M-[\C-fe" C-S-f8 - ;; "\M-[\C-ff" C-S-f9 - ;; "\M-[\C-fg" C-S-f10 ) (t (global-set-key (vcursor-cs-binding "up") #'vcursor-previous-line) @@ -456,11 +422,12 @@ on loading vcursor and from the customize package." (global-set-key (vcursor-cs-binding "f10") #'vcursor-execute-command) ))) +;; TODO: Get rid of references to "oemacs", which was an ancient +;; MS-DOS compatible release of Emacs 19. (defcustom vcursor-key-bindings nil "How to bind keys when vcursor is loaded. -If t, guess; if `xterm', use bindings suitable for an X terminal; if -`oemacs', use bindings which work on a PC with Oemacs. If nil, don't -define any key bindings. +If t or `xterm', use the default bindings; if `oemacs', use +alternative key bindings. If nil, don't define any key bindings. Default is nil." :type '(choice (const t) (const nil) (const xterm) (const oemacs)) @@ -854,9 +821,7 @@ Arguments N and optional ALL-FRAMES are the same as with `other-window'. ALL-FRAMES is also used to decide whether to split the window." (interactive "p") - (if (if (fboundp 'oemacs-version) - (one-window-p nil) - (one-window-p nil all-frames)) + (if (one-window-p nil all-frames) (display-buffer (current-buffer) t)) (save-excursion (save-window-excursion commit 7cd2ba94847acce703d7e0fbf30a6bdf86cdc760 Author: Stefan Kangas Date: Fri May 13 23:50:43 2022 +0200 Remove Emacs 22 compat code from htmlfontify.el * lisp/htmlfontify.el (hfy-prop-invisible-p): Redefine as obsolete function alias for invisible-p. Update all callers. diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index 9ea27f2465..a809e61da7 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -1157,14 +1157,6 @@ The default handler is `hfy-face-to-css-default'. See also `hfy-face-to-style'.") -(defalias 'hfy-prop-invisible-p - (if (fboundp 'invisible-p) #'invisible-p - (lambda (prop) - "Is text property PROP an active invisibility property?" - (or (and (eq buffer-invisibility-spec t) prop) - (or (memq prop buffer-invisibility-spec) - (assq prop buffer-invisibility-spec)))))) - (defun hfy-find-invisible-ranges () "Return a list of (start-point . end-point) cons cells of invisible regions." (save-excursion @@ -1254,8 +1246,8 @@ return a `defface' style list of face properties instead of a face symbol." (when face-name (setq base-face face-name)) (dolist (P overlay-data) (let ((iprops (cadr (memq 'invisible P)))) ;FIXME: plist-get? - ;;(message "(hfy-prop-invisible-p %S)" iprops) - (when (and iprops (hfy-prop-invisible-p iprops)) + ;;(message "(invisible-p %S)" iprops) + (when (and iprops (invisible-p iprops)) (setq extra-props (cons :invisible (cons t extra-props))) )) (let ((fprops (cadr (or (memq 'face P) @@ -2409,6 +2401,8 @@ You may also want to set `hfy-page-header' and `hfy-page-footer'." (declare (obsolete seq-intersection "28.1")) (nreverse (seq-intersection set-a set-b #'eq))) +(define-obsolete-function-alias 'hfy-prop-invisible-p #'invisible-p "29.1") + (provide 'htmlfontify) ;;; htmlfontify.el ends here commit 253374f81a13109b73afc8e319ca1fea72f68c72 Author: Stefan Kangas Date: Fri May 13 23:44:12 2022 +0200 Remove some XEmacs compat code from org-mode * lisp/org/org-clock.el (org-clock-select-task): Remove XEmacs compat code. diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 7395669109..67cda1b746 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -658,7 +658,6 @@ there is no recent clock to choose from." (if (< i 10) (+ i ?0) (+ i (- ?A 10))) m)) - (if (fboundp 'int-to-char) (setf (car s) (int-to-char (car s)))) (push s sel-list))) (run-hooks 'org-clock-before-select-task-hook) (goto-char (point-min)) commit 8d1aa370d33f51e15ca038d2a083502329c64119 Author: Po Lu Date: Sat May 14 21:42:21 2022 +0800 ; Fix PGTK declare-function mistakes * lisp/frame.el (pgtk-frame-list-z-order): (frame-list-z-order): * lisp/term/pgtk-win.el (pgtk-hide-emacs): Remove extraneous or incorrect `declare-function's. Reported by Eli Zaretskii . diff --git a/lisp/frame.el b/lisp/frame.el index 9b8937c258..094d67688c 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -1993,7 +1993,8 @@ workarea attribute." (declare-function x-frame-list-z-order "xfns.c" (&optional display)) (declare-function w32-frame-list-z-order "w32fns.c" (&optional display)) (declare-function ns-frame-list-z-order "nsfns.m" (&optional display)) -(declare-function pgtk-frame-list-z-order "pgtkfns.c" (&optional display)) +;; TODO: implement this on PGTK. +;; (declare-function pgtk-frame-list-z-order "pgtkfns.c" (&optional display)) (declare-function haiku-frame-list-z-order "haikufns.c" (&optional display)) (defun frame-list-z-order (&optional display) @@ -2016,7 +2017,9 @@ Return nil if DISPLAY contains no Emacs frame." ((eq frame-type 'ns) (ns-frame-list-z-order display)) ((eq frame-type 'pgtk) - (pgtk-frame-list-z-order display)) + ;; This is currently not supported on PGTK. + ;; (pgtk-frame-list-z-order display) + nil) ((eq frame-type 'haiku) (haiku-frame-list-z-order display))))) diff --git a/lisp/term/pgtk-win.el b/lisp/term/pgtk-win.el index 9b22ab0970..8abea3edba 100644 --- a/lisp/term/pgtk-win.el +++ b/lisp/term/pgtk-win.el @@ -45,7 +45,6 @@ (defvar pgtk-use-im-context-on-new-connection) (declare-function pgtk-use-im-context "pgtkim.c") -(declare-function pgtk-hide-emacs "pgtkfns.c" (on)) (defun pgtk-drag-n-drop (event &optional new-frame force-text) "Edit the files listed in the drag-n-drop EVENT. commit dbfbae8708d1ccf1015c4aafc151f96ec1caeb0e Merge: 2c4e998592 725251094b Author: Po Lu Date: Sat May 14 21:35:43 2022 +0800 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit 2c4e9985922b106389abf659d63d8dd721f2a9bc Author: Po Lu Date: Sat May 14 21:35:05 2022 +0800 Minor fixes for popup dialogs on macOS * nsmenu.m (pop_down_menu): Restore old hack for macOS. ([EmacsDialogPanel initWithTitle:isQuestion:]): Set command title correctly. diff --git a/src/nsmenu.m b/src/nsmenu.m index 1ebaca4e87..2219d6cf99 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1540,6 +1540,12 @@ - (NSRect) frame { popup_activated_flag = 0; [panel close]; + /* For some reason this is required on macOS, or the selected + frame gets the keyboard focus but doesn't become + highlighted. */ +#ifdef NS_IMPL_COCOA + [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; +#endif discard_menu_items (); } } @@ -1847,10 +1853,11 @@ - (instancetype) initWithTitle: (char *) title_string if (title_string) [title setStringValue: [NSString stringWithUTF8String: title_string]]; - else if (is_question) - [title setStringValue: @"Question"]; + + if (is_question) + [command setStringValue: @"Question"]; else - [title setStringValue: @"Information"]; + [command setStringValue: @"Information"]; return self; } commit 725251094b37727d3acebed22abfb4aa7b9b6592 Merge: 640e52d8fa 5aef501d9c Author: Eli Zaretskii Date: Sat May 14 16:32:38 2022 +0300 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit 640e52d8fa916fe46ea7adb737d12f2702c88a0a Author: Eli Zaretskii Date: Sat May 14 16:19:12 2022 +0300 ; Fix mistakes in 'declare function' forms * lisp/progmodes/gdb-mi.el (tooltip-show): * lisp/vc/vc-git.el (grep-expand-template): * lisp/cedet/semantic/imenu.el (pulse-momentary-highlight-one-line): * lisp/mail/feedmail.el (smtpmail-via-smtp): * lisp/mail/rmail.el (rmail-mime-entity-truncated): * lisp/mail/rmailsum.el (rmail-cease-edit): * lisp/progmodes/gud.el (speedbar-toggle-line-expansion) (speedbar-edit-line): * lisp/autoinsert.el (sgml-tag): * lisp/comint.el (url-host, url-type, url-filename): * lisp/progmodes/elisp-mode.el (xref-make, xref-item-location): * lisp/vc/vc-hooks.el (vc-responsible-backend): * lisp/cedet/semantic/complete.el (tooltip-show): * lisp/doc-view.el (tooltip-show): * lisp/follow.el (mwheel-scroll): * lisp/term/pgtk-win.el (pgtk-set-resource): * lisp/progmodes/cperl-mode.el (Info-find-node): * lisp/lpr.el (print-region-function): * lisp/w32-fns.el (w32-version, w32-read-registry): * lisp/emacs-lisp/checkdoc.el (ispell-correct-p, checkdoc-dired): * lisp/progmodes/xref.el (apropos-parse-pattern): * lisp/cus-edit.el (apropos-parse-pattern): * lisp/obsolete/gs.el (x-change-window-property): * lisp/x-dnd.el (x-change-window-property): * lisp/xwidget.el (make-xwidget): * lisp/transient.el (info, Man-find-section, Man-next-section) (Man-getpage-in-background): * lisp/frame.el (x-device-class, pgtk-device-class): * lisp/textmodes/texinfo.el (flymake--log-1): * lisp/term/x-win.el (x-internal-focus-input-context): Fix 'declare function' errors uncovered by 'check-declare'. diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el index d25275e3ec..c12c554498 100644 --- a/lisp/autoinsert.el +++ b/lisp/autoinsert.el @@ -89,7 +89,7 @@ If this contains a %s, that will be replaced by the matching rule." :type 'string :version "28.1") -(declare-function sgml-tag "sgml-mode" (&optional str arg)) +(declare-function sgml-tag "textmodes/sgml-mode" (&optional str arg)) (defcustom auto-insert-alist `((("\\.\\([Hh]\\|hh\\|hpp\\|hxx\\|h\\+\\+\\)\\'" . "C / C++ header") diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el index 2c608fca38..6a09adca32 100644 --- a/lisp/cedet/semantic/complete.el +++ b/lisp/cedet/semantic/complete.el @@ -1761,7 +1761,8 @@ Return a cons cell (X . Y)." (defvar tooltip-frame-parameters) -(declare-function tooltip-show "tooltip" (text &optional use-echo-area)) +(declare-function tooltip-show "tooltip" (text &optional use-echo-area + text-face default-face)) (defun semantic-displayer-tooltip-show (text) "Display a tooltip with TEXT near cursor." diff --git a/lisp/cedet/semantic/imenu.el b/lisp/cedet/semantic/imenu.el index 235965a995..37dc963272 100644 --- a/lisp/cedet/semantic/imenu.el +++ b/lisp/cedet/semantic/imenu.el @@ -39,7 +39,8 @@ (require 'semantic/sort) (require 'imenu) -(declare-function pulse-momentary-highlight-one-line "pulse" (o &optional face)) +(declare-function pulse-momentary-highlight-one-line "pulse" + (&optional point face)) (declare-function semanticdb-semantic-init-hook-fcn "db-mode") ;; Because semantic imenu tags will hose the current imenu handling diff --git a/lisp/comint.el b/lisp/comint.el index 88eaf1120e..3dc80c20ac 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -4026,9 +4026,9 @@ arguments, with point where the escape sequence was located." ;; Current directory tracking (OSC 7) -(declare-function url-host "url-parse.el") -(declare-function url-type "url-parse.el") -(declare-function url-filename "url-parse.el") +(declare-function url-host "url/url-parse.el") +(declare-function url-type "url/url-parse.el") +(declare-function url-filename "url/url-parse.el") (defun comint-osc-directory-tracker (_ text) "Update `default-directory' from OSC 7 escape sequences. diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index df4edb78a1..6dff9ec97a 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -1498,7 +1498,7 @@ symbols `custom-face' or `custom-variable'." (custom-buffer-create (custom-sort-items found t nil) "*Customize Saved*")))) -(declare-function apropos-parse-pattern "apropos" (pattern)) +(declare-function apropos-parse-pattern "apropos" (pattern &optional di-all)) (defvar apropos-regexp) ;;;###autoload diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 22570dd510..9d27347360 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1641,7 +1641,8 @@ For now these keys are useful: \\[image-kill-buffer] : Kill the conversion process and this buffer. \\[doc-view-kill-proc] : Kill the conversion process.\n"))))) -(declare-function tooltip-show "tooltip" (text &optional use-echo-area)) +(declare-function tooltip-show "tooltip" (text &optional use-echo-area + text-face default-face)) (defun doc-view-show-tooltip () (interactive) diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 72eb776b99..2554948890 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -1127,7 +1127,7 @@ When called from Lisp, FILES is a list of filenames." (progn ;; These Dired functions must be defined since we're in a Dired buffer. (declare-function dired-get-filename "dired" - (&optional localp no-error-if-not-filep bof)) + (&optional localp no-error-if-not-filep)) ;; These functions are used by the expansion of `dired-map-over-marks'. (declare-function dired-move-to-filename "dired" (&optional raise-error eol)) @@ -2234,7 +2234,7 @@ If the offending word is in a piece of quoted text, then it is skipped." ;; (defvar ispell-process) (declare-function ispell-buffer-local-words "ispell" ()) -(declare-function ispell-correct-p "ispell" ()) +(declare-function ispell-correct-p "ispell" (&optional following)) (declare-function ispell-set-spellchecker-params "ispell" ()) (declare-function ispell-accept-buffer-local-defs "ispell" ()) (declare-function ispell-error-checking-word "ispell" (word)) diff --git a/lisp/follow.el b/lisp/follow.el index 6c721899d4..adf1c1b762 100644 --- a/lisp/follow.el +++ b/lisp/follow.el @@ -1552,7 +1552,7 @@ non-first windows in Follow mode." (declare-function scroll-bar-drag "scroll-bar" (event)) (declare-function scroll-bar-scroll-up "scroll-bar" (event)) (declare-function scroll-bar-scroll-down "scroll-bar" (event)) -(declare-function mwheel-scroll "mwheel" (event)) +(declare-function mwheel-scroll "mwheel" (event &optional arg)) (defun follow-scroll-bar-toolkit-scroll (event) (interactive "e") diff --git a/lisp/frame.el b/lisp/frame.el index 49eabcf978..9b8937c258 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -2433,8 +2433,8 @@ monitors." ,(display-mm-height display))) (frames . ,(frames-on-display-list display))))))))) -(declare-function x-device-class (name) "x-win.el") -(declare-function pgtk-device-class (name) "pgtk-win.el") +(declare-function x-device-class "term/x-win.el" (name)) +(declare-function pgtk-device-class "term/pgtk-win.el" (name)) (defun device-class (frame name) "Return the class of the device NAME for an event generated on FRAME. diff --git a/lisp/lpr.el b/lisp/lpr.el index 01617ef912..88b0607b11 100644 --- a/lisp/lpr.el +++ b/lisp/lpr.el @@ -125,7 +125,7 @@ and print the result." (defcustom print-region-function (if (memq system-type '(ms-dos windows-nt)) (progn - (declare-function w32-direct-print-region-function "w32-fns") + (declare-function w32-direct-print-region-function "dos-w32") #'w32-direct-print-region-function) #'call-process-region) "Function to call to print the region on a printer. diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el index 35e9f73f8c..af12417f70 100644 --- a/lisp/mail/feedmail.el +++ b/lisp/mail/feedmail.el @@ -1619,7 +1619,8 @@ local gurus." (if (null mail-interactive) '("-oem" "-odb"))))) (declare-function smtpmail-via-smtp "smtpmail" - (recipient smtpmail-text-buffer &optional ask-for-password)) + (recipient smtpmail-text-buffer &optional ask-for-password + send-attempts)) (defvar smtpmail-smtp-server) ;; provided by jam@austin.asc.slb.com (James A. McLaughlin); diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 6b058d09f9..8cde590bc0 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -4592,8 +4592,6 @@ Argument MIME is non-nil if this is a mime message." armor-end-regexp (buffer-substring armor-start (- (point-max) after-end))))) -(declare-function rmail-mime-entity-truncated "rmailmm" (entity)) - ;; Should this have a key-binding, or be in a menu? ;; There doesn't really seem to be an appropriate menu. ;; Eg the edit command is not in a menu either. diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el index 59c2e578d3..b23fbc3f60 100644 --- a/lisp/mail/rmailsum.el +++ b/lisp/mail/rmailsum.el @@ -1475,7 +1475,7 @@ argument says to read a file name and use that file as the inbox." (forward-line -1)) (declare-function rmail-abort-edit "rmailedit" ()) -(declare-function rmail-cease-edit "rmailedit"()) +(declare-function rmail-cease-edit "rmailedit" (&optional abort)) (declare-function rmail-set-label "rmailkwd" (l state &optional n)) (declare-function rmail-output-read-file-name "rmailout" ()) (declare-function mail-send-and-exit "sendmail" (&optional arg)) diff --git a/lisp/obsolete/gs.el b/lisp/obsolete/gs.el index 971e7d2640..7bf324ceec 100644 --- a/lisp/obsolete/gs.el +++ b/lisp/obsolete/gs.el @@ -116,7 +116,7 @@ FILE is the value to substitute for the place-holder `'." (/ (* 25.4 mm) 72.0))) (declare-function x-change-window-property "xfns.c" - (prop value &optional frame type format outer-p)) + (prop value &optional frame type format outer-p window-id)) (defun gs-set-ghostview-window-prop (frame spec img-width img-height) "Set the `GHOSTVIEW' window property of FRAME. diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 4804b13ded..1bf77381e8 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -6382,7 +6382,8 @@ side-effect of memorizing only. Examples in `cperl-style-examples'." (eval '(mode-compile)))) ; Avoid a warning (declare-function Info-find-node "info" - (filename nodename &optional no-going-back strict-case)) + (filename nodename &optional no-going-back strict-case + noerror)) (defun cperl-info-buffer (type) ;; Return buffer with documentation. Creates if missing. diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 775b6ebab4..1ae1cf7eb6 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -776,8 +776,8 @@ functions are annotated with \"\" via the ;;; Xref backend -(declare-function xref-make "xref" (summary location)) -(declare-function xref-item-location "xref" (this)) +(declare-function xref-make "progmodes/xref" (summary location)) +(declare-function xref-item-location "progmodes/xref" (this)) (defun elisp--xref-backend () 'elisp) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index c9b6ccd324..2319e63854 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -1144,7 +1144,8 @@ no input, and GDB is waiting for input." (setq name (nth 1 (split-string define "[( ]"))) (push (cons name define) gdb-define-alist)))) -(declare-function tooltip-show "tooltip" (text &optional use-echo-area)) +(declare-function tooltip-show "tooltip" (text &optional use-echo-area + text-face default-face)) (defconst gdb--string-regexp (rx "\"" (* (or (seq "\\" nonl) diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 7092ca2041..213ebef92f 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -54,8 +54,8 @@ (declare-function gdb-tooltip-print-1 "gdb-mi" (expr)) (declare-function gud-pp "gdb-mi" (arg)) (declare-function gdb-var-delete "gdb-mi" ()) -(declare-function speedbar-toggle-line-expansion "gud" ()) -(declare-function speedbar-edit-line "gud" ()) +(declare-function speedbar-toggle-line-expansion "speedbar" ()) +(declare-function speedbar-edit-line "speedbar" ()) ;; FIXME: The declares below are necessary because we don't call `gud-def' ;; at toplevel, so the compiler doesn't know under which circumstances ;; they're defined. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 6e763eef01..683589d71c 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1549,7 +1549,7 @@ This command is intended to be bound to a mouse event." (xref-find-references identifier)) (user-error "No identifier here")))) -(declare-function apropos-parse-pattern "apropos" (pattern)) +(declare-function apropos-parse-pattern "apropos" (pattern &optional do-all)) ;;;###autoload (defun xref-find-apropos (pattern) diff --git a/lisp/term/pgtk-win.el b/lisp/term/pgtk-win.el index 5317f6ba01..9b22ab0970 100644 --- a/lisp/term/pgtk-win.el +++ b/lisp/term/pgtk-win.el @@ -97,7 +97,7 @@ the last file dropped is selected." (declare-function x-handle-args "common-win" (args)) (declare-function x-open-connection "pgtkfns.c" (display &optional xrm-string must-succeed)) -(declare-function pgtk-set-resource "pgtkfns.c" (owner name value)) +(declare-function pgtk-set-resource "pgtkfns.c" (attribute value)) ;; Do the actual window system setup here; the above code just defines ;; functions and variables that we use now. diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 08a8bf88e5..1f29b24ef2 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -1559,7 +1559,7 @@ EVENT is a preedit-text event." (defvaralias 'x-gtk-use-system-tooltips 'use-system-tooltips) -(declare-function x-internal-focus-input-context (focus frame) "xfns.c") +(declare-function x-internal-focus-input-context "xfns.c" (focus)) (defun x-gtk-use-native-input-watcher (_symbol newval &rest _ignored) "Variable watcher for `x-gtk-use-native-input'. diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index 71b8d82ed9..5d6f5deae1 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el @@ -39,7 +39,7 @@ (declare-function flymake-make-diagnostic "flymake" ( locus beg end type text &optional data overlay-properties)) -(declare-function flymake--log-1 (level sublog msg &rest args)) +(declare-function flymake--log-1 "flymake" (level sublog msg &rest args)) (eval-when-compile (require 'tex-mode)) (declare-function tex-buffer "tex-mode" ()) diff --git a/lisp/transient.el b/lisp/transient.el index 13e8de258b..d329bbdbcd 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -61,10 +61,10 @@ (eval-when-compile (require 'subr-x)) -(declare-function info 'info) -(declare-function Man-find-section 'man) -(declare-function Man-next-section 'man) -(declare-function Man-getpage-in-background 'man) +(declare-function info "info") +(declare-function Man-find-section "man") +(declare-function Man-next-section "man") +(declare-function Man-getpage-in-background "man") (defvar Man-notify-method) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index ad39dc604a..8937454d11 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1599,7 +1599,7 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"." (declare-function grep-read-regexp "grep" ()) (declare-function grep-read-files "grep" (regexp)) (declare-function grep-expand-template "grep" - (template &optional regexp files dir excl)) + (template &optional regexp files dir excl more-opts)) (defvar compilation-environment) ;; Derived from `lgrep'. diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index bd2ea337b1..76d9771672 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -966,7 +966,7 @@ In the latter case, VC mode is deactivated for this buffer." (defalias 'vc-menu-map vc-menu-map) -(declare-function vc-responsible-backend "vc" (file)) +(declare-function vc-responsible-backend "vc" (file &optional no-error)) (defun vc-menu-map-filter (orig-binding) (if (and (symbolp orig-binding) (fboundp orig-binding)) diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el index f353566b06..bdef0ae17c 100644 --- a/lisp/w32-fns.el +++ b/lisp/w32-fns.el @@ -312,8 +312,8 @@ names." ;;;; System name and version for emacsbug.el -(declare-function w32-version "w32-win" ()) -(declare-function w32-read-registry "w32fns" (root key name)) +(declare-function w32-version "term/w32-win" ()) +(declare-function w32-read-registry "w32fns.c" (root key name)) (defun w32--os-description () "Return a string describing the underlying OS and its version." diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el index c2498a57a1..13a73aa7fb 100644 --- a/lisp/x-dnd.el +++ b/lisp/x-dnd.el @@ -403,7 +403,7 @@ Currently XDND, Motif and old KDE 1.x protocols are recognized." ;;; XDND protocol. (declare-function x-change-window-property "xfns.c" - (prop value &optional frame type format outer-P)) + (prop value &optional frame type format outer-P window-id)) (defun x-dnd-init-xdnd-for-frame (frame) "Set the XdndAware property for FRAME to indicate that we do XDND." diff --git a/lisp/xwidget.el b/lisp/xwidget.el index e50324ac47..62da16d486 100644 --- a/lisp/xwidget.el +++ b/lisp/xwidget.el @@ -36,7 +36,7 @@ (require 'format-spec) (declare-function make-xwidget "xwidget.c" - (type title width height arguments &optional buffer related)) + (type title width height &optional arguments buffer related)) (declare-function xwidget-buffer "xwidget.c" (xwidget)) (declare-function set-xwidget-buffer "xwidget.c" (xwidget buffer)) (declare-function xwidget-size-request "xwidget.c" (xwidget)) commit 5aef501d9c3394599dd2e48ff7ba7bb5f13cd19a Author: Po Lu Date: Sat May 14 21:18:27 2022 +0800 Fix processing of dialog box items on NS * src/nsmenu.m (pop_down_menu): Remove old hack and discard menu items. (ns_popup_dialog): ([EmacsDialogPanel initWithContentRect:styleMask:backing:defer:]): ([EmacsDialogPanel windowShouldClose:]): ([EmacsDialogPanel dealloc]): ([EmacsDialogPanel processdialog:]): ([EmacsDialogPanel addButton:value:row:]): ([EmacsDialogPanel addString:row:]): ([EmacsDialogPanel clicked:]): ([EmacsDialogPanel initFromContents:isQuestion:]): ([EmacsDialogPanel timeouthandler:]): ([EmacsDialogPanel runDialogAt:]): Use the regular menu item machinery to parse dialog items instead of the incorrect ad-hoc code used previously. * src/nsterm.h: Update prototypes. diff --git a/src/nsmenu.m b/src/nsmenu.m index 531f0d3bb6..1ebaca4e87 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1538,31 +1538,32 @@ - (NSRect) frame if (popup_activated_flag) { - block_input (); popup_activated_flag = 0; [panel close]; - [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; - unblock_input (); + discard_menu_items (); } } - Lisp_Object ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) { - id dialog; + EmacsDialogPanel *dialog; Lisp_Object tem, title; NSPoint p; - BOOL isQ; + BOOL is_question; + const char *error_name; + specpdl_ref specpdl_count; NSTRACE ("ns_popup_dialog"); + specpdl_count = SPECPDL_INDEX (); - isQ = NILP (header); - + is_question = NILP (header); check_window_system (f); - p.x = (int)f->left_pos + ((int)FRAME_COLUMN_WIDTH (f) * f->text_cols)/2; - p.y = (int)f->top_pos + (FRAME_LINE_HEIGHT (f) * f->text_lines)/2; + p.x = ((int) f->left_pos + + ((int) FRAME_COLUMN_WIDTH (f) * f->text_cols) / 2); + p.y = ((int) f->top_pos + + (FRAME_LINE_HEIGHT (f) * f->text_lines) / 2); title = Fcar (contents); CHECK_STRING (title); @@ -1572,21 +1573,30 @@ - (NSRect) frame the dialog. */ contents = list2 (title, Fcons (build_string ("Ok"), Qt)); - block_input (); - dialog = [[EmacsDialogPanel alloc] initFromContents: contents - isQuestion: isQ]; - - { - specpdl_ref specpdl_count = SPECPDL_INDEX (); + record_unwind_protect_void (unuse_menu_items); + list_of_panes (list1 (contents)); - record_unwind_protect_ptr (pop_down_menu, dialog); - popup_activated_flag = 1; - tem = [dialog runDialogAt: p]; - unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */ - } + block_input (); + dialog = [[EmacsDialogPanel alloc] initWithTitle: SSDATA (title) + isQuestion: is_question]; + [dialog processMenuItems: menu_items + used: menu_items_used + withErrorOutput: &error_name]; + [dialog resizeBoundsPriorToDisplay]; unblock_input (); + if (error_name) + { + discard_menu_items (); + [dialog close]; + error ("%s", error_name); + } + + record_unwind_protect_ptr (pop_down_menu, dialog); + popup_activated_flag = 1; + tem = [dialog runDialogAt: p]; + unbind_to (specpdl_count, Qnil); return tem; } @@ -1627,7 +1637,6 @@ - (instancetype)initWithContentRect: (NSRect)contentRect styleMask: (NSWindowSty NSImage *img; dialog_return = Qundefined; - button_values = NULL; area.origin.x = 3*SPACER; area.origin.y = 2*SPACER; area.size.width = ICONSIZE; @@ -1711,58 +1720,65 @@ - (instancetype)initWithContentRect: (NSRect)contentRect styleMask: (NSWindowSty } -- (BOOL)windowShouldClose: (id)sender +- (BOOL)windowShouldClose: (id) sender { window_closed = YES; - [NSApp stop:self]; + [NSApp stop: self]; return NO; } -- (void)dealloc +- (void) dealloc { - xfree (button_values); [super dealloc]; } -- (void)process_dialog: (Lisp_Object) list +- (void) processMenuItems: (Lisp_Object) menu_items + used: (ptrdiff_t) menu_items_used + withErrorOutput: (const char **) error_name { - Lisp_Object item, lst = list; - int row = 0; - int buttons = 0, btnnr = 0; + int i, nb_buttons = 0, row = 0; + Lisp_Object item_name, enable; - for (; CONSP (lst); lst = XCDR (lst)) + i = MENU_ITEMS_PANE_LENGTH; + *error_name = NULL; + + /* Loop over all panes and items, filling in the tree. */ + while (i < menu_items_used) { - item = XCAR (list); - if (CONSP (item)) - ++buttons; - } + item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME); + enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE); - if (buttons > 0) - button_values = xmalloc (buttons * sizeof *button_values); + if (NILP (item_name)) + { + *error_name = "Submenu in dialog items"; + return; + } - for (; CONSP (list); list = XCDR (list)) - { - item = XCAR (list); - if (STRINGP (item)) - { - [self addString: SSDATA (item) row: row++]; - } - else if (CONSP (item)) - { - button_values[btnnr] = XCDR (item); - [self addButton: SSDATA (XCAR (item)) value: btnnr row: row++]; - ++btnnr; - } - else if (NILP (item)) - { - [self addSplit]; - row = 0; - } + if (EQ (item_name, Qquote)) + /* This is the boundary between elements on the left and those + on the right, but that boundary is currently not handled on + NS. */ + continue; + + if (nb_buttons > 9) + { + *error_name = "Too many dialog items"; + return; + } + + [self addButton: SSDATA (item_name) + value: (NSInteger) aref_addr (menu_items, i) + row: row++ + enable: !NILP (enable)]; + + i += MENU_ITEMS_ITEM_LENGTH; + nb_buttons++; } } -- (void)addButton: (char *)str value: (int)tag row: (int)row +- (void) addButton: (char *) str value: (NSInteger) tag + row: (int) row enable: (BOOL) enable { id cell; @@ -1771,7 +1787,8 @@ - (void)addButton: (char *)str value: (int)tag row: (int)row [matrix addRow]; rows++; } - cell = [matrix cellAtRow: row column: cols-1]; + + cell = [matrix cellAtRow: row column: cols - 1]; [cell setTarget: self]; [cell setAction: @selector (clicked: )]; [cell setTitle: [NSString stringWithUTF8String: str]]; @@ -1781,7 +1798,7 @@ - (void)addButton: (char *)str value: (int)tag row: (int)row } -- (void)addString: (char *)str row: (int)row +- (void)addString: (char *) str row: (int) row { id cell; @@ -1804,96 +1821,94 @@ - (void)addSplit } -- (void)clicked: sender +- (void) clicked: sender { NSArray *sellist = nil; - EMACS_INT seltag; + NSUInteger seltag; + Lisp_Object *selarray; sellist = [sender selectedCells]; + if ([sellist count] < 1) return; seltag = [[sellist objectAtIndex: 0] tag]; - dialog_return = button_values[seltag]; - [NSApp stop:self]; + selarray = (void *) seltag; + dialog_return = selarray[MENU_ITEMS_ITEM_VALUE]; + [NSApp stop: self]; } -- (instancetype)initFromContents: (Lisp_Object)contents isQuestion: (BOOL)isQ +- (instancetype) initWithTitle: (char *) title_string + isQuestion: (BOOL) is_question { - Lisp_Object head; [super init]; - if (CONSP (contents)) - { - head = Fcar (contents); - [self process_dialog: Fcdr (contents)]; - } - else - head = contents; - - if (STRINGP (head)) - [title setStringValue: - [NSString stringWithUTF8String: SSDATA (head)]]; - else if (isQ == YES) - [title setStringValue: @"Question"]; + if (title_string) + [title setStringValue: + [NSString stringWithUTF8String: title_string]]; + else if (is_question) + [title setStringValue: @"Question"]; else - [title setStringValue: @"Information"]; + [title setStringValue: @"Information"]; - { - int i; - NSRect r, s, t; + return self; +} - if (cols == 1 && rows > 1) /* Never told where to split. */ - { - [matrix addColumn]; - for (i = 0; i < rows/2; i++) - { - [matrix putCell: [matrix cellAtRow: (rows+1)/2 column: 0] - atRow: i column: 1]; - [matrix removeRow: (rows+1)/2]; - } - } +- (void) resizeBoundsPriorToDisplay +{ + int i; + NSRect r, s, t; + NSSize csize; - [matrix sizeToFit]; + if (cols == 1 && rows > 1) { - NSSize csize = [matrix cellSize]; - if (csize.width < MINCELLWIDTH) - { - csize.width = MINCELLWIDTH; - [matrix setCellSize: csize]; - [matrix sizeToCells]; - } + [matrix addColumn]; + for (i = 0; i < rows / 2; i++) + { + [matrix putCell: [matrix cellAtRow: (rows + 1) /2 + column: 0] + atRow: i column: 1]; + [matrix removeRow: (rows + 1) / 2]; + } } - [title sizeToFit]; - [command sizeToFit]; + [matrix sizeToFit]; - t = [matrix frame]; - r = [title frame]; - if (r.size.width+r.origin.x > t.size.width+t.origin.x) - { - t.origin.x = r.origin.x; - t.size.width = r.size.width; - } - r = [command frame]; - if (r.size.width+r.origin.x > t.size.width+t.origin.x) - { - t.origin.x = r.origin.x; - t.size.width = r.size.width; - } + csize = [matrix cellSize]; + if (csize.width < MINCELLWIDTH) + { + csize.width = MINCELLWIDTH; + [matrix setCellSize: csize]; + [matrix sizeToCells]; + } - r = [self frame]; - s = [(NSView *)[self contentView] frame]; - r.size.width += t.origin.x+t.size.width +2*SPACER-s.size.width; - r.size.height += t.origin.y+t.size.height+SPACER-s.size.height; - [self setFrame: r display: NO]; - } + [title sizeToFit]; + [command sizeToFit]; - return self; -} + t = [matrix frame]; + r = [title frame]; + if (r.size.width + r.origin.x > t.size.width + t.origin.x) + { + t.origin.x = r.origin.x; + t.size.width = r.size.width; + } + r = [command frame]; + if (r.size.width + r.origin.x > t.size.width + t.origin.x) + { + t.origin.x = r.origin.x; + t.size.width = r.size.width; + } + r = [self frame]; + s = [(NSView *) [self contentView] frame]; + r.size.width += (t.origin.x + t.size.width + + 2 * SPACER - s.size.width); + r.size.height += (t.origin.y + t.size.height + + SPACER - s.size.height); + [self setFrame: r display: NO]; +} - (void)timeout_handler: (NSTimer *)timedEntry { @@ -1911,11 +1926,11 @@ - (void)timeout_handler: (NSTimer *)timedEntry /* We use stop because stopModal/abortModal out of the main loop does not seem to work in 10.6. But as we use stop we must send a real event so the stop is seen and acted upon. */ - [NSApp stop:self]; + [NSApp stop: self]; [NSApp postEvent: nxev atStart: NO]; } -- (Lisp_Object)runDialogAt: (NSPoint)p +- (Lisp_Object) runDialogAt: (NSPoint) p { Lisp_Object ret = Qundefined; @@ -1935,13 +1950,17 @@ - (Lisp_Object)runDialogAt: (NSPoint)p [[NSRunLoop currentRunLoop] addTimer: tmo forMode: NSModalPanelRunLoopMode]; } + timer_fired = NO; dialog_return = Qundefined; [NSApp runModalForWindow: self]; ret = dialog_return; - if (! timer_fired) + + if (!timer_fired) { - if (tmo != nil) [tmo invalidate]; /* Cancels timer. */ + if (tmo != nil) + [tmo invalidate]; /* Cancels timer. */ + break; } } diff --git a/src/nsterm.h b/src/nsterm.h index 1135225e7b..2c46298a93 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -574,22 +574,32 @@ typedef id instancetype; ========================================================================== */ @interface EmacsDialogPanel : NSPanel - { - NSTextField *command; - NSTextField *title; - NSMatrix *matrix; - int rows, cols; - BOOL timer_fired, window_closed; - Lisp_Object dialog_return; - Lisp_Object *button_values; - } -- (instancetype)initFromContents: (Lisp_Object)menu isQuestion: (BOOL)isQ; -- (void)process_dialog: (Lisp_Object)list; -- (void)addButton: (char *)str value: (int)tag row: (int)row; -- (void)addString: (char *)str row: (int)row; -- (void)addSplit; -- (Lisp_Object)runDialogAt: (NSPoint)p; -- (void)timeout_handler: (NSTimer *)timedEntry; +{ + NSTextField *command; + NSTextField *title; + NSMatrix *matrix; + int rows, cols; + BOOL timer_fired, window_closed; + Lisp_Object dialog_return; +} + +- (instancetype) initWithTitle: (char *) title_str + isQuestion: (BOOL) is_question; +- (void) processMenuItems: (Lisp_Object) menu_items + used: (ptrdiff_t) menu_items_used + withErrorOutput: (const char **) error_name; + +- (void) addButton: (char *) str + value: (NSInteger) tag + row: (int) row + enable: (BOOL) enable; +- (void) addString: (char *) str + row: (int) row; +- (void) addSplit; +- (void) resizeBoundsPriorToDisplay; + +- (Lisp_Object) runDialogAt: (NSPoint) p; +- (void) timeout_handler: (NSTimer *) timedEntry; @end #ifdef NS_IMPL_COCOA commit e0044dfeb0de0d0cafdef04b433b14afa27d3518 Author: Po Lu Date: Sat May 14 20:07:27 2022 +0800 Avoid unsafe alloca when looking up toplevels * src/xterm.c (x_dnd_compute_toplevels): Use SAFE_ALLOCA, since alloca isn't safe when there are lots of toplevels or the window manager is broken. diff --git a/src/xterm.c b/src/xterm.c index 64c4f91a18..c0d2ee40b0 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2106,27 +2106,29 @@ x_dnd_compute_toplevels (struct x_display_info *dpyinfo) toplevels = (Window *) data; #ifdef USE_XCB + USE_SAFE_ALLOCA; + window_attribute_cookies - = alloca (sizeof *window_attribute_cookies * nitems); + = SAFE_ALLOCA (sizeof *window_attribute_cookies * nitems); translate_coordinate_cookies - = alloca (sizeof *translate_coordinate_cookies * nitems); + = SAFE_ALLOCA (sizeof *translate_coordinate_cookies * nitems); get_property_cookies - = alloca (sizeof *get_property_cookies * nitems); + = SAFE_ALLOCA (sizeof *get_property_cookies * nitems); xm_property_cookies - = alloca (sizeof *xm_property_cookies * nitems); + = SAFE_ALLOCA (sizeof *xm_property_cookies * nitems); extent_property_cookies - = alloca (sizeof *extent_property_cookies * nitems); + = SAFE_ALLOCA (sizeof *extent_property_cookies * nitems); get_geometry_cookies - = alloca (sizeof *get_geometry_cookies * nitems); + = SAFE_ALLOCA (sizeof *get_geometry_cookies * nitems); #ifdef HAVE_XCB_SHAPE bounding_rect_cookies - = alloca (sizeof *bounding_rect_cookies * nitems); + = SAFE_ALLOCA (sizeof *bounding_rect_cookies * nitems); #endif #ifdef HAVE_XCB_SHAPE_INPUT_RECTS input_rect_cookies - = alloca (sizeof *input_rect_cookies * nitems); + = SAFE_ALLOCA (sizeof *input_rect_cookies * nitems); #endif for (i = 0; i < nitems; ++i) @@ -2606,6 +2608,10 @@ x_dnd_compute_toplevels (struct x_display_info *dpyinfo) #endif } +#ifdef USE_XCB + SAFE_FREE (); +#endif + return 0; } commit 9a67e83bd656477e46015c629f3e961e22791a88 Author: Eli Zaretskii Date: Sat May 14 11:30:54 2022 +0300 Fix undigest-tests on MS-Windows * lisp/emacs-lisp/ert-x.el (ert-with-temp-file): Accept a new keyword argument :coding CODING to use as the encoding when writing initial text to the temporary file. * test/lisp/mail/undigest-tests.el (rmail-undigest-test-rfc934-digest) (rmail-undigest-test-rfc1153-digest-strict) (rmail-undigest-test-rfc1153-less-strict-digest) (rmail-undigest-test-rfc1153-sloppy-digest) (rmail-undigest-test-rfc1521-mime-digest) (rmail-undigest-test-multipart-mixed-digest): Force the temporary mbox files to have Unix-style EOL format. diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index 0e412a8d34..c42ce09a1c 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -424,10 +424,15 @@ The following keyword arguments are supported: :text STRING If non-nil, pass STRING to `make-temp-file' as the TEXT argument. +:coding CODING If non-nil, bind `coding-system-for-write' to CODING + when executing BODY. This is handy when STRING includes + non-ASCII characters or the temporary file must have a + specific encoding or end-of-line format. + See also `ert-with-temp-directory'." (declare (indent 1) (debug (symbolp body))) (cl-check-type name symbol) - (let (keyw prefix suffix directory text extra-keywords) + (let (keyw prefix suffix directory text extra-keywords coding) (while (keywordp (setq keyw (car body))) (setq body (cdr body)) (pcase keyw @@ -435,6 +440,7 @@ See also `ert-with-temp-directory'." (:suffix (setq suffix (pop body))) (:directory (setq directory (pop body))) (:text (setq text (pop body))) + (:coding (setq coding (pop body))) (_ (push keyw extra-keywords) (pop body)))) (when extra-keywords (error "Invalid keywords: %s" (mapconcat #'symbol-name extra-keywords " "))) @@ -443,7 +449,8 @@ See also `ert-with-temp-directory'." (suffix (or suffix ert-temp-file-suffix (ert--with-temp-file-generate-suffix (or (macroexp-file-name) buffer-file-name))))) - `(let* ((,temp-file (,(if directory 'file-name-as-directory 'identity) + `(let* ((coding-system-for-write ,(or coding coding-system-for-write)) + (,temp-file (,(if directory 'file-name-as-directory 'identity) (make-temp-file ,prefix ,directory ,suffix ,text))) (,name ,(if directory `(file-name-as-directory ,temp-file) diff --git a/test/lisp/mail/undigest-tests.el b/test/lisp/mail/undigest-tests.el index 1c473c4996..d52c9f9c5a 100644 --- a/test/lisp/mail/undigest-tests.el +++ b/test/lisp/mail/undigest-tests.el @@ -273,6 +273,9 @@ The footer. "Test that we can undigest a RFC 934 digest." (ert-with-temp-file file :text rmail-rfc934-digest + ;; Rmail reads mbox files literally, so we must make sure the + ;; temporary mbox file has Unix-style EOLs. + :coding 'undecided-unix (rmail file) (undigestify-rmail-message) (should (= rmail-total-messages 4)) @@ -285,6 +288,9 @@ The footer. :expected-result :failed (ert-with-temp-file file :text rmail-rfc1153-digest-strict + ;; Rmail reads mbox files literally, so we must make sure the + ;; temporary mbox file has Unix-style EOLs. + :coding 'undecided-unix (rmail file) (should (ignore-errors @@ -300,6 +306,9 @@ The footer. "Test that we can undigest a RFC 1153 with a Subject header in its footer." (ert-with-temp-file file :text rmail-rfc1153-digest-less-strict + ;; Rmail reads mbox files literally, so we must make sure the + ;; temporary mbox file has Unix-style EOLs. + :coding 'undecided-unix (rmail file) (undigestify-rmail-message) (should (= rmail-total-messages 5)) @@ -310,6 +319,9 @@ The footer. "Test that we can undigest a sloppy RFC 1153 digest." (ert-with-temp-file file :text rmail-rfc1153-digest-sloppy + ;; Rmail reads mbox files literally, so we must make sure the + ;; temporary mbox file has Unix-style EOLs. + :coding 'undecided-unix (rmail file) (undigestify-rmail-message) (should (= rmail-total-messages 5)) @@ -324,6 +336,9 @@ The footer. :expected-result :failed (ert-with-temp-file file :text rmail-rfc1521-mime-digest + ;; Rmail reads mbox files literally, so we must make sure the + ;; temporary mbox file has Unix-style EOLs. + :coding 'undecided-unix (rmail file) (undigestify-rmail-message) (should (= rmail-total-messages 3)) @@ -334,6 +349,9 @@ The footer. "Test that we can undigest a digest inside a multipart/mixed digest." (ert-with-temp-file file :text rmail-multipart-mixed-digest + ;; Rmail reads mbox files literally, so we must make sure the + ;; temporary mbox file has Unix-style EOLs. + :coding 'undecided-unix (rmail file) (undigestify-rmail-message) (should (= rmail-total-messages 4)) commit e2e081a476a2a9309d0870e4c1adda1167c52911 Author: Eli Zaretskii Date: Sat May 14 10:34:50 2022 +0300 ; Fix the documentation of compiler-macros and advice * doc/lispref/functions.texi (Advice and Byte Code): Fix typos and improve wording and indexing. (Bug#23264) diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index df50a627aa..e3de6009e9 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -2143,32 +2143,31 @@ when porting such old @code{after} advice, you'll need to turn it into new @node Advice and Byte Code @subsection Advice and Byte Code @cindex compiler macros, advising -@cindex @code{byte-compile}, advising -@cindex @code{byte-optimizer}, advising +@cindex @code{byte-compile} and @code{byte-optimize}, advising Not all functions can be reliably advised. The byte compiler may choose to replace a call to a function with a sequence of instructions -that doesn't include the function call to the function you were -interested in altering. +that doesn't call the function you were interested in altering. This usually happens due to one of the three following mechanisms: -@table @dfn +@table @asis @item @code{byte-compile} properties -If function @var{symbol} has a @code{byte-compile} property, that -property will be used instead of @var{symbol}'s definition. +If a function's symbol has a @code{byte-compile} property, that +property will be used instead of the symbol's function definition. @xref{Compilation Functions}. @item @code{byte-optimize} properties -If function @var{symbol} has a @code{byte-compile} property, the byte +If a function's symbol has a @code{byte-optimize} property, the byte compiler may rewrite the function arguments, or decide to use a different function altogether. -@item compiler macros -Compiler macros are defined using a special @code{declare} form. This -tells the compiler to use the defined @dfn{expander} as an -optimization function, and it can return a new expression to use -instead of the function call. @xref{Declare Form}. +@item @code{compiler-macro} declare forms +A function can have a special @code{compiler-macro} @code{declare} +form in its definition (@pxref{Declare Form}) that defines an +@dfn{expander} to call when compiling the function. The expander +could then cause the produced byte-code not to call the original +function. @end table @node Obsolete Functions commit 88e0e034eff81194b775fd3d1e7cbd28eeb610f6 Author: Martin Rudalics Date: Sat May 14 09:19:57 2022 +0200 2022-05-14 Martin Rudalics * lisp/window.el (quit-restore-select-window): New function. (quit-restore-window): Call 'quit-restore-select-window' to avoid selecting inactive minibuffer window (Bug#55403). diff --git a/lisp/window.el b/lisp/window.el index 0787e6390c..e378652e28 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -5142,6 +5142,14 @@ all window-local buffer lists." :version "27.1" :group 'windows) +(defun quit-restore-select-window (window) + "Select WINDOW after having quit another one. +Do not select an inactive minibuffer window." + (when (and (window-live-p window) + (or (not (window-minibuffer-p window)) + (minibuffer-window-active-p window))) + (select-window window))) + (defun quit-restore-window (&optional window bury-or-kill) "Quit WINDOW and deal with its buffer. WINDOW must be a live window and defaults to the selected one. @@ -5191,15 +5199,13 @@ nil means to not handle the buffer in a particular way. This ((and dedicated (not (eq dedicated 'side)) (window--delete window 'dedicated (eq bury-or-kill 'kill))) ;; If the previously selected window is still alive, select it. - (when (window-live-p (nth 2 quit-restore)) - (select-window (nth 2 quit-restore)))) + (quit-restore-select-window (nth 2 quit-restore))) ((and (not prev-buffer) (eq (nth 1 quit-restore) 'tab) (eq (nth 3 quit-restore) buffer)) (tab-bar-close-tab) ;; If the previously selected window is still alive, select it. - (when (window-live-p (nth 2 quit-restore)) - (select-window (nth 2 quit-restore)))) + (quit-restore-select-window (nth 2 quit-restore))) ((and (not prev-buffer) (or (eq (nth 1 quit-restore) 'frame) (and (eq (nth 1 quit-restore) 'window) @@ -5211,8 +5217,7 @@ nil means to not handle the buffer in a particular way. This ;; Delete WINDOW if possible. (window--delete window nil (eq bury-or-kill 'kill))) ;; If the previously selected window is still alive, select it. - (when (window-live-p (nth 2 quit-restore)) - (select-window (nth 2 quit-restore)))) + (quit-restore-select-window (nth 2 quit-restore))) ((and (listp (setq quad (nth 1 quit-restore))) (buffer-live-p (car quad)) (eq (nth 3 quit-restore) buffer)) @@ -5256,8 +5261,8 @@ nil means to not handle the buffer in a particular way. This ;; Reset the quit-restore parameter. (set-window-parameter window 'quit-restore nil) ;; Select old window. - (when (window-live-p (nth 2 quit-restore)) - (select-window (nth 2 quit-restore)))) + ;; If the previously selected window is still alive, select it. + (quit-restore-select-window (nth 2 quit-restore))) (t ;; Show some other buffer in WINDOW and reset the quit-restore ;; parameter. @@ -5270,8 +5275,8 @@ nil means to not handle the buffer in a particular way. This (when (eq dedicated 'side) (set-window-dedicated-p window 'side)) (window--delete window nil (eq bury-or-kill 'kill)) - (when (window-live-p (nth 2 quit-restore)) - (select-window (nth 2 quit-restore)))))) + ;; If the previously selected window is still alive, select it. + (quit-restore-select-window (nth 2 quit-restore))))) ;; Deal with the buffer. (cond