mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-30 20:32:00 -08:00
Merge from origin/emacs-26
71c92d8Fix copying text properties by 'format'96be6b6Improve error messages regarding initial-buffer-choice (Bug#2...00fb127* test/lisp/wdired-tests.el (wdired-test-unfinished-edit-01):... Conflicts: lisp/startup.el
This commit is contained in:
commit
bd6b6cdb62
4 changed files with 29 additions and 7 deletions
|
|
@ -2534,9 +2534,9 @@ nil default-directory" name)
|
|||
((eq initial-buffer-choice t)
|
||||
(get-buffer-create "*scratch*"))
|
||||
(t
|
||||
(error "initial-buffer-choice must be a string, a function, or t.")))))
|
||||
(error "`initial-buffer-choice' must be a string, a function, or t")))))
|
||||
(unless (buffer-live-p buf)
|
||||
(error "initial-buffer-choice is not a live buffer."))
|
||||
(error "Value returned by `initial-buffer-choice' is not a live buffer: %S" buf))
|
||||
(setq displayable-buffers (cons buf (delq buf displayable-buffers)))))
|
||||
|
||||
;; Display the first two buffers in `displayable-buffers'. If
|
||||
|
|
|
|||
|
|
@ -4268,6 +4268,9 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
|
|||
/* The start and end bytepos in the output string. */
|
||||
ptrdiff_t start, end;
|
||||
|
||||
/* The start of the spec in the format string. */
|
||||
ptrdiff_t fbeg;
|
||||
|
||||
/* Whether the argument is a string with intervals. */
|
||||
bool_bf intervals : 1;
|
||||
} *info;
|
||||
|
|
@ -4421,6 +4424,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
|
|||
char conversion = *format++;
|
||||
memset (&discarded[format0 - format_start], 1,
|
||||
format - format0 - (conversion == '%'));
|
||||
info[ispec].fbeg = format0 - format_start;
|
||||
if (conversion == '%')
|
||||
{
|
||||
new_result = true;
|
||||
|
|
@ -5011,7 +5015,9 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
|
|||
else if (discarded[bytepos] == 1)
|
||||
{
|
||||
position++;
|
||||
if (fieldn < nspec && translated == info[fieldn].start)
|
||||
if (fieldn < nspec
|
||||
&& position > info[fieldn].fbeg
|
||||
&& translated == info[fieldn].start)
|
||||
{
|
||||
translated += info[fieldn].end - info[fieldn].start;
|
||||
fieldn++;
|
||||
|
|
@ -5031,7 +5037,9 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
|
|||
else if (discarded[bytepos] == 1)
|
||||
{
|
||||
position++;
|
||||
if (fieldn < nspec && translated == info[fieldn].start)
|
||||
if (fieldn < nspec
|
||||
&& position > info[fieldn].fbeg
|
||||
&& translated == info[fieldn].start)
|
||||
{
|
||||
translated += info[fieldn].end - info[fieldn].start;
|
||||
fieldn++;
|
||||
|
|
|
|||
|
|
@ -116,13 +116,13 @@ wdired-mode."
|
|||
(kill-region (point) (progn (search-forward ".")
|
||||
(forward-char -1) (point)))
|
||||
(insert replace)
|
||||
(should (equal (dired-get-filename) new-file))))
|
||||
(should (equal (dired-get-filename) new-file)))
|
||||
(when buf
|
||||
(with-current-buffer buf
|
||||
;; Prevent kill-buffer-query-functions from chiming in.
|
||||
(set-buffer-modified-p nil)
|
||||
(kill-buffer buf)))
|
||||
(delete-directory test-dir t))))
|
||||
(delete-directory test-dir t)))))
|
||||
|
||||
|
||||
(provide 'wdired-tests)
|
||||
|
|
|
|||
|
|
@ -88,7 +88,21 @@
|
|||
(format "%-10s" (concat (propertize "01" 'face 'bold)
|
||||
(propertize "23" 'face 'underline)
|
||||
(propertize "45" 'face 'italic)))
|
||||
#("012345 " 0 2 (face bold) 2 4 (face underline) 4 10 (face italic)))))
|
||||
#("012345 "
|
||||
0 2 (face bold) 2 4 (face underline) 4 10 (face italic))))
|
||||
;; Bug #32404
|
||||
(should (ert-equal-including-properties
|
||||
(format (concat (propertize "%s" 'face 'bold)
|
||||
""
|
||||
(propertize "%s" 'face 'error))
|
||||
"foo" "bar")
|
||||
#("foobar" 0 3 (face bold) 3 6 (face error))))
|
||||
(should (ert-equal-including-properties
|
||||
(format (concat "%s" (propertize "%s" 'face 'error)) "foo" "bar")
|
||||
#("foobar" 3 6 (face error))))
|
||||
(should (ert-equal-including-properties
|
||||
(format (concat "%s " (propertize "%s" 'face 'error)) "foo" "bar")
|
||||
#("foo bar" 4 7 (face error)))))
|
||||
|
||||
;; Tests for bug#5131.
|
||||
(defun transpose-test-reverse-word (start end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue