1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

Merge from origin/emacs-26

e133b63 (origin/emacs-26) Avoid adverse side effects of fixing bug#21824
cc8f334 Document changes called out in NEWS
20ecc52 ; * etc/NEWS: Document recent change in 'thing-at-point'.
1fc5283 ; INSTALL: Fix a typo in the last commit.
24f240d Tiny doc updates re yum/dnf etc
41c2d25 Remove unused variable
1e3b3fa Fix (thing-at-point 'list) regression (Bug#31772)
219893a Clarify meaning of '*'
41cdda2 * etc/PROBLEMS: Document Ubuntu 16.04 issue.
1c22f03 Increase default value for imenu-auto-rescan-maxout
ee84389 Improve recent change to ELisp manual
ff374e4 * doc/lispref/display.texi (SVG Images): Improve wording.
3a0caf6 * doc/lispref/display.texi (SVG Images): Fix a typo.  (Bug#32...

Conflicts:
	doc/lispref/lists.texi
	etc/NEWS
This commit is contained in:
Glenn Morris 2018-09-15 09:20:32 -07:00
commit 9e79d59790
16 changed files with 192 additions and 108 deletions

View File

@ -202,8 +202,9 @@ The names of the packages that you need varies according to the
GNU/Linux distribution that you use, and the options that you want to
configure Emacs with. On Debian-based systems, you can install all the
packages needed to build the installed version of Emacs with a command
like 'apt-get build-dep emacs24'. On Red Hat systems, the
corresponding command is 'yum-builddep emacs'.
like 'apt-get build-dep emacs' (on older systems, replace 'emacs' with
eg 'emacs25'). On Red Hat-based systems, the corresponding command is
'dnf builddep emacs' (on older systems, use 'yum-builddep' instead).
DETAILED BUILDING AND INSTALLATION:

View File

@ -274,6 +274,10 @@ Rescanning happens automatically if you set @code{imenu-auto-rescan} to
a non-@code{nil} value. There is no need to rescan because of small
changes in the text.
@vindex imenu-auto-rescan-maxout
@code{imenu-auto-rescan} will be disabled in buffers that are larger
than @code{imenu-auto-rescan-maxout} in bytes.
@vindex imenu-sort-function
You can customize the way the menus are sorted by setting the
variable @code{imenu-sort-function}. By default, names are ordered as

View File

@ -1075,12 +1075,13 @@ the current Emacs session. If a symbol has not yet been so used,
@subsection Keyboard Events
@cindex keyboard events
@cindex character event
There are two kinds of input you can get from the keyboard: ordinary
keys, and function keys. Ordinary keys correspond to (possibly
modified) characters; the events they generate are represented in Lisp
as characters. The event type of a character event is the character
itself (an integer), which might have some modifier bits set; see
@ref{Classifying Events}.
as characters. The event type of a @dfn{character event} is the
character itself (an integer), which might have some modifier bits
set; see @ref{Classifying Events}.
@cindex modifier bits (of input character)
@cindex basic code (of input character)

View File

@ -5442,7 +5442,8 @@ Specifies a rotation angle in degrees.
SVG (Scalable Vector Graphics) is an XML format for specifying images.
If your Emacs build has SVG support, you can create and manipulate
these images with the following functions.
these images with the following functions from the @file{svg.el}
library.
@defun svg-create width height &rest args
Create a new, empty SVG image with the specified dimensions.
@ -5456,8 +5457,11 @@ The default width (in pixels) of any lines created.
The default stroke color on any lines created.
@end table
This function returns an SVG structure, and all the following functions
work on that structure.
@cindex SVG object
This function returns an @dfn{SVG object}, a Lisp data structure that
specifies an SVG image, and all the following functions work on that
structure. The argument @var{svg} in the following functions
specifies such an SVG object.
@end defun
@defun svg-gradient svg id type stops
@ -5501,8 +5505,8 @@ gradient object.
@end table
@defun svg-rectangle svg x y width height &rest args
Add a rectangle to @var{svg} where the upper left corner is at
position @var{x}/@var{y} and is of size @var{width}/@var{height}.
Add to @var{svg} a rectangle whose upper left corner is at
position @var{x}/@var{y} and whose size is @var{width}/@var{height}.
@lisp
(svg-rectangle svg 100 100 500 500 :gradient "gradient1")
@ -5510,24 +5514,24 @@ position @var{x}/@var{y} and is of size @var{width}/@var{height}.
@end defun
@defun svg-circle svg x y radius &rest args
Add a circle to @var{svg} where the center is at @var{x}/@var{y}
and the radius is @var{radius}.
Add to @var{svg} a circle whose center is at @var{x}/@var{y} and whose
radius is @var{radius}.
@end defun
@defun svg-ellipse svg x y x-radius y-radius &rest args
Add a circle to @var{svg} where the center is at @var{x}/@var{y} and
the horizontal radius is @var{x-radius} and the vertical radius is
Add to @var{svg} an ellipse whose center is at @var{x}/@var{y}, and
whose horizontal radius is @var{x-radius} and the vertical radius is
@var{y-radius}.
@end defun
@defun svg-line svg x1 y1 x2 y2 &rest args
Add a line to @var{svg} that starts at @var{x1}/@var{y1} and extends
Add to @var{svg} a line that starts at @var{x1}/@var{y1} and extends
to @var{x2}/@var{y2}.
@end defun
@defun svg-polyline svg points &rest args
Add a multiple segment line to @var{svg} that goes through
@var{points}, which is a list of X/Y position pairs.
Add to @var{svg} a multiple-segment line (a.k.a.@: ``polyline'') that
goes through @var{points}, which is a list of X/Y position pairs.
@lisp
(svg-polyline svg '((200 . 100) (500 . 450) (80 . 100))
@ -5541,12 +5545,12 @@ that describe the outer circumference of the polygon.
@lisp
(svg-polygon svg '((100 . 100) (200 . 150) (150 . 90))
:stroke-color "blue" :fill-color "red"")
:stroke-color "blue" :fill-color "red")
@end lisp
@end defun
@defun svg-text svg text &rest args
Add a text to @var{svg}.
Add the specified @var{text} to @var{svg}.
@lisp
(svg-text
@ -5565,9 +5569,9 @@ Add a text to @var{svg}.
@defun svg-embed svg image image-type datap &rest args
Add an embedded (raster) image to @var{svg}. If @var{datap} is
@code{nil}, @var{IMAGE} should be a file name; if not, it should be a
binary string containing the image data. @var{image-type} should be a
@acronym{MIME} image type, for instance @samp{"image/jpeg"}.
@code{nil}, @var{image} should be a file name; otherwise it should be a
string containing the image data as raw bytes. @var{image-type} should be a
@acronym{MIME} image type, for instance @code{"image/jpeg"}.
@lisp
(svg-embed svg "~/rms.jpg" "image/jpeg" nil
@ -5580,10 +5584,14 @@ binary string containing the image data. @var{image-type} should be a
Remove the element with identifier @code{id} from the @code{svg}.
@end defun
Finally, the @code{svg-image} takes an SVG object as its parameter and
@defun svg-image svg
Finally, the @code{svg-image} takes an SVG object as its argument and
returns an image object suitable for use in functions like
@code{insert-image}. Here's a complete example that creates and
inserts an image with a circle:
@code{insert-image}.
@end defun
Here's a complete example that creates and inserts an image with a
circle:
@lisp
(let ((svg (svg-create 400 400 :stroke-width 10)))

View File

@ -1755,7 +1755,7 @@ alist
@defun assoc-delete-all key alist &optional test
This function is like @code{assq-delete-all} except that it accepts
an optional argument @var{test}, a predicate function to compare the
keys in @var{alist}. If omitted or @code{nil}, @var{test} defaults to
keys in @var{alist}. If omitted or @code{nil}, @var{test} defaults to
@code{equal}. As @code{assq-delete-all}, this function often modifies
the original list structure of @var{alist}.
@end defun

View File

@ -26,7 +26,7 @@ argument.
* Initial Input:: Specifying initial contents for the minibuffer.
* Completion:: How to invoke and customize completion.
* Yes-or-No Queries:: Asking a question with a simple answer.
* Multiple Queries:: Asking a series of similar questions.
* Multiple Queries:: Asking complex questions.
* Reading a Password:: Reading a password from the terminal.
* Minibuffer Commands:: Commands used as key bindings in minibuffers.
* Minibuffer Windows:: Operating on the special minibuffer windows.
@ -2090,9 +2090,12 @@ Do you really want to remove everything? (yes or no)
@end defun
@node Multiple Queries
@section Asking Multiple Y-or-N Questions
@cindex multiple yes-or-no questions
@section Asking Multiple-Choice Questions
This section describes facilities for asking the user more complex
questions or several similar questions.
@cindex multiple yes-or-no questions
When you have a series of similar questions to ask, such as ``Do you
want to save this buffer?'' for each buffer in turn, you should use
@code{map-y-or-n-p} to ask the collection of questions, rather than
@ -2186,6 +2189,52 @@ The return value of @code{map-y-or-n-p} is the number of objects acted on.
@c FIXME An example of this would be more useful than all the
@c preceding examples of simple things.
If you need to ask the user a question that might have more than just
2 answers, use @code{read-answer}.
@defun read-answer question answers
@vindex read-answer-short
This function prompts the user with text in @var{question}, which
should end in the @samp{SPC} character. The function includes in the
prompt the possible responses in @var{answers} by appending them to
the end of @var{question}. The possible responses are provided in
@var{answers} as an alist whose elements are of the following form:
@lisp
(@var{long-answer} @var{short-answer} @var{help-message})
@end lisp
@noindent
where @var{long-answer} is the complete text of the user response, a
string; @var{short-answer} is a short form of the same response, a
single character; and @var{help-message} is the text that describes
the meaning of the answer. If the variable @code{read-answer-short}
is non-@code{nil}, the prompt will show the short variants of the
possible answers and the user is expected to type the single
characters shown in the prompt; otherwise the prompt will show the
long variants of the answers, and the user is expected to type the
full text of one of the answers and end by pressing @key{RET}. If
@code{use-dialog-box} is non-@code{nil}, and this function was invoked
by mouse events, the question and the answers will be displayed in a
GUI dialog box.
The function returns the text of the @var{long-answer} selected by the
user, regardless of whether long or short answers were shown in the
prompt and typed by the user.
Here is an example of using this function:
@lisp
(let ((read-answer-short t))
(read-answer "Foo "
'(("yes" ?y "perform the action")
("no" ?n "skip to the next")
("all" ?! "perform for the rest without more questions")
("help" ?h "show help")
("quit" ?q "exit"))))
@end lisp
@end defun
@node Reading a Password
@section Reading a Password
@cindex passwords, reading

View File

@ -521,8 +521,7 @@ where each @var{command} can either be a string or a Lisp expression
that evaluates to a string. If several commands are given, all of
them will temporarily be pushed onto the history.
If @samp{*} in the shell command, that means to substitute the file
name.
A @samp{*} in the shell command is replaced by the file name.
You can set this variable in your @file{~/.emacs}. For example,
to add rules for @samp{.foo} and @samp{.bar} file extensions, write

View File

@ -3392,8 +3392,9 @@ and binaries, and how to install Emacs on those systems.
Most GNU/Linux distributions provide pre-built Emacs packages.
If Emacs is not installed already, you can install it by running (as
root) a command such as @samp{yum install emacs} (Red Hat and
derivatives) or @samp{apt-get install emacs} (Debian and derivatives).
root) a command such as @samp{dnf install emacs} (Red Hat and
derivatives; use @samp{yum} in older distributions) or
@samp{apt-get install emacs} (Debian and derivatives).
If you want to compile Emacs yourself, read the file @file{INSTALL} in
the source distribution. In brief:

View File

@ -37,6 +37,11 @@ in its NEWS.)
* Changes in Specialized Modes and Packages in Emacs 26.2
** Imenu
---
*** The value for 'imenu-auto-rescan-maxout' has been increased to 600000.
** Gnus
---
@ -60,6 +65,7 @@ in its NEWS.)
** VC
---
*** VC support for Mercurial was improved.
Emacs now avoids invoking 'hg' as much as possible, for faster operation.
(This and the following changes were actually made in Emacs 26.1, but

View File

@ -2957,6 +2957,15 @@ as a macro. If the definition (in both unex*.c and malloc.c) is wrong,
it can cause problems like this. You might be able to find the correct
value in the man page for a.out(5).
* 'make check' failures
** emacs-module-tests fail on Ubuntu 16.04
This is due to a bug in GCC that was fixed in 2015; see
<https://lists.gnu.org/r/emacs-devel/2018-09/msg00548.html>.
You can work around the problem by using a later version of GCC or of
Ubuntu, or by configuring without modules.
* Problems on legacy systems
This section covers bugs reported on very old hardware or software.

View File

@ -96,11 +96,11 @@ This might not yet be honored by all index-building functions."
:type 'boolean
:group 'imenu)
(defcustom imenu-auto-rescan-maxout 60000
"Imenu auto-rescan is disabled in buffers larger than this size (in bytes).
This variable is buffer-local."
(defcustom imenu-auto-rescan-maxout 600000
"Imenu auto-rescan is disabled in buffers larger than this size (in bytes)."
:type 'integer
:group 'imenu)
:group 'imenu
:version "26.2")
(defcustom imenu-use-popup-menu 'on-mouse
"Use a popup menu rather than a minibuffer prompt.

View File

@ -480,12 +480,6 @@ Legal values:
;; Keyboard
(defcustom prolog-hungry-delete-key-flag nil
"Non-nil means delete key consumes all preceding spaces."
:version "24.1"
:group 'prolog-keyboard
:type 'boolean)
(defcustom prolog-electric-dot-flag nil
"Non-nil means make dot key electric.
Electric dot appends newline or inserts head of a new clause.

View File

@ -222,17 +222,15 @@ The bounds of THING are determined by `bounds-of-thing-at-point'."
(defun thing-at-point-bounds-of-list-at-point ()
"Return the bounds of the list at point.
Prefer the enclosing list with fallback on sexp at point.
\[Internal function used by `bounds-of-thing-at-point'.]"
(save-excursion
(let* ((st (parse-partial-sexp (point-min) (point)))
(beg (or (and (eq 4 (car (syntax-after (point))))
(not (nth 8 st))
(point))
(nth 1 st))))
(when beg
(goto-char beg)
(forward-sexp)
(cons beg (point))))))
(if (ignore-errors (up-list -1))
(ignore-errors (cons (point) (progn (forward-sexp) (point))))
(let ((bound (bounds-of-thing-at-point 'sexp)))
(and bound
(<= (car bound) (point)) (< (point) (cdr bound))
bound)))))
;; Defuns
@ -636,8 +634,13 @@ Signal an error if the entire string was not used."
(put 'number 'thing-at-point 'number-at-point)
;;;###autoload
(defun list-at-point ()
"Return the Lisp list at point, or nil if none is found."
(form-at-point 'list 'listp))
(defun list-at-point (&optional ignore-comment-or-string)
"Return the Lisp list at point, or nil if none is found.
If IGNORE-COMMENT-OR-STRING is non-nil comments and strings are
treated as white space."
(let ((ppss (and ignore-comment-or-string (syntax-ppss))))
(save-excursion
(goto-char (or (nth 8 ppss) (point)))
(form-at-point 'list 'listp))))
;;; thingatpt.el ends here

View File

@ -4516,23 +4516,6 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after,
Lisp_Object *copy;
ptrdiff_t i;
if (size)
{
Lisp_Object ovl
= XVECTOR (last_overlay_modification_hooks)->contents[1];
/* If the buffer of the first overlay in the array doesn't
match the current buffer, then these modification hooks
should not be run in this buffer. This could happen when
some code calls some insdel functions, such as del_range_1,
with the PREPARE argument false -- in that case this
function is never called to record the overlay modification
hook functions in the last_overlay_modification_hooks
array, so anything we find there is not ours. */
if (XMARKER (OVERLAY_START (ovl))->buffer != current_buffer)
return;
}
USE_SAFE_ALLOCA;
SAFE_ALLOCA_LISP (copy, size);
memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents,
@ -4543,7 +4526,12 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after,
Lisp_Object prop_i, overlay_i;
prop_i = copy[i++];
overlay_i = copy[i++];
call_overlay_mod_hooks (prop_i, overlay_i, after, arg1, arg2, arg3);
/* It is possible that the recorded overlay has been deleted
(which makes it's markers' buffers be nil), or that (due to
some bug) it belongs to a different buffer. Only run this
hook if the overlay belongs to the current buffer. */
if (XMARKER (OVERLAY_START (overlay_i))->buffer == current_buffer)
call_overlay_mod_hooks (prop_i, overlay_i, after, arg1, arg2, arg3);
}
SAFE_FREE ();

View File

@ -87,41 +87,43 @@ position to retrieve THING.")
(goto-char (nth 1 test))
(should (equal (thing-at-point (nth 2 test)) (nth 3 test))))))
;; These tests reflect the actual behavior of
;; `thing-at-point-bounds-of-list-at-point'.
(ert-deftest thing-at-point-bug24627 ()
"Test for https://debbugs.gnu.org/24627 ."
(let ((string-result '(("(a \"b\" c)" . (a "b" c))
(";(a \"b\" c)")
("(a \"b\" c\n)" . (a "b" c))
("\"(a b c)\"")
("(a ;(b c d)\ne)" . (a e))
("(foo\n(a ;(b c d)\ne) bar)" . (a e))
("(foo\na ;(b c d)\ne bar)" . (foo a e bar))
("(foo\n(a \"(b c d)\"\ne) bar)" . (a "(b c d)" e))
("(b\n(a ;(foo c d)\ne) bar)" . (a e))
("(princ \"(a b c)\")" . (princ "(a b c)"))
("(defun foo ()\n \"Test function.\"\n ;;(a b)\n nil)" . (defun foo nil "Test function." nil))))
(file
(expand-file-name "lisp/thingatpt.el" source-directory))
buf)
;; Test for `thing-at-point'.
(when (file-exists-p file)
(unwind-protect
(progn
(setq buf (find-file file))
(goto-char (point-max))
(forward-line -1)
(should-not (thing-at-point 'list)))
(kill-buffer buf)))
;; Tests for `list-at-point'.
(dolist (str-res string-result)
(with-temp-buffer
(emacs-lisp-mode)
(insert (car str-res))
(re-search-backward "\\((a\\|^a\\)")
(should (equal (list-at-point)
(cdr str-res)))))))
;; See bug#24627 and bug#31772.
(ert-deftest thing-at-point-bounds-of-list-at-point ()
(cl-macrolet ((with-test-buffer (str &rest body)
`(with-temp-buffer
(emacs-lisp-mode)
(insert ,str)
(search-backward "|")
(delete-char 1)
,@body)))
(let ((tests1
'(("|(a \"b\" c)" (a "b" c))
(";|(a \"b\" c)" (a "b" c) nil)
("|(a \"b\" c\n)" (a "b" c))
("\"|(a b c)\"" (a b c) nil)
("|(a ;(b c d)\ne)" (a e))
("(foo\n|(a ;(b c d)\ne) bar)" (foo (a e) bar))
("(foo\n|a ;(b c d)\ne bar)" (foo a e bar))
("(foo\n|(a \"(b c d)\"\ne) bar)" (foo (a "(b c d)" e) bar))
("(b\n|(a ;(foo c d)\ne) bar)" (b (a e) bar))
("(princ \"|(a b c)\")" (a b c) (princ "(a b c)"))
("(defun foo ()\n \"Test function.\"\n ;;|(a b)\n nil)"
(defun foo nil "Test function." nil)
(defun foo nil "Test function." nil))))
(tests2
'(("|list-at-point" . "list-at-point")
("list-|at-point" . "list-at-point")
("list-at-point|" . nil)
("|(a b c)" . "(a b c)")
("(a b c)|" . nil))))
(dolist (test tests1)
(with-test-buffer (car test)
(should (equal (list-at-point) (cl-second test)))
(when (cddr test)
(should (equal (list-at-point t) (cl-third test))))))
(dolist (test tests2)
(with-test-buffer (car test)
(should (equal (thing-at-point 'list) (cdr test))))))))
(ert-deftest thing-at-point-url-in-comment ()
(with-temp-buffer

View File

@ -45,6 +45,25 @@ with parameters from the *Messages* buffer modification."
(should (eq buf (current-buffer))))
(when msg-ov (delete-overlay msg-ov))))))
(ert-deftest overlay-modification-hooks-deleted-overlay ()
"Test for bug#30823."
(let ((check-point nil)
(ov-delete nil)
(ov-set nil))
(with-temp-buffer
(insert "abc")
(setq ov-set (make-overlay 1 3))
(overlay-put ov-set 'modification-hooks
(list (lambda (_o after &rest _args)
(and after (setq check-point t)))))
(setq ov-delete (make-overlay 1 3))
(overlay-put ov-delete 'modification-hooks
(list (lambda (o after &rest _args)
(and (not after) (delete-overlay o)))))
(goto-char 2)
(insert "1")
(should (eq check-point t)))))
(ert-deftest test-generate-new-buffer-name-bug27966 ()
(should-not (string-equal "nil"
(progn (get-buffer-create "nil")