diff options
| author | Glenn Morris | 2017-10-21 09:07:30 -0700 |
|---|---|---|
| committer | Glenn Morris | 2017-10-21 09:07:30 -0700 |
| commit | cda4c74e60962a49908d130f6dd70b0ae90a0255 (patch) | |
| tree | e60604475057495c22fb64bf81933f72602151e0 | |
| parent | 701c65829d79dbc479fd8c282af3c6faffc21665 (diff) | |
| parent | 888e51f2203c125e8283852d55e54acc8e893f8a (diff) | |
| download | emacs-cda4c74e60962a49908d130f6dd70b0ae90a0255.tar.gz emacs-cda4c74e60962a49908d130f6dd70b0ae90a0255.zip | |
Merge from origin/emacs-26
888e51f220 (origin/emacs-26) Update describe-function for recent Fdoc...
75bb482763 Make flymake's mouse-wheel interaction portable (Bug#28732)
035d7ac7e4 Prevent eldoc from changing the mode line
c9d71b31bf Fix doc strings in simple.el
0d8e4f45d6 Avoid creating inconsistent buffer states in term-char-mode
79d57f4b7a New input method 'usbek-cyrillic'
4587d8e0ef Document 'minibuffer-with-setup-hook'
# Conflicts:
# etc/NEWS
| -rw-r--r-- | doc/lispref/minibuf.texi | 13 | ||||
| -rw-r--r-- | etc/NEWS.26 | 19 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eldoc.el | 3 | ||||
| -rw-r--r-- | lisp/help-fns.el | 4 | ||||
| -rw-r--r-- | lisp/leim/quail/cyrillic.el | 114 | ||||
| -rw-r--r-- | lisp/progmodes/flymake.el | 10 | ||||
| -rw-r--r-- | lisp/simple.el | 11 | ||||
| -rw-r--r-- | lisp/term.el | 98 |
8 files changed, 260 insertions, 12 deletions
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index afd44b7dfe4..1ece8996008 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi | |||
| @@ -2407,6 +2407,19 @@ This is a normal hook that is run whenever the minibuffer is entered. | |||
| 2407 | @xref{Hooks}. | 2407 | @xref{Hooks}. |
| 2408 | @end defvar | 2408 | @end defvar |
| 2409 | 2409 | ||
| 2410 | @defmac minibuffer-with-setup-hook function &rest body | ||
| 2411 | This macro executes @var{body} after arranging for the specified | ||
| 2412 | @var{function} to be called via @code{minibuffer-setup-hook}. By | ||
| 2413 | default, @var{function} is called before the other functions in the | ||
| 2414 | @code{minibuffer-setup-hook} list, but if @var{function} is of the | ||
| 2415 | form @w{@code{(:append @var{func})}}, @var{func} will be called | ||
| 2416 | @emph{after} the other hook functions. | ||
| 2417 | |||
| 2418 | The @var{body} forms should not use the minibuffer more than once. If | ||
| 2419 | the minibuffer is re-entered recursively, @var{function} will only be | ||
| 2420 | called once, for the outermost use of the minibuffer. | ||
| 2421 | @end defmac | ||
| 2422 | |||
| 2410 | @defvar minibuffer-exit-hook | 2423 | @defvar minibuffer-exit-hook |
| 2411 | This is a normal hook that is run whenever the minibuffer is exited. | 2424 | This is a normal hook that is run whenever the minibuffer is exited. |
| 2412 | @xref{Hooks}. | 2425 | @xref{Hooks}. |
diff --git a/etc/NEWS.26 b/etc/NEWS.26 index 97b21f7dd86..82778932ab1 100644 --- a/etc/NEWS.26 +++ b/etc/NEWS.26 | |||
| @@ -398,7 +398,7 @@ roster of X keysyms. It can be used in combination with another | |||
| 398 | variable of this kind to swap modifiers in Emacs. | 398 | variable of this kind to swap modifiers in Emacs. |
| 399 | 399 | ||
| 400 | --- | 400 | --- |
| 401 | ** New input methods: 'cyrillic-tuvan', 'polish-prefix'. | 401 | ** New input methods: 'cyrillic-tuvan', 'polish-prefix', 'uzbek-cyrillic'. |
| 402 | 402 | ||
| 403 | --- | 403 | --- |
| 404 | ** The 'dutch' input method no longer attempts to support Turkish too. | 404 | ** The 'dutch' input method no longer attempts to support Turkish too. |
| @@ -1168,6 +1168,23 @@ provided. | |||
| 1168 | The old Flymake behavior is preserved in the so-called "legacy | 1168 | The old Flymake behavior is preserved in the so-called "legacy |
| 1169 | backend", which has been updated to benefit from the new UI features. | 1169 | backend", which has been updated to benefit from the new UI features. |
| 1170 | 1170 | ||
| 1171 | ** Term | ||
| 1172 | |||
| 1173 | --- | ||
| 1174 | *** `term-char-mode' now makes its buffer read-only. | ||
| 1175 | |||
| 1176 | The buffer is made read-only to prevent changes from being made by | ||
| 1177 | anything other than the process filter; and movements of point away | ||
| 1178 | from the process mark are counter-acted so that the cursor is in the | ||
| 1179 | correct position after each command. This is needed to avoid states | ||
| 1180 | which are inconsistent with the state of the terminal understood by | ||
| 1181 | the inferior process. | ||
| 1182 | |||
| 1183 | New user options `term-char-mode-buffer-read-only' and | ||
| 1184 | `term-char-mode-point-at-process-mark' control these behaviors, and | ||
| 1185 | are non-nil by default. Customize these options to nil if you want | ||
| 1186 | the previous behavior. | ||
| 1187 | |||
| 1171 | 1188 | ||
| 1172 | * New Modes and Packages in Emacs 26.1 | 1189 | * New Modes and Packages in Emacs 26.1 |
| 1173 | 1190 | ||
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index cba9a00fa5a..ad08977b81a 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el | |||
| @@ -264,12 +264,13 @@ Otherwise work like `message'." | |||
| 264 | (or (window-in-direction 'above (minibuffer-window)) | 264 | (or (window-in-direction 'above (minibuffer-window)) |
| 265 | (minibuffer-selected-window) | 265 | (minibuffer-selected-window) |
| 266 | (get-largest-window))) | 266 | (get-largest-window))) |
| 267 | (when mode-line-format | ||
| 267 | (unless (and (listp mode-line-format) | 268 | (unless (and (listp mode-line-format) |
| 268 | (assq 'eldoc-mode-line-string mode-line-format)) | 269 | (assq 'eldoc-mode-line-string mode-line-format)) |
| 269 | (setq mode-line-format | 270 | (setq mode-line-format |
| 270 | (list "" '(eldoc-mode-line-string | 271 | (list "" '(eldoc-mode-line-string |
| 271 | (" " eldoc-mode-line-string " ")) | 272 | (" " eldoc-mode-line-string " ")) |
| 272 | mode-line-format))) | 273 | mode-line-format)))) |
| 273 | (setq eldoc-mode-line-string | 274 | (setq eldoc-mode-line-string |
| 274 | (when (stringp format-string) | 275 | (when (stringp format-string) |
| 275 | (apply #'format-message format-string args))) | 276 | (apply #'format-message format-string args))) |
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index e509ce6e2a8..3c237654fb9 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -698,7 +698,7 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)." | |||
| 698 | ;; for invalid functions i.s.o. signaling an error. | 698 | ;; for invalid functions i.s.o. signaling an error. |
| 699 | (documentation function t) | 699 | (documentation function t) |
| 700 | ;; E.g. an alias for a not yet defined function. | 700 | ;; E.g. an alias for a not yet defined function. |
| 701 | (invalid-function nil))) | 701 | ((invalid-function void-function) nil))) |
| 702 | (key-bindings-buffer (current-buffer))) | 702 | (key-bindings-buffer (current-buffer))) |
| 703 | 703 | ||
| 704 | ;; If the function is autoloaded, and its docstring has | 704 | ;; If the function is autoloaded, and its docstring has |
| @@ -718,7 +718,7 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)." | |||
| 718 | (if (subrp def) (indirect-function real-def) real-def) | 718 | (if (subrp def) (indirect-function real-def) real-def) |
| 719 | real-function key-bindings-buffer) | 719 | real-function key-bindings-buffer) |
| 720 | ;; E.g. an alias for a not yet defined function. | 720 | ;; E.g. an alias for a not yet defined function. |
| 721 | (invalid-function doc-raw)))) | 721 | ((invalid-function void-function) doc-raw)))) |
| 722 | (run-hook-with-args 'help-fns-describe-function-functions function) | 722 | (run-hook-with-args 'help-fns-describe-function-functions function) |
| 723 | (insert "\n" (or doc "Not documented."))) | 723 | (insert "\n" (or doc "Not documented."))) |
| 724 | (when (or (function-get function 'pure) | 724 | (when (or (function-get function 'pure) |
diff --git a/lisp/leim/quail/cyrillic.el b/lisp/leim/quail/cyrillic.el index 95b443f210c..2218095f880 100644 --- a/lisp/leim/quail/cyrillic.el +++ b/lisp/leim/quail/cyrillic.el | |||
| @@ -831,6 +831,120 @@ Sorry, but `ghe with upturn' is not included in ISO 8859-5." | |||
| 831 | ("|" ?Ґ)) | 831 | ("|" ?Ґ)) |
| 832 | ;; | 832 | ;; |
| 833 | 833 | ||
| 834 | (quail-define-package | ||
| 835 | "uzbek-cyrillic" "Ўзбекча" "Ўзб" nil | ||
| 836 | "ЙЦУКЕН Uzbek computer layout" | ||
| 837 | nil t t t t nil nil nil nil nil t) | ||
| 838 | |||
| 839 | ;; Ё 1! 2" 3№ 4; 5% 6: 7? 8* 9( 0) Ғ Ҳ | ||
| 840 | ;; Й Ц У К Е Н Г Ш Ў З Х Ъ \| | ||
| 841 | ;; Ф Қ В А П Р О Л Д Ж Э | ||
| 842 | ;; Я Ч С М И Т Ь Б Ю ., | ||
| 843 | |||
| 844 | (quail-define-rules | ||
| 845 | ("`" ?ё) | ||
| 846 | ("1" ?1) | ||
| 847 | ("2" ?2) | ||
| 848 | ("3" ?3) | ||
| 849 | ("4" ?4) | ||
| 850 | ("5" ?5) | ||
| 851 | ("6" ?6) | ||
| 852 | ("7" ?7) | ||
| 853 | ("8" ?8) | ||
| 854 | ("9" ?9) | ||
| 855 | ("0" ?0) | ||
| 856 | ("-" ?ғ) | ||
| 857 | ("=" ?ҳ) | ||
| 858 | |||
| 859 | ("q" ?й) | ||
| 860 | ("w" ?ц) | ||
| 861 | ("e" ?у) | ||
| 862 | ("r" ?к) | ||
| 863 | ("t" ?е) | ||
| 864 | ("y" ?н) | ||
| 865 | ("u" ?г) | ||
| 866 | ("i" ?ш) | ||
| 867 | ("o" ?ў) | ||
| 868 | ("p" ?з) | ||
| 869 | ("[" ?х) | ||
| 870 | ("]" ?ъ) | ||
| 871 | ("\\" ?\\) | ||
| 872 | |||
| 873 | ("a" ?ф) | ||
| 874 | ("s" ?қ) | ||
| 875 | ("d" ?в) | ||
| 876 | ("f" ?а) | ||
| 877 | ("g" ?п) | ||
| 878 | ("h" ?р) | ||
| 879 | ("j" ?о) | ||
| 880 | ("k" ?л) | ||
| 881 | ("l" ?д) | ||
| 882 | (";" ?ж) | ||
| 883 | ("'" ?э) | ||
| 884 | |||
| 885 | ("z" ?я) | ||
| 886 | ("x" ?ч) | ||
| 887 | ("c" ?с) | ||
| 888 | ("v" ?м) | ||
| 889 | ("b" ?и) | ||
| 890 | ("n" ?т) | ||
| 891 | ("m" ?ь) | ||
| 892 | ("," ?б) | ||
| 893 | ("." ?ю) | ||
| 894 | ("/" ?.) | ||
| 895 | |||
| 896 | ("~" ?Ё) | ||
| 897 | ("!" ?!) | ||
| 898 | ("@" ?\") | ||
| 899 | ("#" ?№) | ||
| 900 | ("$" ?\;) | ||
| 901 | ("%" ?%) | ||
| 902 | ("^" ?:) | ||
| 903 | ("&" ??) | ||
| 904 | ("*" ?*) | ||
| 905 | ("(" ?\() | ||
| 906 | (")" ?\)) | ||
| 907 | ("_" ?Ғ) | ||
| 908 | ("+" ?Ҳ) | ||
| 909 | |||
| 910 | ("Q" ?Й) | ||
| 911 | ("W" ?Ц) | ||
| 912 | ("E" ?У) | ||
| 913 | ("R" ?К) | ||
| 914 | ("T" ?Е) | ||
| 915 | ("Y" ?Н) | ||
| 916 | ("U" ?Г) | ||
| 917 | ("I" ?Ш) | ||
| 918 | ("O" ?Ў) | ||
| 919 | ("P" ?З) | ||
| 920 | ("{" ?Х) | ||
| 921 | ("}" ?Ъ) | ||
| 922 | ("|" ?|) | ||
| 923 | |||
| 924 | ("A" ?Ф) | ||
| 925 | ("S" ?Қ) | ||
| 926 | ("D" ?В) | ||
| 927 | ("F" ?А) | ||
| 928 | ("G" ?П) | ||
| 929 | ("H" ?Р) | ||
| 930 | ("J" ?О) | ||
| 931 | ("K" ?Л) | ||
| 932 | ("L" ?Д) | ||
| 933 | (":" ?Ж) | ||
| 934 | ("\"" ?Э) | ||
| 935 | |||
| 936 | ("Z" ?Я) | ||
| 937 | ("X" ?Ч) | ||
| 938 | ("C" ?С) | ||
| 939 | ("V" ?М) | ||
| 940 | ("B" ?И) | ||
| 941 | ("N" ?Т) | ||
| 942 | ("M" ?Ь) | ||
| 943 | ("<" ?Б) | ||
| 944 | (">" ?Ю) | ||
| 945 | ("?" ?,)) | ||
| 946 | |||
| 947 | |||
| 834 | ;; Alexander Mikhailian says this is of limited use. It has been | 948 | ;; Alexander Mikhailian says this is of limited use. It has been |
| 835 | ;; popular among emigrants or foreigners who have to type in Cyrillic | 949 | ;; popular among emigrants or foreigners who have to type in Cyrillic |
| 836 | ;; (mostly Russian) from time to time. | 950 | ;; (mostly Russian) from time to time. |
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 3c588f02fa6..1048bc50655 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el | |||
| @@ -1068,12 +1068,14 @@ applied." | |||
| 1068 | keymap | 1068 | keymap |
| 1069 | ,(let ((map (make-sparse-keymap)) | 1069 | ,(let ((map (make-sparse-keymap)) |
| 1070 | (type type)) | 1070 | (type type)) |
| 1071 | (define-key map [mode-line mouse-4] | 1071 | (define-key map (vector 'mode-line |
| 1072 | mouse-wheel-down-event) | ||
| 1072 | (lambda (event) | 1073 | (lambda (event) |
| 1073 | (interactive "e") | 1074 | (interactive "e") |
| 1074 | (with-selected-window (posn-window (event-start event)) | 1075 | (with-selected-window (posn-window (event-start event)) |
| 1075 | (flymake-goto-prev-error 1 (list type) t)))) | 1076 | (flymake-goto-prev-error 1 (list type) t)))) |
| 1076 | (define-key map [mode-line mouse-5] | 1077 | (define-key map (vector 'mode-line |
| 1078 | mouse-wheel-up-event) | ||
| 1077 | (lambda (event) | 1079 | (lambda (event) |
| 1078 | (interactive "e") | 1080 | (interactive "e") |
| 1079 | (with-selected-window (posn-window (event-start event)) | 1081 | (with-selected-window (posn-window (event-start event)) |
| @@ -1086,7 +1088,9 @@ applied." | |||
| 1086 | 'face face) | 1088 | 'face face) |
| 1087 | (propertize (format "%s" type) | 1089 | (propertize (format "%s" type) |
| 1088 | 'face face)) | 1090 | 'face face)) |
| 1089 | "mouse-4/mouse-5: previous/next of this type\n")) | 1091 | (format "%s/%s: previous/next of this type" |
| 1092 | mouse-wheel-down-event | ||
| 1093 | mouse-wheel-up-event))) | ||
| 1090 | into forms | 1094 | into forms |
| 1091 | finally return | 1095 | finally return |
| 1092 | `((:propertize "[") | 1096 | `((:propertize "[") |
diff --git a/lisp/simple.el b/lisp/simple.el index 5ef511ce0a0..12d65e50c34 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -53,9 +53,10 @@ restores the buffer position before the command." | |||
| 53 | :version "26.1") | 53 | :version "26.1") |
| 54 | 54 | ||
| 55 | (defvar shell-command-saved-pos nil | 55 | (defvar shell-command-saved-pos nil |
| 56 | "Position of point in the output buffer after command completes. | 56 | "Record of point positions in output buffers after command completion. |
| 57 | It is a cons cell of the form (BUFFER . POS), where BUFFER is the output | 57 | The value is an alist whose elements are of the form (BUFFER . POS), |
| 58 | buffer, and POS is the point position in BUFFER once the command finishes. | 58 | where BUFFER is the output buffer, and POS is the point position |
| 59 | in BUFFER once the command finishes. | ||
| 59 | This variable is used when `shell-command-dont-erase-buffer' is non-nil.") | 60 | This variable is used when `shell-command-dont-erase-buffer' is non-nil.") |
| 60 | 61 | ||
| 61 | (defcustom idle-update-delay 0.5 | 62 | (defcustom idle-update-delay 0.5 |
| @@ -1003,7 +1004,7 @@ Called with one argument METHOD. | |||
| 1003 | If METHOD is `delete-only', then delete the region; the return value | 1004 | If METHOD is `delete-only', then delete the region; the return value |
| 1004 | is undefined. If METHOD is nil, then return the content as a string. | 1005 | is undefined. If METHOD is nil, then return the content as a string. |
| 1005 | If METHOD is `bounds', then return the boundaries of the region | 1006 | If METHOD is `bounds', then return the boundaries of the region |
| 1006 | as a cons cell of the form (START . END). | 1007 | as a list of cons cells of the form (START . END). |
| 1007 | If METHOD is anything else, delete the region and return its content | 1008 | If METHOD is anything else, delete the region and return its content |
| 1008 | as a string, after filtering it with `filter-buffer-substring', which | 1009 | as a string, after filtering it with `filter-buffer-substring', which |
| 1009 | is called with METHOD as its 3rd argument.") | 1010 | is called with METHOD as its 3rd argument.") |
| @@ -5474,7 +5475,7 @@ also checks the value of `use-empty-active-region'." | |||
| 5474 | 5475 | ||
| 5475 | (defun region-bounds () | 5476 | (defun region-bounds () |
| 5476 | "Return the boundaries of the region as a pair of positions. | 5477 | "Return the boundaries of the region as a pair of positions. |
| 5477 | Value is a cons cell of the form (START . END)." | 5478 | Value is a list of cons cells of the form (START . END)." |
| 5478 | (funcall region-extract-function 'bounds)) | 5479 | (funcall region-extract-function 'bounds)) |
| 5479 | 5480 | ||
| 5480 | (defun region-noncontiguous-p () | 5481 | (defun region-noncontiguous-p () |
diff --git a/lisp/term.el b/lisp/term.el index c748c450206..2046578368c 100644 --- a/lisp/term.el +++ b/lisp/term.el | |||
| @@ -427,6 +427,8 @@ by moving term-home-marker. It is set to t if there is a | |||
| 427 | (defvar term-old-mode-line-format) ; Saves old mode-line-format while paging. | 427 | (defvar term-old-mode-line-format) ; Saves old mode-line-format while paging. |
| 428 | (defvar term-pager-old-local-map nil "Saves old keymap while paging.") | 428 | (defvar term-pager-old-local-map nil "Saves old keymap while paging.") |
| 429 | (defvar term-pager-old-filter) ; Saved process-filter while paging. | 429 | (defvar term-pager-old-filter) ; Saved process-filter while paging. |
| 430 | (defvar-local term-line-mode-buffer-read-only nil | ||
| 431 | "The `buffer-read-only' state to set in `term-line-mode'.") | ||
| 430 | 432 | ||
| 431 | (defcustom explicit-shell-file-name nil | 433 | (defcustom explicit-shell-file-name nil |
| 432 | "If non-nil, is file name to use for explicitly requested inferior shell." | 434 | "If non-nil, is file name to use for explicitly requested inferior shell." |
| @@ -487,6 +489,41 @@ This variable is buffer-local, and is a good thing to set in mode hooks." | |||
| 487 | :type 'boolean | 489 | :type 'boolean |
| 488 | :group 'term) | 490 | :group 'term) |
| 489 | 491 | ||
| 492 | (defcustom term-char-mode-buffer-read-only t | ||
| 493 | "If non-nil, only the process filter may modify the buffer in char mode. | ||
| 494 | |||
| 495 | A non-nil value makes the buffer read-only in `term-char-mode', | ||
| 496 | which prevents editing commands from making the buffer state | ||
| 497 | inconsistent with the state of the terminal understood by the | ||
| 498 | inferior process. Only the process filter is allowed to make | ||
| 499 | changes to the buffer. | ||
| 500 | |||
| 501 | Customize this option to nil if you want the previous behaviour." | ||
| 502 | :version "26.1" | ||
| 503 | :type 'boolean | ||
| 504 | :group 'term) | ||
| 505 | |||
| 506 | (defcustom term-char-mode-point-at-process-mark t | ||
| 507 | "If non-nil, keep point at the process mark in char mode. | ||
| 508 | |||
| 509 | A non-nil value causes point to be moved to the current process | ||
| 510 | mark after each command in `term-char-mode' (provided that the | ||
| 511 | pre-command point position was also at the process mark). This | ||
| 512 | prevents commands that move point from making the buffer state | ||
| 513 | inconsistent with the state of the terminal understood by the | ||
| 514 | inferior process. | ||
| 515 | |||
| 516 | Mouse events are not affected, so moving point and selecting text | ||
| 517 | is still possible in char mode via the mouse, after which other | ||
| 518 | commands can be invoked on the mouse-selected point or region, | ||
| 519 | until the process filter (or user) moves point to the process | ||
| 520 | mark once again. | ||
| 521 | |||
| 522 | Customize this option to nil if you want the previous behaviour." | ||
| 523 | :version "26.1" | ||
| 524 | :type 'boolean | ||
| 525 | :group 'term) | ||
| 526 | |||
| 490 | (defcustom term-scroll-to-bottom-on-output nil | 527 | (defcustom term-scroll-to-bottom-on-output nil |
| 491 | "Controls whether interpreter output causes window to scroll. | 528 | "Controls whether interpreter output causes window to scroll. |
| 492 | If nil, then do not scroll. If t or `all', scroll all windows showing buffer. | 529 | If nil, then do not scroll. If t or `all', scroll all windows showing buffer. |
| @@ -1105,6 +1142,8 @@ Entry to this mode runs the hooks on `term-mode-hook'." | |||
| 1105 | (term-reset-size (cdr size) (car size))) | 1142 | (term-reset-size (cdr size) (car size))) |
| 1106 | size)) | 1143 | size)) |
| 1107 | 1144 | ||
| 1145 | (add-hook 'read-only-mode-hook #'term-line-mode-buffer-read-only-update nil t) | ||
| 1146 | |||
| 1108 | (easy-menu-add term-terminal-menu) | 1147 | (easy-menu-add term-terminal-menu) |
| 1109 | (easy-menu-add term-signals-menu) | 1148 | (easy-menu-add term-signals-menu) |
| 1110 | (or term-input-ring | 1149 | (or term-input-ring |
| @@ -1246,6 +1285,13 @@ intervention from Emacs, except for the escape character (usually C-c)." | |||
| 1246 | (easy-menu-add term-terminal-menu) | 1285 | (easy-menu-add term-terminal-menu) |
| 1247 | (easy-menu-add term-signals-menu) | 1286 | (easy-menu-add term-signals-menu) |
| 1248 | 1287 | ||
| 1288 | ;; Don't allow changes to the buffer or to point which are not | ||
| 1289 | ;; caused by the process filter. | ||
| 1290 | (when term-char-mode-buffer-read-only | ||
| 1291 | (setq buffer-read-only t)) | ||
| 1292 | (add-hook 'pre-command-hook #'term-set-goto-process-mark nil t) | ||
| 1293 | (add-hook 'post-command-hook #'term-goto-process-mark-maybe nil t) | ||
| 1294 | |||
| 1249 | ;; Send existing partial line to inferior (without newline). | 1295 | ;; Send existing partial line to inferior (without newline). |
| 1250 | (let ((pmark (process-mark (get-buffer-process (current-buffer)))) | 1296 | (let ((pmark (process-mark (get-buffer-process (current-buffer)))) |
| 1251 | (save-input-sender term-input-sender)) | 1297 | (save-input-sender term-input-sender)) |
| @@ -1265,9 +1311,20 @@ This means that Emacs editing commands work as normally, until | |||
| 1265 | you type \\[term-send-input] which sends the current line to the inferior." | 1311 | you type \\[term-send-input] which sends the current line to the inferior." |
| 1266 | (interactive) | 1312 | (interactive) |
| 1267 | (when (term-in-char-mode) | 1313 | (when (term-in-char-mode) |
| 1314 | (when term-char-mode-buffer-read-only | ||
| 1315 | (setq buffer-read-only term-line-mode-buffer-read-only)) | ||
| 1316 | (remove-hook 'pre-command-hook #'term-set-goto-process-mark t) | ||
| 1317 | (remove-hook 'post-command-hook #'term-goto-process-mark-maybe t) | ||
| 1268 | (use-local-map term-old-mode-map) | 1318 | (use-local-map term-old-mode-map) |
| 1269 | (term-update-mode-line))) | 1319 | (term-update-mode-line))) |
| 1270 | 1320 | ||
| 1321 | (defun term-line-mode-buffer-read-only-update () | ||
| 1322 | "Update the user-set state of `buffer-read-only' in `term-line-mode'. | ||
| 1323 | |||
| 1324 | Called as a buffer-local `read-only-mode-hook' function." | ||
| 1325 | (when (term-in-line-mode) | ||
| 1326 | (setq term-line-mode-buffer-read-only buffer-read-only))) | ||
| 1327 | |||
| 1271 | (defun term-update-mode-line () | 1328 | (defun term-update-mode-line () |
| 1272 | (let ((term-mode | 1329 | (let ((term-mode |
| 1273 | (if (term-in-char-mode) | 1330 | (if (term-in-char-mode) |
| @@ -2711,6 +2768,7 @@ See `term-prompt-regexp'." | |||
| 2711 | count-bytes ; number of bytes | 2768 | count-bytes ; number of bytes |
| 2712 | decoded-substring | 2769 | decoded-substring |
| 2713 | save-point save-marker old-point temp win | 2770 | save-point save-marker old-point temp win |
| 2771 | (inhibit-read-only t) | ||
| 2714 | (buffer-undo-list t) | 2772 | (buffer-undo-list t) |
| 2715 | (selected (selected-window)) | 2773 | (selected (selected-window)) |
| 2716 | last-win | 2774 | last-win |
| @@ -3109,6 +3167,46 @@ See `term-prompt-regexp'." | |||
| 3109 | (when (get-buffer-window (current-buffer)) | 3167 | (when (get-buffer-window (current-buffer)) |
| 3110 | (redisplay)))) | 3168 | (redisplay)))) |
| 3111 | 3169 | ||
| 3170 | (defvar-local term-goto-process-mark t | ||
| 3171 | "Whether to reset point to the current process mark after this command. | ||
| 3172 | |||
| 3173 | Set in `pre-command-hook' in char mode by `term-set-goto-process-mark'.") | ||
| 3174 | |||
| 3175 | (defun term-set-goto-process-mark () | ||
| 3176 | "Sets `term-goto-process-mark'. | ||
| 3177 | |||
| 3178 | Always set to nil if `term-char-mode-point-at-process-mark' is nil. | ||
| 3179 | |||
| 3180 | Called as a buffer-local `pre-command-hook' function in | ||
| 3181 | `term-char-mode' so that when point is equal to the process mark | ||
| 3182 | at the pre-command stage, we know to restore point to the process | ||
| 3183 | mark at the post-command stage. | ||
| 3184 | |||
| 3185 | See also `term-goto-process-mark-maybe'." | ||
| 3186 | (setq term-goto-process-mark | ||
| 3187 | (and term-char-mode-point-at-process-mark | ||
| 3188 | (eq (point) (marker-position (term-process-mark)))))) | ||
| 3189 | |||
| 3190 | (defun term-goto-process-mark-maybe () | ||
| 3191 | "Move point to the term buffer's process mark upon keyboard input. | ||
| 3192 | |||
| 3193 | Called as a buffer-local `post-command-hook' function in | ||
| 3194 | `term-char-mode' to prevent commands from putting the buffer into | ||
| 3195 | an inconsistent state by unexpectedly moving point. | ||
| 3196 | |||
| 3197 | Mouse events are ignored so that mouse selection is unimpeded. | ||
| 3198 | |||
| 3199 | Only acts when the pre-command position of point was equal to the | ||
| 3200 | process mark, and the `term-char-mode-point-at-process-mark' | ||
| 3201 | option is enabled. See `term-set-goto-process-mark'." | ||
| 3202 | (when term-goto-process-mark | ||
| 3203 | (unless (mouse-event-p last-command-event) | ||
| 3204 | (goto-char (term-process-mark))))) | ||
| 3205 | |||
| 3206 | (defun term-process-mark () | ||
| 3207 | "The current `process-mark' for the term buffer process." | ||
| 3208 | (process-mark (get-buffer-process (current-buffer)))) | ||
| 3209 | |||
| 3112 | (defun term-handle-deferred-scroll () | 3210 | (defun term-handle-deferred-scroll () |
| 3113 | (let ((count (- (term-current-row) term-height))) | 3211 | (let ((count (- (term-current-row) term-height))) |
| 3114 | (when (>= count 0) | 3212 | (when (>= count 0) |