diff options
| author | Gerd Möllmann | 2025-01-23 15:38:26 +0100 |
|---|---|---|
| committer | Gerd Möllmann | 2025-01-23 15:38:26 +0100 |
| commit | 7c10518d169210b0aaf53035dff44923d7ee663c (patch) | |
| tree | 3f43b02edfe85fd659380bd3d22b756f44d70457 | |
| parent | 24ee7217957c621c951d7d3956889aff74f74a7e (diff) | |
| parent | d83d090de1127d6e88e4ff33a617d8621a85a8cd (diff) | |
| download | emacs-scratch/se-matrix.tar.gz emacs-scratch/se-matrix.zip | |
Merge branch 'master' into scratch/se-matrixscratch/se-matrix
| -rw-r--r-- | lisp/emacs-lisp/shortdoc.el | 131 | ||||
| -rw-r--r-- | src/dispextern.h | 2 | ||||
| -rw-r--r-- | src/dispnew.c | 4 | ||||
| -rw-r--r-- | src/term.c | 17 |
4 files changed, 142 insertions, 12 deletions
diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index 230df47821c..cc9971b232f 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el | |||
| @@ -174,6 +174,137 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'), | |||
| 174 | (if (eq .rose 'red) | 174 | (if (eq .rose 'red) |
| 175 | .lily))))) | 175 | .lily))))) |
| 176 | 176 | ||
| 177 | (define-short-documentation-group map | ||
| 178 | "Map Basics" | ||
| 179 | (mapp | ||
| 180 | :eval (mapp (list 'bar 1 'foo 2 'baz 3)) | ||
| 181 | :eval (mapp (list '(bar . 1) '(foo . 2) '(baz . 3))) | ||
| 182 | :eval (mapp [bar foo baz]) | ||
| 183 | :eval (mapp "this is a string") | ||
| 184 | :eval (mapp #s(hash-table data (bar 1 foo 2 baz 3))) | ||
| 185 | :eval (mapp '()) | ||
| 186 | :eval (mapp nil) | ||
| 187 | :eval (mapp (make-char-table 'shortdoc-test))) | ||
| 188 | (map-empty-p | ||
| 189 | :args (map) | ||
| 190 | :eval (map-empty-p nil) | ||
| 191 | :eval (map-empty-p []) | ||
| 192 | :eval (map-empty-p '())) | ||
| 193 | (map-elt | ||
| 194 | :args (map key) | ||
| 195 | :eval (map-elt (list 'bar 1 'foo 2 'baz 3) 'foo) | ||
| 196 | :eval (map-elt (list '(bar . 1) '(foo . 2) '(baz . 3)) 'foo) | ||
| 197 | :eval (map-elt [bar foo baz] 1) | ||
| 198 | :eval (map-elt #s(hash-table data (bar 1 foo 2 baz 3)) 'foo)) | ||
| 199 | (map-contains-key | ||
| 200 | :args (map key) | ||
| 201 | :eval (map-contains-key (list 'bar 1 'foo 2 'baz 3) 'foo) | ||
| 202 | :eval (map-contains-key (list '(bar . 1) '(foo . 2) '(baz . 3)) 'foo) | ||
| 203 | :eval (map-contains-key [bar foo baz] 1) | ||
| 204 | :eval (map-contains-key #s(hash-table data (bar 1 foo 2 baz 3)) 'foo)) | ||
| 205 | (map-put! | ||
| 206 | (map key value) | ||
| 207 | :eval | ||
| 208 | "(let ((map (list 'bar 1 'baz 3))) | ||
| 209 | (map-put! map 'foo 2) | ||
| 210 | map)" | ||
| 211 | ;; This signals map-not-inplace when used in shortdoc.el :-( | ||
| 212 | ;; :eval | ||
| 213 | ;; "(let ((map (list '(bar . 1) '(baz . 3)))) | ||
| 214 | ;; (map-put! map 'foo 2) | ||
| 215 | ;; map)" | ||
| 216 | :eval | ||
| 217 | "(let ((map [bar bot baz])) | ||
| 218 | (map-put! map 1 'foo) | ||
| 219 | map)" | ||
| 220 | :eval | ||
| 221 | "(let ((map #s(hash-table data (bar 1 baz 3)))) | ||
| 222 | (map-put! map 'foo 2) | ||
| 223 | map)") | ||
| 224 | (map-insert | ||
| 225 | :args (map key value) | ||
| 226 | :eval (map-insert (list 'bar 1 'baz 3 'foo 7) 'foo 2) | ||
| 227 | :eval (map-insert (list '(bar . 1) '(baz . 3) '(foo . 7)) 'foo 2) | ||
| 228 | :eval (map-insert [bar bot baz] 1 'foo) | ||
| 229 | :eval (map-insert #s(hash-table data (bar 1 baz 3 foo 7)) 'foo 2)) | ||
| 230 | (map-delete | ||
| 231 | :args (map key) | ||
| 232 | :eval (map-delete (list 'bar 1 'foo 2 'baz 3) 'foo) | ||
| 233 | :eval (map-delete (list '(bar . 1) '(foo . 2) '(baz . 3)) 'foo) | ||
| 234 | :eval (map-delete [bar foo baz] 1) | ||
| 235 | :eval (map-delete #s(hash-table data (bar 1 foo 2 baz 3)) 'foo)) | ||
| 236 | (map-keys | ||
| 237 | :eval (map-keys (list 'bar 1 'foo 2 'baz 3)) | ||
| 238 | :eval (map-keys (list '(bar . 1) '(foo . 2) '(baz . 3))) | ||
| 239 | :eval (map-keys [bar foo baz]) | ||
| 240 | :eval (map-keys #s(hash-table data (bar 1 foo 2 baz 3)))) | ||
| 241 | (map-values | ||
| 242 | :args (map) | ||
| 243 | :eval (map-values (list 'bar 1 'foo 2 'baz 3)) | ||
| 244 | :eval (map-values (list '(bar . 1) '(foo . 2) '(baz . 3))) | ||
| 245 | :eval (map-values [bar foo baz]) | ||
| 246 | :eval (map-values #s(hash-table data (bar 1 foo 2 baz 3)))) | ||
| 247 | (map-pairs | ||
| 248 | :eval (map-pairs (list 'bar 1 'foo 2 'baz 3)) | ||
| 249 | :eval (map-pairs (list '(bar . 1) '(foo . 2) '(baz . 3))) | ||
| 250 | :eval (map-pairs [bar foo baz]) | ||
| 251 | :eval (map-pairs #s(hash-table data (bar 1 foo 2 baz 3)))) | ||
| 252 | (map-length | ||
| 253 | :args (map) | ||
| 254 | :eval (map-length (list 'bar 1 'foo 2 'baz 3)) | ||
| 255 | :eval (map-length (list '(bar . 1) '(foo . 2) '(baz . 3))) | ||
| 256 | :eval (map-length [bar foo baz]) | ||
| 257 | :eval (map-length #s(hash-table data (bar 1 foo 2 baz 3)))) | ||
| 258 | (map-copy | ||
| 259 | :args (map) | ||
| 260 | :eval (map-copy (list 'bar 1 'foo 2 'baz 3)) | ||
| 261 | :eval (map-copy (list '(bar . 1) '(foo . 2) '(baz . 3))) | ||
| 262 | :eval (map-copy [bar foo baz]) | ||
| 263 | :eval (map-copy #s(hash-table data (bar 1 foo 2 baz 3)))) | ||
| 264 | "Doing things to maps and their contents" | ||
| 265 | (map-apply | ||
| 266 | :args (function map) | ||
| 267 | :eval (map-apply #'+ (list '(1 . 2) '(3 . 4)))) | ||
| 268 | (map-do | ||
| 269 | :args (function map) | ||
| 270 | :eval | ||
| 271 | "(let ((map (list '(1 . 1) '(2 . 3))) | ||
| 272 | acc) | ||
| 273 | (map-do (lambda (k v) (push (+ k v) acc)) map) | ||
| 274 | (nreverse acc))") | ||
| 275 | (map-keys-apply | ||
| 276 | :eval (map-keys-apply #'1+ (list '(1 . 2) '(3 . 4)))) | ||
| 277 | (map-values-apply | ||
| 278 | :args (function map) | ||
| 279 | :eval (map-values-apply #'1+ (list '(1 . 2) '(3 . 4)))) | ||
| 280 | (map-filter | ||
| 281 | :eval (map-filter (lambda (k _) (cl-oddp k)) (list '(1 . 2) '(4 . 6))) | ||
| 282 | :eval (map-filter (lambda (k v) (cl-evenp (+ k v))) (list '(1 . 2) '(4 . 6)))) | ||
| 283 | (map-remove | ||
| 284 | :eval (map-remove (lambda (k _) (cl-oddp k)) (list '(1 . 2) '(4 . 6))) | ||
| 285 | :eval (map-remove (lambda (k v) (cl-evenp (+ k v))) (list '(1 . 2) '(4 . 6)))) | ||
| 286 | (map-some | ||
| 287 | :eval (map-some (lambda (k _) (cl-oddp k)) (list '(1 . 2) '(4 . 6))) | ||
| 288 | :eval (map-some (lambda (k v) (cl-evenp (+ k v))) (list '(1 . 2) '(4 . 6)))) | ||
| 289 | (map-every-p | ||
| 290 | :eval (map-every-p (lambda (k _) (cl-oddp k)) (list '(1 . 2) '(4 . 6))) | ||
| 291 | :eval (map-every-p (lambda (k v) (cl-evenp (+ k v))) (list '(1 . 3) '(4 . 6)))) | ||
| 292 | "Combining and changing maps" | ||
| 293 | (map-merge | ||
| 294 | :eval (map-merge 'alist '(1 2 3 4) #s(hash-table data (5 6 7 8))) | ||
| 295 | :eval (map-merge 'list '(1 2 3 4) #s(hash-table data (5 6 7 8))) | ||
| 296 | :eval (map-merge 'plist '(1 2 3 4) #s(hash-table data (5 6 7 8))) | ||
| 297 | :eval (map-merge 'hash-table '(1 2 3 4) #s(hash-table data (5 6 7 8)))) | ||
| 298 | (map-merge-with | ||
| 299 | :eval (map-merge-with 'alist #'max '(1 2 3 4) #s(hash-table data (1 1 3 5))) | ||
| 300 | :eval (map-merge-with 'alist #'min '(1 2 3 4) #s(hash-table data (1 1 3 5))) | ||
| 301 | :eval (map-merge-with 'hash-table #'min '(1 2 3 4) #s(hash-table data (1 1 3 5)))) | ||
| 302 | (map-into | ||
| 303 | :args (map type) | ||
| 304 | :eval (map-into #s(hash-table data '(5 6 7 8)) 'list) | ||
| 305 | :eval (map-into '((5 . 6) (7 . 8)) 'plist) | ||
| 306 | :eval (map-into '((5 . 6) (7 . 8)) 'hash-table))) | ||
| 307 | |||
| 177 | (define-short-documentation-group string | 308 | (define-short-documentation-group string |
| 178 | "Making Strings" | 309 | "Making Strings" |
| 179 | (make-string | 310 | (make-string |
diff --git a/src/dispextern.h b/src/dispextern.h index af4e0547af4..3582b9d567d 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3967,6 +3967,8 @@ void check_window_matrix_pointers_for_frame (struct frame *f); | |||
| 3967 | # else | 3967 | # else |
| 3968 | INLINE void check_window_matrix_pointers_for_frame (struct frame *f) {} | 3968 | INLINE void check_window_matrix_pointers_for_frame (struct frame *f) {} |
| 3969 | # endif | 3969 | # endif |
| 3970 | void frame_pos_abs (struct frame *f, int *x, int *y); | ||
| 3971 | bool is_frame_ancestor (struct frame *f1, struct frame *f2); | ||
| 3970 | 3972 | ||
| 3971 | INLINE_HEADER_END | 3973 | INLINE_HEADER_END |
| 3972 | 3974 | ||
diff --git a/src/dispnew.c b/src/dispnew.c index a35ded7e567..93cf40b0203 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -3383,7 +3383,7 @@ rect_intersect (struct rect *r, struct rect r1, struct rect r2) | |||
| 3383 | 3383 | ||
| 3384 | /* Return the absolute position of frame F in *X and *Y. */ | 3384 | /* Return the absolute position of frame F in *X and *Y. */ |
| 3385 | 3385 | ||
| 3386 | static void | 3386 | void |
| 3387 | frame_pos_abs (struct frame *f, int *x, int *y) | 3387 | frame_pos_abs (struct frame *f, int *x, int *y) |
| 3388 | { | 3388 | { |
| 3389 | *x = *y = 0; | 3389 | *x = *y = 0; |
| @@ -3423,7 +3423,7 @@ max_child_z_order (struct frame *parent) | |||
| 3423 | 3423 | ||
| 3424 | /* Return true if F1 is an ancestor of F2. */ | 3424 | /* Return true if F1 is an ancestor of F2. */ |
| 3425 | 3425 | ||
| 3426 | static bool | 3426 | bool |
| 3427 | is_frame_ancestor (struct frame *f1, struct frame *f2) | 3427 | is_frame_ancestor (struct frame *f1, struct frame *f2) |
| 3428 | { | 3428 | { |
| 3429 | for (struct frame *f = FRAME_PARENT_FRAME (f2); f; f = FRAME_PARENT_FRAME (f)) | 3429 | for (struct frame *f = FRAME_PARENT_FRAME (f2); f; f = FRAME_PARENT_FRAME (f)) |
diff --git a/src/term.c b/src/term.c index 47fd9297ab5..4774b7a32d0 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -2990,19 +2990,16 @@ tty_menu_calc_size (tty_menu *menu, int *width, int *height) | |||
| 2990 | static void | 2990 | static void |
| 2991 | mouse_get_xy (int *x, int *y) | 2991 | mouse_get_xy (int *x, int *y) |
| 2992 | { | 2992 | { |
| 2993 | Lisp_Object lmx = Qnil, lmy = Qnil; | ||
| 2994 | Lisp_Object mouse = mouse_position (tty_menu_calls_mouse_position_function); | 2993 | Lisp_Object mouse = mouse_position (tty_menu_calls_mouse_position_function); |
| 2995 | 2994 | ||
| 2996 | if (EQ (selected_frame, XCAR (mouse))) | 2995 | struct frame *f = XFRAME (XCAR (mouse)); |
| 2997 | { | 2996 | struct frame *sf = SELECTED_FRAME (); |
| 2998 | lmx = XCAR (XCDR (mouse)); | 2997 | if (f == sf || is_frame_ancestor (sf, f)) |
| 2999 | lmy = XCDR (XCDR (mouse)); | ||
| 3000 | } | ||
| 3001 | |||
| 3002 | if (!NILP (lmx)) | ||
| 3003 | { | 2998 | { |
| 3004 | *x = XFIXNUM (lmx); | 2999 | int fx, fy; |
| 3005 | *y = XFIXNUM (lmy); | 3000 | frame_pos_abs (f, &fx, &fy); |
| 3001 | *x = fx + XFIXNUM (XCAR (XCDR (mouse))); | ||
| 3002 | *y = fy + XFIXNUM (XCDR (XCDR (mouse))); | ||
| 3006 | } | 3003 | } |
| 3007 | } | 3004 | } |
| 3008 | 3005 | ||