Commit 590dab5a authored by Paul Eggert's avatar Paul Eggert

Merge from origin/emacs-25

8c2946e2 In NEWS describe new handling of window margins (Bug#24193)
0cee66c3 Facultatively ignore margins when splitting and resizing wind...
8d681476 Document CATEGORY arg to modify-category-entry
8342e748 Document char-script-table's effect on word motion
e9ff4857 Further fix for 'url-http-create-request' and multibyte strings
06952353 Fix docstring of eval-expression
98b01dd1 Clarify when 'cursor' property is in effect
75f18824 Convert the remaining strings to unibyte before concatenating
d2db5dd8 Fix bug with handling the bidi cache
ccd0e92e * doc/lispref/text.texi (Change Hooks): Minor copyedits.
f785ff45 Clarify documentation of before/after-change-functions
3c9cb57c Document use of vectors in keymaps

# Conflicts:
#	src/xdisp.c
parents caa2770d 8c2946e2
...@@ -194,10 +194,19 @@ explicitly bound to @code{nil} (see below). ...@@ -194,10 +194,19 @@ explicitly bound to @code{nil} (see below).
@item @var{char-table} @item @var{char-table}
If an element of a keymap is a char-table, it counts as holding If an element of a keymap is a char-table, it counts as holding
bindings for all character events with no modifier bits bindings for all character events with no modifier bits
(@pxref{modifier bits}): element @var{n} is the binding for the (@pxref{modifier bits}): the element whose index is @var{c} is the
character with code @var{n}. This is a compact way to record lots of binding for the character @var{c}. This is a compact way to record
bindings. A keymap with such a char-table is called a @dfn{full lots of bindings. A keymap with such a char-table is called a
keymap}. Other keymaps are called @dfn{sparse keymaps}. @dfn{full keymap}. Other keymaps are called @dfn{sparse keymaps}.
@item @var{vector}
This kind of element is similar to a char-table: the element whose
index is @var{c} is the binding for the character @var{c}. Since the
range of characters that can be bound this way is limited by the
vector size, and vector creation allocates space for all character
codes from 0 up, this format should not be used except for creating
menu keymaps (@pxref{Menu Keymaps}), where the bindings themselves
don't matter.
@item @var{string} @item @var{string}
@cindex keymap prompt string @cindex keymap prompt string
......
...@@ -192,8 +192,9 @@ in the opposite direction. ...@@ -192,8 +192,9 @@ in the opposite direction.
@subsection Motion by Words @subsection Motion by Words
The functions for parsing words described below use the syntax table The functions for parsing words described below use the syntax table
to decide whether a given character is part of a word. @xref{Syntax and @code{char-script-table} to decide whether a given character is
Tables}. part of a word. @xref{Syntax Tables}, and see @ref{Character
Properties}.
@deffn Command forward-word &optional count @deffn Command forward-word &optional count
This function moves point forward @var{count} words (or backward if This function moves point forward @var{count} words (or backward if
...@@ -207,11 +208,13 @@ and then continue moving until the word ends. By default, characters ...@@ -207,11 +208,13 @@ and then continue moving until the word ends. By default, characters
that begin and end words, known as @dfn{word boundaries}, are defined that begin and end words, known as @dfn{word boundaries}, are defined
by the current buffer's syntax table (@pxref{Syntax Class Table}), but by the current buffer's syntax table (@pxref{Syntax Class Table}), but
modes can override that by setting up a suitable modes can override that by setting up a suitable
@code{find-word-boundary-function-table}, described below. In any @code{find-word-boundary-function-table}, described below. Characters
case, this function cannot move point past the boundary of the that belong to different scripts (as defined by
accessible portion of the buffer, or across a field boundary @code{char-syntax-table}), also define a word boundary
(@pxref{Fields}). The most common case of a field boundary is the end (@pxref{Character Properties}). In any case, this function cannot
of the prompt in the minibuffer. move point past the boundary of the accessible portion of the buffer,
or across a field boundary (@pxref{Fields}). The most common case of
a field boundary is the end of the prompt in the minibuffer.
If it is possible to move @var{count} words, without being stopped If it is possible to move @var{count} words, without being stopped
prematurely by the buffer boundary or a field boundary, the value is prematurely by the buffer boundary or a field boundary, the value is
......
...@@ -3439,12 +3439,14 @@ the beginning of the @code{display} property or at ...@@ -3439,12 +3439,14 @@ the beginning of the @code{display} property or at
@cindex cursor position for @code{display} properties and overlays @cindex cursor position for @code{display} properties and overlays
When the buffer has many overlay strings (e.g., @pxref{Overlay When the buffer has many overlay strings (e.g., @pxref{Overlay
Properties, before-string}) or @code{display} properties that are Properties, before-string}) that conceal some of the buffer text or
strings, it is a good idea to use the @code{cursor} property on these @code{display} properties that are strings, it is a good idea to use
strings to cue the Emacs display about the places where to put the the @code{cursor} property on these strings to cue the Emacs display
cursor while traversing these strings. This directly communicates to about the places where to put the cursor while traversing these
the display engine where the Lisp program wants to put the cursor, or strings. This directly communicates to the display engine where the
where the user would expect the cursor. Lisp program wants to put the cursor, or where the user would expect
the cursor, when point is located on some buffer position that is
``covered'' by the display or overlay string.
@item pointer @item pointer
@kindex pointer @r{(text property)} @kindex pointer @r{(text property)}
...@@ -4770,10 +4772,10 @@ group you start for any given buffer should be the last one finished. ...@@ -4770,10 +4772,10 @@ group you start for any given buffer should be the last one finished.
@cindex change hooks @cindex change hooks
@cindex hooks for text changes @cindex hooks for text changes
These hook variables let you arrange to take notice of all changes in These hook variables let you arrange to take notice of changes in
all buffers (or in a particular buffer, if you make them buffer-local). buffers (or in a particular buffer, if you make them buffer-local).
See also @ref{Special Properties}, for how to detect changes to specific See also @ref{Special Properties}, for how to detect changes to
parts of the text. specific parts of the text.
The functions you use in these hooks should save and restore the match The functions you use in these hooks should save and restore the match
data if they do anything that uses regular expressions; otherwise, they data if they do anything that uses regular expressions; otherwise, they
...@@ -4781,18 +4783,20 @@ will interfere in bizarre ways with the editing operations that call ...@@ -4781,18 +4783,20 @@ will interfere in bizarre ways with the editing operations that call
them. them.
@defvar before-change-functions @defvar before-change-functions
This variable holds a list of functions to call before any buffer This variable holds a list of functions to call when Emacs is about to
modification. Each function gets two arguments, the beginning and end modify a buffer. Each function gets two arguments, the beginning and
of the region that is about to change, represented as integers. The end of the region that is about to change, represented as integers.
buffer that is about to change is always the current buffer. The buffer that is about to change is always the current buffer when
the function is called.
@end defvar @end defvar
@defvar after-change-functions @defvar after-change-functions
This variable holds a list of functions to call after any buffer This variable holds a list of functions to call after Emacs modifies a
modification. Each function receives three arguments: the beginning buffer. Each function receives three arguments: the beginning and end
and end of the region just changed, and the length of the text that of the region just changed, and the length of the text that existed
existed before the change. All three arguments are integers. The before the change. All three arguments are integers. The buffer that
buffer that has been changed is always the current buffer. has been changed is always the current buffer when the function is
called.
The length of the old text is the difference between the buffer The length of the old text is the difference between the buffer
positions before and after that text as it was before the change. As positions before and after that text as it was before the change. As
...@@ -4800,8 +4804,19 @@ for the changed text, its length is simply the difference between the ...@@ -4800,8 +4804,19 @@ for the changed text, its length is simply the difference between the
first two arguments. first two arguments.
@end defvar @end defvar
Output of messages into the @file{*Messages*} buffer does not Output of messages into the @file{*Messages*} buffer does not call
call these functions. these functions, and neither do certain internal buffer changes, such
as changes in buffers created by Emacs internally for certain jobs,
that should not be visible to Lisp programs.
Do @emph{not} expect the before-change hooks and the after-change
hooks be called in balanced pairs around each buffer change. Also
don't expect the before-change hooks to be called for every chunk of
text Emacs is about to delete. These hooks are provided on the
assumption that Lisp programs will use either before- or the
after-change hooks, but not both, and the boundaries of the region
where the changes happen might include more than just the actual
changed text, or even lump together several changes done piecemeal.
@defmac combine-after-change-calls body@dots{} @defmac combine-after-change-calls body@dots{}
The macro executes @var{body} normally, but arranges to call the The macro executes @var{body} normally, but arranges to call the
......
...@@ -4386,6 +4386,27 @@ window when it deletes the window passed to it as argument. ...@@ -4386,6 +4386,27 @@ window when it deletes the window passed to it as argument.
The fourth element is the buffer whose display caused the creation of The fourth element is the buffer whose display caused the creation of
this parameter. @code{quit-restore-window} deletes the specified window this parameter. @code{quit-restore-window} deletes the specified window
only if it still shows that buffer. only if it still shows that buffer.
@item @code{min-margins}
The value of this parameter is a cons cell whose @sc{car} and @sc{cdr},
if non-@code{nil}, specify the minimum values (in columns) for the left
and right margin of this window. When present, Emacs will use these
values instead of the actual margin widths for determining whether a
window can be split or shrunk horizontally.
Emacs never auto-adjusts the margins of any window after splitting or
resizing it. It is sole responsibility of the application that has set
this parameter to adjust the margins of this window as well as those of
any new window that inherits this window's margins due to a split.
Both, @code{window-configuration-change-hook} and
@code{window-size-change-functions} (@pxref{Window Hooks}), should be
employed for this purpose.
This parameter was introduced in Emacs version 25.1 to support
applications that use large margins to center buffer text within a
window and should be used, with due care, exclusively by those
applications. It might be replaced by an improved solution in future
versions of Emacs.
@end table @end table
There are additional parameters @code{window-atom} and @code{window-side}; There are additional parameters @code{window-atom} and @code{window-side};
......
...@@ -2215,6 +2215,14 @@ frames. ...@@ -2215,6 +2215,14 @@ frames.
'window-divider-default-places', 'window-divider-default-bottom-width' 'window-divider-default-places', 'window-divider-default-bottom-width'
and 'window-divider-default-right-width'. and 'window-divider-default-right-width'.
*** When a window is shrunk horizontally its margins are no more removed
automatically. Rather, Emacs refuses to split or resize windows when
this would cause margins to no more fit into the width reserved for the
corresponding window. An application can override this behavior for a
particular window by setting that window's 'min-margins' parameter. As
a consequence, the application becomes fully responsible for trimming
the margin sizes of that window and any window inheriting these margins.
*** The window displaying the '*Completions*' buffer with minibuffer *** The window displaying the '*Completions*' buffer with minibuffer
completion candidates is now shown at the bottom of the selected completion candidates is now shown at the bottom of the selected
frame. The size of that window is always as large as required to frame. The size of that window is always as large as required to
......
...@@ -1479,16 +1479,16 @@ result of expression evaluation." ...@@ -1479,16 +1479,16 @@ result of expression evaluation."
"Evaluate EXP and print value in the echo area. "Evaluate EXP and print value in the echo area.
When called interactively, read an Emacs Lisp expression and evaluate it. When called interactively, read an Emacs Lisp expression and evaluate it.
Value is also consed on to front of the variable `values'. Value is also consed on to front of the variable `values'.
Optional argument INSERT-VALUE non-nil (interactively, with prefix If the resulting value is an integer, it will be printed in
argument) means insert the result into the current buffer instead of several additional formats (octal, hexadecimal, and character).
printing it in the echo area. Optional argument INSERT-VALUE non-nil (interactively, with
prefix argument) means insert the result into the current buffer
instead of printing it in the echo area.
Normally, this function truncates long output according to the value Normally, this function truncates long output according to the value
of the variables `eval-expression-print-length' and of the variables `eval-expression-print-length' and
`eval-expression-print-level'. With a prefix argument of zero, `eval-expression-print-level'. With a prefix argument of zero,
however, there is no such truncation. Such a prefix argument however, there is no such truncation.
also causes integers to be printed in several additional formats
\(octal, hexadecimal, and character).
Runs the hook `eval-expression-minibuffer-setup-hook' on entering the Runs the hook `eval-expression-minibuffer-setup-hook' on entering the
minibuffer. minibuffer.
......
...@@ -267,7 +267,7 @@ The string is based on `url-privacy-level' and `url-user-agent'." ...@@ -267,7 +267,7 @@ The string is based on `url-privacy-level' and `url-user-agent'."
'url-http-proxy-basic-auth-storage)) 'url-http-proxy-basic-auth-storage))
(url-get-authentication url-http-proxy nil 'any nil)))) (url-get-authentication url-http-proxy nil 'any nil))))
(real-fname (url-filename url-http-target-url)) (real-fname (url-filename url-http-target-url))
(host (url-host url-http-target-url)) (host (url-http--encode-string (url-host url-http-target-url)))
(auth (if (cdr-safe (assoc "Authorization" url-http-extra-headers)) (auth (if (cdr-safe (assoc "Authorization" url-http-extra-headers))
nil nil
(url-get-authentication (or (url-get-authentication (or
...@@ -310,7 +310,8 @@ The string is based on `url-privacy-level' and `url-user-agent'." ...@@ -310,7 +310,8 @@ The string is based on `url-privacy-level' and `url-user-agent'."
(concat (concat
;; The request ;; The request
(or url-http-method "GET") " " (or url-http-method "GET") " "
(if using-proxy (url-recreate-url url-http-target-url) real-fname) (url-http--encode-string
(if using-proxy (url-recreate-url url-http-target-url) real-fname))
" HTTP/" url-http-version "\r\n" " HTTP/" url-http-version "\r\n"
;; Version of MIME we speak ;; Version of MIME we speak
"MIME-Version: 1.0\r\n" "MIME-Version: 1.0\r\n"
...@@ -347,7 +348,9 @@ The string is based on `url-privacy-level' and `url-user-agent'." ...@@ -347,7 +348,9 @@ The string is based on `url-privacy-level' and `url-user-agent'."
"Accept-encoding: " url-mime-encoding-string "\r\n")) "Accept-encoding: " url-mime-encoding-string "\r\n"))
(if url-mime-charset-string (if url-mime-charset-string
(concat (concat
"Accept-charset: " url-mime-charset-string "\r\n")) "Accept-charset: "
(url-http--encode-string url-mime-charset-string)
"\r\n"))
;; Languages we understand ;; Languages we understand
(if url-mime-language-string (if url-mime-language-string
(concat (concat
...@@ -393,6 +396,11 @@ The string is based on `url-privacy-level' and `url-user-agent'." ...@@ -393,6 +396,11 @@ The string is based on `url-privacy-level' and `url-user-agent'."
(url-http-debug "Request is: \n%s" request) (url-http-debug "Request is: \n%s" request)
request)) request))
(defun url-http--encode-string (s)
(if (multibyte-string-p s)
(encode-coding-string s 'us-ascii)
s))
;; Parsing routines ;; Parsing routines
(defun url-http-clean-headers () (defun url-http-clean-headers ()
"Remove trailing \r from header lines. "Remove trailing \r from header lines.
......
...@@ -1381,10 +1381,21 @@ return the minimum pixel-size of WINDOW." ...@@ -1381,10 +1381,21 @@ return the minimum pixel-size of WINDOW."
(let* ((char-size (frame-char-size window t)) (let* ((char-size (frame-char-size window t))
(fringes (window-fringes window)) (fringes (window-fringes window))
(margins (window-margins window)) (margins (window-margins window))
;; Let the 'min-margins' parameter override the actual
;; widths of the margins. We allow any number to
;; replace the values specified by `window-margins'.
;; See bug#24193 for the rationale of this parameter.
(min-margins (window-parameter window 'min-margins))
(left-min-margin (and min-margins
(numberp (car min-margins))
(car min-margins)))
(right-min-margin (and min-margins
(numberp (cdr min-margins))
(cdr min-margins)))
(pixel-width (pixel-width
(+ (window-safe-min-size window t t) (+ (window-safe-min-size window t t)
(* (or (car margins) 0) char-size) (* (or left-min-margin (car margins) 0) char-size)
(* (or (cdr margins) 0) char-size) (* (or right-min-margin(cdr margins) 0) char-size)
(car fringes) (cadr fringes) (car fringes) (cadr fringes)
(window-scroll-bar-width window) (window-scroll-bar-width window)
(window-right-divider-width window)))) (window-right-divider-width window))))
...@@ -4771,7 +4782,7 @@ frame. The selected window is not changed by this function." ...@@ -4771,7 +4782,7 @@ frame. The selected window is not changed by this function."
(window-sizable-p (window-sizable-p
parent (- (+ new-pixel-size divider-width)) horizontal parent (- (+ new-pixel-size divider-width)) horizontal
(setq ignore 'preserved) t)) (setq ignore 'preserved) t))
(error "Window %s too small for splitting (1)" parent))) (error "Window %s too small for splitting" parent)))
((and (> (+ new-pixel-size divider-width ((and (> (+ new-pixel-size divider-width
(window-min-size window horizontal nil t)) (window-min-size window horizontal nil t))
old-pixel-size) old-pixel-size)
...@@ -4780,7 +4791,7 @@ frame. The selected window is not changed by this function." ...@@ -4780,7 +4791,7 @@ frame. The selected window is not changed by this function."
window horizontal (setq ignore 'preserved) t)) window horizontal (setq ignore 'preserved) t))
old-pixel-size)) old-pixel-size))
;; SIZE unspecified, no resizing. ;; SIZE unspecified, no resizing.
(error "Window %s too small for splitting (2)" window)))) (error "Window %s too small for splitting" window))))
((and (>= pixel-size 0) ((and (>= pixel-size 0)
(or (>= pixel-size old-pixel-size) (or (>= pixel-size old-pixel-size)
(< new-pixel-size (< new-pixel-size
...@@ -4788,7 +4799,7 @@ frame. The selected window is not changed by this function." ...@@ -4788,7 +4799,7 @@ frame. The selected window is not changed by this function."
;; SIZE specified as new size of old window. If the new size ;; SIZE specified as new size of old window. If the new size
;; is larger than the old size or the size of the new window ;; is larger than the old size or the size of the new window
;; would be less than the safe minimum, signal an error. ;; would be less than the safe minimum, signal an error.
(error "Window %s too small for splitting (3)" window)) (error "Window %s too small for splitting" window))
(resize (resize
;; SIZE specified, resizing. ;; SIZE specified, resizing.
(unless (or (window-sizable-p (unless (or (window-sizable-p
...@@ -4798,13 +4809,13 @@ frame. The selected window is not changed by this function." ...@@ -4798,13 +4809,13 @@ frame. The selected window is not changed by this function."
parent (- (+ new-pixel-size divider-width)) horizontal parent (- (+ new-pixel-size divider-width)) horizontal
(setq ignore 'preserved) t)) (setq ignore 'preserved) t))
;; If we cannot resize the parent give up. ;; If we cannot resize the parent give up.
(error "Window %s too small for splitting (4)" parent))) (error "Window %s too small for splitting" parent)))
((or (< new-pixel-size ((or (< new-pixel-size
(window-safe-min-pixel-size window horizontal)) (window-safe-min-pixel-size window horizontal))
(< (- old-pixel-size new-pixel-size) (< (- old-pixel-size new-pixel-size)
(window-safe-min-pixel-size window horizontal))) (window-safe-min-pixel-size window horizontal)))
;; SIZE specification violates minimum size restrictions. ;; SIZE specification violates minimum size restrictions.
(error "Window %s too small for splitting (5)" window))) (error "Window %s too small for splitting" window)))
(window--resize-reset frame horizontal) (window--resize-reset frame horizontal)
......
...@@ -336,6 +336,8 @@ The category is changed only for table TABLE, which defaults to ...@@ -336,6 +336,8 @@ The category is changed only for table TABLE, which defaults to
the current buffer's category table. the current buffer's category table.
CHARACTER can be either a single character or a cons representing the CHARACTER can be either a single character or a cons representing the
lower and upper ends of an inclusive character range to modify. lower and upper ends of an inclusive character range to modify.
CATEGORY must be a category name (a character between ` ' and `~').
Use `describe-categories' to see existing category names.
If optional fourth argument RESET is non-nil, If optional fourth argument RESET is non-nil,
then delete CATEGORY from the category set instead of adding it. */) then delete CATEGORY from the category set instead of adding it. */)
(Lisp_Object character, Lisp_Object category, Lisp_Object table, Lisp_Object reset) (Lisp_Object character, Lisp_Object category, Lisp_Object table, Lisp_Object reset)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment