diff options
Diffstat (limited to 'lisp/term')
-rw-r--r-- | lisp/term/linux.el | 3 | ||||
-rw-r--r-- | lisp/term/ns-win.el | 12 | ||||
-rw-r--r-- | lisp/term/pc-win.el | 2 | ||||
-rw-r--r-- | lisp/term/st.el | 10 | ||||
-rw-r--r-- | lisp/term/sun.el | 4 | ||||
-rw-r--r-- | lisp/term/w32-win.el | 11 | ||||
-rw-r--r-- | lisp/term/x-win.el | 2 | ||||
-rw-r--r-- | lisp/term/xterm.el | 56 |
8 files changed, 72 insertions, 28 deletions
diff --git a/lisp/term/linux.el b/lisp/term/linux.el index c6d84ab96c3..6d43e477ac9 100644 --- a/lisp/term/linux.el +++ b/lisp/term/linux.el @@ -12,6 +12,9 @@ ;; It can't really display underlines. (tty-no-underline) + ;; Compositions confuse cursor movement. + (setq-default auto-composition-mode "linux") + (ignore-errors (when gpm-mouse-mode (require 't-mouse) (gpm-mouse-enable))) ;; Make Latin-1 input characters work, too. diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el index af1e388c2a3..67a417c1161 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el @@ -586,8 +586,8 @@ string dropped into the current buffer." ;; Based on a function by David Reitter <dreitter@inf.ed.ac.uk> ; ;; see https://lists.gnu.org/r/emacs-devel/2005-09/msg00681.html . (defun ns-toggle-toolbar (&optional frame) - "Switches the tool bar on and off in frame FRAME. - If FRAME is nil, the change applies to the selected frame." + "Switch the tool bar on and off in frame FRAME. +If FRAME is nil, the change applies to the selected frame." (interactive) (modify-frame-parameters frame (list (cons 'tool-bar-lines @@ -867,10 +867,10 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") ;; For Darwin nothing except UTF-8 makes sense. (when (eq system-type 'darwin) (add-hook 'before-init-hook - #'(lambda () - (setq locale-coding-system 'utf-8-unix) - (setq default-process-coding-system - '(utf-8-unix . utf-8-unix))))) + (lambda () + (setq locale-coding-system 'utf-8-unix) + (setq default-process-coding-system + '(utf-8-unix . utf-8-unix))))) ;; Mac OS X Lion introduces PressAndHold, which is unsupported by this port. ;; See this thread for more details: diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el index 8cff2ceaeec..9e7b360b9c6 100644 --- a/lisp/term/pc-win.el +++ b/lisp/term/pc-win.el @@ -290,7 +290,7 @@ This is used by `msdos-show-help'.") (not cursor-in-echo-area)) ;Don't overwrite a prompt. (cond ((stringp help) - (setq help (replace-regexp-in-string "\n" ", " help)) + (setq help (string-replace "\n" ", " help)) (unless (or msdos-previous-message (string-equal help (current-message)) (and (stringp msdos-last-help-message) diff --git a/lisp/term/st.el b/lisp/term/st.el index 9a1c0646f89..26478ca2490 100644 --- a/lisp/term/st.el +++ b/lisp/term/st.el @@ -11,9 +11,17 @@ (require 'term/xterm) +(defcustom xterm-st-extra-capabilities '(modifyOtherKeys) + "Extra capabilities supported under \"stterm\"." + :version "28.1" + :type xterm--extra-capabilities-type + :group 'xterm) + (defun terminal-init-st () "Terminal initialization function for st." - (tty-run-terminal-initialization (selected-frame) "xterm")) + ;; Using `check' leads to a two-second timeout. + (let ((xterm-extra-capabilities xterm-st-extra-capabilities)) + (tty-run-terminal-initialization (selected-frame) "xterm"))) (provide 'term/st) diff --git a/lisp/term/sun.el b/lisp/term/sun.el index 3dfd4c697a2..4c88c80bf7b 100644 --- a/lisp/term/sun.el +++ b/lisp/term/sun.el @@ -38,7 +38,7 @@ (scroll-up n)) (defun kill-region-and-unmark (beg end) - "Like `kill-region', but pops the mark [which equals point, anyway.]" + "Like `kill-region', but pops the mark [which equals point, anyway]." (interactive "r") (kill-region beg end) (setq this-command 'kill-region-and-unmark) @@ -49,7 +49,7 @@ (interactive) (eval (nth 0 command-history))) -(defvar grep-arg nil "Default arg for RE-search") +(defvar grep-arg nil "Default arg for RE-search.") (defun grep-arg () (if (memq last-command '(research-forward research-backward)) grep-arg (let* ((command (car command-history)) diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index 6b849164aec..8b745c495d5 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el @@ -274,6 +274,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") '(gif "libgif-6.dll" "giflib5.dll" "gif.dll") '(gif "libgif-5.dll" "giflib4.dll" "libungif4.dll" "libungif.dll"))) '(svg "librsvg-2-2.dll") + '(webp "libwebp-7.dll" "libwebp.dll") '(gdk-pixbuf "libgdk_pixbuf-2.0-0.dll") '(glib "libglib-2.0-0.dll") '(gio "libgio-2.0-0.dll") @@ -410,7 +411,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") ;;; Fix interface to (X-specific) mouse.el (defun w32--set-selection (type value) (if (eq type 'CLIPBOARD) - (w32-set-clipboard-data (replace-regexp-in-string "\0" "\\0" value t t)) + (w32-set-clipboard-data (string-replace "\0" "\\0" value)) (put 'x-selections (or type 'PRIMARY) value))) (defun w32--get-selection (&optional type data-type) @@ -532,7 +533,7 @@ characters from these blocks.") (let (val) (dolist (elt script-representative-chars) (let ((subranges w32-no-usb-subranges) - (chars (cdr elt)) + (chars (append (cdr elt) nil)) ; handle vectors as well ch found subrange) (while (and (consp chars) (not found)) (setq ch (car chars) @@ -595,7 +596,11 @@ default font on FRAME, or its best approximation." 0 nchars script-chars) '[nil])) ;; Does this font support ALL of the script's - ;; representative characters? + ;; representative characters? Note that, when the + ;; representative characters are specified as a + ;; vector, this is a more stringent test than font + ;; selection does, because supporting _any_ + ;; character from the vector is enough. (setq idx 0) (while (and (< idx nchars) (not (null (aref glyphs idx)))) (setq idx (1+ idx))) diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 8c6c75e7e22..d6e63187487 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -131,7 +131,7 @@ When a session manager tells Emacs that the window system is shutting down, this function is called. It calls the functions in the hook `emacs-save-session-functions'. Functions are called with the current buffer set to a temporary buffer. Functions should use `insert' to insert -lisp code to save the session state. The buffer is saved in a file in the +Lisp code to save the session state. The buffer is saved in a file in the home directory of the user running Emacs. The file is evaluated when Emacs is restarted by the session manager. diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index 8bcae37afe4..52a64d6c414 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -73,6 +73,13 @@ string bytes that can be copied is 3/4 of this value." :version "27.1" :type 'boolean) +(defcustom xterm-store-paste-on-kill-ring t + "If non-nil, pasting text into Emacs will put the text onto the kill ring. +This user option is only heeded when using a terminal using xterm +capabilities, and only when that terminal understands bracketed paste." + :version "28.1" + :type 'boolean) + (defconst xterm-paste-ending-sequence "\e[201~" "Characters sent by the terminal to end a bracketed paste.") @@ -100,9 +107,15 @@ Return the pasted text as a string." (interactive "e") (unless (eq (car-safe event) 'xterm-paste) (error "xterm-paste must be found to xterm-paste event")) - (let* ((pasted-text (nth 1 event)) - (interprogram-paste-function (lambda () pasted-text))) - (yank))) + (let ((pasted-text (nth 1 event))) + (if xterm-store-paste-on-kill-ring + ;; Put the text onto the kill ring and then insert it into the + ;; buffer. + (let ((interprogram-paste-function (lambda () pasted-text))) + (yank)) + ;; Insert the text without putting it onto the kill ring. + (push-mark) + (insert-for-yank pasted-text)))) ;; Put xterm-paste itself in global-map because, after translation, ;; it's just a normal input event. @@ -350,7 +363,20 @@ Return the pasted text as a string." (define-key map "\e[5;3~" [M-prior]) (define-key map "\e[6;3~" [M-next]) - (define-key map "\e[29~" [print]) + ;; This escape sequence has a controversial story. + ;; It was initially mapped to [print] (initial commit by Karl Heuer), + ;; but we can't find any justification for it. + ;; Xterm uses this escape sequence for both `F16' and `Menu' keys, + ;; and the reason for it is that in the VT220 keyboard the key + ;; placed logically at position where `F16' would be (and sending + ;; the escape sequence that naturally belongs to `F16') was + ;; labeled `Menu'. [ The story gets even more interesting if you + ;; want to dig deeper, e.g. some terminals would send that same + ;; escape sequence in response to `S-F4' (because they (ab)used + ;; the escape sequence of `F<n+12>' for `S-F<n>'). ] + ;; The current binding was chosen because current keyboards almost never + ;; have an `F16' key, whereas many do have a `Menu' key. + (define-key map "\e[29~" [menu]) (define-key map "\eOj" [kp-multiply]) (define-key map "\eOk" [kp-add]) @@ -368,6 +394,9 @@ Return the pasted text as a string." (define-key map "\eOx" [kp-8]) (define-key map "\eOy" [kp-9]) + ;; Some keypads have an equal key (for instance, most Apple keypads). + (define-key map "\eOX" [kp-equal]) + (define-key map "\eO2j" [S-kp-multiply]) (define-key map "\eO2k" [S-kp-add]) (define-key map "\eO2l" [S-kp-separator]) @@ -761,14 +790,13 @@ Return the pasted text as a string." Can be nil to mean \"no timeout\".") (defvar xterm-query-redisplay-timeout 0.2 - "Seconds to wait before allowing redisplay during terminal - query." ) + "Seconds to wait before allowing redisplay during terminal query." ) (defun xterm--read-event-for-query () - "Like read-event, but inhibit redisplay. + "Like `read-event', but inhibit redisplay. By not redisplaying right away for xterm queries, we can avoid -unsightly flashing during initialization. Give up and redisplay +unsightly flashing during initialization. Give up and redisplay anyway if we've been waiting a little while." (let ((start-time (current-time))) (or (let ((inhibit-redisplay t)) @@ -944,9 +972,10 @@ See `xterm--init-frame-title'" (defun xterm-set-window-title (&optional terminal) "Set the window title of the Xterm TERMINAL. The title is constructed from `frame-title-format'." - (send-string-to-terminal - (format "\e]2;%s\a" (format-mode-line frame-title-format)) - terminal)) + (unless (display-graphic-p terminal) + (send-string-to-terminal + (format "\e]2;%s\a" (format-mode-line frame-title-format)) + terminal))) (defun xterm--selection-char (type) (pcase type @@ -1015,10 +1044,9 @@ hitting screen's max DCS length." 'terminal-init-screen)) (bytes (encode-coding-string data 'utf-8-unix)) (base-64 (if screen - (replace-regexp-in-string + (string-replace "\n" "\e\\\eP" - (base64-encode-string bytes) - :fixedcase :literal) + (base64-encode-string bytes)) (base64-encode-string bytes :no-line-break))) (length (length base-64))) (if (> length xterm-max-cut-length) |