summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-08-22 14:38:49 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2016-08-22 14:38:49 -0700
commit590dab5a68f4283d53ce79d4633fe1503131baea (patch)
tree2e2452d22d54826cb84e2c5dc976abbb2ed40322
parentcaa2770d1d79f9c8013d6dddcd9e86d05230b26d (diff)
parent8c2946e29b38fa3e0dff6b4d402ba0fda0e03c9b (diff)
Merge from origin/emacs-25
8c2946e In NEWS describe new handling of window margins (Bug#24193) 0cee66c Facultatively ignore margins when splitting and resizing wind... 8d68147 Document CATEGORY arg to modify-category-entry 8342e74 Document char-script-table's effect on word motion e9ff485 Further fix for 'url-http-create-request' and multibyte strings 0695235 Fix docstring of eval-expression 98b01dd Clarify when 'cursor' property is in effect 75f1882 Convert the remaining strings to unibyte before concatenating d2db5dd Fix bug with handling the bidi cache ccd0e92 * doc/lispref/text.texi (Change Hooks): Minor copyedits. f785ff4 Clarify documentation of before/after-change-functions 3c9cb57 Document use of vectors in keymaps # Conflicts: # src/xdisp.c
-rw-r--r--doc/lispref/keymaps.texi17
-rw-r--r--doc/lispref/positions.texi17
-rw-r--r--doc/lispref/text.texi57
-rw-r--r--doc/lispref/windows.texi21
-rw-r--r--etc/NEWS8
-rw-r--r--lisp/simple.el12
-rw-r--r--lisp/url/url-http.el14
-rw-r--r--lisp/window.el25
-rw-r--r--src/category.c2
9 files changed, 125 insertions, 48 deletions
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi
index 35d9d0c965..29f2c422cb 100644
--- a/doc/lispref/keymaps.texi
+++ b/doc/lispref/keymaps.texi
@@ -194,10 +194,19 @@ explicitly bound to @code{nil} (see below).
@item @var{char-table}
If an element of a keymap is a char-table, it counts as holding
bindings for all character events with no modifier bits
-(@pxref{modifier bits}): element @var{n} is the binding for the
-character with code @var{n}. This is a compact way to record lots of
-bindings. A keymap with such a char-table is called a @dfn{full
-keymap}. Other keymaps are called @dfn{sparse keymaps}.
+(@pxref{modifier bits}): the element whose index is @var{c} is the
+binding for the character @var{c}. This is a compact way to record
+lots of bindings. A keymap with such a char-table is called a
+@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}
@cindex keymap prompt string
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index 796a06615a..a56ab5ef30 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -192,8 +192,9 @@ in the opposite direction.
@subsection Motion by Words
The functions for parsing words described below use the syntax table
-to decide whether a given character is part of a word. @xref{Syntax
-Tables}.
+and @code{char-script-table} to decide whether a given character is
+part of a word. @xref{Syntax Tables}, and see @ref{Character
+Properties}.
@deffn Command forward-word &optional count
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
that begin and end words, known as @dfn{word boundaries}, are defined
by the current buffer's syntax table (@pxref{Syntax Class Table}), but
modes can override that by setting up a suitable
-@code{find-word-boundary-function-table}, described below. In any
-case, this function cannot 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.
+@code{find-word-boundary-function-table}, described below. Characters
+that belong to different scripts (as defined by
+@code{char-syntax-table}), also define a word boundary
+(@pxref{Character Properties}). In any case, this function cannot
+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
prematurely by the buffer boundary or a field boundary, the value is
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 4dc943f868..213eec9d3c 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -3439,12 +3439,14 @@ the beginning of the @code{display} property or at
@cindex cursor position for @code{display} properties and overlays
When the buffer has many overlay strings (e.g., @pxref{Overlay
-Properties, before-string}) or @code{display} properties that are
-strings, it is a good idea to use the @code{cursor} property on these
-strings to cue the Emacs display about the places where to put the
-cursor while traversing these strings. This directly communicates to
-the display engine where the Lisp program wants to put the cursor, or
-where the user would expect the cursor.
+Properties, before-string}) that conceal some of the buffer text or
+@code{display} properties that are strings, it is a good idea to use
+the @code{cursor} property on these strings to cue the Emacs display
+about the places where to put the cursor while traversing these
+strings. This directly communicates to the display engine where the
+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
@kindex pointer @r{(text property)}
@@ -4770,10 +4772,10 @@ group you start for any given buffer should be the last one finished.
@cindex change hooks
@cindex hooks for text changes
- These hook variables let you arrange to take notice of all changes in
-all buffers (or in a particular buffer, if you make them buffer-local).
-See also @ref{Special Properties}, for how to detect changes to specific
-parts of the text.
+ These hook variables let you arrange to take notice of changes in
+buffers (or in a particular buffer, if you make them buffer-local).
+See also @ref{Special Properties}, for how to detect changes to
+specific parts of the text.
The functions you use in these hooks should save and restore the match
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
them.
@defvar before-change-functions
-This variable holds a list of functions to call before any buffer
-modification. Each function gets two arguments, the beginning and end
-of the region that is about to change, represented as integers. The
-buffer that is about to change is always the current buffer.
+This variable holds a list of functions to call when Emacs is about to
+modify a buffer. Each function gets two arguments, the beginning and
+end of the region that is about to change, represented as integers.
+The buffer that is about to change is always the current buffer when
+the function is called.
@end defvar
@defvar after-change-functions
-This variable holds a list of functions to call after any buffer
-modification. Each function receives three arguments: the beginning
-and end of the region just changed, and the length of the text that
-existed before the change. All three arguments are integers. The
-buffer that has been changed is always the current buffer.
+This variable holds a list of functions to call after Emacs modifies a
+buffer. Each function receives three arguments: the beginning and end
+of the region just changed, and the length of the text that existed
+before the change. All three arguments are integers. The buffer that
+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
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
first two arguments.
@end defvar
- Output of messages into the @file{*Messages*} buffer does not
-call these functions.
+ Output of messages into the @file{*Messages*} buffer does not call
+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{}
The macro executes @var{body} normally, but arranges to call the
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 7a5d1bbf16..b2b5764243 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -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
this parameter. @code{quit-restore-window} deletes the specified window
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
There are additional parameters @code{window-atom} and @code{window-side};
diff --git a/etc/NEWS b/etc/NEWS
index 0c561ccc51..1c3c036fbb 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2215,6 +2215,14 @@ frames.
'window-divider-default-places', 'window-divider-default-bottom-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
completion candidates is now shown at the bottom of the selected
frame. The size of that window is always as large as required to
diff --git a/lisp/simple.el b/lisp/simple.el
index f77c9f8855..51b24bb3ff 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1479,16 +1479,16 @@ result of expression evaluation."
"Evaluate EXP and print value in the echo area.
When called interactively, read an Emacs Lisp expression and evaluate it.
Value is also consed on to front of the variable `values'.
-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.
+If the resulting value is an integer, it will be printed in
+several additional formats (octal, hexadecimal, and character).
+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
of the variables `eval-expression-print-length' and
`eval-expression-print-level'. With a prefix argument of zero,
-however, there is no such truncation. Such a prefix argument
-also causes integers to be printed in several additional formats
-\(octal, hexadecimal, and character).
+however, there is no such truncation.
Runs the hook `eval-expression-minibuffer-setup-hook' on entering the
minibuffer.
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index ef7b77969e..f62ec57f53 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -267,7 +267,7 @@ The string is based on `url-privacy-level' and `url-user-agent'."
'url-http-proxy-basic-auth-storage))
(url-get-authentication url-http-proxy nil 'any nil))))
(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))
nil
(url-get-authentication (or
@@ -310,7 +310,8 @@ The string is based on `url-privacy-level' and `url-user-agent'."
(concat
;; The request
(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"
;; Version of MIME we speak
"MIME-Version: 1.0\r\n"
@@ -347,7 +348,9 @@ The string is based on `url-privacy-level' and `url-user-agent'."
"Accept-encoding: " url-mime-encoding-string "\r\n"))
(if url-mime-charset-string
(concat
- "Accept-charset: " url-mime-charset-string "\r\n"))
+ "Accept-charset: "
+ (url-http--encode-string url-mime-charset-string)
+ "\r\n"))
;; Languages we understand
(if url-mime-language-string
(concat
@@ -393,6 +396,11 @@ The string is based on `url-privacy-level' and `url-user-agent'."
(url-http-debug "Request is: \n%s" request)
request))
+(defun url-http--encode-string (s)
+ (if (multibyte-string-p s)
+ (encode-coding-string s 'us-ascii)
+ s))
+
;; Parsing routines
(defun url-http-clean-headers ()
"Remove trailing \r from header lines.
diff --git a/lisp/window.el b/lisp/window.el
index 4699e2c5e5..cfa10ea1b0 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1381,10 +1381,21 @@ return the minimum pixel-size of WINDOW."
(let* ((char-size (frame-char-size window t))
(fringes (window-fringes 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
(+ (window-safe-min-size window t t)
- (* (or (car margins) 0) char-size)
- (* (or (cdr margins) 0) char-size)
+ (* (or left-min-margin (car margins) 0) char-size)
+ (* (or right-min-margin(cdr margins) 0) char-size)
(car fringes) (cadr fringes)
(window-scroll-bar-width window)
(window-right-divider-width window))))
@@ -4771,7 +4782,7 @@ frame. The selected window is not changed by this function."
(window-sizable-p
parent (- (+ new-pixel-size divider-width)) horizontal
(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
(window-min-size window horizontal nil t))
old-pixel-size)
@@ -4780,7 +4791,7 @@ frame. The selected window is not changed by this function."
window horizontal (setq ignore 'preserved) t))
old-pixel-size))
;; 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)
(or (>= pixel-size old-pixel-size)
(< new-pixel-size
@@ -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
;; is larger than the old size or the size of the new window
;; 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
;; SIZE specified, resizing.
(unless (or (window-sizable-p
@@ -4798,13 +4809,13 @@ frame. The selected window is not changed by this function."
parent (- (+ new-pixel-size divider-width)) horizontal
(setq ignore 'preserved) t))
;; 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
(window-safe-min-pixel-size window horizontal))
(< (- old-pixel-size new-pixel-size)
(window-safe-min-pixel-size window horizontal)))
;; 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)
diff --git a/src/category.c b/src/category.c
index 4397f662ba..8315797408 100644
--- a/src/category.c
+++ b/src/category.c
@@ -336,6 +336,8 @@ The category is changed only for table TABLE, which defaults to
the current buffer's category table.
CHARACTER can be either a single character or a cons representing the
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,
then delete CATEGORY from the category set instead of adding it. */)
(Lisp_Object character, Lisp_Object category, Lisp_Object table, Lisp_Object reset)