[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master cda4c74: Merge from origin/emacs-26
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] master cda4c74: Merge from origin/emacs-26 |
Date: |
Sat, 21 Oct 2017 12:12:18 -0400 (EDT) |
branch: master
commit cda4c74e60962a49908d130f6dd70b0ae90a0255
Merge: 701c658 888e51f
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>
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
---
doc/lispref/minibuf.texi | 13 +++++
etc/NEWS.26 | 19 +++++++-
lisp/emacs-lisp/eldoc.el | 3 +-
lisp/help-fns.el | 4 +-
lisp/leim/quail/cyrillic.el | 114 ++++++++++++++++++++++++++++++++++++++++++++
lisp/progmodes/flymake.el | 10 ++--
lisp/simple.el | 11 +++--
lisp/term.el | 98 +++++++++++++++++++++++++++++++++++++
8 files changed, 260 insertions(+), 12 deletions(-)
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index afd44b7..1ece899 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.
@xref{Hooks}.
@end defvar
address@hidden minibuffer-with-setup-hook function &rest body
+This macro executes @var{body} after arranging for the specified
address@hidden to be called via @code{minibuffer-setup-hook}. By
+default, @var{function} is called before the other functions in the
address@hidden list, but if @var{function} is of the
+form @address@hidden(:append @var{func})}}, @var{func} will be called
address@hidden the other hook functions.
+
+The @var{body} forms should not use the minibuffer more than once. If
+the minibuffer is re-entered recursively, @var{function} will only be
+called once, for the outermost use of the minibuffer.
address@hidden defmac
+
@defvar minibuffer-exit-hook
This is a normal hook that is run whenever the minibuffer is exited.
@xref{Hooks}.
diff --git a/etc/NEWS.26 b/etc/NEWS.26
index 97b21f7..8277893 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
variable of this kind to swap modifiers in Emacs.
---
-** New input methods: 'cyrillic-tuvan', 'polish-prefix'.
+** New input methods: 'cyrillic-tuvan', 'polish-prefix', 'uzbek-cyrillic'.
---
** The 'dutch' input method no longer attempts to support Turkish too.
@@ -1168,6 +1168,23 @@ provided.
The old Flymake behavior is preserved in the so-called "legacy
backend", which has been updated to benefit from the new UI features.
+** Term
+
+---
+*** `term-char-mode' now makes its buffer read-only.
+
+The buffer is made read-only to prevent changes from being made by
+anything other than the process filter; and movements of point away
+from the process mark are counter-acted so that the cursor is in the
+correct position after each command. This is needed to avoid states
+which are inconsistent with the state of the terminal understood by
+the inferior process.
+
+New user options `term-char-mode-buffer-read-only' and
+`term-char-mode-point-at-process-mark' control these behaviors, and
+are non-nil by default. Customize these options to nil if you want
+the previous behavior.
+
* New Modes and Packages in Emacs 26.1
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index cba9a00..ad08977 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -264,12 +264,13 @@ Otherwise work like `message'."
(or (window-in-direction 'above (minibuffer-window))
(minibuffer-selected-window)
(get-largest-window)))
+ (when mode-line-format
(unless (and (listp mode-line-format)
(assq 'eldoc-mode-line-string mode-line-format))
(setq mode-line-format
(list "" '(eldoc-mode-line-string
(" " eldoc-mode-line-string " "))
- mode-line-format)))
+ mode-line-format))))
(setq eldoc-mode-line-string
(when (stringp format-string)
(apply #'format-message format-string args)))
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index e509ce6..3c23765 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)."
;; for invalid functions i.s.o. signaling an error.
(documentation function t)
;; E.g. an alias for a not yet defined function.
- (invalid-function nil)))
+ ((invalid-function void-function) nil)))
(key-bindings-buffer (current-buffer)))
;; 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)."
(if (subrp def) (indirect-function real-def) real-def)
real-function key-bindings-buffer)
;; E.g. an alias for a not yet defined function.
- (invalid-function doc-raw))))
+ ((invalid-function void-function) doc-raw))))
(run-hook-with-args 'help-fns-describe-function-functions function)
(insert "\n" (or doc "Not documented.")))
(when (or (function-get function 'pure)
diff --git a/lisp/leim/quail/cyrillic.el b/lisp/leim/quail/cyrillic.el
index 95b443f..2218095 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."
("|" ?Ґ))
;;
+(quail-define-package
+ "uzbek-cyrillic" "Ўзбекча" "Ўзб" nil
+ "ЙЦУКЕН Uzbek computer layout"
+ nil t t t t nil nil nil nil nil t)
+
+;; Ё 1! 2" 3№ 4; 5% 6: 7? 8* 9( 0) Ғ Ҳ
+;; Й Ц У К Е Н Г Ш Ў З Х Ъ \|
+;; Ф Қ В А П Р О Л Д Ж Э
+;; Я Ч С М И Т Ь Б Ю .,
+
+(quail-define-rules
+ ("`" ?ё)
+ ("1" ?1)
+ ("2" ?2)
+ ("3" ?3)
+ ("4" ?4)
+ ("5" ?5)
+ ("6" ?6)
+ ("7" ?7)
+ ("8" ?8)
+ ("9" ?9)
+ ("0" ?0)
+ ("-" ?ғ)
+ ("=" ?ҳ)
+
+ ("q" ?й)
+ ("w" ?ц)
+ ("e" ?у)
+ ("r" ?к)
+ ("t" ?е)
+ ("y" ?н)
+ ("u" ?г)
+ ("i" ?ш)
+ ("o" ?ў)
+ ("p" ?з)
+ ("[" ?х)
+ ("]" ?ъ)
+ ("\\" ?\\)
+
+ ("a" ?ф)
+ ("s" ?қ)
+ ("d" ?в)
+ ("f" ?а)
+ ("g" ?п)
+ ("h" ?р)
+ ("j" ?о)
+ ("k" ?л)
+ ("l" ?д)
+ (";" ?ж)
+ ("'" ?э)
+
+ ("z" ?я)
+ ("x" ?ч)
+ ("c" ?с)
+ ("v" ?м)
+ ("b" ?и)
+ ("n" ?т)
+ ("m" ?ь)
+ ("," ?б)
+ ("." ?ю)
+ ("/" ?.)
+
+ ("~" ?Ё)
+ ("!" ?!)
+ ("@" ?\")
+ ("#" ?№)
+ ("$" ?\;)
+ ("%" ?%)
+ ("^" ?:)
+ ("&" ??)
+ ("*" ?*)
+ ("(" ?\()
+ (")" ?\))
+ ("_" ?Ғ)
+ ("+" ?Ҳ)
+
+ ("Q" ?Й)
+ ("W" ?Ц)
+ ("E" ?У)
+ ("R" ?К)
+ ("T" ?Е)
+ ("Y" ?Н)
+ ("U" ?Г)
+ ("I" ?Ш)
+ ("O" ?Ў)
+ ("P" ?З)
+ ("{" ?Х)
+ ("}" ?Ъ)
+ ("|" ?|)
+
+ ("A" ?Ф)
+ ("S" ?Қ)
+ ("D" ?В)
+ ("F" ?А)
+ ("G" ?П)
+ ("H" ?Р)
+ ("J" ?О)
+ ("K" ?Л)
+ ("L" ?Д)
+ (":" ?Ж)
+ ("\"" ?Э)
+
+ ("Z" ?Я)
+ ("X" ?Ч)
+ ("C" ?С)
+ ("V" ?М)
+ ("B" ?И)
+ ("N" ?Т)
+ ("M" ?Ь)
+ ("<" ?Б)
+ (">" ?Ю)
+ ("?" ?,))
+
+
;; Alexander Mikhailian says this is of limited use. It has been
;; popular among emigrants or foreigners who have to type in Cyrillic
;; (mostly Russian) from time to time.
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 3c588f0..1048bc5 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1068,12 +1068,14 @@ applied."
keymap
,(let ((map (make-sparse-keymap))
(type type))
- (define-key map [mode-line mouse-4]
+ (define-key map (vector 'mode-line
+ mouse-wheel-down-event)
(lambda (event)
(interactive "e")
(with-selected-window (posn-window (event-start
event))
(flymake-goto-prev-error 1 (list type) t))))
- (define-key map [mode-line mouse-5]
+ (define-key map (vector 'mode-line
+ mouse-wheel-up-event)
(lambda (event)
(interactive "e")
(with-selected-window (posn-window (event-start
event))
@@ -1086,7 +1088,9 @@ applied."
'face face)
(propertize (format "%s" type)
'face face))
- "mouse-4/mouse-5: previous/next of this type\n"))
+ (format "%s/%s: previous/next of this type"
+ mouse-wheel-down-event
+ mouse-wheel-up-event)))
into forms
finally return
`((:propertize "[")
diff --git a/lisp/simple.el b/lisp/simple.el
index 5ef511c..12d65e5 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -53,9 +53,10 @@ restores the buffer position before the command."
:version "26.1")
(defvar shell-command-saved-pos nil
- "Position of point in the output buffer after command completes.
-It is a cons cell of the form (BUFFER . POS), where BUFFER is the output
-buffer, and POS is the point position in BUFFER once the command finishes.
+ "Record of point positions in output buffers after command completion.
+The value is an alist whose elements are of the form (BUFFER . POS),
+where BUFFER is the output buffer, and POS is the point position
+in BUFFER once the command finishes.
This variable is used when `shell-command-dont-erase-buffer' is non-nil.")
(defcustom idle-update-delay 0.5
@@ -1003,7 +1004,7 @@ Called with one argument METHOD.
If METHOD is `delete-only', then delete the region; the return value
is undefined. If METHOD is nil, then return the content as a string.
If METHOD is `bounds', then return the boundaries of the region
-as a cons cell of the form (START . END).
+as a list of cons cells of the form (START . END).
If METHOD is anything else, delete the region and return its content
as a string, after filtering it with `filter-buffer-substring', which
is called with METHOD as its 3rd argument.")
@@ -5474,7 +5475,7 @@ also checks the value of `use-empty-active-region'."
(defun region-bounds ()
"Return the boundaries of the region as a pair of positions.
-Value is a cons cell of the form (START . END)."
+Value is a list of cons cells of the form (START . END)."
(funcall region-extract-function 'bounds))
(defun region-noncontiguous-p ()
diff --git a/lisp/term.el b/lisp/term.el
index c748c45..2046578 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
(defvar term-old-mode-line-format) ; Saves old mode-line-format while paging.
(defvar term-pager-old-local-map nil "Saves old keymap while paging.")
(defvar term-pager-old-filter) ; Saved process-filter while paging.
+(defvar-local term-line-mode-buffer-read-only nil
+ "The `buffer-read-only' state to set in `term-line-mode'.")
(defcustom explicit-shell-file-name nil
"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."
:type 'boolean
:group 'term)
+(defcustom term-char-mode-buffer-read-only t
+ "If non-nil, only the process filter may modify the buffer in char mode.
+
+A non-nil value makes the buffer read-only in `term-char-mode',
+which prevents editing commands from making the buffer state
+inconsistent with the state of the terminal understood by the
+inferior process. Only the process filter is allowed to make
+changes to the buffer.
+
+Customize this option to nil if you want the previous behaviour."
+ :version "26.1"
+ :type 'boolean
+ :group 'term)
+
+(defcustom term-char-mode-point-at-process-mark t
+ "If non-nil, keep point at the process mark in char mode.
+
+A non-nil value causes point to be moved to the current process
+mark after each command in `term-char-mode' (provided that the
+pre-command point position was also at the process mark). This
+prevents commands that move point from making the buffer state
+inconsistent with the state of the terminal understood by the
+inferior process.
+
+Mouse events are not affected, so moving point and selecting text
+is still possible in char mode via the mouse, after which other
+commands can be invoked on the mouse-selected point or region,
+until the process filter (or user) moves point to the process
+mark once again.
+
+Customize this option to nil if you want the previous behaviour."
+ :version "26.1"
+ :type 'boolean
+ :group 'term)
+
(defcustom term-scroll-to-bottom-on-output nil
"Controls whether interpreter output causes window to scroll.
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'."
(term-reset-size (cdr size) (car size)))
size))
+ (add-hook 'read-only-mode-hook #'term-line-mode-buffer-read-only-update nil
t)
+
(easy-menu-add term-terminal-menu)
(easy-menu-add term-signals-menu)
(or term-input-ring
@@ -1246,6 +1285,13 @@ intervention from Emacs, except for the escape character
(usually C-c)."
(easy-menu-add term-terminal-menu)
(easy-menu-add term-signals-menu)
+ ;; Don't allow changes to the buffer or to point which are not
+ ;; caused by the process filter.
+ (when term-char-mode-buffer-read-only
+ (setq buffer-read-only t))
+ (add-hook 'pre-command-hook #'term-set-goto-process-mark nil t)
+ (add-hook 'post-command-hook #'term-goto-process-mark-maybe nil t)
+
;; Send existing partial line to inferior (without newline).
(let ((pmark (process-mark (get-buffer-process (current-buffer))))
(save-input-sender term-input-sender))
@@ -1265,9 +1311,20 @@ This means that Emacs editing commands work as normally,
until
you type \\[term-send-input] which sends the current line to the inferior."
(interactive)
(when (term-in-char-mode)
+ (when term-char-mode-buffer-read-only
+ (setq buffer-read-only term-line-mode-buffer-read-only))
+ (remove-hook 'pre-command-hook #'term-set-goto-process-mark t)
+ (remove-hook 'post-command-hook #'term-goto-process-mark-maybe t)
(use-local-map term-old-mode-map)
(term-update-mode-line)))
+(defun term-line-mode-buffer-read-only-update ()
+ "Update the user-set state of `buffer-read-only' in `term-line-mode'.
+
+Called as a buffer-local `read-only-mode-hook' function."
+ (when (term-in-line-mode)
+ (setq term-line-mode-buffer-read-only buffer-read-only)))
+
(defun term-update-mode-line ()
(let ((term-mode
(if (term-in-char-mode)
@@ -2711,6 +2768,7 @@ See `term-prompt-regexp'."
count-bytes ; number of bytes
decoded-substring
save-point save-marker old-point temp win
+ (inhibit-read-only t)
(buffer-undo-list t)
(selected (selected-window))
last-win
@@ -3109,6 +3167,46 @@ See `term-prompt-regexp'."
(when (get-buffer-window (current-buffer))
(redisplay))))
+(defvar-local term-goto-process-mark t
+ "Whether to reset point to the current process mark after this command.
+
+Set in `pre-command-hook' in char mode by `term-set-goto-process-mark'.")
+
+(defun term-set-goto-process-mark ()
+ "Sets `term-goto-process-mark'.
+
+Always set to nil if `term-char-mode-point-at-process-mark' is nil.
+
+Called as a buffer-local `pre-command-hook' function in
+`term-char-mode' so that when point is equal to the process mark
+at the pre-command stage, we know to restore point to the process
+mark at the post-command stage.
+
+See also `term-goto-process-mark-maybe'."
+ (setq term-goto-process-mark
+ (and term-char-mode-point-at-process-mark
+ (eq (point) (marker-position (term-process-mark))))))
+
+(defun term-goto-process-mark-maybe ()
+ "Move point to the term buffer's process mark upon keyboard input.
+
+Called as a buffer-local `post-command-hook' function in
+`term-char-mode' to prevent commands from putting the buffer into
+an inconsistent state by unexpectedly moving point.
+
+Mouse events are ignored so that mouse selection is unimpeded.
+
+Only acts when the pre-command position of point was equal to the
+process mark, and the `term-char-mode-point-at-process-mark'
+option is enabled. See `term-set-goto-process-mark'."
+ (when term-goto-process-mark
+ (unless (mouse-event-p last-command-event)
+ (goto-char (term-process-mark)))))
+
+(defun term-process-mark ()
+ "The current `process-mark' for the term buffer process."
+ (process-mark (get-buffer-process (current-buffer))))
+
(defun term-handle-deferred-scroll ()
(let ((count (- (term-current-row) term-height)))
(when (>= count 0)