aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Wiegley2016-04-02 14:51:33 -0700
committerJohn Wiegley2016-04-02 14:51:33 -0700
commitc558890bde00f4b5079edd2c1d0d51086af3b13b (patch)
treebeda72a5f248e3e758690a8d4562771519d1aa20
parent52c7b770d5f3d9deedf47fec4a23190d48bd62a1 (diff)
parente65c3079c65595d95749348366af9811fafff062 (diff)
downloademacs-c558890bde00f4b5079edd2c1d0d51086af3b13b.tar.gz
emacs-c558890bde00f4b5079edd2c1d0d51086af3b13b.zip
Merge from origin/emacs-25
e65c307 * src/font.c (QCuser_spec): Add missing colon to :user-spec. c8b868b Don't start the 'midnight' timer twice 278c8a7 * src/xwidget.c (Fxwidget_resize): Fix inappropriate use of X... e5c17f4 Fix todo-mode category movement bc70fda * lisp/xt-mouse.el (xterm-mouse-utf-8): Add :version. cf40f38 Ignore non-nil. non-cons values of unread-command-events 8ee4c52 Improve documentatuon of 'truncate-partial-width-windows' fb9a62c * src/ftfont.c (ftfont_shape_by_flt): Parenthesize as per GNU... 1e1ea22 Fix 'dired-goto-file' in Dired buffers produced by find-dired 3a13472 Fix map-put and map-delete for alists (Bug#23105) 422c3da Minor copyedits of documentation for temporary displays 90fb9b3 Add customization option for using UTF-8 coordinates in xt-mouse f14d463 Minor doc string fixes in replace.el e70ee9d Fix scrolling upwards with 'xwidget-webkit-browse-url' 44782de Fix display of Indic scripts 326c64f Fix splash screen display at startup 7ab2a97 ; In NEWS mention new display of minibuffer completions window a1cd84c Describe temporary displays in Emacs manual 5ec1056 Avoid stray As next to IDLW icons 45577d5 Avoid GTK 3 crash with icons and masks e99ff6e * lisp/minibuffer.el (minibuffer-completion-help): Use fit-wi... 077b78c Define make_save_ptr_ptr unconditionally 20a1003 Preserve current buffer when popping up TTY menus 7eba90c Improve font selection by family on MS-Windows 73d213f Comint, term, and compile now set EMACS 9524ec5 Ignore more merges when generating ChangeLog ad250f2 Sync with gnulib c0165ea Resurrect GNUS-NEWS autogeneration 1e5327c ; Backport ChangeLog.2 fixes from master e643977 Make `toggle-frame-maximized' respect the dock on OS X (bug#2... 38a43f1 Fix bug in displaying header line with a box face 91e6676 Fix an Isearch var to be a string (Bug#23038) 76ef522 Fix (args-out-of-range 1) error in cursor-sensor--detect 8a35f83 Render empty <ul><li><ul> correctly d8b2ce5 Ignore invalid base64 encoded embedded images 52ba24b Fix <p> and <div> newlines with or without <li> in shr b8ea08b Avoid errors in 'newline' fc3cd53 Fix Bug#23032 dd2737b Adjudicate review comments in abbrevs.texi 26f9c50 Fixup the "normal" matcher; highlight global var symbols, too 413e73b ; Small theme additions cd950da Honor prefix arg in doc-view-next-line-or-next-page ed909c0 ; Spelling fixes 6da3a6d Port to strict C99 offsetof de7601f Port to GTK with strict C11 compiler 658aa2d Port to GTK with strict C99 compiler 1df7173 Avoid screen artifacts with new OS X visible bell after scrol... 7a2edd3 Merge branch 'emacs-25' of git.sv.gnu.org:/srv/git/emacs into... dca240a Suppress some Tramp tests for OSX, do not merge with master 9094304 * lisp/progmodes/xref.el (xref-buffer-name, xref--window): Mo... cbedfc2 * lisp/gnus/mm-decode.el (gnus-format-message): Autoload it. 005ac7c * lisp/mail/rmail.el (rmail-mime-entity-truncated): Declare. 9ab03f2 ; Auto-commit of loaddefs files. 56df617 Address compilation warnings due to 2016-01-03 mml refactoring. a1ef911 * lisp/emacs-lisp/smie.el (smie-indent-keyword): Don't burp i... 79ae7fb * lisp/dired-x.el (dired-omit-here-always): Correct error mes... 253929f * lisp/dired-x.el (dired-omit-here-always): Replace undefined... ce53389 * lisp/xml.el (xml-parse-tag-1): Replace undefined function. d6d164f Avoid segfaults due to frame image cache being absent bc7f6f6 Improve documentation of glyphless-character display 6b6916e ; * src/xdisp.c (with_echo_area_buffer): Fix typos in comments. ee9a1f7 Support safe navigation operator in non-SMIE indentation code c3ed95b Move xsd:base64Binary decoding fix to debbugs.el 0.9.1 2036be4 Fix Ruby's operator precedence 1d686c2 (ruby-interpolation-inside-another-interpolation): New failin... 7950e1d Port to clang 3.7.0 on x86-64 218ae59 * test/automated/package-test.el (package-test-signed): Tweak... ba33b7c Sync with gnulib 38b276d Fix startup of "emacs -nw" on systems that CANNOT_DUMP dbfbedd Do not tokenize a comment before continuation as ';' 0403620 Don't misindent arguments of a method call inside continuation e6776f8 * src/keyboard.c (echo_keystrokes_p): Don't test cursor_in_ec... 8475f3d ASCII-only etc/NEWS etc. 5cc6919 Fix a cacheing bug, which led to inordinately slow c-beginnin... 0ce37ea Fix Isearch prompt when invoked with an argument f3033d4 Fix a typo in the Emacs manual 4235d2d Curved quotes in etc/NEWS etc. 26b56dc Fix some single quotes in documentation 80ec484 Make lisp-completion-at-point's argument optional 9d463ae Tweak the left precedence of '=>' 5b705bc Indent '.' relative to the first sibling expression 04f5525 Make '.' associative, for easier sexp navigation ba24c99 Revert "Simplify "Visit New File" to "New File""
-rwxr-xr-xbuild-aux/gitlog-to-emacslog2
-rw-r--r--doc/emacs/display.texi1
-rw-r--r--doc/emacs/emacs.texi1
-rw-r--r--doc/emacs/windows.texi86
-rw-r--r--etc/NEWS19
-rw-r--r--lisp/calendar/todo-mode.el25
-rw-r--r--lisp/comint.el7
-rw-r--r--lisp/dired.el15
-rw-r--r--lisp/emacs-lisp/map.el36
-rw-r--r--lisp/midnight.el8
-rw-r--r--lisp/minibuffer.el2
-rw-r--r--lisp/net/tramp-sh.el1
-rw-r--r--lisp/progmodes/compile.el8
-rw-r--r--lisp/progmodes/idlw-toolbar.el4
-rw-r--r--lisp/replace.el17
-rw-r--r--lisp/startup.el10
-rw-r--r--lisp/term.el7
-rw-r--r--lisp/xt-mouse.el129
-rw-r--r--src/alloc.c2
-rw-r--r--src/font.c2
-rw-r--r--src/frame.c2
-rw-r--r--src/ftfont.c7
-rw-r--r--src/gtkutil.c100
-rw-r--r--src/keyboard.c8
-rw-r--r--src/term.c7
-rw-r--r--src/w32font.c3
-rw-r--r--src/xdisp.c7
-rw-r--r--src/xwidget.c4
-rw-r--r--test/automated/xt-mouse-tests.el110
-rw-r--r--test/lisp/emacs-lisp/map-tests.el9
30 files changed, 463 insertions, 176 deletions
diff --git a/build-aux/gitlog-to-emacslog b/build-aux/gitlog-to-emacslog
index bcc47b1b28d..5c187f5eae0 100755
--- a/build-aux/gitlog-to-emacslog
+++ b/build-aux/gitlog-to-emacslog
@@ -77,7 +77,7 @@ test -d .git || {
77# Maybe we should skip all "Merge branch 'master'" messages. 77# Maybe we should skip all "Merge branch 'master'" messages.
78# See eg the cairo-related ones. 78# See eg the cairo-related ones.
79./build-aux/gitlog-to-changelog \ 79./build-aux/gitlog-to-changelog \
80 --ignore-matching="^; |^Merge branch '(master|emacs-[0-9][0-9])' of git\.(savannah|sv)\.gnu\.org:/srv/git/emacs$|^Merge remote-tracking branch '.*'$" \ 80 --ignore-matching="^; |^Merge branch '[^']*' of git\.(savannah|sv)\.gnu\.org:/srv/git/emacs|^Merge remote-tracking branch '.*'$" \
81 --ignore-line='^; ' --format='%B' \ 81 --ignore-line='^; ' --format='%B' \
82 "$gen_origin..$new_origin" >"ChangeLog.tmp" || exit 82 "$gen_origin..$new_origin" >"ChangeLog.tmp" || exit
83 83
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index c8987c279c5..01f899f1c09 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -1601,7 +1601,6 @@ screen lines. Setting the variable @code{truncate-lines} in any way
1601makes it local to the current buffer; until that time, the default 1601makes it local to the current buffer; until that time, the default
1602value, which is normally @code{nil}, is in effect. 1602value, which is normally @code{nil}, is in effect.
1603 1603
1604@vindex truncate-partial-width-windows
1605 If a split window becomes too narrow, Emacs may automatically enable 1604 If a split window becomes too narrow, Emacs may automatically enable
1606line truncation. @xref{Split Window}, for the variable 1605line truncation. @xref{Split Window}, for the variable
1607@code{truncate-partial-width-windows} which controls this. 1606@code{truncate-partial-width-windows} which controls this.
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index dc99d493241..c23c96f0745 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -519,6 +519,7 @@ Multiple Windows
519* Pop Up Window:: Finding a file or buffer in another window. 519* Pop Up Window:: Finding a file or buffer in another window.
520* Change Window:: Deleting windows and changing their sizes. 520* Change Window:: Deleting windows and changing their sizes.
521* Displaying Buffers:: How Emacs picks a window for displaying a buffer. 521* Displaying Buffers:: How Emacs picks a window for displaying a buffer.
522* Temporary Displays:: Displaying non-editable buffers.
522* Window Convenience:: Convenience functions for window handling. 523* Window Convenience:: Convenience functions for window handling.
523 524
524Displaying a Buffer in a Window 525Displaying a Buffer in a Window
diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi
index f99234b5c1b..702963f75c5 100644
--- a/doc/emacs/windows.texi
+++ b/doc/emacs/windows.texi
@@ -117,10 +117,14 @@ variable @code{truncate-lines} (@pxref{Line Truncation}); it is
117instead controlled by the variable 117instead controlled by the variable
118@code{truncate-partial-width-windows}. If the value of this variable 118@code{truncate-partial-width-windows}. If the value of this variable
119is a positive integer (the default is 50), that specifies the minimum 119is a positive integer (the default is 50), that specifies the minimum
120width for a partial-width window before automatic line truncation 120total width for a partial-width window before automatic line
121occurs; if the value is @code{nil}, automatic line truncation is 121truncation occurs; if the value is @code{nil}, automatic line
122disabled; and for any other non-@code{nil} value, Emacs truncates 122truncation is disabled; and for any other non-@code{nil} value, Emacs
123lines in every partial-width window regardless of its width. 123truncates lines in every partial-width window regardless of its width.
124The total width of a window is in column units as reported by
125@code{window-total-width} (@pxref{Window Sizes,,, elisp, The Emacs
126Lisp Reference Manual}), it includes the fringes, the continuation and
127truncation glyphs, the margins, and the scroll bar.
124 128
125 On text terminals, side-by-side windows are separated by a vertical 129 On text terminals, side-by-side windows are separated by a vertical
126divider which is drawn using the @code{vertical-border} face. 130divider which is drawn using the @code{vertical-border} face.
@@ -206,7 +210,7 @@ Choice}, for how Emacs picks or creates the window to use.
206Select buffer @var{bufname} in another window 210Select buffer @var{bufname} in another window
207(@code{switch-to-buffer-other-window}). 211(@code{switch-to-buffer-other-window}).
208 212
209@findex display-buffer 213@findex display-buffer @r{(command)}
210@item C-x 4 C-o @var{bufname} @key{RET} 214@item C-x 4 C-o @var{bufname} @key{RET}
211@kindex C-x 4 C-o 215@kindex C-x 4 C-o
212Display buffer @var{bufname} in some window, without trying to select 216Display buffer @var{bufname} in some window, without trying to select
@@ -345,7 +349,6 @@ user's attention will be diverted to that buffer. These commands
345usually work by calling @code{switch-to-buffer} internally 349usually work by calling @code{switch-to-buffer} internally
346(@pxref{Select Buffer}). 350(@pxref{Select Buffer}).
347 351
348@findex display-buffer
349 Some commands try to display intelligently, trying not to take 352 Some commands try to display intelligently, trying not to take
350over the selected window, e.g., by splitting off a new window and 353over the selected window, e.g., by splitting off a new window and
351displaying the desired buffer there. Such commands, which include the 354displaying the desired buffer there. Such commands, which include the
@@ -374,11 +377,12 @@ Several of these commands are bound in the @kbd{C-x 5} prefix key.
374 377
375@menu 378@menu
376* Window Choice:: How @code{display-buffer} works. 379* Window Choice:: How @code{display-buffer} works.
380* Temporary Displays:: Displaying non-editable buffers.
377@end menu 381@end menu
378 382
379@node Window Choice 383@node Window Choice
380@subsection How @code{display-buffer} works 384@subsection How @code{display-buffer} works
381@findex display-buffer 385@findex display-buffer, detailed description
382 386
383The @code{display-buffer} command (as well as commands that call it 387The @code{display-buffer} command (as well as commands that call it
384internally) chooses a window to display by following the steps given 388internally) chooses a window to display by following the steps given
@@ -411,15 +415,15 @@ By default, this step is skipped. To enable it, change the variable
411@code{graphic-only} means to do this only on graphical displays. 415@code{graphic-only} means to do this only on graphical displays.
412 416
413@item 417@item
414Otherwise, try to create a new window by splitting the selected 418Otherwise, try to create a new window by splitting a window on the
415window, and display the buffer in that new window. 419selected frame, and display the buffer in that new window.
416 420
417@vindex split-height-threshold 421@vindex split-height-threshold
418@vindex split-width-threshold 422@vindex split-width-threshold
419The split can be either vertical or horizontal, depending on the 423The split can be either vertical or horizontal, depending on the
420variables @code{split-height-threshold} and 424variables @code{split-height-threshold} and
421@code{split-width-threshold}. These variables should have integer 425@code{split-width-threshold}. These variables should have integer
422values. If @code{split-height-threshold} is smaller than the selected 426values. If @code{split-height-threshold} is smaller than the chosen
423window's height, the split puts the new window below. Otherwise, if 427window's height, the split puts the new window below. Otherwise, if
424@code{split-width-threshold} is smaller than the window's width, the 428@code{split-width-threshold} is smaller than the window's width, the
425split puts the new window on the right. If neither condition holds, 429split puts the new window on the right. If neither condition holds,
@@ -427,6 +431,12 @@ Emacs tries to split so that the new window is below---but only if the
427window was not split before (to avoid excessive splitting). 431window was not split before (to avoid excessive splitting).
428 432
429@item 433@item
434Otherwise, display the buffer in a window previously showing it.
435Normally, only windows on the selected frame are considered, but if
436@code{pop-up-frames} is non-@code{nil} the window may be also on another
437frame.
438
439@item
430Otherwise, display the buffer in an existing window on the selected 440Otherwise, display the buffer in an existing window on the selected
431frame. 441frame.
432 442
@@ -435,6 +445,62 @@ If all the above methods fail for whatever reason, create a new frame
435and display the buffer there. 445and display the buffer there.
436@end itemize 446@end itemize
437 447
448A more advanced and flexible way to customize the behavior of
449@code{display-buffer} is by using the option @code{display-buffer-alist}
450mentioned in the next section.
451
452
453@node Temporary Displays
454@subsection Displaying non-editable buffers.
455@cindex pop-up windows
456@cindex temporary windows
457
458Some buffers are shown in windows for perusal rather than for editing.
459Help commands (@pxref{Help}) typically use a buffer called @file{*Help*}
460for that purpose, minibuffer completion (@pxref{Completion}) uses a
461buffer called @file{*Completions*} instead. Such buffers are usually
462displayed only for a short period of time.
463
464 Normally, Emacs chooses the window for such temporary displays via
465@code{display-buffer} as described above. The @file{*Completions*}
466buffer, on the other hand, is normally displayed in a window at the
467bottom of the selected frame, regardless of the number of windows
468already shown on that frame.
469
470 If you prefer Emacs to display a temporary buffer in a different
471fashion, we recommend to customize the variable
472@code{display-buffer-alist} (@pxref{Choosing Window,,Choosing a Window
473for Display, elisp, The Emacs Lisp Reference Manual}). For example,
474to display @file{*Completions*} by splitting a window as described in
475the previous section, use the following form in your initialization
476file (@pxref{Init File}):
477
478@example
479@group
480(customize-set-variable
481 'display-buffer-alist
482 '(("\\*Completions\\*" display-buffer-pop-up-window)))
483@end group
484@end example
485
486@findex temp-buffer-resize-mode
487 The @file{*Completions*} buffer is also special in the sense that
488Emacs usually tries to make its window just as large as necessary to
489display all of its contents. To resize windows showing other
490temporary displays like, for example, the @file{*Help*} buffer
491accordingly, turn on the minor mode (@pxref{Minor Modes})
492@code{temp-buffer-resize-mode} (@pxref{Temporary Displays,,Temporary
493Displays, elisp, The Emacs Lisp Reference Manual}).
494
495@vindex temp-buffer-max-height
496@vindex temp-buffer-max-width
497 The maximum size of windows resized by @code{temp-buffer-resize-mode}
498can be controlled by customizing the options
499@code{temp-buffer-max-height} and @code{temp-buffer-max-width}
500(@pxref{Temporary Displays,,Temporary Displays, elisp, The Emacs Lisp
501Reference Manual}) and cannot exceed the size of the containing frame.
502
503
438@node Window Convenience 504@node Window Convenience
439@section Convenience Features for Window Handling 505@section Convenience Features for Window Handling
440 506
diff --git a/etc/NEWS b/etc/NEWS
index 726b4b9b711..d878228720e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -321,6 +321,12 @@ command line when 'initial-buffer-choice' is non-nil.
321** The value of 'initial-scratch-message' is now treated as a doc string 321** The value of 'initial-scratch-message' is now treated as a doc string
322and can contain escape sequences for command keys, quotes, and the like. 322and can contain escape sequences for command keys, quotes, and the like.
323 323
324---
325** The default height of GUI frames was enlarged.
326This is so there's enough space in the initial window to display the
327optional text about recovering crashes sessions, without losing the
328splash image display.
329
324 330
325* Changes in Emacs 25.1 331* Changes in Emacs 25.1
326 332
@@ -1695,7 +1701,8 @@ symbol-function was changed not to signal 'void-function' any more.
1695*** As a consequence, the second arg of 'indirect-function' is now obsolete. 1701*** As a consequence, the second arg of 'indirect-function' is now obsolete.
1696 1702
1697+++ 1703+++
1698** Comint, term, and compile do not set the EMACS env var any more. 1704** Although comint, term, and compile still set the EMACS variable,
1705this is now considered deprecated and will be removed in a future release.
1699Use the INSIDE_EMACS environment variable instead. 1706Use the INSIDE_EMACS environment variable instead.
1700 1707
1701** 'C-up', 'C-down', 'C-left' and 'C-right' are now defined in term 1708** 'C-up', 'C-down', 'C-left' and 'C-right' are now defined in term
@@ -2240,6 +2247,16 @@ frames.
2240'window-divider-default-places', 'window-divider-default-bottom-width' 2247'window-divider-default-places', 'window-divider-default-bottom-width'
2241and 'window-divider-default-right-width'. 2248and 'window-divider-default-right-width'.
2242 2249
2250+++
2251*** The window displaying the '*Completions*' buffer with minibuffer
2252completion candidates is now shown at the bottom of the selected
2253frame. The size of that window is always as large as required to
2254display all the candidates, except when limited by the minimum size
2255of the other windows on that frame; those other windows are resized
2256to provide space for the '*Completions*' display. The Emacs manual
2257describes how to customize 'display-buffer-alist' to get back the old
2258behavior, see the node "Temporary Displays" there.
2259
2243--- 2260---
2244** Tearoff menus and detachable toolbars for Gtk+ have been removed. 2261** Tearoff menus and detachable toolbars for Gtk+ have been removed.
2245Those features have been deprecated in Gtk+ for a long time. 2262Those features have been deprecated in Gtk+ for a long time.
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 94cd08eaa4e..9574c03043e 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -1414,7 +1414,12 @@ the archive of the file moved to, creating it if it does not exist."
1414 (setq todo-files (funcall todo-files-function)) 1414 (setq todo-files (funcall todo-files-function))
1415 (todo-reevaluate-filelist-defcustoms)) 1415 (todo-reevaluate-filelist-defcustoms))
1416 (dolist (buf buffers) 1416 (dolist (buf buffers)
1417 ;; Make sure archive file is in Todo Archive mode so that
1418 ;; todo-categories has correct value.
1417 (with-current-buffer (find-file-noselect buf) 1419 (with-current-buffer (find-file-noselect buf)
1420 (when (equal (file-name-extension (buffer-file-name)) "toda")
1421 (unless (derived-mode-p 'todo-archive-mode)
1422 (todo-archive-mode)))
1418 (widen) 1423 (widen)
1419 (goto-char (point-max)) 1424 (goto-char (point-max))
1420 (let* ((beg (re-search-backward 1425 (let* ((beg (re-search-backward
@@ -1466,10 +1471,18 @@ the archive of the file moved to, creating it if it does not exist."
1466 (re-search-backward 1471 (re-search-backward
1467 (concat "^" (regexp-quote todo-category-beg) 1472 (concat "^" (regexp-quote todo-category-beg)
1468 "\\(" (regexp-quote cat) "\\)$") nil t) 1473 "\\(" (regexp-quote cat) "\\)$") nil t)
1469 (replace-match new nil nil nil 1))) 1474 (replace-match new nil nil nil 1))
1470 (setq todo-categories 1475 (setq todo-categories
1471 (append todo-categories (list (cons (or new cat) counts)))) 1476 (append todo-categories (list (cons (or new cat) counts))))
1472 (todo-update-categories-sexp) 1477 (goto-char (point-min))
1478 (if (looking-at "((\"")
1479 ;; Delete existing sexp.
1480 (delete-region (line-beginning-position) (line-end-position))
1481 ;; Otherwise, file is new, so make space for categories sexp.
1482 (insert "\n")
1483 (goto-char (point-min)))
1484 ;; Insert (new or updated) sexp.
1485 (prin1 todo-categories (current-buffer)))
1473 ;; If archive was just created, save it to avoid "File 1486 ;; If archive was just created, save it to avoid "File
1474 ;; <xyz> no longer exists!" message on invoking 1487 ;; <xyz> no longer exists!" message on invoking
1475 ;; `todo-view-archived-items'. 1488 ;; `todo-view-archived-items'.
@@ -1500,9 +1513,7 @@ the archive of the file moved to, creating it if it does not exist."
1500 (setq todo-category-number 1)) 1513 (setq todo-category-number 1))
1501 (todo-category-select))))) 1514 (todo-category-select)))))
1502 (set-window-buffer (selected-window) 1515 (set-window-buffer (selected-window)
1503 (set-buffer (find-file-noselect nfile))) 1516 (set-buffer (find-file-noselect nfile))))))
1504 (todo-category-number (or new cat))
1505 (todo-category-select))))
1506 1517
1507(defun todo-merge-category (&optional file) 1518(defun todo-merge-category (&optional file)
1508 "Merge current category into another existing category. 1519 "Merge current category into another existing category.
diff --git a/lisp/comint.el b/lisp/comint.el
index dcd4a5ae4cf..cb79c175f0e 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -816,6 +816,13 @@ series of processes in the same Comint buffer. The hook
816 (format "COLUMNS=%d" (window-width))) 816 (format "COLUMNS=%d" (window-width)))
817 (list "TERM=emacs" 817 (list "TERM=emacs"
818 (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width)))) 818 (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width))))
819
820 ;; This hack is for backward compatibility with Bash 4.3 and
821 ;; earlier. It can break common uses of 'configure', so
822 ;; remove it once Bash 4.4 or later is common.
823 (unless (getenv "EMACS")
824 (list "EMACS=t"))
825
819 (list (format "INSIDE_EMACS=%s,comint" emacs-version)) 826 (list (format "INSIDE_EMACS=%s,comint" emacs-version))
820 process-environment)) 827 process-environment))
821 (default-directory 828 (default-directory
diff --git a/lisp/dired.el b/lisp/dired.el
index 6c7445c3486..2a65bd09cc5 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2740,9 +2740,18 @@ instead of `dired-actual-switches'."
2740 (save-excursion 2740 (save-excursion
2741 (goto-char (point-min)) 2741 (goto-char (point-min))
2742 (dired-goto-file-1 file file (point-max))) 2742 (dired-goto-file-1 file file (point-max)))
2743 ;; Otherwise, look for it as a relative name. The 2743 ;; Next, look for it as a relative name with leading
2744 ;; hair is to get the result of `dired-goto-subdir' 2744 ;; subdirectories. (This happens in Dired buffers
2745 ;; without calling it if we don't have any subdirs. 2745 ;; created by find-dired, for example.)
2746 (save-excursion
2747 (goto-char (point-min))
2748 (dired-goto-file-1 (file-relative-name file
2749 default-directory)
2750 file (point-max)))
2751 ;; Otherwise, look for it as a relative name, a base
2752 ;; name only. The hair is to get the result of
2753 ;; `dired-goto-subdir' without calling it if we don't
2754 ;; have any subdirs.
2746 (save-excursion 2755 (save-excursion
2747 (when (if (string= dir (expand-file-name default-directory)) 2756 (when (if (string= dir (expand-file-name default-directory))
2748 (goto-char (point-min)) 2757 (goto-char (point-min))
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el
index ec8d3d79d9f..ba15a65f5e1 100644
--- a/lisp/emacs-lisp/map.el
+++ b/lisp/emacs-lisp/map.el
@@ -123,33 +123,26 @@ MAP can be a list, hash-table or array."
123 default))) 123 default)))
124 124
125(defmacro map-put (map key value) 125(defmacro map-put (map key value)
126 "Associate KEY with VALUE in MAP and return MAP. 126 "Associate KEY with VALUE in MAP and return VALUE.
127If KEY is already present in MAP, replace the associated value 127If KEY is already present in MAP, replace the associated value
128with VALUE. 128with VALUE.
129 129
130MAP can be a list, hash-table or array." 130MAP can be a list, hash-table or array."
131 (macroexp-let2 nil map map 131 `(setf (map-elt ,map ,key) ,value))
132 `(progn
133 (setf (map-elt ,map ,key) ,value)
134 ,map)))
135 132
136(defmacro map-delete (map key) 133(defun map-delete (map key)
137 "Delete KEY from MAP and return MAP. 134 "Delete KEY from MAP and return MAP.
138No error is signaled if KEY is not a key of MAP. If MAP is an 135No error is signaled if KEY is not a key of MAP. If MAP is an
139array, store nil at the index KEY. 136array, store nil at the index KEY.
140 137
141MAP can be a list, hash-table or array." 138MAP can be a list, hash-table or array."
142 (declare (debug t)) 139 (map--dispatch map
143 (gv-letplace (mgetter msetter) `(gv-delay-error ,map) 140 :list (setf (alist-get key map nil t) nil)
144 (macroexp-let2 nil key key 141 :hash-table (remhash key map)
145 `(if (not (listp ,mgetter)) 142 :array (and (>= key 0)
146 (map--delete ,mgetter ,key) 143 (<= key (seq-length map))
147 ;; The alist case is special, since it can't be handled by the 144 (aset map key nil)))
148 ;; map--delete function. 145 map)
149 (setf (alist-get ,key (gv-synthetic-place ,mgetter ,msetter)
150 nil t)
151 nil)
152 ,mgetter))))
153 146
154(defun map-nested-elt (map keys &optional default) 147(defun map-nested-elt (map keys &optional default)
155 "Traverse MAP using KEYS and return the looked up value or DEFAULT if nil. 148 "Traverse MAP using KEYS and return the looked up value or DEFAULT if nil.
@@ -337,15 +330,6 @@ MAP can be a list, hash-table or array."
337 (cdr pair))) 330 (cdr pair)))
338 map)) 331 map))
339 332
340(defun map--delete (map key)
341 (map--dispatch map
342 :list (error "No place to remove the mapping for %S" key)
343 :hash-table (remhash key map)
344 :array (and (>= key 0)
345 (<= key (seq-length map))
346 (aset map key nil)))
347 map)
348
349(defun map--apply-hash-table (function map) 333(defun map--apply-hash-table (function map)
350 "Private function used to apply FUNCTION over MAP, MAP being a hash-table." 334 "Private function used to apply FUNCTION over MAP, MAP being a hash-table."
351 (let (result) 335 (let (result)
diff --git a/lisp/midnight.el b/lisp/midnight.el
index 0e68eb923cd..878c5a7f71f 100644
--- a/lisp/midnight.el
+++ b/lisp/midnight.el
@@ -53,8 +53,12 @@ the time when it is run.")
53 "Non-nil means run `midnight-hook' at midnight." 53 "Non-nil means run `midnight-hook' at midnight."
54 :global t 54 :global t
55 :initialize #'custom-initialize-default 55 :initialize #'custom-initialize-default
56 (if midnight-mode (timer-activate midnight-timer) 56 ;; Disable first, since the ':initialize' function above already
57 (cancel-timer midnight-timer))) 57 ;; starts the timer when the mode is turned on for the first time,
58 ;; via setting 'midnight-delay', which calls 'midnight-delay-set',
59 ;; which starts the timer.
60 (when (timerp midnight-timer) (cancel-timer midnight-timer))
61 (if midnight-mode (timer-activate midnight-timer)))
58 62
59;;; time conversion 63;;; time conversion
60 64
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index ecac0aeb135..6540059b965 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1835,7 +1835,7 @@ variables.")
1835 'display-buffer-below-selected)) 1835 'display-buffer-below-selected))
1836 ,(if temp-buffer-resize-mode 1836 ,(if temp-buffer-resize-mode
1837 '(window-height . resize-temp-buffer-window) 1837 '(window-height . resize-temp-buffer-window)
1838 '(window-height . shrink-window-if-larger-than-buffer)) 1838 '(window-height . fit-window-to-buffer))
1839 ,(when temp-buffer-resize-mode 1839 ,(when temp-buffer-resize-mode
1840 '(preserve-size . (nil . t)))) 1840 '(preserve-size . (nil . t))))
1841 nil 1841 nil
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 402e1cc3332..7260107d0f7 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -542,6 +542,7 @@ as given in your `~/.profile'."
542(defcustom tramp-remote-process-environment 542(defcustom tramp-remote-process-environment
543 `("TMOUT=0" "LC_CTYPE=''" 543 `("TMOUT=0" "LC_CTYPE=''"
544 ,(format "TERM=%s" tramp-terminal-type) 544 ,(format "TERM=%s" tramp-terminal-type)
545 "EMACS=t" ;; Deprecated; remove this line once Bash 4.4-or-later is common.
545 ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version) 546 ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version)
546 "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat" 547 "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat"
547 "autocorrect=" "correct=") 548 "autocorrect=" "correct=")
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index b7ab408f744..0b15a283090 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1702,6 +1702,14 @@ Returns the compilation buffer created."
1702 (list "TERM=emacs" 1702 (list "TERM=emacs"
1703 (format "TERMCAP=emacs:co#%d:tc=unknown:" 1703 (format "TERMCAP=emacs:co#%d:tc=unknown:"
1704 (window-width)))) 1704 (window-width))))
1705
1706 ;; Set the EMACS variable, but
1707 ;; don't override users' setting of $EMACS.
1708 ;; Remove this hack once Bash 4.4-or-later is common,
1709 ;; since it can break 'configure'.
1710 (unless (getenv "EMACS")
1711 (list "EMACS=t"))
1712
1705 (list (format "INSIDE_EMACS=%s,compile" emacs-version)) 1713 (list (format "INSIDE_EMACS=%s,compile" emacs-version))
1706 (copy-sequence process-environment)))) 1714 (copy-sequence process-environment))))
1707 (set (make-local-variable 'compilation-arguments) 1715 (set (make-local-variable 'compilation-arguments)
diff --git a/lisp/progmodes/idlw-toolbar.el b/lisp/progmodes/idlw-toolbar.el
index 0e0714e27ed..d857bfd88c3 100644
--- a/lisp/progmodes/idlw-toolbar.el
+++ b/lisp/progmodes/idlw-toolbar.el
@@ -439,7 +439,7 @@ static char * file[] = {
439\" \", 439\" \",
440\" \", 440\" \",
441\" \"};") 441\" \"};")
442 "The Cont icon.") 442 "The Cont icon.")
443 443
444(defvar idlwave-toolbar-to-here-icon 444(defvar idlwave-toolbar-to-here-icon
445 (idlwave-toolbar-make-button 445 (idlwave-toolbar-make-button
@@ -918,7 +918,7 @@ static char * file[] = {
918 (help (aref x 3)) 918 (help (aref x 3))
919 (key (vector 'tool-bar func)) 919 (key (vector 'tool-bar func))
920 (def (list 'menu-item 920 (def (list 'menu-item
921 "a" 921 ""
922 func 922 func
923 :image (symbol-value icon) 923 :image (symbol-value icon)
924 :visible show 924 :visible show
diff --git a/lisp/replace.el b/lisp/replace.el
index a2ce78a8bb2..2c6a23ae618 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -293,7 +293,8 @@ As each match is found, the user must type a character saying
293what to do with it. For directions, type \\[help-command] at that time. 293what to do with it. For directions, type \\[help-command] at that time.
294 294
295In Transient Mark mode, if the mark is active, operate on the contents 295In Transient Mark mode, if the mark is active, operate on the contents
296of the region. Otherwise, operate from point to the end of the buffer. 296of the region. Otherwise, operate from point to the end of the buffer's
297accessible portion.
297 298
298Use \\<minibuffer-local-map>\\[next-history-element] \ 299Use \\<minibuffer-local-map>\\[next-history-element] \
299to pull the last incremental search string to the minibuffer 300to pull the last incremental search string to the minibuffer
@@ -355,7 +356,8 @@ As each match is found, the user must type a character saying
355what to do with it. For directions, type \\[help-command] at that time. 356what to do with it. For directions, type \\[help-command] at that time.
356 357
357In Transient Mark mode, if the mark is active, operate on the contents 358In Transient Mark mode, if the mark is active, operate on the contents
358of the region. Otherwise, operate from point to the end of the buffer. 359of the region. Otherwise, operate from point to the end of the buffer's
360accessible portion.
359 361
360Use \\<minibuffer-local-map>\\[next-history-element] \ 362Use \\<minibuffer-local-map>\\[next-history-element] \
361to pull the last incremental search regexp to the minibuffer 363to pull the last incremental search regexp to the minibuffer
@@ -452,7 +454,8 @@ Use `\\#&' or `\\#N' if you want a number instead of a string.
452In interactive use, `\\#' in itself stands for `replace-count'. 454In interactive use, `\\#' in itself stands for `replace-count'.
453 455
454In Transient Mark mode, if the mark is active, operate on the contents 456In Transient Mark mode, if the mark is active, operate on the contents
455of the region. Otherwise, operate from point to the end of the buffer. 457of the region. Otherwise, operate from point to the end of the buffer's
458accessible portion.
456 459
457Use \\<minibuffer-local-map>\\[next-history-element] \ 460Use \\<minibuffer-local-map>\\[next-history-element] \
458to pull the last incremental search regexp to the minibuffer 461to pull the last incremental search regexp to the minibuffer
@@ -507,7 +510,8 @@ each successive replacement uses the next successive replacement string,
507wrapping around from the last such string to the first. 510wrapping around from the last such string to the first.
508 511
509In Transient Mark mode, if the mark is active, operate on the contents 512In Transient Mark mode, if the mark is active, operate on the contents
510of the region. Otherwise, operate from point to the end of the buffer. 513of the region. Otherwise, operate from point to the end of the buffer's
514accessible portion.
511 515
512Non-interactively, TO-STRINGS may be a list of replacement strings. 516Non-interactively, TO-STRINGS may be a list of replacement strings.
513 517
@@ -573,7 +577,7 @@ replace backward.
573Operates on the region between START and END (if both are nil, from point 577Operates on the region between START and END (if both are nil, from point
574to the end of the buffer). Interactively, if Transient Mark mode is 578to the end of the buffer). Interactively, if Transient Mark mode is
575enabled and the mark is active, operates on the contents of the region; 579enabled and the mark is active, operates on the contents of the region;
576otherwise from point to the end of the buffer. 580otherwise from point to the end of the buffer's accessible portion.
577 581
578Use \\<minibuffer-local-map>\\[next-history-element] \ 582Use \\<minibuffer-local-map>\\[next-history-element] \
579to pull the last incremental search string to the minibuffer 583to pull the last incremental search string to the minibuffer
@@ -620,7 +624,8 @@ regexp in `search-whitespace-regexp'.
620This function is not affected by `replace-character-fold' 624This function is not affected by `replace-character-fold'
621 625
622In Transient Mark mode, if the mark is active, operate on the contents 626In Transient Mark mode, if the mark is active, operate on the contents
623of the region. Otherwise, operate from point to the end of the buffer. 627of the region. Otherwise, operate from point to the end of the buffer's
628accessible portion.
624 629
625Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace 630Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace
626only matches surrounded by word boundaries. A negative prefix arg means 631only matches surrounded by word boundaries. A negative prefix arg means
diff --git a/lisp/startup.el b/lisp/startup.el
index 15a79f6f5bf..536289c3891 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1890,10 +1890,12 @@ we put it on this frame."
1890 (when frame 1890 (when frame
1891 (let* ((img (create-image (fancy-splash-image-file))) 1891 (let* ((img (create-image (fancy-splash-image-file)))
1892 (image-height (and img (cdr (image-size img nil frame)))) 1892 (image-height (and img (cdr (image-size img nil frame))))
1893 ;; We test frame-height so that, if the frame is split 1893 ;; We test frame-height and not window-height so that,
1894 ;; by displaying a warning, that doesn't cause the normal 1894 ;; if the frame is split by displaying a warning, that
1895 ;; splash screen to be used. 1895 ;; doesn't cause the normal splash screen to be used.
1896 (frame-height (1- (frame-height frame)))) 1896 ;; We subtract 2 from frame-height to account for the
1897 ;; echo area and the mode line.
1898 (frame-height (- (frame-height frame) 2)))
1897 (> frame-height (+ image-height 19))))))) 1899 (> frame-height (+ image-height 19)))))))
1898 1900
1899 1901
diff --git a/lisp/term.el b/lisp/term.el
index c1e827875d1..ecaca505683 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1462,6 +1462,13 @@ Using \"emacs\" loses, because bash disables editing if $TERM == emacs.")
1462 (format "TERMINFO=%s" data-directory) 1462 (format "TERMINFO=%s" data-directory)
1463 (format term-termcap-format "TERMCAP=" 1463 (format term-termcap-format "TERMCAP="
1464 term-term-name term-height term-width) 1464 term-term-name term-height term-width)
1465
1466 ;; This is for backwards compatibility with Bash 4.3 and earlier.
1467 ;; Remove this hack once Bash 4.4-or-later is common, because
1468 ;; it breaks './configure' of some packages that expect it to
1469 ;; say where to find EMACS.
1470 (format "EMACS=%s (term:%s)" emacs-version term-protocol-version)
1471
1465 (format "INSIDE_EMACS=%s,term:%s" emacs-version term-protocol-version) 1472 (format "INSIDE_EMACS=%s,term:%s" emacs-version term-protocol-version)
1466 (format "LINES=%d" term-height) 1473 (format "LINES=%d" term-height)
1467 (format "COLUMNS=%d" term-width)) 1474 (format "COLUMNS=%d" term-width))
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index 5975e60272f..e52095789ba 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -134,23 +134,35 @@ http://invisible-island.net/xterm/ctlseqs/ctlseqs.html)."
134 (fdiff (- f (* 1.0 maxwrap dbig)))) 134 (fdiff (- f (* 1.0 maxwrap dbig))))
135 (+ (truncate fdiff) (* maxwrap dbig)))))) 135 (+ (truncate fdiff) (* maxwrap dbig))))))
136 136
137(defun xterm-mouse--read-utf8-char (&optional prompt seconds) 137(defcustom xterm-mouse-utf-8 nil
138 "Read an utf-8 encoded character from the current terminal. 138 "Non-nil if UTF-8 coordinates should be used to read mouse coordinates.
139This function reads and returns an utf-8 encoded character of 139Set this to non-nil if you are sure that your terminal
140command input. If the user generates an event which is not a 140understands UTF-8 coordinates, but not SGR coordinates."
141character (i.e., a mouse click or function key event), read-char 141 :version "25.1"
142signals an error. 142 :type 'boolean
143 143 :risky t
144The returned event may come directly from the user, or from a 144 :group 'xterm)
145keyboard macro. It is not decoded by the keyboard's input coding 145
146system and always treated with an utf-8 input encoding. 146(defun xterm-mouse--read-coordinate ()
147 147 "Read a mouse coordinate from the current terminal.
148The optional arguments PROMPT and SECONDS work like in 148If `xterm-mouse-utf-8' was non-nil when
149`read-event'." 149`turn-on-xterm-mouse-tracking-on-terminal' was called, reads the
150 (let ((tmp (keyboard-coding-system))) 150coordinate as an UTF-8 code unit sequence; otherwise, reads a
151 (set-keyboard-coding-system 'utf-8) 151single byte."
152 (prog1 (read-event prompt t seconds) 152 (let ((previous-keyboard-coding-system (keyboard-coding-system)))
153 (set-keyboard-coding-system tmp)))) 153 (unwind-protect
154 (progn
155 (set-keyboard-coding-system
156 (if (terminal-parameter nil 'xterm-mouse-utf-8)
157 'utf-8-unix
158 ;; Use Latin-1 instead of no-conversion to avoid flicker
159 ;; due to `set-keyboard-coding-system' changing the meta
160 ;; mode.
161 'latin-1))
162 ;; Wait only a little; we assume that the entire escape sequence
163 ;; has already been sent when this function is called.
164 (read-char nil nil 0.1))
165 (set-keyboard-coding-system previous-keyboard-coding-system))))
154 166
155;; In default mode, each numeric parameter of XTerm's mouse report is 167;; In default mode, each numeric parameter of XTerm's mouse report is
156;; a single char, possibly encoded as utf-8. The actual numeric 168;; a single char, possibly encoded as utf-8. The actual numeric
@@ -170,7 +182,7 @@ The optional arguments PROMPT and SECONDS work like in
170 (<= ?0 c ?9)) 182 (<= ?0 c ?9))
171 (setq n (+ (* 10 n) c (- ?0)))) 183 (setq n (+ (* 10 n) c (- ?0))))
172 (cons n c)) 184 (cons n c))
173 (cons (- (setq c (xterm-mouse--read-utf8-char)) 32) c)))) 185 (cons (- (setq c (xterm-mouse--read-coordinate)) 32) c))))
174 186
175;; XTerm reports mouse events as 187;; XTerm reports mouse events as
176;; <EVENT-CODE> <X> <Y> in default mode, and 188;; <EVENT-CODE> <X> <Y> in default mode, and
@@ -314,6 +326,38 @@ down the SHIFT key while pressing the mouse button."
314 (mapc #'turn-off-xterm-mouse-tracking-on-terminal (terminal-list)) 326 (mapc #'turn-off-xterm-mouse-tracking-on-terminal (terminal-list))
315 (setq mouse-position-function nil))) 327 (setq mouse-position-function nil)))
316 328
329(defun xterm-mouse-tracking-enable-sequence ()
330 "Return a control sequence to enable XTerm mouse tracking.
331The returned control sequence enables basic mouse tracking, mouse
332motion events and finally extended tracking on terminals that
333support it. The following escape sequences are understood by
334modern xterms:
335
336\"\\e[?1000h\" \"Basic mouse mode\": Enables reports for mouse
337 clicks. There is a limit to the maximum row/column
338 position (<= 223), which can be reported in this
339 basic mode.
340
341\"\\e[?1002h\" \"Mouse motion mode\": Enables reports for mouse
342 motion events during dragging operations.
343
344\"\\e[?1005h\" \"UTF-8 coordinate extension\": Enables an
345 extension to the basic mouse mode, which uses UTF-8
346 characters to overcome the 223 row/column limit.
347 This extension may conflict with non UTF-8
348 applications or non UTF-8 locales. It is only
349 enabled when the option `xterm-mouse-utf-8' is
350 non-nil.
351
352\"\\e[?1006h\" \"SGR coordinate extension\": Enables a newer
353 alternative extension to the basic mouse mode, which
354 overcomes the 223 row/column limit without the
355 drawbacks of the UTF-8 coordinate extension.
356
357The two extension modes are mutually exclusive, where the last
358given escape sequence takes precedence over the former."
359 (apply #'concat (xterm-mouse--tracking-sequence ?h)))
360
317(defconst xterm-mouse-tracking-enable-sequence 361(defconst xterm-mouse-tracking-enable-sequence
318 "\e[?1000h\e[?1002h\e[?1005h\e[?1006h" 362 "\e[?1000h\e[?1002h\e[?1005h\e[?1006h"
319 "Control sequence to enable xterm mouse tracking. 363 "Control sequence to enable xterm mouse tracking.
@@ -343,10 +387,34 @@ escape sequences are understood by modern xterms:
343The two extension modes are mutually exclusive, where the last 387The two extension modes are mutually exclusive, where the last
344given escape sequence takes precedence over the former.") 388given escape sequence takes precedence over the former.")
345 389
390(make-obsolete-variable
391 'xterm-mouse-tracking-enable-sequence
392 "use the function `xterm-mouse-tracking-enable-sequence' instead."
393 "25.1")
394
395(defun xterm-mouse-tracking-disable-sequence ()
396 "Return a control sequence to disable XTerm mouse tracking.
397The control sequence resets the modes set by
398`xterm-mouse-tracking-enable-sequence'."
399 (apply #'concat (nreverse (xterm-mouse--tracking-sequence ?l))))
400
346(defconst xterm-mouse-tracking-disable-sequence 401(defconst xterm-mouse-tracking-disable-sequence
347 "\e[?1006l\e[?1005l\e[?1002l\e[?1000l" 402 "\e[?1006l\e[?1005l\e[?1002l\e[?1000l"
348 "Reset the modes set by `xterm-mouse-tracking-enable-sequence'.") 403 "Reset the modes set by `xterm-mouse-tracking-enable-sequence'.")
349 404
405(make-obsolete-variable
406 'xterm-mouse-tracking-disable-sequence
407 "use the function `xterm-mouse-tracking-disable-sequence' instead."
408 "25.1")
409
410(defun xterm-mouse--tracking-sequence (suffix)
411 "Return a control sequence to enable or disable mouse tracking.
412SUFFIX is the last character of each escape sequence (?h to
413enable, ?l to disable)."
414 (mapcar
415 (lambda (code) (format "\e[?%d%c" code suffix))
416 `(1000 1002 ,@(when xterm-mouse-utf-8 '(1005)) 1006)))
417
350(defun turn-on-xterm-mouse-tracking-on-terminal (&optional terminal) 418(defun turn-on-xterm-mouse-tracking-on-terminal (&optional terminal)
351 "Enable xterm mouse tracking on TERMINAL." 419 "Enable xterm mouse tracking on TERMINAL."
352 (when (and xterm-mouse-mode (eq t (terminal-live-p terminal)) 420 (when (and xterm-mouse-mode (eq t (terminal-live-p terminal))
@@ -360,18 +428,19 @@ given escape sequence takes precedence over the former.")
360 (with-selected-frame (car (frames-on-display-list terminal)) 428 (with-selected-frame (car (frames-on-display-list terminal))
361 (define-key input-decode-map "\e[M" 'xterm-mouse-translate) 429 (define-key input-decode-map "\e[M" 'xterm-mouse-translate)
362 (define-key input-decode-map "\e[<" 'xterm-mouse-translate-extended)) 430 (define-key input-decode-map "\e[<" 'xterm-mouse-translate-extended))
363 (condition-case err 431 (let ((enable (xterm-mouse-tracking-enable-sequence))
364 (send-string-to-terminal xterm-mouse-tracking-enable-sequence 432 (disable (xterm-mouse-tracking-disable-sequence)))
365 terminal) 433 (condition-case err
366 ;; FIXME: This should use a dedicated error signal. 434 (send-string-to-terminal enable terminal)
367 (error (if (equal (cadr err) "Terminal is currently suspended") 435 ;; FIXME: This should use a dedicated error signal.
368 nil ;The sequence will be sent upon resume. 436 (error (if (equal (cadr err) "Terminal is currently suspended")
369 (signal (car err) (cdr err))))) 437 nil ; The sequence will be sent upon resume.
370 (push xterm-mouse-tracking-enable-sequence 438 (signal (car err) (cdr err)))))
371 (terminal-parameter nil 'tty-mode-set-strings)) 439 (push enable (terminal-parameter nil 'tty-mode-set-strings))
372 (push xterm-mouse-tracking-disable-sequence 440 (push disable (terminal-parameter nil 'tty-mode-reset-strings))
373 (terminal-parameter nil 'tty-mode-reset-strings)) 441 (set-terminal-parameter terminal 'xterm-mouse-mode t)
374 (set-terminal-parameter terminal 'xterm-mouse-mode t)))) 442 (set-terminal-parameter terminal 'xterm-mouse-utf-8
443 xterm-mouse-utf-8)))))
375 444
376(defun turn-off-xterm-mouse-tracking-on-terminal (terminal) 445(defun turn-off-xterm-mouse-tracking-on-terminal (terminal)
377 "Disable xterm mouse tracking on TERMINAL." 446 "Disable xterm mouse tracking on TERMINAL."
diff --git a/src/alloc.c b/src/alloc.c
index 1e4ec8b0573..56a535411c8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3724,7 +3724,6 @@ make_save_ptr_int (void *a, ptrdiff_t b)
3724 return val; 3724 return val;
3725} 3725}
3726 3726
3727#if ! (defined USE_X_TOOLKIT || defined USE_GTK)
3728Lisp_Object 3727Lisp_Object
3729make_save_ptr_ptr (void *a, void *b) 3728make_save_ptr_ptr (void *a, void *b)
3730{ 3729{
@@ -3735,7 +3734,6 @@ make_save_ptr_ptr (void *a, void *b)
3735 p->data[1].pointer = b; 3734 p->data[1].pointer = b;
3736 return val; 3735 return val;
3737} 3736}
3738#endif
3739 3737
3740Lisp_Object 3738Lisp_Object
3741make_save_funcptr_ptr_obj (void (*a) (void), void *b, Lisp_Object c) 3739make_save_funcptr_ptr_obj (void (*a) (void), void *b, Lisp_Object c)
diff --git a/src/font.c b/src/font.c
index 5ab3b3e8399..2519599bc63 100644
--- a/src/font.c
+++ b/src/font.c
@@ -5317,7 +5317,7 @@ syms_of_font (void)
5317 DEFSYM (Qja, "ja"); 5317 DEFSYM (Qja, "ja");
5318 DEFSYM (Qko, "ko"); 5318 DEFSYM (Qko, "ko");
5319 5319
5320 DEFSYM (QCuser_spec, "user-spec"); 5320 DEFSYM (QCuser_spec, ":user-spec");
5321 5321
5322 staticpro (&scratch_font_spec); 5322 staticpro (&scratch_font_spec);
5323 scratch_font_spec = Ffont_spec (0, NULL); 5323 scratch_font_spec = Ffont_spec (0, NULL);
diff --git a/src/frame.c b/src/frame.c
index 88102a36625..9c8926c42c7 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -4563,7 +4563,7 @@ On Nextstep, this just calls `ns-parse-geometry'. */)
4563 4563
4564 This function does not make the coordinates positive. */ 4564 This function does not make the coordinates positive. */
4565 4565
4566#define DEFAULT_ROWS 35 4566#define DEFAULT_ROWS 36
4567#define DEFAULT_COLS 80 4567#define DEFAULT_COLS 80
4568 4568
4569long 4569long
diff --git a/src/ftfont.c b/src/ftfont.c
index a402245a067..7285aee9bd4 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -2596,7 +2596,12 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font,
2596 language information, and select a proper flt for them 2596 language information, and select a proper flt for them
2597 here. */ 2597 here. */
2598 int c1 = LGLYPH_CHAR (LGSTRING_GLYPH (lgstring, 1)); 2598 int c1 = LGLYPH_CHAR (LGSTRING_GLYPH (lgstring, 1));
2599 if (CHAR_HAS_CATEGORY (c1, '^')) 2599 /* For the combining characters in the range U+300..U+36F,
2600 "combining" is the sole FLT provided by the m17n-lib. In
2601 addition, it is the sole FLT that can handle the other
2602 combining characters with non-OTF fonts. */
2603 if ((0x300 <= c1 && c1 <= 0x36F)
2604 || (! otf && CHAR_HAS_CATEGORY (c1, '^')))
2600 flt = mflt_get (msymbol ("combining")); 2605 flt = mflt_get (msymbol ("combining"));
2601 } 2606 }
2602 if (! flt && ! otf) 2607 if (! flt && ! otf)
diff --git a/src/gtkutil.c b/src/gtkutil.c
index ba059b73a70..e791e6ac317 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -252,35 +252,6 @@ xg_create_default_cursor (Display *dpy)
252 return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR); 252 return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR);
253} 253}
254 254
255static GdkPixbuf *
256xg_get_pixbuf_from_pixmap (struct frame *f, Pixmap pix)
257{
258 int iunused;
259 GdkPixbuf *tmp_buf;
260 Window wunused;
261 unsigned int width, height, uunused;
262 XImage *xim;
263
264 XGetGeometry (FRAME_X_DISPLAY (f), pix, &wunused, &iunused, &iunused,
265 &width, &height, &uunused, &uunused);
266
267 xim = XGetImage (FRAME_X_DISPLAY (f), pix, 0, 0, width, height,
268 ~0, XYPixmap);
269 if (!xim) return 0;
270
271 tmp_buf = gdk_pixbuf_new_from_data ((guchar *) xim->data,
272 GDK_COLORSPACE_RGB,
273 FALSE,
274 xim->bitmap_unit,
275 width,
276 height,
277 xim->bytes_per_line,
278 NULL,
279 NULL);
280 XDestroyImage (xim);
281 return tmp_buf;
282}
283
284/* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */ 255/* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */
285 256
286static GdkPixbuf * 257static GdkPixbuf *
@@ -288,46 +259,43 @@ xg_get_pixbuf_from_pix_and_mask (struct frame *f,
288 Pixmap pix, 259 Pixmap pix,
289 Pixmap mask) 260 Pixmap mask)
290{ 261{
291 int width, height; 262 GdkPixbuf *icon_buf = 0;
292 GdkPixbuf *icon_buf, *tmp_buf; 263 int iunused;
293 264 Window wunused;
294 tmp_buf = xg_get_pixbuf_from_pixmap (f, pix); 265 unsigned int width, height, depth, uunused;
295 icon_buf = gdk_pixbuf_add_alpha (tmp_buf, FALSE, 0, 0, 0);
296 g_object_unref (G_OBJECT (tmp_buf));
297
298 width = gdk_pixbuf_get_width (icon_buf);
299 height = gdk_pixbuf_get_height (icon_buf);
300 266
301 if (mask) 267 if (FRAME_DISPLAY_INFO (f)->red_bits != 8)
268 return 0;
269 XGetGeometry (FRAME_X_DISPLAY (f), pix, &wunused, &iunused, &iunused,
270 &width, &height, &uunused, &depth);
271 if (depth != 24)
272 return 0;
273 XImage *xim = XGetImage (FRAME_X_DISPLAY (f), pix, 0, 0, width, height,
274 ~0, XYPixmap);
275 if (xim)
302 { 276 {
303 GdkPixbuf *mask_buf = xg_get_pixbuf_from_pixmap (f, mask); 277 XImage *xmm = (! mask ? 0
304 guchar *pixels = gdk_pixbuf_get_pixels (icon_buf); 278 : XGetImage (FRAME_X_DISPLAY (f), mask, 0, 0,
305 guchar *mask_pixels = gdk_pixbuf_get_pixels (mask_buf); 279 width, height, ~0, XYPixmap));
306 int rowstride = gdk_pixbuf_get_rowstride (icon_buf); 280 icon_buf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
307 int mask_rowstride = gdk_pixbuf_get_rowstride (mask_buf); 281 if (icon_buf)
308 int y; 282 {
309 283 guchar *pixels = gdk_pixbuf_get_pixels (icon_buf);
310 for (y = 0; y < height; ++y) 284 int rowjunkwidth = gdk_pixbuf_get_rowstride (icon_buf) - width * 4;
311 { 285 for (int y = 0; y < height; y++, pixels += rowjunkwidth)
312 guchar *iconptr, *maskptr; 286 for (int x = 0; x < width; x++)
313 int x; 287 {
314 288 unsigned long rgb = XGetPixel (xim, x, y);
315 iconptr = pixels + y * rowstride; 289 *pixels++ = (rgb >> 16) & 255;
316 maskptr = mask_pixels + y * mask_rowstride; 290 *pixels++ = (rgb >> 8) & 255;
317 291 *pixels++ = rgb & 255;
318 for (x = 0; x < width; ++x) 292 *pixels++ = xmm && !XGetPixel (xmm, x, y) ? 0 : 255;
319 { 293 }
320 /* In a bitmap, RGB is either 255/255/255 or 0/0/0. Checking 294 }
321 just R is sufficient. */
322 if (maskptr[0] == 0)
323 iconptr[3] = 0; /* 0, 1, 2 is R, G, B. 3 is alpha. */
324
325 iconptr += rowstride/width;
326 maskptr += mask_rowstride/width;
327 }
328 }
329 295
330 g_object_unref (G_OBJECT (mask_buf)); 296 if (xmm)
297 XDestroyImage (xmm);
298 XDestroyImage (xim);
331 } 299 }
332 300
333 return icon_buf; 301 return icon_buf;
diff --git a/src/keyboard.c b/src/keyboard.c
index 1a5dbd0f617..54643eebba4 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2529,7 +2529,7 @@ read_char (int commandflag, Lisp_Object map,
2529 if (KEYMAPP (map) && INTERACTIVE 2529 if (KEYMAPP (map) && INTERACTIVE
2530 && !NILP (prev_event) && ! EVENT_HAS_PARAMETERS (prev_event) 2530 && !NILP (prev_event) && ! EVENT_HAS_PARAMETERS (prev_event)
2531 /* Don't bring up a menu if we already have another event. */ 2531 /* Don't bring up a menu if we already have another event. */
2532 && NILP (Vunread_command_events) 2532 && !CONSP (Vunread_command_events)
2533 && !detect_input_pending_run_timers (0)) 2533 && !detect_input_pending_run_timers (0))
2534 { 2534 {
2535 c = read_char_minibuf_menu_prompt (commandflag, map); 2535 c = read_char_minibuf_menu_prompt (commandflag, map);
@@ -2660,7 +2660,7 @@ read_char (int commandflag, Lisp_Object map,
2660 && !EQ (XCAR (prev_event), Qmenu_bar) 2660 && !EQ (XCAR (prev_event), Qmenu_bar)
2661 && !EQ (XCAR (prev_event), Qtool_bar) 2661 && !EQ (XCAR (prev_event), Qtool_bar)
2662 /* Don't bring up a menu if we already have another event. */ 2662 /* Don't bring up a menu if we already have another event. */
2663 && NILP (Vunread_command_events)) 2663 && !CONSP (Vunread_command_events))
2664 { 2664 {
2665 c = read_char_x_menu_prompt (map, prev_event, used_mouse_menu); 2665 c = read_char_x_menu_prompt (map, prev_event, used_mouse_menu);
2666 2666
@@ -9877,7 +9877,7 @@ clear_input_pending (void)
9877bool 9877bool
9878requeued_events_pending_p (void) 9878requeued_events_pending_p (void)
9879{ 9879{
9880 return (!NILP (Vunread_command_events)); 9880 return (CONSP (Vunread_command_events));
9881} 9881}
9882 9882
9883DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 1, 0, 9883DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 1, 0,
@@ -9888,7 +9888,7 @@ if there is a doubt, the value is t.
9888If CHECK-TIMERS is non-nil, timers that are ready to run will do so. */) 9888If CHECK-TIMERS is non-nil, timers that are ready to run will do so. */)
9889 (Lisp_Object check_timers) 9889 (Lisp_Object check_timers)
9890{ 9890{
9891 if (!NILP (Vunread_command_events) 9891 if (CONSP (Vunread_command_events)
9892 || !NILP (Vunread_post_input_method_events) 9892 || !NILP (Vunread_post_input_method_events)
9893 || !NILP (Vunread_input_method_events)) 9893 || !NILP (Vunread_input_method_events))
9894 return (Qt); 9894 return (Qt);
diff --git a/src/term.c b/src/term.c
index 17f36795998..a77e5729b5b 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3402,9 +3402,11 @@ static void
3402tty_pop_down_menu (Lisp_Object arg) 3402tty_pop_down_menu (Lisp_Object arg)
3403{ 3403{
3404 tty_menu *menu = XSAVE_POINTER (arg, 0); 3404 tty_menu *menu = XSAVE_POINTER (arg, 0);
3405 struct buffer *orig_buffer = XSAVE_POINTER (arg, 1);
3405 3406
3406 block_input (); 3407 block_input ();
3407 tty_menu_destroy (menu); 3408 tty_menu_destroy (menu);
3409 set_buffer_internal (orig_buffer);
3408 unblock_input (); 3410 unblock_input ();
3409} 3411}
3410 3412
@@ -3683,7 +3685,10 @@ tty_menu_show (struct frame *f, int x, int y, int menuflags,
3683 3685
3684 pane = selidx = 0; 3686 pane = selidx = 0;
3685 3687
3686 record_unwind_protect (tty_pop_down_menu, make_save_ptr (menu)); 3688 /* We save and restore the current buffer because tty_menu_activate
3689 triggers redisplay, which switches buffers at will. */
3690 record_unwind_protect (tty_pop_down_menu,
3691 make_save_ptr_ptr (menu, current_buffer));
3687 3692
3688 specbind (Qoverriding_terminal_local_map, 3693 specbind (Qoverriding_terminal_local_map,
3689 Fsymbol_value (Qtty_menu_navigation_map)); 3694 Fsymbol_value (Qtty_menu_navigation_map));
diff --git a/src/w32font.c b/src/w32font.c
index a1878adb4bd..018e6572563 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -796,7 +796,8 @@ w32font_list_internal (struct frame *f, Lisp_Object font_spec,
796 && !EQ (spec_charset, Qiso10646_1) 796 && !EQ (spec_charset, Qiso10646_1)
797 && !EQ (spec_charset, Qunicode_bmp) 797 && !EQ (spec_charset, Qunicode_bmp)
798 && !EQ (spec_charset, Qunicode_sip) 798 && !EQ (spec_charset, Qunicode_sip)
799 && !EQ (spec_charset, Qunknown)) 799 && !EQ (spec_charset, Qunknown)
800 && !EQ (spec_charset, Qascii_0))
800 return Qnil; 801 return Qnil;
801 } 802 }
802 803
diff --git a/src/xdisp.c b/src/xdisp.c
index bdc8af8b5bf..290f69878da 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -31386,8 +31386,11 @@ Value is a number or a cons (WIDTH-DPI . HEIGHT-DPI). */);
31386 Vtruncate_partial_width_windows, 31386 Vtruncate_partial_width_windows,
31387 doc: /* Non-nil means truncate lines in windows narrower than the frame. 31387 doc: /* Non-nil means truncate lines in windows narrower than the frame.
31388For an integer value, truncate lines in each window narrower than the 31388For an integer value, truncate lines in each window narrower than the
31389full frame width, provided the window width is less than that integer; 31389full frame width, provided the total window width in column units is less
31390otherwise, respect the value of `truncate-lines'. 31390than that integer; otherwise, respect the value of `truncate-lines'.
31391The total width of the window is as returned by `window-total-width', it
31392includes the fringes, the continuation and truncation glyphs, the
31393display margins (if any), and the scroll bar
31391 31394
31392For any other non-nil value, truncate lines in all windows that do 31395For any other non-nil value, truncate lines in all windows that do
31393not span the full frame width. 31396not span the full frame width.
diff --git a/src/xwidget.c b/src/xwidget.c
index d438d879098..c24475f5312 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -767,14 +767,14 @@ VALUE is the amount to scroll, either relatively or absolutely. */)
767 Lisp_Object value) 767 Lisp_Object value)
768{ 768{
769 CHECK_XWIDGET (xwidget); 769 CHECK_XWIDGET (xwidget);
770 CHECK_NATNUM (value); 770 CHECK_NUMBER (value);
771 struct xwidget *xw = XXWIDGET (xwidget); 771 struct xwidget *xw = XXWIDGET (xwidget);
772 GtkAdjustment *adjustment 772 GtkAdjustment *adjustment
773 = ((EQ (Qhorizontal, axis) 773 = ((EQ (Qhorizontal, axis)
774 ? gtk_scrolled_window_get_hadjustment 774 ? gtk_scrolled_window_get_hadjustment
775 : gtk_scrolled_window_get_vadjustment) 775 : gtk_scrolled_window_get_vadjustment)
776 (GTK_SCROLLED_WINDOW (xw->widgetscrolledwindow_osr))); 776 (GTK_SCROLLED_WINDOW (xw->widgetscrolledwindow_osr)));
777 double final_value = XFASTINT (value); 777 double final_value = XINT (value);
778 if (EQ (Qt, relative)) 778 if (EQ (Qt, relative))
779 final_value += gtk_adjustment_get_value (adjustment); 779 final_value += gtk_adjustment_get_value (adjustment);
780 gtk_adjustment_set_value (adjustment, final_value); 780 gtk_adjustment_set_value (adjustment, final_value);
diff --git a/test/automated/xt-mouse-tests.el b/test/automated/xt-mouse-tests.el
new file mode 100644
index 00000000000..c7e835c0311
--- /dev/null
+++ b/test/automated/xt-mouse-tests.el
@@ -0,0 +1,110 @@
1;;; xt-mouse-tests.el --- Test suite for xt-mouse. -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2016 Free Software Foundation, Inc.
4
5;; Author: Philipp Stephani <phst@google.com>
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21
22;;; Commentary:
23
24;;; Code:
25
26(require 'xt-mouse)
27
28(defmacro with-xterm-mouse-mode (&rest body)
29 "Run BODY with `xterm-mouse-mode' temporarily enabled."
30 (declare (indent 0))
31 ;; Make the frame huge so that the test input events below don't hit
32 ;; the menu bar.
33 `(cl-letf (((frame-width nil) 2000)
34 ((frame-height nil) 2000)
35 ;; Reset XTerm parameters so that the tests don't get
36 ;; confused.
37 ((terminal-parameter nil 'xterm-mouse-x) nil)
38 ((terminal-parameter nil 'xterm-mouse-y) nil)
39 ((terminal-parameter nil 'xterm-mouse-last-down) nil)
40 ((terminal-parameter nil 'xterm-mouse-last-click) nil))
41 (if xterm-mouse-mode
42 (progn ,@body)
43 (unwind-protect
44 (progn
45 ;; `xterm-mouse-mode' doesn't work in the initial
46 ;; terminal. Since we can't create a second terminal in
47 ;; batch mode, fake it temporarily.
48 (cl-letf (((symbol-function 'terminal-name)
49 (lambda (&optional _terminal) "fake-terminal")))
50 (xterm-mouse-mode))
51 ,@body)
52 (xterm-mouse-mode 0)))))
53
54(ert-deftest xt-mouse-tracking-basic ()
55 (should (equal (xterm-mouse-tracking-enable-sequence)
56 "\e[?1000h\e[?1002h\e[?1006h"))
57 (should (equal (xterm-mouse-tracking-disable-sequence)
58 "\e[?1006l\e[?1002l\e[?1000l"))
59 (with-xterm-mouse-mode
60 (should xterm-mouse-mode)
61 (should (terminal-parameter nil 'xterm-mouse-mode))
62 (should-not (terminal-parameter nil 'xterm-mouse-utf-8))
63 (let* ((unread-command-events (append "\e[M%\xD9\x81"
64 "\e[M'\xD9\x81" nil))
65 (key (read-key)))
66 (should (consp key))
67 (cl-destructuring-bind (event-type position . rest) key
68 (should (equal event-type 'S-mouse-2))
69 (should (consp position))
70 (cl-destructuring-bind (_ _ xy . rest) position
71 (should (equal xy '(184 . 95))))))))
72
73(ert-deftest xt-mouse-tracking-utf-8 ()
74 (let ((xterm-mouse-utf-8 t))
75 (should (equal (xterm-mouse-tracking-enable-sequence)
76 "\e[?1000h\e[?1002h\e[?1005h\e[?1006h"))
77 (should (equal (xterm-mouse-tracking-disable-sequence)
78 "\e[?1006l\e[?1005l\e[?1002l\e[?1000l"))
79 (with-xterm-mouse-mode
80 (should xterm-mouse-mode)
81 (should (terminal-parameter nil 'xterm-mouse-mode))
82 (should (terminal-parameter nil 'xterm-mouse-utf-8))
83 ;; The keyboard driver doesn't decode bytes in
84 ;; `unread-command-events'.
85 (let* ((unread-command-events (append "\e[M%\u0640\u0131"
86 "\e[M'\u0640\u0131" nil))
87 (key (read-key)))
88 (should (consp key))
89 (cl-destructuring-bind (event-type position . rest) key
90 (should (equal event-type 'S-mouse-2))
91 (should (consp position))
92 (cl-destructuring-bind (_ _ xy . rest) position
93 (should (equal xy '(1567 . 271)))))))))
94
95(ert-deftest xt-mouse-tracking-sgr ()
96 (with-xterm-mouse-mode
97 (should xterm-mouse-mode)
98 (should (terminal-parameter nil 'xterm-mouse-mode))
99 (should-not (terminal-parameter nil 'xterm-mouse-utf-8))
100 (let* ((unread-command-events (append "\e[<5;1569;273;M"
101 "\e[<5;1569;273;m" nil))
102 (key (read-key)))
103 (should (consp key))
104 (cl-destructuring-bind (event-type position . rest) key
105 (should (equal event-type 'S-mouse-2))
106 (should (consp position))
107 (cl-destructuring-bind (_ _ xy . rest) position
108 (should (equal xy '(1568 . 271))))))))
109
110;;; xt-mouse-tests.el ends here
diff --git a/test/lisp/emacs-lisp/map-tests.el b/test/lisp/emacs-lisp/map-tests.el
index d145c197a4e..20cb0f6b399 100644
--- a/test/lisp/emacs-lisp/map-tests.el
+++ b/test/lisp/emacs-lisp/map-tests.el
@@ -87,9 +87,16 @@ Evaluate BODY for each created map.
87 (let ((vec [3 4 5])) 87 (let ((vec [3 4 5]))
88 (should-error (setf (map-elt vec 3) 6)))) 88 (should-error (setf (map-elt vec 3) 6))))
89 89
90(ert-deftest test-map-put-alist-new-key ()
91 "Regression test for Bug#23105."
92 (let ((alist '((0 . a))))
93 (map-put alist 2 'b)
94 (should (eq (map-elt alist 2)
95 'b))))
96
90(ert-deftest test-map-put-return-value () 97(ert-deftest test-map-put-return-value ()
91 (let ((ht (make-hash-table))) 98 (let ((ht (make-hash-table)))
92 (should (eq (map-put ht 'a 'hello) ht)))) 99 (should (eq (map-put ht 'a 'hello) 'hello))))
93 100
94(ert-deftest test-map-delete () 101(ert-deftest test-map-delete ()
95 (with-maps-do map 102 (with-maps-do map